summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-08-20 14:57:33 -0700
committerStan Hu <stanhu@gmail.com>2017-08-20 14:58:13 -0700
commit7d8d5e3c15fb20ec48f6ab2fd5eb031e24afbb55 (patch)
tree2738cfe3085267a4f65cd8d176359cfd02e7fe3b
parent187f989eda34be206d697ad37569397a01f3fd40 (diff)
downloadgitlab-ce-sh-fix-atom-feeds.tar.gz
Use Rails to_partial_path to override default partial pathsh-fix-atom-feeds
-rw-r--r--app/models/push_event.rb5
-rw-r--r--app/views/events/_event_push.atom.haml12
-rw-r--r--app/views/push_events/_push_event.atom.haml13
3 files changed, 11 insertions, 19 deletions
diff --git a/app/models/push_event.rb b/app/models/push_event.rb
index 3f1ff979de6..f4946a8afdf 100644
--- a/app/models/push_event.rb
+++ b/app/models/push_event.rb
@@ -123,4 +123,9 @@ class PushEvent < Event
errors.add(:action, "the action #{action.inspect} is not valid")
end
+
+ def to_partial_path
+ # By default, Rails will use 'push_events/push_event', which is not what we want.
+ 'events/event_push'
+ end
end
diff --git a/app/views/events/_event_push.atom.haml b/app/views/events/_event_push.atom.haml
index bf655f9d21a..78317500e92 100644
--- a/app/views/events/_event_push.atom.haml
+++ b/app/views/events/_event_push.atom.haml
@@ -1,13 +1,13 @@
%div{ xmlns: "http://www.w3.org/1999/xhtml" }
%p
- %strong= event.author_name
- = link_to "(#{truncate_sha(event.commit_id)})", project_commit_path(event.project, event.commit_id)
+ %strong= event_push.author_name
+ = link_to "(#{truncate_sha(event_push.commit_id)})", project_commit_path(event_push.project, event_push.commit_id)
%i
at
- = event.created_at.to_s(:short)
- %blockquote= markdown(escape_once(event.commit_title), pipeline: :atom, project: event.project, author: event.author)
- - if event.commits_count > 1
+ = event_push.created_at.to_s(:short)
+ %blockquote= markdown(escape_once(event_push.commit_title), pipeline: :atom, project: event_push.project, author: event_push.author)
+ - if event_push.commits_count > 1
%p
%i
\... and
- = pluralize(event.commits_count - 1, "more commit")
+ = pluralize(event_push.commits_count - 1, "more commit")
diff --git a/app/views/push_events/_push_event.atom.haml b/app/views/push_events/_push_event.atom.haml
deleted file mode 100644
index 5272189eb90..00000000000
--- a/app/views/push_events/_push_event.atom.haml
+++ /dev/null
@@ -1,13 +0,0 @@
-%div{ xmlns: "http://www.w3.org/1999/xhtml" }
- %p
- %strong= push_event.author_name
- = link_to "(#{truncate_sha(push_event.commit_id)})", project_commit_path(push_event.project, push_event.commit_id)
- %i
- at
- = push_event.created_at.to_s(:short)
- %blockquote= markdown(escape_once(push_event.commit_title), pipeline: :atom, project: push_event.project, author: push_event.author)
- - if push_event.commits_count > 1
- %p
- %i
- \... and
- = pluralize(push_event.commits_count - 1, "more commit")