Commit 0b8e956f32cac5847029c29a607816b743e52465
1 parent
8ec95642
Exists in
master
and in
4 other branches
Add a more verbose dashboard event feed
- Add project name to event title - Push: Entry links to single commit or commits overview depending on number of pushed commits - Push: Display first 15 commits with commit message and author and link to single commit - Issues: Display issue description
Showing
4 changed files
with
40 additions
and
5 deletions
Show diff stats
app/decorators/event_decorator.rb
... | ... | @@ -3,11 +3,11 @@ class EventDecorator < ApplicationDecorator |
3 | 3 | |
4 | 4 | def feed_title |
5 | 5 | if self.issue? |
6 | - "#{self.author_name} #{self.action_name} issue ##{self.target_id}:" + self.issue_title | |
6 | + "#{self.author_name} #{self.action_name} issue ##{self.target_id}: #{self.issue_title} at #{self.project.name}" | |
7 | 7 | elsif self.merge_request? |
8 | - "#{self.author_name} #{self.action_name} MR ##{self.target_id}:" + self.merge_request_title | |
8 | + "#{self.author_name} #{self.action_name} MR ##{self.target_id}: #{self.merge_request_title} at #{self.project.name}" | |
9 | 9 | elsif self.push? |
10 | - "#{self.author_name} #{self.push_action_name} #{self.ref_type} " + self.ref_name | |
10 | + "#{self.author_name} #{self.push_action_name} #{self.ref_type} #{self.ref_name} at #{self.project.name}" | |
11 | 11 | elsif self.membership_changed? |
12 | 12 | "#{self.author_name} #{self.action_name} #{self.project.name}" |
13 | 13 | else |
... | ... | @@ -20,8 +20,26 @@ class EventDecorator < ApplicationDecorator |
20 | 20 | h.project_issue_url(self.project, self.issue) |
21 | 21 | elsif self.merge_request? |
22 | 22 | h.project_merge_request_url(self.project, self.merge_request) |
23 | + | |
24 | + elsif self.push? | |
25 | + if self.push_with_commits? | |
26 | + if self.commits_count > 1 | |
27 | + h.compare_project_commits_path(self.project, :from => self.parent_commit.id, :to => self.last_commit.id) | |
28 | + else | |
29 | + h.project_commit_path(self.project, :id => self.last_commit.id) | |
30 | + end | |
31 | + else | |
32 | + h.project_commits_url(self.project, ref: self.ref_name) | |
33 | + end | |
34 | + end | |
35 | + | |
36 | + end | |
37 | + | |
38 | + def feed_summary | |
39 | + if self.issue? | |
40 | + h.render "events/event_issue", issue: self.issue | |
23 | 41 | elsif self.push? |
24 | - h.project_commits_url(self.project, ref: self.ref_name) | |
42 | + h.render "events/event_push", event: self | |
25 | 43 | end |
26 | 44 | end |
27 | 45 | end | ... | ... |
app/views/dashboard/index.atom.builder
... | ... | @@ -12,6 +12,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear |
12 | 12 | xml.entry do |
13 | 13 | event_link = event.feed_url |
14 | 14 | event_title = event.feed_title |
15 | + event_summary = event.feed_summary | |
15 | 16 | |
16 | 17 | xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}" |
17 | 18 | xml.link :href => event_link |
... | ... | @@ -22,7 +23,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear |
22 | 23 | xml.name event.author_name |
23 | 24 | xml.email event.author_email |
24 | 25 | end |
25 | - xml.summary event_title | |
26 | + xml.summary(:type => "xhtml") { |x| x << event_summary unless event_summary.nil? } | |
26 | 27 | end |
27 | 28 | end |
28 | 29 | end | ... | ... |
... | ... | @@ -0,0 +1,14 @@ |
1 | +%div{:xmlns => "http://www.w3.org/1999/xhtml"} | |
2 | + - event.commits.first(15).each do |commit| | |
3 | + %p | |
4 | + %strong= commit.author_name | |
5 | + = link_to "(##{commit.short_id})", project_commit_path(event.project, :id => commit.id) | |
6 | + %i | |
7 | + at | |
8 | + = commit.committed_date.strftime("%Y-%m-%d %H:%M:%S") | |
9 | + %blockquote= simple_format commit.safe_message | |
10 | + - if event.commits_count > 15 | |
11 | + %p | |
12 | + %i | |
13 | + \... and | |
14 | + = pluralize(event.commits_count - 15, "more commit") | ... | ... |