From a5f538b9ae0c5b2563f1af1acfd9748982c7c64a Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sat, 10 Sep 2016 17:32:54 +0200 Subject: [PATCH] Load jquery in the head on mobile Some pages need jquery in the head and instead of loading it twice on these pages, it is better and easier to load it in the head on all pages. It should be in the cache after the first load anyway. closes #7086 --- Changelog.md | 1 + app/views/conversations/new.mobile.haml | 2 -- app/views/layouts/application.mobile.haml | 3 ++- app/views/profiles/_edit_public.haml | 2 -- app/views/status_messages/bookmarklet.mobile.haml | 3 --- app/views/users/getting_started.mobile.haml | 2 -- 6 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Changelog.md b/Changelog.md index 4723bd45f..ac3fa1a76 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ * Invalidate sessions with invalid CSRF tokens [#7050](https://github.com/diaspora/diaspora/pull/7050) * Liking a post will no longer update its interacted timestamp [#7030](https://github.com/diaspora/diaspora/pull/7030) * Improve W3C compliance [#7068](https://github.com/diaspora/diaspora/pull/7068) +* Load jQuery in the head on mobile [#7086](https://github.com/diaspora/diaspora/pull/7086) ## Bug fixes * Post comments no longer get collapsed when interacting with a post [#7040](https://github.com/diaspora/diaspora/pull/7040) diff --git a/app/views/conversations/new.mobile.haml b/app/views/conversations/new.mobile.haml index d7c6fe94e..5bc187d0d 100644 --- a/app/views/conversations/new.mobile.haml +++ b/app/views/conversations/new.mobile.haml @@ -2,8 +2,6 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -= javascript_include_tag :jquery - :javascript $(document).ready(function () { var data = $.parseJSON( "#{escape_javascript(@contacts_json)}" ), diff --git a/app/views/layouts/application.mobile.haml b/app/views/layouts/application.mobile.haml index 7c272bcde..3a26380f8 100644 --- a/app/views/layouts/application.mobile.haml +++ b/app/views/layouts/application.mobile.haml @@ -48,6 +48,8 @@ - if Rails.env.test? = stylesheet_link_tag :poltergeist_disable_transition, media: "all" + = jquery_include_tag + = yield(:head) = include_gon(:camel_case => true) @@ -64,7 +66,6 @@ = yield / javascripts at the bottom - = jquery_include_tag = javascript_include_tag "mobile/mobile" = load_javascript_locales = include_chartbeat diff --git a/app/views/profiles/_edit_public.haml b/app/views/profiles/_edit_public.haml index c909ca841..f2a14d47d 100644 --- a/app/views/profiles/_edit_public.haml +++ b/app/views/profiles/_edit_public.haml @@ -1,6 +1,4 @@ - content_for :head do - - if mobile - = javascript_include_tag :jquery :javascript $(document).ready(function () { var data = $.parseJSON( '#{@tags_array.to_json.gsub("'", "\\\\'")}' ), diff --git a/app/views/status_messages/bookmarklet.mobile.haml b/app/views/status_messages/bookmarklet.mobile.haml index 31279a386..e6c6227c2 100644 --- a/app/views/status_messages/bookmarklet.mobile.haml +++ b/app/views/status_messages/bookmarklet.mobile.haml @@ -19,6 +19,3 @@ $("#status_message_text").val(contents); } }); - -- content_for(:head) do - = javascript_include_tag :jquery diff --git a/app/views/users/getting_started.mobile.haml b/app/views/users/getting_started.mobile.haml index 2ab3a3f6c..ff158e90a 100644 --- a/app/views/users/getting_started.mobile.haml +++ b/app/views/users/getting_started.mobile.haml @@ -3,8 +3,6 @@ -# the COPYRIGHT file. - content_for :head do - = javascript_include_tag :jquery - :javascript $(document).ready(function () { var data = $.parseJSON( '#{@tags_array.to_json.gsub("'", "\\\\'")}' ),