diff options
author | Tieu-Philippe KHIM <khim.tieu.philippe@gmail.com> | 2017-06-12 19:21:13 +0200 |
---|---|---|
committer | Tieu-Philippe KHIM <khim.tieu.philippe@gmail.com> | 2017-06-12 19:21:13 +0200 |
commit | 3c1700cde65ef8a410c2c2a9f44727613d3ef9ff (patch) | |
tree | 658c251d7b9b7f957b8350db1ef442c883401ce1 | |
parent | b16730fc8317b282d5dc86dbc8936c74303f5a36 (diff) | |
download | gitlab-ce-3c1700cde65ef8a410c2c2a9f44727613d3ef9ff.tar.gz |
Refactor atom builder by using xml.atom layout
-rw-r--r-- | app/controllers/concerns/issues_action.rb | 2 | ||||
-rw-r--r-- | app/controllers/dashboard/projects_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/groups_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/projects/commits_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/projects/issues_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/users_controller.rb | 2 | ||||
-rw-r--r-- | app/views/dashboard/issues.atom.builder | 15 | ||||
-rw-r--r-- | app/views/dashboard/projects/index.atom.builder | 15 | ||||
-rw-r--r-- | app/views/groups/issues.atom.builder | 15 | ||||
-rw-r--r-- | app/views/groups/show.atom.builder | 15 | ||||
-rw-r--r-- | app/views/layouts/xml.atom.builder | 4 | ||||
-rw-r--r-- | app/views/projects/commits/show.atom.builder | 15 | ||||
-rw-r--r-- | app/views/projects/issues/index.atom.builder | 15 | ||||
-rw-r--r-- | app/views/projects/show.atom.builder | 15 | ||||
-rw-r--r-- | app/views/users/show.atom.builder | 15 |
16 files changed, 59 insertions, 79 deletions
diff --git a/app/controllers/concerns/issues_action.rb b/app/controllers/concerns/issues_action.rb index b17c138d5c7..404559c8707 100644 --- a/app/controllers/concerns/issues_action.rb +++ b/app/controllers/concerns/issues_action.rb @@ -14,7 +14,7 @@ module IssuesAction respond_to do |format| format.html - format.atom { render layout: false } + format.atom { render layout: 'xml.atom' } end end end diff --git a/app/controllers/dashboard/projects_controller.rb b/app/controllers/dashboard/projects_controller.rb index 3d49ea97591..641c502dbe4 100644 --- a/app/controllers/dashboard/projects_controller.rb +++ b/app/controllers/dashboard/projects_controller.rb @@ -11,7 +11,7 @@ class Dashboard::ProjectsController < Dashboard::ApplicationController format.html format.atom do load_events - render layout: false + render layout: 'xml.atom' end format.json do render json: { diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index c08943d993a..27137ffde54 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -58,7 +58,7 @@ class GroupsController < Groups::ApplicationController format.atom do load_events - render layout: false + render layout: 'xml.atom' end end end diff --git a/app/controllers/projects/commits_controller.rb b/app/controllers/projects/commits_controller.rb index ad92f05a42d..f33797ca310 100644 --- a/app/controllers/projects/commits_controller.rb +++ b/app/controllers/projects/commits_controller.rb @@ -26,7 +26,7 @@ class Projects::CommitsController < Projects::ApplicationController respond_to do |format| format.html - format.atom { render layout: false } + format.atom { render layout: 'xml.atom' } format.json do pager_json( diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 8b1efd0c572..ebb163bf9dc 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -55,7 +55,7 @@ class Projects::IssuesController < Projects::ApplicationController respond_to do |format| format.html - format.atom { render layout: false } + format.atom { render layout: 'xml.atom' } format.json do render json: { html: view_to_html_string("projects/issues/_issues"), diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 38ed7d776a7..5480814874b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -108,7 +108,7 @@ class ProjectsController < Projects::ApplicationController format.atom do load_events - render layout: false + render layout: 'xml.atom' end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 19fc1e5de49..c211106fbaa 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -10,7 +10,7 @@ class UsersController < ApplicationController format.atom do load_events - render layout: false + render layout: 'xml.atom' end format.json do diff --git a/app/views/dashboard/issues.atom.builder b/app/views/dashboard/issues.atom.builder index 06fb531b546..70ec6bc6257 100644 --- a/app/views/dashboard/issues.atom.builder +++ b/app/views/dashboard/issues.atom.builder @@ -1,10 +1,7 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{current_user.name} issues" - xml.link href: url_for(params), rel: "self", type: "application/atom+xml" - xml.link href: issues_dashboard_url, rel: "alternate", type: "text/html" - xml.id issues_dashboard_url - xml.updated @issues.first.updated_at.xmlschema if @issues.reorder(nil).any? +xml.title "#{current_user.name} issues" +xml.link href: url_for(params), rel: "self", type: "application/atom+xml" +xml.link href: issues_dashboard_url, rel: "alternate", type: "text/html" +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? -end +xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any? diff --git a/app/views/dashboard/projects/index.atom.builder b/app/views/dashboard/projects/index.atom.builder index 13f7a8ddcec..747c53b440e 100644 --- a/app/views/dashboard/projects/index.atom.builder +++ b/app/views/dashboard/projects/index.atom.builder @@ -1,10 +1,7 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "Activity" - xml.link href: dashboard_projects_url(rss_url_options), rel: "self", type: "application/atom+xml" - xml.link href: dashboard_projects_url, rel: "alternate", type: "text/html" - xml.id dashboard_projects_url - xml.updated @events[0].updated_at.xmlschema if @events[0] +xml.title "Activity" +xml.link href: dashboard_projects_url(rss_url_options), rel: "self", type: "application/atom+xml" +xml.link href: dashboard_projects_url, rel: "alternate", type: "text/html" +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? -end +xml << render(partial: 'events/event', collection: @events) if @events.any? diff --git a/app/views/groups/issues.atom.builder b/app/views/groups/issues.atom.builder index 469768d83f2..a239ea8caf0 100644 --- a/app/views/groups/issues.atom.builder +++ b/app/views/groups/issues.atom.builder @@ -1,10 +1,7 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{@group.name} issues" - xml.link href: url_for(params), rel: "self", type: "application/atom+xml" - xml.link href: issues_group_url, rel: "alternate", type: "text/html" - xml.id issues_group_url - xml.updated @issues.first.updated_at.xmlschema if @issues.reorder(nil).any? +xml.title "#{@group.name} issues" +xml.link href: url_for(params), rel: "self", type: "application/atom+xml" +xml.link href: issues_group_url, rel: "alternate", type: "text/html" +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? -end +xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any? diff --git a/app/views/groups/show.atom.builder b/app/views/groups/show.atom.builder index 914091dfd15..0f67b15c301 100644 --- a/app/views/groups/show.atom.builder +++ b/app/views/groups/show.atom.builder @@ -1,10 +1,7 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{@group.name} activity" - xml.link href: group_url(@group, rss_url_options), rel: "self", type: "application/atom+xml" - xml.link href: group_url(@group), rel: "alternate", type: "text/html" - xml.id group_url(@group) - xml.updated @events[0].updated_at.xmlschema if @events[0] +xml.title "#{@group.name} activity" +xml.link href: group_url(@group, rss_url_options), rel: "self", type: "application/atom+xml" +xml.link href: group_url(@group), rel: "alternate", type: "text/html" +xml.id group_url(@group) +xml.updated @events[0].updated_at.xmlschema if @events[0] - xml << render(@events) if @events.any? -end +xml << render(@events) if @events.any? diff --git a/app/views/layouts/xml.atom.builder b/app/views/layouts/xml.atom.builder new file mode 100644 index 00000000000..4ee09cb87a1 --- /dev/null +++ b/app/views/layouts/xml.atom.builder @@ -0,0 +1,4 @@ +xml.instruct! +xml.feed 'xmlns' => 'http://www.w3.org/2005/Atom', 'xmlns:media' => 'http://search.yahoo.com/mrss/' do + xml << yield +end diff --git a/app/views/projects/commits/show.atom.builder b/app/views/projects/commits/show.atom.builder index 2f0b6e39800..9cf792e1721 100644 --- a/app/views/projects/commits/show.atom.builder +++ b/app/views/projects/commits/show.atom.builder @@ -1,10 +1,7 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{@project.name}:#{@ref} commits" - xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref, rss_url_options), rel: "self", type: "application/atom+xml" - xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref), rel: "alternate", type: "text/html" - xml.id namespace_project_commits_url(@project.namespace, @project, @ref) - xml.updated @commits.first.committed_date.xmlschema if @commits.any? +xml.title "#{@project.name}:#{@ref} commits" +xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref, rss_url_options), rel: "self", type: "application/atom+xml" +xml.link href: namespace_project_commits_url(@project.namespace, @project, @ref), rel: "alternate", type: "text/html" +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? -end +xml << render(@commits) if @commits.any? diff --git a/app/views/projects/issues/index.atom.builder b/app/views/projects/issues/index.atom.builder index 4feec09bb5d..61346884346 100644 --- a/app/views/projects/issues/index.atom.builder +++ b/app/views/projects/issues/index.atom.builder @@ -1,10 +1,7 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{@project.name} issues" - xml.link href: url_for(params), rel: "self", type: "application/atom+xml" - xml.link href: namespace_project_issues_url(@project.namespace, @project), rel: "alternate", type: "text/html" - xml.id namespace_project_issues_url(@project.namespace, @project) - xml.updated @issues.first.updated_at.xmlschema if @issues.reorder(nil).any? +xml.title "#{@project.name} issues" +xml.link href: url_for(params), rel: "self", type: "application/atom+xml" +xml.link href: namespace_project_issues_url(@project.namespace, @project), rel: "alternate", type: "text/html" +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? -end +xml << render(partial: 'issues/issue', collection: @issues) if @issues.reorder(nil).any? diff --git a/app/views/projects/show.atom.builder b/app/views/projects/show.atom.builder index 5c7f2e315f0..ed34f5c0520 100644 --- a/app/views/projects/show.atom.builder +++ b/app/views/projects/show.atom.builder @@ -1,10 +1,7 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{@project.name} activity" - xml.link href: namespace_project_url(@project.namespace, @project, rss_url_options), rel: "self", type: "application/atom+xml" - xml.link href: namespace_project_url(@project.namespace, @project), rel: "alternate", type: "text/html" - xml.id namespace_project_url(@project.namespace, @project) - xml.updated @events[0].updated_at.xmlschema if @events[0] +xml.title "#{@project.name} activity" +xml.link href: namespace_project_url(@project.namespace, @project, rss_url_options), rel: "self", type: "application/atom+xml" +xml.link href: namespace_project_url(@project.namespace, @project), rel: "alternate", type: "text/html" +xml.id namespace_project_url(@project.namespace, @project) +xml.updated @events[0].updated_at.xmlschema if @events[0] - xml << render(@events) if @events.any? -end +xml << render(@events) if @events.any? diff --git a/app/views/users/show.atom.builder b/app/views/users/show.atom.builder index 6c85e5f9fbd..e95814875f1 100644 --- a/app/views/users/show.atom.builder +++ b/app/views/users/show.atom.builder @@ -1,10 +1,7 @@ -xml.instruct! -xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do - xml.title "#{@user.name} activity" - xml.link href: user_url(@user, :atom), rel: "self", type: "application/atom+xml" - xml.link href: user_url(@user), rel: "alternate", type: "text/html" - xml.id user_url(@user) - xml.updated @events[0].updated_at.xmlschema if @events[0] +xml.title "#{@user.name} activity" +xml.link href: user_url(@user, :atom), rel: "self", type: "application/atom+xml" +xml.link href: user_url(@user), rel: "alternate", type: "text/html" +xml.id user_url(@user) +xml.updated @events[0].updated_at.xmlschema if @events[0] - xml << render(@events) if @events.any? -end +xml << render(@events) if @events.any? |