]> git.openstreetmap.org Git - rails.git/commitdiff
Make helpers return text instead of appending to the output buffer
authorTom Hughes <tom@compton.nu>
Fri, 3 Sep 2010 14:25:11 +0000 (15:25 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 14 Nov 2011 09:42:42 +0000 (09:42 +0000)
app/helpers/application_helper.rb
app/views/diary_entry/_diary_comment.html.erb
app/views/diary_entry/_diary_entry.html.erb
app/views/diary_entry/list.html.erb
app/views/diary_entry/view.html.erb
app/views/trace/list.html.erb
app/views/trace/view.html.erb

index b2ce9b003f42082480736495006e46591f15b8e3..e285215b8d85a01c81bc7eabb93d58ba233ff774 100644 (file)
@@ -54,29 +54,29 @@ module ApplicationHelper
   end
 
   def if_logged_in(tag = :div, &block)
-    concat(content_tag(tag, capture(&block), :class => "hide_unless_logged_in"))
+    content_tag(tag, capture(&block), :class => "hide_unless_logged_in")
   end
 
   def if_not_logged_in(tag = :div, &block)
-    concat(content_tag(tag, capture(&block), :class => "hide_if_logged_in"))
+    content_tag(tag, capture(&block), :class => "hide_if_logged_in")
   end
 
   def if_user(user, tag = :div, &block)
     if user
-      concat(content_tag(tag, capture(&block), :class => "hidden show_if_user_#{user.id}"))
+      content_tag(tag, capture(&block), :class => "hidden show_if_user_#{user.id}")
     end
   end
 
   def unless_user(user, tag = :div, &block)
     if user
-      concat(content_tag(tag, capture(&block), :class => "hide_if_user_#{user.id}"))
+      content_tag(tag, capture(&block), :class => "hide_if_user_#{user.id}")
     else
-      concat(content_tag(tag, capture(&block)))
+      content_tag(tag, capture(&block))
     end
   end
 
   def if_administrator(tag = :div, &block)
-    concat(content_tag(tag, capture(&block), :class => "hide_unless_administrator"))
+    content_tag(tag, capture(&block), :class => "hide_unless_administrator")
   end
 
   def describe_location(lat, lon, zoom = nil, language = nil)
index da10c88ac9d939cd9c8107e6cb843d61e663f0ac..05cb80157d4faeaac7b030ea2986fa110c8e24c4 100644 (file)
@@ -1,7 +1,7 @@
 <%= user_thumbnail diary_comment.user %>
 <h4 id="comment<%= diary_comment.id %>"><%= raw(t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => l(diary_comment.created_at, :format => :friendly))) %></h4>
 <%= htmlize(diary_comment.body) %>
-<% if_administrator(:span) do %> 
+<%= if_administrator(:span) do %> 
   <%= link_to t('diary_entry.diary_comment.hide_link'), {:action => 'hidecomment', :display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id}, {:confirm => t('diary_entry.diary_comment.confirm')} %>
 <% end %>
 <hr />
index 02100c74dbf8d4c596709c68c7fba0a30ec5bd7a..6ab7aaf48924852c6becb9d8e5788dc551427701 100644 (file)
   |
   <%= link_to t('diary_entry.diary_entry.comment_count', :count => diary_entry.visible_comments.count), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comments' %>
 <% end %>
-<% if_user(diary_entry.user, :span) do %>
+<%= if_user(diary_entry.user, :span) do %>
   | <%= link_to t('diary_entry.diary_entry.edit_link'), :action => 'edit', :display_name => diary_entry.user.display_name, :id => diary_entry.id %>
 <% end %>
-<% if_administrator(:span) do %>
+<%= if_administrator(:span) do %>
   | <%= link_to t('diary_entry.diary_entry.hide_link'), {:action => 'hide', :display_name => diary_entry.user.display_name, :id => diary_entry.id}, {:confirm => t('diary_entry.diary_entry.confirm')} %>
 <% end %>
 
index a78b41a4f5039f2f7a1e1ddd7086f7595c1334f4..03a326d16bbf7f9dee36245148f4f84ed09b609b 100644 (file)
@@ -5,11 +5,11 @@
 <h2><%= h(@title) %></h2>
 
 <% if @this_user %>
-  <% if_user(@this_user) do %>
+  <%= if_user(@this_user) do %>
     <%= link_to image_tag("new.png", :border=>0) + t('diary_entry.list.new'), {:controller => 'diary_entry', :action => 'new'}, {:title => t('diary_entry.list.new_title')} %>
   <% end %>
 <% else %>
-  <% if_logged_in do %>
+  <%= if_logged_in do %>
     <%= link_to image_tag("new.png", :border=>0) + t('diary_entry.list.new'), {:controller => 'diary_entry', :action => 'new'}, {:title => t('diary_entry.list.new_title')} %>
   <% end %>
 <% end %>
index 2261e256831b5b023ca9210336f9000a22a5ccce..63d43158dc2e250ebddda700aa124bcdbb08c831 100644 (file)
@@ -8,7 +8,7 @@
 
 <%= render :partial => 'diary_comment', :collection => @entry.visible_comments %>
 
-<% if_logged_in(:div) do %>
+<%= if_logged_in(:div) do %>
   <h4 id="newcomment"><%= t 'diary_entry.view.leave_a_comment' %></h4>
 
   <%= error_messages_for 'diary_comment' %>
@@ -21,6 +21,6 @@
   <% end %>
 <% end %>
 
-<% if_not_logged_in(:div) do %>
+<%= if_not_logged_in(:div) do %>
   <h4 id="newcomment"><%= t("diary_entry.view.login_to_leave_a_comment", :login_link => link_to(t("diary_entry.view.login"), :controller => 'user', :action => 'login', :referer => request.request_uri)) %></h4>
 <% end %>
index 31ea0eb3ae100d49302ceafa93f5a3da935d3d1b..2475b5ad2ef1a0786cd55d1d9317cd7fd9d43506 100644 (file)
@@ -14,7 +14,7 @@
     <% if @display_name %>
       | <%= link_to t('trace.trace_header.see_all_traces'), :controller => 'trace', :action => 'list', :display_name => nil, :tag => nil, :page => nil %>
     <% end %>
-    <% unless_user(@target_user, :span) do %>
+    <%= unless_user(@target_user, :span) do %>
       | <%= link_to t('trace.trace_header.see_your_traces'), :action => 'mine', :tag => nil, :page => nil %>
     <% end %>
   <% end %>
index 1f272b271df0a41b15ae1bb2577c4402add5669a..5a7c5bcc6c909d090d76dd90a3f277d8d80d514c 100644 (file)
@@ -52,7 +52,7 @@
 
 <br /><br />
 
-<% if_user(@trace.user) do %>
+<%= if_user(@trace.user) do %>
   <table>
     <tr>
       <td><%= button_to t('trace.view.edit_track'), :controller => 'trace', :action => 'edit', :id => @trace.id %></td>