diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-11 16:02:48 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-06-11 16:02:48 +0400 |
commit | f881e4367753075bbdbfaca1ea83a6ef80549b72 (patch) | |
tree | ff744590062ee336e800a990cae27101ee4678bb /app | |
parent | f82d0d8d58d93ce335b499c007f838fcd1e7fe0f (diff) | |
parent | 9c046fea676b65c4883707fad22ceb8dd0e7525e (diff) |
Merge pull request #7024 from skv-headless/linkto_issues_on_main_dashboard
links to issues on main dashboard
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/gitlab_markdown_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/issues_helper.rb | 82 | ||||
-rw-r--r-- | app/views/events/_commit.html.haml | 2 |
3 files changed, 45 insertions, 41 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index b8891d801aa..db5b4eacd1f 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -19,7 +19,7 @@ module GitlabMarkdownHelper escape_once(body) end - gfm_body = gfm(escaped_body, html_options) + gfm_body = gfm(escaped_body, @project, html_options) gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match| "</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1 diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 7c58908165c..2031519c32f 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -13,76 +13,80 @@ module IssuesHelper OpenStruct.new(id: 0, title: 'None (backlog)', name: 'Unassigned') end - def url_for_project_issues - return "" if @project.nil? + def url_for_project_issues(project = @project) + return '' if project.nil? - if @project.used_default_issues_tracker? || !external_issues_tracker_enabled? - project_issues_path(@project) + if project.used_default_issues_tracker? || !external_issues_tracker_enabled? + project_issues_path(project) else - url = Gitlab.config.issues_tracker[@project.issues_tracker]["project_url"] - url.gsub(':project_id', @project.id.to_s) - .gsub(':issues_tracker_id', @project.issues_tracker_id.to_s) + url = Gitlab.config.issues_tracker[project.issues_tracker]['project_url'] + url.gsub(':project_id', project.id.to_s). + gsub(':issues_tracker_id', project.issues_tracker_id.to_s) end end - def url_for_new_issue - return "" if @project.nil? + def url_for_new_issue(project = @project) + return '' if project.nil? - if @project.used_default_issues_tracker? || !external_issues_tracker_enabled? - url = new_project_issue_path project_id: @project + if project.used_default_issues_tracker? || !external_issues_tracker_enabled? + url = new_project_issue_path project_id: project else - url = Gitlab.config.issues_tracker[@project.issues_tracker]["new_issue_url"] - url.gsub(':project_id', @project.id.to_s) - .gsub(':issues_tracker_id', @project.issues_tracker_id.to_s) + issues_tracker = Gitlab.config.issues_tracker[project.issues_tracker] + url = issues_tracker['new_issue_url'] + url.gsub(':project_id', project.id.to_s). + gsub(':issues_tracker_id', project.issues_tracker_id.to_s) end end - def url_for_issue(issue_iid) - return "" if @project.nil? + def url_for_issue(issue_iid, project = @project) + return '' if project.nil? - if @project.used_default_issues_tracker? || !external_issues_tracker_enabled? - url = project_issue_url project_id: @project, id: issue_iid + if project.used_default_issues_tracker? || !external_issues_tracker_enabled? + url = project_issue_url project_id: project, id: issue_iid else - url = Gitlab.config.issues_tracker[@project.issues_tracker]["issues_url"] - url.gsub(':id', issue_iid.to_s) - .gsub(':project_id', @project.id.to_s) - .gsub(':issues_tracker_id', @project.issues_tracker_id.to_s) + url = Gitlab.config.issues_tracker[project.issues_tracker]['issues_url'] + url.gsub(':id', issue_iid.to_s). + gsub(':project_id', project.id.to_s). + gsub(':issues_tracker_id', project.issues_tracker_id.to_s) end end - def title_for_issue(issue_iid) - return "" if @project.nil? + def title_for_issue(issue_iid, project = @project) + return '' if project.nil? - if @project.used_default_issues_tracker? && issue = @project.issues.where(iid: issue_iid).first - issue.title - else - "" + if project.used_default_issues_tracker? + issue = project.issues.where(iid: issue_iid).first + return issue.title if issue end + + '' end # Checks if issues_tracker setting exists in gitlab.yml def external_issues_tracker_enabled? - if Gitlab.config.issues_tracker && Gitlab.config.issues_tracker.values.any? - true - else - false - end + Gitlab.config.issues_tracker && Gitlab.config.issues_tracker.values.any? end def bulk_update_milestone_options - options_for_select(["None (backlog)"]) + options_from_collection_for_select(project_active_milestones, "id", "title", params[:milestone_id]) + options_for_select(['None (backlog)']) + + options_from_collection_for_select(project_active_milestones, 'id', + 'title', params[:milestone_id]) end - def bulk_update_assignee_options - options_for_select(["None (unassigned)"]) + options_from_collection_for_select(@project.team.members, "id", "name", params[:assignee_id]) + def bulk_update_assignee_options(project = @project) + options_for_select(['None (unassigned)']) + + options_from_collection_for_select(project.team.members, 'id', + 'name', params[:assignee_id]) end - def assignee_options object - options_from_collection_for_select(@project.team.members.sort_by(&:name), 'id', 'name', object.assignee_id) + def assignee_options(object, project = @project) + options_from_collection_for_select(project.team.members.sort_by(&:name), + 'id', 'name', object.assignee_id) end def milestone_options object - options_from_collection_for_select(object.project.milestones.active, 'id', 'title', object.milestone_id) + options_from_collection_for_select(object.project.milestones.active, + 'id', 'title', object.milestone_id) end def issue_box_class(item) diff --git a/app/views/events/_commit.html.haml b/app/views/events/_commit.html.haml index 135320da57e..0e03e116e7d 100644 --- a/app/views/events/_commit.html.haml +++ b/app/views/events/_commit.html.haml @@ -2,4 +2,4 @@ .commit-row-title = link_to commit[:id][0..8], project_commit_path(project, commit[:id]), class: "commit_short_id", alt: '' - = gfm event_commit_title(commit[:message]) + = gfm event_commit_title(commit[:message]), project |