From: Andy Allan Date: Wed, 26 Jun 2019 12:13:09 +0000 (+0200) Subject: Simplify partial rendering when the partial is named after the model X-Git-Tag: live~3062^2~1 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/3914050fcc24c8727c485412a69b12292bbf213d?hp=5b4636d5213de2e699769821031c37663ab71557 Simplify partial rendering when the partial is named after the model --- diff --git a/app/views/api/notes/index.gpx.builder b/app/views/api/notes/index.gpx.builder index 58da357da..d737752bf 100644 --- a/app/views/api/notes/index.gpx.builder +++ b/app/views/api/notes/index.gpx.builder @@ -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 diff --git a/app/views/api/notes/index.json.jsonify b/app/views/api/notes/index.json.jsonify index cb75d41c4..bfc8ffcf8 100644 --- a/app/views/api/notes/index.json.jsonify +++ b/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 diff --git a/app/views/api/notes/index.rss.builder b/app/views/api/notes/index.rss.builder index 96ba4b734..95ea0b3b1 100644 --- a/app/views/api/notes/index.rss.builder +++ b/app/views/api/notes/index.rss.builder @@ -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 diff --git a/app/views/api/notes/index.xml.builder b/app/views/api/notes/index.xml.builder index 286b1e1cc..ebb026e65 100644 --- a/app/views/api/notes/index.xml.builder +++ b/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 diff --git a/app/views/api/notes/show.gpx.builder b/app/views/api/notes/show.gpx.builder index f87ff4dd9..750d01f56 100644 --- a/app/views/api/notes/show.gpx.builder +++ b/app/views/api/notes/show.gpx.builder @@ -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 diff --git a/app/views/api/notes/show.json.jsonify b/app/views/api/notes/show.json.jsonify index 3e5685fc0..10d127291 100644 --- a/app/views/api/notes/show.json.jsonify +++ b/app/views/api/notes/show.json.jsonify @@ -1 +1 @@ -json.ingest! render(:partial => "note", :object => @note) +json.ingest! render(@note) diff --git a/app/views/api/notes/show.rss.builder b/app/views/api/notes/show.rss.builder index 61ee0857a..d739ea6d9 100644 --- a/app/views/api/notes/show.rss.builder +++ b/app/views/api/notes/show.rss.builder @@ -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 diff --git a/app/views/api/notes/show.xml.builder b/app/views/api/notes/show.xml.builder index 51b3daebd..bb87fe762 100644 --- a/app/views/api/notes/show.xml.builder +++ b/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 diff --git a/app/views/api/users/index.builder b/app/views/api/users/index.builder index 68d629099..60fcfa898 100644 --- a/app/views/api/users/index.builder +++ b/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 diff --git a/app/views/api/users/show.builder b/app/views/api/users/show.builder index dd5e93689..96bfdd3fa 100644 --- a/app/views/api/users/show.builder +++ b/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 diff --git a/app/views/diary_entries/_diary_index_entry.html.erb b/app/views/diary_entries/_diary_index_entry.html.erb deleted file mode 100644 index 3d6df4e03..000000000 --- a/app/views/diary_entries/_diary_index_entry.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => "diary_entry", :object => diary_index_entry %> diff --git a/app/views/diary_entries/index.html.erb b/app/views/diary_entries/index.html.erb index 4610e5fd7..acf9ac17c 100644 --- a/app/views/diary_entries/index.html.erb +++ b/app/views/diary_entries/index.html.erb @@ -32,11 +32,7 @@ <% else %>

<%= t ".recent_entries" %>

- <% if @user %> - <%= render :partial => "diary_entry", :collection => @entries %> - <% else %> - <%= render :partial => "diary_index_entry", :collection => @entries %> - <% end %> + <%= render @entries %> <% end %> -<%= render :partial => "diary_entry", :object => @entry %> +<%= render @entry %>
diff --git a/app/views/redactions/_redactions.html.erb b/app/views/redactions/_redactions.html.erb deleted file mode 100644 index 225e2561c..000000000 --- a/app/views/redactions/_redactions.html.erb +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/app/views/redactions/index.html.erb b/app/views/redactions/index.html.erb index e3388fafa..b6b6ef46e 100644 --- a/app/views/redactions/index.html.erb +++ b/app/views/redactions/index.html.erb @@ -4,7 +4,9 @@ <% end %> <% unless @redactions.empty? %> - <%= render :partial => "redactions" %> + <% else %>

<%= t ".empty" %>

<% end %> diff --git a/app/views/traces/index.html.erb b/app/views/traces/index.html.erb index 9db246bd4..da40f5a4d 100644 --- a/app/views/traces/index.html.erb +++ b/app/views/traces/index.html.erb @@ -33,7 +33,7 @@ - <%= render :partial => "trace", :collection => @traces unless @traces.nil? %> + <%= render @traces unless @traces.nil? %> diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb index ffaceeff0..f1ef5b538 100644 --- a/app/views/users/index.html.erb +++ b/app/views/users/index.html.erb @@ -30,7 +30,7 @@ <%= check_box_tag "user_all", "1", false %> - <%= render :partial => "user", :collection => @users %> + <%= render @users %>