Merge branch 'feature/dashboardfeed' of https://github.com/alexleutgoeb/gitlabhq into alexleutgoeb-feature/dashboardfeed
Conflicts: app/decorators/event_decorator.rb
This commit is contained in:
commit
624abdfc72
|
@ -3,11 +3,11 @@ class EventDecorator < ApplicationDecorator
|
||||||
|
|
||||||
def feed_title
|
def feed_title
|
||||||
if self.issue?
|
if self.issue?
|
||||||
"#{self.author_name} #{self.action_name} issue ##{self.target_id}:" + self.issue_title
|
"#{self.author_name} #{self.action_name} issue ##{self.target_id}: #{self.issue_title} at #{self.project.name}"
|
||||||
elsif self.merge_request?
|
elsif self.merge_request?
|
||||||
"#{self.author_name} #{self.action_name} MR ##{self.target_id}:" + self.merge_request_title
|
"#{self.author_name} #{self.action_name} MR ##{self.target_id}: #{self.merge_request_title} at #{self.project.name}"
|
||||||
elsif self.push?
|
elsif self.push?
|
||||||
"#{self.author_name} #{self.push_action_name} #{self.ref_type} " + self.ref_name
|
"#{self.author_name} #{self.push_action_name} #{self.ref_type} #{self.ref_name} at #{self.project.name}"
|
||||||
elsif self.membership_changed?
|
elsif self.membership_changed?
|
||||||
"#{self.author_name} #{self.action_name} #{self.project.name}"
|
"#{self.author_name} #{self.action_name} #{self.project.name}"
|
||||||
else
|
else
|
||||||
|
@ -20,8 +20,26 @@ class EventDecorator < ApplicationDecorator
|
||||||
h.project_issue_url(self.project, self.issue)
|
h.project_issue_url(self.project, self.issue)
|
||||||
elsif self.merge_request?
|
elsif self.merge_request?
|
||||||
h.project_merge_request_url(self.project, self.merge_request)
|
h.project_merge_request_url(self.project, self.merge_request)
|
||||||
|
|
||||||
elsif self.push?
|
elsif self.push?
|
||||||
h.project_commits_url(self.project, self.ref_name)
|
if self.push_with_commits?
|
||||||
|
if self.commits_count > 1
|
||||||
|
h.compare_project_commits_path(self.project, :from => self.parent_commit.id, :to => self.last_commit.id)
|
||||||
|
else
|
||||||
|
h.project_commit_path(self.project, :id => self.last_commit.id)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
h.project_commits_url(self.project, ref: self.ref_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def feed_summary
|
||||||
|
if self.issue?
|
||||||
|
h.render "events/event_issue", issue: self.issue
|
||||||
|
elsif self.push?
|
||||||
|
h.render "events/event_push", event: self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,6 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
|
||||||
xml.entry do
|
xml.entry do
|
||||||
event_link = event.feed_url
|
event_link = event.feed_url
|
||||||
event_title = event.feed_title
|
event_title = event.feed_title
|
||||||
|
event_summary = event.feed_summary
|
||||||
|
|
||||||
xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}"
|
xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}"
|
||||||
xml.link :href => event_link
|
xml.link :href => event_link
|
||||||
|
@ -22,7 +23,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
|
||||||
xml.name event.author_name
|
xml.name event.author_name
|
||||||
xml.email event.author_email
|
xml.email event.author_email
|
||||||
end
|
end
|
||||||
xml.summary event_title
|
xml.summary(:type => "xhtml") { |x| x << event_summary unless event_summary.nil? }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
2
app/views/events/_event_issue.atom.haml
Normal file
2
app/views/events/_event_issue.atom.haml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
%div{:xmlns => "http://www.w3.org/1999/xhtml"}
|
||||||
|
%p= simple_format issue.description
|
14
app/views/events/_event_push.atom.haml
Normal file
14
app/views/events/_event_push.atom.haml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
%div{:xmlns => "http://www.w3.org/1999/xhtml"}
|
||||||
|
- event.commits.first(15).each do |commit|
|
||||||
|
%p
|
||||||
|
%strong= commit.author_name
|
||||||
|
= link_to "(##{commit.short_id})", project_commit_path(event.project, :id => commit.id)
|
||||||
|
%i
|
||||||
|
at
|
||||||
|
= commit.committed_date.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
%blockquote= simple_format(escape_once(commit.safe_message))
|
||||||
|
- if event.commits_count > 15
|
||||||
|
%p
|
||||||
|
%i
|
||||||
|
\... and
|
||||||
|
= pluralize(event.commits_count - 15, "more commit")
|
Loading…
Reference in a new issue