17 lines
726 B
CoffeeScript
17 lines
726 B
CoffeeScript
Dunlop.register_setup 'categorize-as-button', (target)->
|
|
button = $('#categorize-as-button')
|
|
return unless button.length
|
|
button.click ->
|
|
selected_ids = Dunlop.selected_ids() # proxy for MultiSelect.selected_ids()
|
|
return alert("Nothing selected") unless selected_ids.length
|
|
|
|
selector = $("#categorize-as-scenario-selector")
|
|
return unless target_scenario = selector.val()
|
|
if confirmation_t = button.data("confirmationT")
|
|
message = t_substitute_params confirmation_t,
|
|
target_scenario: selector.text() || target_scenario
|
|
return unless confirm(message)
|
|
$.post Routes.dunlop_categorize_as_workflow_instances_path(),
|
|
ids: selected_ids.join("~")
|
|
scenario: target_scenario
|