Commit f9f7f3414aa9af6016623e5e7fdf2ecb940ec6ed

Authored by Victor Costa
1 parent 76c22144

Fix article versioning page

(AI3223)
app/controllers/public/content_viewer_controller.rb
@@ -74,7 +74,7 @@ class ContentViewerController < ApplicationController @@ -74,7 +74,7 @@ class ContentViewerController < ApplicationController
74 end 74 end
75 75
76 def versions_diff 76 def versions_diff
77 - path = params[:page].join('/') 77 + path = params[:page]
78 @page = profile.articles.find_by_path(path) 78 @page = profile.articles.find_by_path(path)
79 @v1, @v2 = @page.versions.find_by_version(params[:v1]), @page.versions.find_by_version(params[:v2]) 79 @v1, @v2 = @page.versions.find_by_version(params[:v1]), @page.versions.find_by_version(params[:v2])
80 end 80 end
app/views/content_viewer/article_versions.html.erb
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 6
7 <p><%= _('This is the list of all versions of this content. Select a version to see it and then revert to it.') %>.</p> 7 <p><%= _('This is the list of all versions of this content. Select a version to see it and then revert to it.') %>.</p>
8 8
9 -<%= form_tag({:controller => 'content_viewer', :action => 'versions_diff', :profile => profile.identifier, :page => @page.path.split('/')}, :method => 'get') do %> 9 +<%= form_tag({:controller => 'content_viewer', :action => 'versions_diff', :profile => profile.identifier, :page => @page.path}, :method => 'get') do %>
10 <ul id="article-versions"> 10 <ul id="article-versions">
11 <% @versions.each do |v| %> 11 <% @versions.each do |v| %>
12 <li> 12 <li>
config/routes.rb
@@ -131,7 +131,7 @@ Noosfero::Application.routes.draw do @@ -131,7 +131,7 @@ Noosfero::Application.routes.draw do
131 match ':profile/*page/versions', :controller => 'content_viewer', :action => 'article_versions', :profile => /#{Noosfero.identifier_format}/, :constraints => EnvironmentDomainConstraint.new 131 match ':profile/*page/versions', :controller => 'content_viewer', :action => 'article_versions', :profile => /#{Noosfero.identifier_format}/, :constraints => EnvironmentDomainConstraint.new
132 match '*page/versions', :controller => 'content_viewer', :action => 'article_versions' 132 match '*page/versions', :controller => 'content_viewer', :action => 'article_versions'
133 133
134 - match ':profile/*page/versions_diff', :controller => 'content_viewer', :action => 'versions_diff', :profile => /#{Noosfero.identifier_format}/, :conditions => { :if => lambda { |env| !Domain.hosting_profile_at(env[:host]) } } 134 + match ':profile/*page/versions_diff', :controller => 'content_viewer', :action => 'versions_diff', :profile => /#{Noosfero.identifier_format}/, :constraints => EnvironmentDomainConstraint.new
135 match '*page/versions_diff', :controller => 'content_viewer', :action => 'versions_diff' 135 match '*page/versions_diff', :controller => 'content_viewer', :action => 'versions_diff'
136 136
137 # match requests for profiles that don't have a custom domain 137 # match requests for profiles that don't have a custom domain