diff options
author | micael.bergeron <micaelbergeron@gmail.com> | 2017-11-08 15:39:29 -0500 |
---|---|---|
committer | micael.bergeron <micaelbergeron@gmail.com> | 2017-12-07 09:01:23 -0500 |
commit | 142edf0afcb83f220175d02ea74b71d90753a875 (patch) | |
tree | af1bd5a3edaec72705688deb21f87bd33366b882 /app/helpers/merge_requests_helper.rb | |
parent | e4eba908cd85c3ad7b9861c3edbd3c81623242a0 (diff) | |
download | gitlab-ce-142edf0afcb83f220175d02ea74b71d90753a875.tar.gz |
diff notes created in merge request on a commit have the right context
add a spec for commit merge request diff notes
Diffstat (limited to 'app/helpers/merge_requests_helper.rb')
-rw-r--r-- | app/helpers/merge_requests_helper.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/helpers/merge_requests_helper.rb b/app/helpers/merge_requests_helper.rb index 5b2c58d193d..004aaeb2c56 100644 --- a/app/helpers/merge_requests_helper.rb +++ b/app/helpers/merge_requests_helper.rb @@ -101,6 +101,30 @@ module MergeRequestsHelper }.merge(merge_params_ee(merge_request)) end + def tab_link_for(tab, options={}, &block) + data_attrs = { + action: tab.to_s, + target: "##{tab.to_s}", + toggle: options.fetch(:force_link, false) ? '' : 'tab' + } + + url = case tab + when :show + data_attrs.merge!(target: '#notes') + project_merge_request_path(@project, @merge_request) + when :commits + commits_project_merge_request_path(@project, @merge_request) + when :pipelines + pipelines_project_merge_request_path(@project, @merge_request) + when :diffs + diffs_project_merge_request_path(@project, @merge_request) + else + raise "Cannot create tab #{tab}." + end + + link_to(url, data: data_attrs, &block) + end + def merge_params_ee(merge_request) {} end |