Commit 3c1700cd authored by Tieu-Philippe KHIM's avatar Tieu-Philippe KHIM

Refactor atom builder by using xml.atom layout

parent b16730fc
...@@ -14,7 +14,7 @@ module IssuesAction ...@@ -14,7 +14,7 @@ module IssuesAction
respond_to do |format| respond_to do |format|
format.html format.html
format.atom { render layout: false } format.atom { render layout: 'xml.atom' }
end end
end end
end end
...@@ -11,7 +11,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController ...@@ -11,7 +11,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController
format.html format.html
format.atom do format.atom do
load_events load_events
render layout: false render layout: 'xml.atom'
end end
format.json do format.json do
render json: { render json: {
......
...@@ -58,7 +58,7 @@ class GroupsController < Groups::ApplicationController ...@@ -58,7 +58,7 @@ class GroupsController < Groups::ApplicationController
format.atom do format.atom do
load_events load_events
render layout: false render layout: 'xml.atom'
end end
end end
end end
......
...@@ -26,7 +26,7 @@ class Projects::CommitsController < Projects::ApplicationController ...@@ -26,7 +26,7 @@ class Projects::CommitsController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.atom { render layout: false } format.atom { render layout: 'xml.atom' }
format.json do format.json do
pager_json( pager_json(
......
...@@ -55,7 +55,7 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -55,7 +55,7 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to do |format| respond_to do |format|
format.html format.html
format.atom { render layout: false } format.atom { render layout: 'xml.atom' }
format.json do format.json do
render json: { render json: {
html: view_to_html_string("projects/issues/_issues"), html: view_to_html_string("projects/issues/_issues"),
......
...@@ -108,7 +108,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -108,7 +108,7 @@ class ProjectsController < Projects::ApplicationController
format.atom do format.atom do
load_events load_events
render layout: false render layout: 'xml.atom'
end end
end end
end end
......
...@@ -10,7 +10,7 @@ class UsersController < ApplicationController ...@@ -10,7 +10,7 @@ class UsersController < ApplicationController
format.atom do format.atom do
load_events load_events
render layout: false render layout: 'xml.atom'
end end
format.json do format.json do
......
xml.instruct! xml.title "#{current_user.name} issues"
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.link href: url_for(params), rel: "self", type: "application/atom+xml"
xml.title "#{current_user.name} issues" xml.link href: issues_dashboard_url, rel: "alternate", type: "text/html"
xml.link href: url_for(params), rel: "self", type: "application/atom+xml" xml.id issues_dashboard_url
xml.link href: issues_dashboard_url, rel: "alternate", type: "text/html" xml.updated @issues.first.updated_at.xmlschema if @issues.reorder(nil).any?
xml.id issues_dashboard_url
xml.updated @issues.first.updated_at.xmlschema if @issues.reorder(nil).any?
xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any? xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any?
end
xml.instruct! xml.title "Activity"
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.link href: dashboard_projects_url(rss_url_options), rel: "self", type: "application/atom+xml"
xml.title "Activity" xml.link href: dashboard_projects_url, rel: "alternate", type: "text/html"
xml.link href: dashboard_projects_url(rss_url_options), rel: "self", type: "application/atom+xml" xml.id dashboard_projects_url
xml.link href: dashboard_projects_url, rel: "alternate", type: "text/html" xml.updated @events[0].updated_at.xmlschema if @events[0]
xml.id dashboard_projects_url
xml.updated @events[0].updated_at.xmlschema if @events[0]
xml << render(partial: 'events/event', collection: @events) if @events.any? xml << render(partial: 'events/event', collection: @events) if @events.any?
end
xml.instruct! xml.title "#{@group.name} issues"
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.link href: url_for(params), rel: "self", type: "application/atom+xml"
xml.title "#{@group.name} issues" xml.link href: issues_group_url, rel: "alternate", type: "text/html"
xml.link href: url_for(params), rel: "self", type: "application/atom+xml" xml.id issues_group_url
xml.link href: issues_group_url, rel: "alternate", type: "text/html" xml.updated @issues.first.updated_at.xmlschema if @issues.reorder(nil).any?
xml.id issues_group_url
xml.updated @issues.first.updated_at.xmlschema if @issues.reorder(nil).any?
xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any? xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any?
end
xml.instruct! xml.title "#{@group.name} activity"
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.link href: group_url(@group, rss_url_options), rel: "self", type: "application/atom+xml"
xml.title "#{@group.name} activity" xml.link href: group_url(@group), rel: "alternate", type: "text/html"
xml.link href: group_url(@group, rss_url_options), rel: "self", type: "application/atom+xml" xml.id group_url(@group)
xml.link href: group_url(@group), rel: "alternate", type: "text/html" xml.updated @events[0].updated_at.xmlschema if @events[0]
xml.id group_url(@group)
xml.updated @events[0].updated_at.xmlschema if @events[0]
xml << render(@events) if @events.any? xml << render(@events) if @events.any?
end
xml.instruct!
xml.feed 'xmlns' => 'http://www.w3.org/2005/Atom', 'xmlns:media' => 'http://search.yahoo.com/mrss/' do
xml << yield
end
xml.instruct! xml.title "#{@project.name}:#{@ref} commits"
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref, rss_url_options), rel: "self", type: "application/atom+xml"
xml.title "#{@project.name}:#{@ref} commits" xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref), rel: "alternate", type: "text/html"
xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref, rss_url_options), rel: "self", type: "application/atom+xml" xml.id namespace_project_commits_url(@project.namespace, @project, @ref)
xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref), rel: "alternate", type: "text/html" xml.updated @commits.first.committed_date.xmlschema if @commits.any?
xml.id namespace_project_commits_url(@project.namespace, @project, @ref)
xml.updated @commits.first.committed_date.xmlschema if @commits.any?
xml << render(@commits) if @commits.any? xml << render(@commits) if @commits.any?
end
xml.instruct! xml.title "#{@project.name} issues"
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.link href: url_for(params), rel: "self", type: "application/atom+xml"
xml.title "#{@project.name} issues" xml.link href: namespace_project_issues_url(@project.namespace, @project), rel: "alternate", type: "text/html"
xml.link href: url_for(params), rel: "self", type: "application/atom+xml" xml.id namespace_project_issues_url(@project.namespace, @project)
xml.link href: namespace_project_issues_url(@project.namespace, @project), rel: "alternate", type: "text/html" xml.updated @issues.first.updated_at.xmlschema if @issues.reorder(nil).any?
xml.id namespace_project_issues_url(@project.namespace, @project)
xml.updated @issues.first.updated_at.xmlschema if @issues.reorder(nil).any?
xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any? xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any?
end
xml.instruct! xml.title "#{@project.name} activity"
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.link href: namespace_project_url(@project.namespace, @project, rss_url_options), rel: "self", type: "application/atom+xml"
xml.title "#{@project.name} activity" xml.link href: namespace_project_url(@project.namespace, @project), rel: "alternate", type: "text/html"
xml.link href: namespace_project_url(@project.namespace, @project, rss_url_options), rel: "self", type: "application/atom+xml" xml.id namespace_project_url(@project.namespace, @project)
xml.link href: namespace_project_url(@project.namespace, @project), rel: "alternate", type: "text/html" xml.updated @events[0].updated_at.xmlschema if @events[0]
xml.id namespace_project_url(@project.namespace, @project)
xml.updated @events[0].updated_at.xmlschema if @events[0]
xml << render(@events) if @events.any? xml << render(@events) if @events.any?
end
xml.instruct! xml.title "#{@user.name} activity"
xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do xml.link href: user_url(@user, :atom), rel: "self", type: "application/atom+xml"
xml.title "#{@user.name} activity" xml.link href: user_url(@user), rel: "alternate", type: "text/html"
xml.link href: user_url(@user, :atom), rel: "self", type: "application/atom+xml" xml.id user_url(@user)
xml.link href: user_url(@user), rel: "alternate", type: "text/html" xml.updated @events[0].updated_at.xmlschema if @events[0]
xml.id user_url(@user)
xml.updated @events[0].updated_at.xmlschema if @events[0]
xml << render(@events) if @events.any? xml << render(@events) if @events.any?
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment