From: Tom Hughes Date: Mon, 27 Feb 2017 22:48:36 +0000 (+0000) Subject: Remove inline javascript from user views X-Git-Tag: live~3522 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/d13348c0ea27cdb33153564aacf3130b0432157c?hp=-c Remove inline javascript from user views --- d13348c0ea27cdb33153564aacf3130b0432157c diff --git a/app/assets/javascripts/osm.js.erb b/app/assets/javascripts/osm.js.erb index 10b7cfdb8..697017697 100644 --- a/app/assets/javascripts/osm.js.erb +++ b/app/assets/javascripts/osm.js.erb @@ -38,6 +38,8 @@ OSM = { OPEN_NOTE_MARKER: <%= image_path("open_note_marker.png").to_json %>, CLOSED_NOTE_MARKER: <%= image_path("closed_note_marker.png").to_json %>, + SEARCHING: <%= image_path("searching.gif").to_json %>, + apiUrl: function (object) { var url = "/api/" + OSM.API_VERSION + "/" + object.type + "/" + object.id; diff --git a/app/assets/javascripts/user.js b/app/assets/javascripts/user.js index 7e7e7c803..44872a78c 100644 --- a/app/assets/javascripts/user.js +++ b/app/assets/javascripts/user.js @@ -103,4 +103,20 @@ $(document).ready(function () { } else { enableAuth(); } + + $("#user_all").change(function () { + $("#user_list input[type=checkbox]").prop("checked", $("#user_all").prop("checked")); + }); + + $("#content.user_confirm").each(function () { + $(this).hide(); + $(this).find("#confirm").submit(); + }); + + $("input[name=legale]").change(function () { + var url = $(this).data("url"); + + $("#contributorTerms").html(""); + $("#contributorTerms").load(url); + }); }); diff --git a/app/views/user/confirm.html.erb b/app/views/user/confirm.html.erb index 9fc33094e..f52098289 100644 --- a/app/views/user/confirm.html.erb +++ b/app/views/user/confirm.html.erb @@ -4,9 +4,11 @@ <% end %> <% if params[:confirm_string] %> - + <% content_for :head do %> + <%= javascript_include_tag "user" %> + <% end %> + + <% content_for(:content_class) { "user_confirm" } %>

<%= t 'user.confirm.press confirm button' %>

@@ -15,10 +17,6 @@ <% end %> - - <% else %>

<%= t "user.confirm.introduction_1" %> diff --git a/app/views/user/confirm_email.html.erb b/app/views/user/confirm_email.html.erb index 1170631ca..1791cfc73 100644 --- a/app/views/user/confirm_email.html.erb +++ b/app/views/user/confirm_email.html.erb @@ -1,6 +1,8 @@ - +<% content_for :head do %> + <%= javascript_include_tag "user" %> +<% end %> + +<% content_for(:content_class) { "user_confirm" } %> <% content_for :heading do %>

<%= t 'user.confirm_email.heading' %>

@@ -12,7 +14,3 @@ $("#content").hide(); <% end %> - - diff --git a/app/views/user/list.html.erb b/app/views/user/list.html.erb index 93839cbe8..fcd0c41fc 100644 --- a/app/views/user/list.html.erb +++ b/app/views/user/list.html.erb @@ -1,5 +1,9 @@ <% @title = t('user.list.title') %> +<% content_for :head do %> + <%= javascript_include_tag "user" %> +<% end %> + <% content_for :heading do %>

<%= t('user.list.heading') %>

<% end %> @@ -34,12 +38,6 @@ <%= submit_tag t('user.list.confirm'), :name => "confirm" %> <%= submit_tag t('user.list.hide'), :name => "hide" %> - - <% end %> <% else %>

<%= t "user.list.empty" %>

diff --git a/app/views/user/terms.html.erb b/app/views/user/terms.html.erb index 47e2f8b54..3d8cb22f7 100644 --- a/app/views/user/terms.html.erb +++ b/app/views/user/terms.html.erb @@ -1,3 +1,7 @@ +<% content_for :head do %> + <%= javascript_include_tag "user" %> +<% end %> + <% content_for :heading do %>

<%= t 'user.terms.heading' %>

@@ -13,15 +17,9 @@ <% [['france', 'FR'], ['italy', 'IT'], ['rest_of_world', 'GB']].each do |name, legale| %>
-
<% end %>