Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting $indexOptions = [ 'edit' => false] prevents delete #289

Closed
Riaan-ZA opened this issue Jun 4, 2019 · 4 comments
Closed

Setting $indexOptions = [ 'edit' => false] prevents delete #289

Riaan-ZA opened this issue Jun 4, 2019 · 4 comments

Comments

@Riaan-ZA
Copy link
Contributor

Riaan-ZA commented Jun 4, 2019

Came across an issue, when I set:

protected $indexOptions = [
    'create' => false,
    'edit' => false,
    'delete' => true,
];

No delete functionality is enabled, I need to set 'create' => true even though I might not want to allow create

@yanhao-li
Copy link

Hi @Riaan-ZA ,

Yes, that's working as expected. The delete functionality on UI is controlled by the line 617 of ModuleController.php: https://github.com/area17/twill/blob/1.2/src/Http/Controllers/Admin/ModuleController.php#L617

As you can see in the code, the item can be deleted only if delete and edit are both set as true in $indexOptions. I believe there is nothing to do with create option, are you sure that set 'create' => true can re-enable the delete functionality here?

Back to your case, if I'm not understanding it wrong -- are you implying that your module, could be deleted, however, can not be edit nor created?

@Riaan-ZA
Copy link
Contributor Author

Hi @yanhao-li, yes sorry you're correct, I meant to write "edit"

The issue I'm having is that I have a module to store submissions from a form. The functionality in the back end that I require is that form submissions can be viewed and deleted on the listing page, but not edited or created. This doesn't seem possible given the above constraint.

@yanhao-li
Copy link

@Riaan-ZA

Interesting use case, it should be a good improvement for Twill to separate the canDelete and canEdit logics. However, for now, you can always try overriding the getIndexTableData method (or other methods) to fit your requirement!

@yanhao-li
Copy link

This issue has been fixed in #446, closing this issue.

m4n1ok added a commit to m4n1ok/twill that referenced this issue Nov 14, 2019
* 1.2:
  Add style for subscript into wysiwyg (area17#450)
  Add a default value for `$fieldsGroups` to prevent error from repositories which extend ModuleRepository. (area17#452)
  fixed the http & https issue from APP URL (area17#431)
  Add a feature to group fields in a JSON column (area17#410)
  Replace bcrypt() with Hash::make in CreateSuperAdmin command (area17#445)
  Fixed the issue that 'delete' => true not working in indexOptions, refs area17#289 (area17#446)
  Fix « Handle Repeater » feature compatibility with Laravel 5.6 (area17#449)
  Revert "Add quotes when populating store from form field (area17#416)"
  Fix media and file libraries upload endpoint logic
  Properly support fileupload for Azure (area17#443)
  Invert sorting order in ModuleRepository.
  Support azure storage (area17#424)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants