summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/helpers/event_rendering_helper.rb35
-rw-r--r--app/views/events/_event.html.erb4
-rw-r--r--public/stylesheets/base.css16
3 files changed, 52 insertions, 3 deletions
diff --git a/app/helpers/event_rendering_helper.rb b/app/helpers/event_rendering_helper.rb
index 912430f..cae0a4d 100644
--- a/app/helpers/event_rendering_helper.rb
+++ b/app/helpers/event_rendering_helper.rb
@@ -292,6 +292,23 @@ module EventRenderingHelper
end
def render_event_push(event)
+ event.single_commit? ? render_single_commit_push(event) : render_several_commit_push(event)
+ end
+
+ def render_single_commit_push(event)
+ project = event.target.project
+ commit = event.events.first
+ repo = event.target
+ commit_link = link_to(commit.data[0,8],
+ project_repository_commit_path(project, repo, commit.data)
+ )
+ repo_link = link_to("#{repo_title(repo, project)}:#{event.data}",
+ [project, repo])
+ action = "pushed #{commit_link} to #{repo_link}"
+ [action,"","push"]
+ end
+
+ def render_several_commit_push(event)
project = event.target.project
commit_link = link_to_if(event.has_commits?, pluralize(event.events.size, 'commit'),
repo_owner_path(event.target, :project_repository_commits_in_ref_path,
@@ -311,6 +328,24 @@ module EventRenderingHelper
[action, body, category]
end
+ # Push events need to include information about their commits
+ # - either a container for their commits (for Ajax loading)
+ # - or the single commit included
+ def render_commit_details_for_push_event(event)
+ if event.single_commit?
+ commit = event.events.first
+ icon = avatar_from_email(commit.email, :size => 16)
+ meta = content_tag(:span,
+ "#{commit.actor_display} at #{commit.created_at.to_s(:short_time)}")
+ message = content_tag(:div, [icon, meta].join("\n"))
+ body = content_tag(:div, h(commit.body), :class => "commit_message")
+ content_tag(:li, [message, body].join("\n"), :class => "event_instance")
+ else
+ img = image_tag("spinner.gif")
+ content_tag(:div, img, :id => "commits_in_event_#{event.to_param}", :style => "display: none")
+ end
+ end
+
def render_event_add_project_repository(event)
action = action_for_event(:event_status_add_project_repository) do
link_to(h(event.target.name), project_repository_path(event.project, event.target)) +
diff --git a/app/views/events/_event.html.erb b/app/views/events/_event.html.erb
index 058fa37..c4c7e81 100644
--- a/app/views/events/_event.html.erb
+++ b/app/views/events/_event.html.erb
@@ -44,9 +44,7 @@
<%= simple_format(sanitize(body)) %>
</div>
<% if event.has_commits? %>
- <div id="commits_in_event_<%= event.to_param %>" style="display:none">
- <%= image_tag("spinner.gif") %>
- </div>
+ <%= render_commit_details_for_push_event(event) -%>
<% end %>
</div>
diff --git a/public/stylesheets/base.css b/public/stylesheets/base.css
index ad59c9f..ecc77e0 100644
--- a/public/stylesheets/base.css
+++ b/public/stylesheets/base.css
@@ -1080,6 +1080,22 @@ td.meta-info {
margin: 2px 0 0 0;
}
+/*
+Single (inline) commit under a push
+*/
+.event_instance.push .event_instance {
+ margin: 10px 0 0 2px;
+}
+
+.event_instance.push .event_instance img {
+ float: left;
+ margin-right: 10px;
+}
+
+.event_instance.push .event_instance .commit_message {
+ margin-left: 26px;
+}
+
.commit_list .commit_item .commit_message {
margin-left: 40px;
}