Simplify partial rendering when the partial is named after the model

This commit is contained in:
Andy Allan 2019-06-26 14:13:09 +02:00
parent 5b4636d521
commit 3914050fcc
17 changed files with 17 additions and 23 deletions

View file

@ -5,5 +5,5 @@ xml.gpx("version" => "1.1",
"xmlns" => "http://www.topografix.com/GPX/1/1",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xsi:schemaLocation" => "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd") do
xml << (render(:partial => "note", :collection => @notes) || "")
xml << (render(@notes) || "")
end

View file

@ -1,5 +1,5 @@
json.type "FeatureCollection"
json.features(@notes) do |note|
json.ingest! render(:partial => "note", :object => note)
json.ingest! render(note)
end

View file

@ -9,6 +9,6 @@ xml.rss("version" => "2.0",
xml.description t("api.notes.rss.description_area", :min_lat => @min_lat, :min_lon => @min_lon, :max_lat => @max_lat, :max_lon => @max_lon)
xml.link url_for(:controller => "/site", :action => "index", :only_path => false)
xml << (render(:partial => "note", :collection => @notes) || "")
xml << (render(@notes) || "")
end
end

View file

@ -1,5 +1,5 @@
xml.instruct!
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
osm << (render(:partial => "note", :collection => @notes) || "")
osm << (render(@notes) || "")
end

View file

@ -5,5 +5,5 @@ xml.gpx("version" => "1.1",
"xmlns" => "http://www.topografix.com/GPX/1/1",
"xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
"xsi:schemaLocation" => "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd") do
xml << render(:partial => "note", :object => @note)
xml << render(@note)
end

View file

@ -1 +1 @@
json.ingest! render(:partial => "note", :object => @note)
json.ingest! render(@note)

View file

@ -8,6 +8,6 @@ xml.rss("version" => "2.0",
xml.description t("api.notes.rss.description_item", :id => @note.id)
xml.link url_for(:controller => "/site", :action => "index", :only_path => false)
xml << render(:partial => "note", :object => @note)
xml << render(@note)
end
end

View file

@ -1,5 +1,5 @@
xml.instruct!
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
osm << render(:partial => "note", :object => @note)
osm << render(@note)
end

View file

@ -1,4 +1,4 @@
xml.instruct! :xml, :version => "1.0"
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
osm << render(:partial => "user", :collection => @users)
osm << render(@users)
end

View file

@ -1,4 +1,4 @@
xml.instruct! :xml, :version => "1.0"
xml.osm(OSM::API.new.xml_root_attributes) do |osm|
osm << render(:partial => "user", :object => @user)
osm << render(@user)
end

View file

@ -1 +0,0 @@
<%= render :partial => "diary_entry", :object => diary_index_entry %>

View file

@ -32,11 +32,7 @@
<% else %>
<h4><%= t ".recent_entries" %></h4>
<% if @user %>
<%= render :partial => "diary_entry", :collection => @entries %>
<% else %>
<%= render :partial => "diary_index_entry", :collection => @entries %>
<% end %>
<%= render @entries %>
<div class="pagination">
<% if @entries.size < @page_size -%>

View file

@ -6,7 +6,7 @@
</div>
<% end %>
<%= render :partial => "diary_entry", :object => @entry %>
<%= render @entry %>
<a id="comments"></a>
<div class='comments'>

View file

@ -1,3 +0,0 @@
<ul id="redaction_list">
<%= render :partial => "redaction", :collection => @redactions %>
</ul>

View file

@ -4,7 +4,9 @@
<% end %>
<% unless @redactions.empty? %>
<%= render :partial => "redactions" %>
<ul id="redaction_list">
<%= render @redactions %>
</ul>
<% else %>
<p><%= t ".empty" %></p>
<% end %>

View file

@ -33,7 +33,7 @@
</tr>
</thead>
<tbody>
<%= render :partial => "trace", :collection => @traces unless @traces.nil? %>
<%= render @traces unless @traces.nil? %>
</tbody>
</table>

View file

@ -30,7 +30,7 @@
<%= check_box_tag "user_all", "1", false %>
</td>
</tr>
<%= render :partial => "user", :collection => @users %>
<%= render @users %>
</table>
<div id="user_list_actions buttons">