Skip to content

Commit

Permalink
Simplify partial rendering when the partial is named after the model
Browse files Browse the repository at this point in the history
  • Loading branch information
gravitystorm committed Jun 26, 2019
1 parent 5b4636d commit 3914050
Show file tree
Hide file tree
Showing 17 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion app/views/api/notes/index.gpx.builder
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/views/api/notes/index.json.jsonify
@@ -1,5 +1,5 @@
json.type "FeatureCollection"

json.features(@notes) do |note|
json.ingest! render(:partial => "note", :object => note)
json.ingest! render(note)
end
2 changes: 1 addition & 1 deletion app/views/api/notes/index.rss.builder
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/views/api/notes/index.xml.builder
@@ -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
2 changes: 1 addition & 1 deletion app/views/api/notes/show.gpx.builder
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/views/api/notes/show.json.jsonify
@@ -1 +1 @@
json.ingest! render(:partial => "note", :object => @note)
json.ingest! render(@note)
2 changes: 1 addition & 1 deletion app/views/api/notes/show.rss.builder
Expand Up @@ -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
2 changes: 1 addition & 1 deletion app/views/api/notes/show.xml.builder
@@ -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
2 changes: 1 addition & 1 deletion app/views/api/users/index.builder
@@ -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
2 changes: 1 addition & 1 deletion app/views/api/users/show.builder
@@ -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
1 change: 0 additions & 1 deletion app/views/diary_entries/_diary_index_entry.html.erb

This file was deleted.

6 changes: 1 addition & 5 deletions app/views/diary_entries/index.html.erb
Expand Up @@ -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 -%>
Expand Down
2 changes: 1 addition & 1 deletion app/views/diary_entries/show.html.erb
Expand Up @@ -6,7 +6,7 @@
</div>
<% end %>
<%= render :partial => "diary_entry", :object => @entry %>
<%= render @entry %>

<a id="comments"></a>
<div class='comments'>
Expand Down
3 changes: 0 additions & 3 deletions app/views/redactions/_redactions.html.erb

This file was deleted.

4 changes: 3 additions & 1 deletion app/views/redactions/index.html.erb
Expand Up @@ -4,7 +4,9 @@
<% end %>
<% unless @redactions.empty? %>
<%= render :partial => "redactions" %>
<ul id="redaction_list">
<%= render @redactions %>
</ul>
<% else %>
<p><%= t ".empty" %></p>
<% end %>
2 changes: 1 addition & 1 deletion app/views/traces/index.html.erb
Expand Up @@ -33,7 +33,7 @@
</tr>
</thead>
<tbody>
<%= render :partial => "trace", :collection => @traces unless @traces.nil? %>
<%= render @traces unless @traces.nil? %>
</tbody>
</table>

Expand Down
2 changes: 1 addition & 1 deletion app/views/users/index.html.erb
Expand Up @@ -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">
Expand Down

0 comments on commit 3914050

Please sign in to comment.