From 145f49de2da505769a709d3f53315700f5ea006c Mon Sep 17 00:00:00 2001 From: okriuchykhin Date: Mon, 26 Mar 2018 17:38:48 +0200 Subject: [PATCH] Revert "Update turbolinks and fix repository table init [SCI-2251]" --- Gemfile | 3 ++- Gemfile.lock | 16 +++++++++------- app/assets/javascripts/application.js.erb | 2 ++ .../repositories/my_module_repository.js | 8 +++++--- .../repositories/repository_datatable.js | 7 ++----- app/views/layouts/application.html.erb | 4 ---- app/views/my_modules/repository.html.erb | 3 --- app/views/repositories/index.html.erb | 4 ---- app/views/users/registrations/edit.html.erb | 10 +++++----- 9 files changed, 25 insertions(+), 32 deletions(-) diff --git a/Gemfile b/Gemfile index ca6093286..1bea45cc0 100644 --- a/Gemfile +++ b/Gemfile @@ -30,6 +30,7 @@ gem 'bootstrap3-datetimepicker-rails', '~> 4.15.35' gem 'bootstrap-select-rails', '~> 1.6.3' gem 'uglifier', '>= 1.3.0' # jQuery & plugins +gem 'jquery-turbolinks' gem 'jquery-rails' gem 'jquery-ui-rails' gem 'jquery-scrollto-rails', @@ -41,7 +42,7 @@ gem 'spinjs-rails' gem 'autosize-rails' # jQuery autosize plugin gem 'underscore-rails' -gem 'turbolinks', '~> 5.0.1' +gem 'turbolinks', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc gem 'bcrypt', '~> 3.1.10' gem 'logging', '~> 2.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index 32fe70373..c811bb108 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,11 +1,10 @@ GIT remote: https://github.com/biosistemika/canaid - revision: 943ae9b9801819fd2513f6ab9e1143ad8de523ce + revision: f2000c19b75e66ea929a44cb0575262b7f5fc13e branch: master specs: - canaid (1.0.2) + canaid (1.0.1) devise (>= 3.4.1) - docile (>= 1.1.0) rails (>= 4) GIT @@ -243,6 +242,9 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + jquery-turbolinks (2.1.0) + railties (>= 3.1.0) + turbolinks jquery-ui-rails (6.0.1) railties (>= 3.2.16) js_cookie_rails (2.1.4) @@ -489,9 +491,8 @@ GEM tilt (2.0.8) tinymce-rails (4.6.7) railties (>= 3.1.1) - turbolinks (5.0.1) - turbolinks-source (~> 5) - turbolinks-source (5.1.0) + turbolinks (2.5.4) + coffee-rails tzinfo (1.2.4) thread_safe (~> 0.1) uglifier (4.1.4) @@ -561,6 +562,7 @@ DEPENDENCIES jbuilder jquery-rails jquery-scrollto-rails! + jquery-turbolinks jquery-ui-rails js_cookie_rails json_matchers @@ -607,7 +609,7 @@ DEPENDENCIES spinjs-rails starscope tinymce-rails (~> 4.6.4) - turbolinks (~> 5.0.1) + turbolinks (~> 2.0) tzinfo-data uglifier (>= 1.3.0) underscore-rails diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index 9e127d9e0..f5051cee4 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -1,5 +1,7 @@ +// jquery.turbolinks MUST IMMEDIATELY FOLLOW jquery inclusion // turbolinks MUST BE THE LAST inclusion //= require jquery +//= require jquery.turbolinks //= require jquery_ujs //= require jquery.remotipart //= require jquery.mousewheel.min diff --git a/app/assets/javascripts/repositories/my_module_repository.js b/app/assets/javascripts/repositories/my_module_repository.js index 146022a2c..cc22b599c 100644 --- a/app/assets/javascripts/repositories/my_module_repository.js +++ b/app/assets/javascripts/repositories/my_module_repository.js @@ -2,7 +2,9 @@ 'use strict'; // initialze repository datatable - RepositoryDatatable.destroy(); - RepositoryDatatable.init($('#content').attr('data-repo-id')); - onClickToggleAssignedRecords(); + $(document).ready(function() { + RepositoryDatatable.destroy() + RepositoryDatatable.init($('#content').attr('data-repo-id')); + onClickToggleAssignedRecords(); + }); })(); diff --git a/app/assets/javascripts/repositories/repository_datatable.js b/app/assets/javascripts/repositories/repository_datatable.js index e67be7307..23aadea84 100644 --- a/app/assets/javascripts/repositories/repository_datatable.js +++ b/app/assets/javascripts/repositories/repository_datatable.js @@ -4,7 +4,7 @@ var RepositoryDatatable = (function(global) { 'use strict'; var TABLE_ID = ''; - var TABLE; + var TABLE = {}; // Extend datatables API with searchable options // (http://stackoverflow.com/questions/39912395/datatables-dynamically-set-columns-searchable) @@ -1405,10 +1405,7 @@ var RepositoryDatatable = (function(global) { } function destroy() { - if (TABLE !== null) { - TABLE.destroy(); - TABLE = null; - } + TABLE = {}; TABLE_ID = ''; } diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2d46f8e74..ec1165f14 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -13,10 +13,6 @@ <%= favicon_link_tag "favicon-48.png", type: "image/png", size: "48x48" %> <%= csrf_meta_tags %> - - <% if content_for?(:head) %> - <%= yield(:head) %> - <% end %> - -<% end %> <% provide(:head_title, t("my_modules.repository.head_title", project: h(@project.name), module: h(@my_module.name), diff --git a/app/views/repositories/index.html.erb b/app/views/repositories/index.html.erb index 3f05df5a1..2fcbbe935 100644 --- a/app/views/repositories/index.html.erb +++ b/app/views/repositories/index.html.erb @@ -1,7 +1,3 @@ -<% content_for :head do %> - -<% end %> - <% provide(:head_title, t("repositories.index.head_title")) %> <% if current_team %> diff --git a/app/views/users/registrations/edit.html.erb b/app/views/users/registrations/edit.html.erb index 5dcba7e94..c27d23e93 100644 --- a/app/views/users/registrations/edit.html.erb +++ b/app/views/users/registrations/edit.html.erb @@ -21,7 +21,7 @@ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), - html: { method: :put, "data-for" => "avatar", 'data-turbolinks' => false, id: 'user-avatar-field' }) do |f| %> + html: { method: :put, "data-for" => "avatar", id: 'user-avatar-field' }) do |f| %> <%= hidden_field_tag "user[change_avatar]", "true" %>
@@ -60,7 +60,7 @@ as: resource_name, url: registration_path(resource_name, format: :json), remote: true, - html: { method: :put, "data-for" => "full_name", 'data-turbolinks' => false, class: 'settings-page-full-name', id: 'user-full_name-field' }) do |f| %> + html: { method: :put, "data-for" => "full_name", class: 'settings-page-full-name', id: 'user-full_name-field' }) do |f| %>
<%= f.label t("users.registrations.edit.name_label") %> @@ -91,7 +91,7 @@ as: resource_name, url: registration_path(resource_name, format: :json), remote: true, - html: { method: :put, "data-for" => "initials", 'data-turbolinks' => false, class: 'settings-page-initials', id: 'user-initials-field' }) do |f| %> + html: { method: :put, "data-for" => "initials", class: 'settings-page-initials', id: 'user-initials-field' }) do |f| %>
<%= f.label t("users.registrations.edit.initials_label") %> @@ -122,7 +122,7 @@ as: resource_name, url: registration_path(resource_name, format: :json), remote: true, - html: { method: :put, "data-for" => "email", 'data-turbolinks' => false, class: 'settings-page-email', id: 'user-email-field' }) do |f| %> + html: { method: :put, "data-for" => "email", class: 'settings-page-email', id: 'user-email-field' }) do |f| %>
<%= f.label t("users.registrations.edit.email_label") %> @@ -163,7 +163,7 @@ as: resource_name, url: registration_path(resource_name, format: :json), remote: true, - html: { method: :put, "data-for" => "password", 'data-turbolinks' => false, class: 'settings-page-change-password', id: 'user-password-field' }) do |f| %> + html: { method: :put, "data-for" => "password", class: 'settings-page-change-password', id: 'user-password-field' }) do |f| %> <%= hidden_field_tag "user[change_password]", "true" %>