summaryrefslogtreecommitdiff
path: root/app/helpers/issues_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/issues_helper.rb')
-rw-r--r--app/helpers/issues_helper.rb61
1 files changed, 34 insertions, 27 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index 7671033b539..15c5dcb6a25 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -16,45 +16,25 @@ module IssuesHelper
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)
- 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)
- end
+ project.issues_tracker.project_url
end
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
- else
- 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
+ project.issues_tracker.new_issue_url
end
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
- 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)
- end
+ project.issues_tracker.issue_url(issue_iid)
end
def title_for_issue(issue_iid, project = @project)
return '' if project.nil?
- if project.used_default_issues_tracker?
+ if project.default_issues_tracker?
issue = project.issues.where(iid: issue_iid).first
return issue.title if issue
end
@@ -62,9 +42,19 @@ module IssuesHelper
''
end
- # Checks if issues_tracker setting exists in gitlab.yml
- def external_issues_tracker_enabled?
- Gitlab.config.issues_tracker && Gitlab.config.issues_tracker.values.any?
+ def issue_timestamp(issue)
+ # Shows the created at time and the updated at time if different
+ ts = "#{time_ago_with_tooltip(issue.created_at, 'bottom', 'note_created_ago')}"
+ if issue.updated_at != issue.created_at
+ ts << capture_haml do
+ haml_tag :span do
+ haml_concat '&middot;'
+ haml_concat icon('edit', title: 'edited')
+ haml_concat time_ago_with_tooltip(issue.updated_at, 'bottom', 'issue_edited_ago')
+ end
+ end
+ end
+ ts.html_safe
end
def bulk_update_milestone_options
@@ -100,4 +90,21 @@ module IssuesHelper
'issue-box-open'
end
end
+
+ def issue_to_atom(xml, issue)
+ xml.entry do
+ xml.id namespace_project_issue_url(issue.project.namespace,
+ issue.project, issue)
+ xml.link href: namespace_project_issue_url(issue.project.namespace,
+ issue.project, issue)
+ xml.title truncate(issue.title, length: 80)
+ xml.updated issue.created_at.strftime("%Y-%m-%dT%H:%M:%SZ")
+ xml.media :thumbnail, width: "40", height: "40", url: avatar_icon(issue.author_email)
+ xml.author do |author|
+ xml.name issue.author_name
+ xml.email issue.author_email
+ end
+ xml.summary issue.title
+ end
+ end
end