diff options
author | Luke Bennett <lukeeeebennettplus@gmail.com> | 2016-08-28 18:24:48 +0300 |
---|---|---|
committer | Luke Bennett <lukeeeebennettplus@gmail.com> | 2016-09-01 16:35:34 +0300 |
commit | 922b38a0bea8c5b8610120dfb5ea168db713f3e3 (patch) | |
tree | 3acd8626b10ab6b2072426dcce30b51b1a884be9 /app/helpers/todos_helper.rb | |
parent | f157a9e5144fde90dc31add4006b9132e1489aa1 (diff) |
Removed inline JS and improved dropdown labels
Diffstat (limited to 'app/helpers/todos_helper.rb')
-rw-r--r-- | app/helpers/todos_helper.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index a9f4c8b07b5..1e86f648203 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -98,12 +98,22 @@ module TodosHelper def todo_types_options [ - { text: 'Any Type', id: '' }, - { text: 'Issue', id: 'Issue' }, - { text: 'Merge Request', id: 'MergeRequest' } + { id: '', text: 'Any Type' }, + { id: 'Issue', text: 'Issue' }, + { id: 'MergeRequest', text: 'Merge Request' } ] end + def todo_actions_dropdown_label(selected_action_id, default_action) + selected_action = todo_actions_options.find { |action| action[:id] == selected_action_id.to_i} + selected_action ? selected_action[:text] : default_action + end + + def todo_types_dropdown_label(selected_type, default_type) + selected_type = todo_types_options.find { |type| type[:id] == selected_type && type[:id] != '' } + selected_type ? selected_type[:text] : default_type + end + private def show_todo_state?(todo) |