Skip to content

Commit

Permalink
Implement removeAction Stimulus method
Browse files Browse the repository at this point in the history
  • Loading branch information
spohlenz committed Dec 4, 2024
1 parent 98db106 commit 4ce8062
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/assets/bundle/trestle/admin.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions frontend/js/controllers/application_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export default class extends Controller {
element.dataset.action = actions.join(' ')
}

removeAction (event, method, element = this.element) {
const newAction = `${event}->${this.identifier}#${method}`
const actions = this.actionsList.filter(action => action !== newAction)

element.dataset.action = actions.join(' ')
}

fetch (url, options = {}) {
return fetchWithErrorHandling(url, options)
}
Expand Down

0 comments on commit 4ce8062

Please sign in to comment.