mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 18:10:06 -05:00
The Delete and View buttons are in the rulesList child template's each, but their handlers are on the parent rulesMain and used Template.currentData() — which returned the PARENT data context, not the clicked rule. So the rule id was null: deleting failed with 'Match error: Expected string, got null', and 'View rule' always opened the first rule. Add explicit data-rule-id to the buttons and read it in the handlers so both operate on the rule actually clicked.
51 lines
1.7 KiB
Plaintext
51 lines
1.7 KiB
Plaintext
template(name="rulesList")
|
|
.rules(class=currentBoard.colorClass)
|
|
h2
|
|
i.fa.fa-magic
|
|
| {{_ 'r-board-rules' }}
|
|
|
|
if rules.length
|
|
.rules-toolbar
|
|
button.js-rules-select-all(type="button")
|
|
i.fa.fa-check-square-o
|
|
| {{_ 'r-select-all'}}
|
|
button.js-rules-select-none(type="button")
|
|
i.fa.fa-square-o
|
|
| {{_ 'r-unselect-all'}}
|
|
if canAdmin
|
|
button.js-rules-delete-selected(type="button")
|
|
i.fa.fa-trash
|
|
| {{_ 'r-delete-selected'}}
|
|
button.js-rules-export-selected(type="button")
|
|
i.fa.fa-download
|
|
| {{_ 'r-export-selected'}}
|
|
|
|
ul.rules-list
|
|
each rules
|
|
li.rules-lists-item
|
|
input.js-rule-select(type="checkbox" data-rule-id="{{_id}}" checked=isSelected)
|
|
p
|
|
if isEditing
|
|
input.js-edit-rule-input(type=text value="{{title}}" autofocus)
|
|
else
|
|
= title
|
|
div.rules-btns-group
|
|
button.primary.wide.js-goto-details(type="submit" data-rule-id="{{_id}}")
|
|
i.fa.fa-eye
|
|
| {{_ 'r-view-rule'}}
|
|
if canAdmin
|
|
button.primary.wide.js-edit-rule(type="submit" data-rule-id="{{_id}}")
|
|
i.fa.fa-pencil
|
|
| {{_ 'r-edit-rule'}}
|
|
button.primary.wide.js-delete-rule(type="submit" data-rule-id="{{_id}}")
|
|
i.fa.fa-trash
|
|
| {{_ 'r-delete-rule'}}
|
|
else
|
|
li.no-items-message {{_ 'r-no-rules' }}
|
|
if canAdmin
|
|
div.rules-add
|
|
button.primary.wide.rules-add-trigger.js-goto-trigger(type="submit")
|
|
i.fa.fa-plus
|
|
| {{_ 'r-add-rule'}}
|
|
input(type=text,placeholder="{{_ 'r-new-rule-name' }}",id="ruleTitle")
|