Remove event_to_atom
helper
This commit is contained in:
parent
00fa9a769d
commit
66cebb6f61
6 changed files with 24 additions and 34 deletions
|
@ -159,28 +159,6 @@ module EventsHelper
|
|||
"--broken encoding"
|
||||
end
|
||||
|
||||
def event_to_atom(xml, event)
|
||||
if event.visible_to_user?(current_user)
|
||||
xml.entry do
|
||||
event_link = event_feed_url(event)
|
||||
event_title = event_feed_title(event)
|
||||
event_summary = event_feed_summary(event)
|
||||
|
||||
xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}"
|
||||
xml.link href: event_link
|
||||
xml.title truncate(event_title, length: 80)
|
||||
xml.updated event.created_at.xmlschema
|
||||
xml.media :thumbnail, width: "40", height: "40", url: image_url(avatar_icon(event.author_email))
|
||||
xml.author do |author|
|
||||
xml.name event.author_name
|
||||
xml.email event.author_email
|
||||
end
|
||||
|
||||
xml.summary(type: "xhtml") { |x| x << event_summary unless event_summary.nil? }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def event_row_class(event)
|
||||
if event.body?
|
||||
"event-block"
|
||||
|
|
|
@ -6,7 +6,5 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
|
|||
xml.id dashboard_projects_url
|
||||
xml.updated @events[0].updated_at.xmlschema if @events[0]
|
||||
|
||||
@events.each do |event|
|
||||
event_to_atom(xml, event)
|
||||
end
|
||||
xml << render(partial: 'events/event', collection: @events) if @events.any?
|
||||
end
|
||||
|
|
20
app/views/events/_event.atom.builder
Normal file
20
app/views/events/_event.atom.builder
Normal file
|
@ -0,0 +1,20 @@
|
|||
return unless event.visible_to_user?(current_user)
|
||||
|
||||
xml.entry do
|
||||
xml.id "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}"
|
||||
xml.link href: event_feed_url(event)
|
||||
xml.title truncate(event_feed_title(event), length: 80)
|
||||
xml.updated event.created_at.xmlschema
|
||||
xml.media :thumbnail, width: "40", height: "40", url: image_url(avatar_icon(event.author_email))
|
||||
|
||||
xml.author do
|
||||
xml.name event.author_name
|
||||
xml.email event.author_email
|
||||
end
|
||||
|
||||
xml.summary(type: "xhtml") do |summary|
|
||||
event_summary = event_feed_summary(event)
|
||||
|
||||
summary << event_summary unless event_summary.nil?
|
||||
end
|
||||
end
|
|
@ -6,7 +6,5 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
|
|||
xml.id group_url(@group)
|
||||
xml.updated @events[0].updated_at.xmlschema if @events[0]
|
||||
|
||||
@events.each do |event|
|
||||
event_to_atom(xml, event)
|
||||
end
|
||||
xml << render(@events) if @events.any?
|
||||
end
|
||||
|
|
|
@ -6,7 +6,5 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
|
|||
xml.id namespace_project_url(@project.namespace, @project)
|
||||
xml.updated @events[0].updated_at.xmlschema if @events[0]
|
||||
|
||||
@events.each do |event|
|
||||
event_to_atom(xml, event)
|
||||
end
|
||||
xml << render(@events) if @events.any?
|
||||
end
|
||||
|
|
|
@ -6,7 +6,5 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear
|
|||
xml.id user_url(@user)
|
||||
xml.updated @events[0].updated_at.xmlschema if @events[0]
|
||||
|
||||
@events.each do |event|
|
||||
event_to_atom(xml, event)
|
||||
end
|
||||
xml << render(@events) if @events.any?
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue