From 51b7c3a5be1b6b52ee0041435357a960fdf0eff8 Mon Sep 17 00:00:00 2001 From: Harry Wood Date: Sat, 5 Mar 2022 01:53:07 +0000 Subject: [PATCH] More readable multi-line ruby in erbs A couple of erb files had unnecessary start and end erb tags around every line in a multi-line block of ruby. More readable this way. --- app/views/site/_id.html.erb | 10 +++++----- app/views/site/id.html.erb | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/views/site/_id.html.erb b/app/views/site/_id.html.erb index f1f48c1e1..1a3807e4a 100644 --- a/app/views/site/_id.html.erb +++ b/app/views/site/_id.html.erb @@ -1,10 +1,10 @@ <%= javascript_include_tag "edit/id" %>
- <% data = { :key => Settings.id_key } -%> - <% data[:lat] = @lat if @lat -%> - <% data[:lon] = @lon if @lon -%> - <% data[:gpx] = trace_data_url(params[:gpx], :format => :xml) if params[:gpx] -%> - <% data[:url] = id_url(:locale => params[:locale]) -%> + <% data = { :key => Settings.id_key } + data[:lat] = @lat if @lat + data[:lon] = @lon if @lon + data[:gpx] = trace_data_url(params[:gpx], :format => :xml) if params[:gpx] + data[:url] = id_url(:locale => params[:locale]) %> <%= tag.iframe "", :frameBorder => 0, :id => "id-embed", :class => "id-embed", :allowfullscreen => "", :data => data %>
diff --git a/app/views/site/id.html.erb b/app/views/site/id.html.erb index 0178c8f22..ec067b9e7 100644 --- a/app/views/site/id.html.erb +++ b/app/views/site/id.html.erb @@ -8,16 +8,16 @@ -<% data = {} -%> -<% if Settings.key?(:id_key) %> -<% token = current_user.access_token(Settings.id_key) %> -<% data[:token] = token.token -%> -<% data[:token_secret] = token.secret -%> -<% data[:consumer_key] = token.client_application.key -%> -<% data[:consumer_secret] = token.client_application.secret -%> -<% end %> -<% data[:locale] = ID::LOCALES.preferred(preferred_languages).to_s -%> -<% data[:asset_map] = assets("iD").to_json -%> +<% data = {} + if Settings.key?(:id_key) + token = current_user.access_token(Settings.id_key) + data[:token] = token.token + data[:token_secret] = token.secret + data[:consumer_key] = token.client_application.key + data[:consumer_secret] = token.client_application.secret + end + data[:locale] = ID::LOCALES.preferred(preferred_languages).to_s + data[:asset_map] = assets("iD").to_json %> <%= tag.div "", :id => "id-container", :data => data %> -- 2.39.5