summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorLuke Bennett <lukeeeebennettplus@gmail.com>2016-08-28 16:24:48 +0100
committerLuke Bennett <lukeeeebennettplus@gmail.com>2016-09-01 14:35:34 +0100
commit922b38a0bea8c5b8610120dfb5ea168db713f3e3 (patch)
tree3acd8626b10ab6b2072426dcce30b51b1a884be9 /app/helpers
parentf157a9e5144fde90dc31add4006b9132e1489aa1 (diff)
downloadgitlab-ce-922b38a0bea8c5b8610120dfb5ea168db713f3e3.tar.gz
Removed inline JS and improved dropdown labels
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/todos_helper.rb16
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)