From: John Firebaugh Date: Sat, 29 Sep 2012 16:23:32 +0000 (-0700) Subject: Move edit JS to page-specific script file X-Git-Tag: live~5314 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/e83d43ca822a30b6074834233064613ea6478f88 Move edit JS to page-specific script file --- diff --git a/app/assets/javascripts/edit.js b/app/assets/javascripts/edit.js new file mode 100644 index 000000000..f5ada1508 --- /dev/null +++ b/app/assets/javascripts/edit.js @@ -0,0 +1,32 @@ +function maximiseMap() { + $("#left").hide(); + $("#greeting").hide(); + $("#tabnav").hide(); + + $("#content").css("top", "0px"); + if ($("html").attr("dir") == "ltr") { + $("#content").css("left", "0px"); + } else { + $("#content").css("right", "0px"); + } + + handleResize(); +} + +function minimiseMap() { + $("#left").show(); + $("#greeting").show(); + $("#tabnav").show(); + + $("#content").css("top", "30px"); + if ($("html").attr("dir") == "ltr") { + $("#content").css("left", "185px"); + } else { + $("#content").css("right", "185px"); + } + + handleResize(); +} + +$(document).ready(handleResize); +$(window).resize(handleResize); diff --git a/app/views/site/edit.html.erb b/app/views/site/edit.html.erb index abbb5918f..761975466 100644 --- a/app/views/site/edit.html.erb +++ b/app/views/site/edit.html.erb @@ -9,44 +9,13 @@

<%= raw t 'site.edit.not_public_description', :user_page => (link_to t('site.edit.user_page_link'), {:controller => 'user', :action => 'account', :display_name => @user.display_name, :anchor => 'public'}) %>

<%= raw t 'site.edit.anon_edits', :link => link_to(t('site.edit.anon_edits_link_text'), t('site.edit.anon_edits_link')) %>

<% else %> +<% content_for :head do %> + <%= javascript_include_tag "edit" %> +<% end %> + <%= render :partial => 'home_link' %> <%= render :partial => 'sidebar' %> <%= render :partial => 'search' %> <%= render :partial => preferred_editor %> - - <% end %> diff --git a/config/environments/production.rb b/config/environments/production.rb index 43c76a6a5..a930fb93b 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -56,7 +56,7 @@ OpenStreetMap::Application.configure do # config.action_controller.asset_host = "http://assets.example.com" # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - config.assets.precompile += %w( index.js pngfix.js swfobject.js ) + config.assets.precompile += %w( index.js edit.js pngfix.js swfobject.js ) config.assets.precompile += %w( large-ltr.css small-ltr.css print-ltr.css ) config.assets.precompile += %w( large-rtl.css small-rtl.css print-rtl.css ) config.assets.precompile += %w( browse.css theme/openstreetmap/style.css )