Commit 459640601c4be57f1035dfbabd9cc826fad08b88

Authored by Antonio Terceiro
2 parents 1f3cc39f daa42a63

Merge branch 'fix_block_links' into 'master'

Fix block links

Fixing the URL from the article block and fixing the path of the New event button of the agenda.

When Noosfero is used in a subdirectory, it crashes without this modification.

See merge request !395
app/helpers/application_helper.rb
@@ -945,9 +945,9 @@ module ApplicationHelper @@ -945,9 +945,9 @@ module ApplicationHelper
945 # from Article model for an ArticleBlock. 945 # from Article model for an ArticleBlock.
946 def reference_to_article(text, article, anchor=nil) 946 def reference_to_article(text, article, anchor=nil)
947 if article.profile.domains.empty? 947 if article.profile.domains.empty?
948 - href = "/#{article.url[:profile]}/" 948 + href = "#{Noosfero.root}/#{article.url[:profile]}/"
949 else 949 else
950 - href = "http://#{article.profile.domains.first.name}/" 950 + href = "http://#{article.profile.domains.first.name}#{Noosfero.root}/"
951 end 951 end
952 href += article.url[:page].join('/') 952 href += article.url[:page].join('/')
953 href += '#' + anchor if anchor 953 href += '#' + anchor if anchor
app/views/events/events.html.erb
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <div id='agenda-toolbar'> 3 <div id='agenda-toolbar'>
4 <%= button :back, _('Back to %s') % profile.name, profile.url %> 4 <%= button :back, _('Back to %s') % profile.name, profile.url %>
5 <% if user && user.has_permission?('post_content', profile) %> 5 <% if user && user.has_permission?('post_content', profile) %>
6 - <%= button :new, _('New event'), myprofile_url(:controller => 'cms', :action => 'new', :type => 'Event') %> 6 + <%= button :new, _('New event'), myprofile_path(:controller => 'cms', :action => 'new', :type => 'Event') %>
7 <% end %> 7 <% end %>
8 </div> 8 </div>
9 9