Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Duncalfe <lduncalfe@eml.cc>2019-08-14 04:34:42 +0300
committerLuke Duncalfe <lduncalfe@eml.cc>2019-08-15 06:08:34 +0300
commit88746f5311a2624d99c3639daf2760c6715d5670 (patch)
tree098fee08c628771f755521a83ec1374f3c5e6077 /app/helpers/todos_helper.rb
parent7c9fb3c61715acb7cb2bfcbad1a12a5ef66d9bbd (diff)
CE-specific changes to allow design Todos
CE-specific changes for: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/15129 Co-Authored-By: Alex Kalderimis <akalderimis@gitlab.com> Co-Authored-By: Luke Duncalfe <lduncalfe@eml.cc>
Diffstat (limited to 'app/helpers/todos_helper.rb')
-rw-r--r--app/helpers/todos_helper.rb21
1 files changed, 16 insertions, 5 deletions
diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb
index 645160077f5..38142bc68cb 100644
--- a/app/helpers/todos_helper.rb
+++ b/app/helpers/todos_helper.rb
@@ -26,7 +26,7 @@ module TodosHelper
end
def todo_target_link(todo)
- text = raw("#{todo.target_type.titleize.downcase} ") +
+ text = raw(todo_target_type_name(todo) + ' ') +
if todo.for_commit?
content_tag(:span, todo.target_reference, class: 'commit-sha')
else
@@ -36,23 +36,34 @@ module TodosHelper
link_to text, todo_target_path(todo), class: 'has-tooltip', title: todo.target.title
end
+ def todo_target_type_name(todo)
+ todo.target_type.titleize.downcase
+ end
+
def todo_target_path(todo)
return unless todo.target.present?
- anchor = dom_id(todo.note) if todo.note.present?
+ path_options = todo_target_path_options(todo)
if todo.for_commit?
- project_commit_path(todo.project,
- todo.target, anchor: anchor)
+ project_commit_path(todo.project, todo.target, path_options)
else
path = [todo.parent, todo.target]
path.unshift(:pipelines) if todo.build_failed?
- polymorphic_path(path, anchor: anchor)
+ polymorphic_path(path, path_options)
end
end
+ def todo_target_path_options(todo)
+ { anchor: todo_target_path_anchor(todo) }
+ end
+
+ def todo_target_path_anchor(todo)
+ dom_id(todo.note) if todo.note.present?
+ end
+
def todo_target_state_pill(todo)
return unless show_todo_state?(todo)