From 6795b08a914db4a5d835464eeab8303690cd6d0a Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Mon, 20 Aug 2018 13:13:34 +0200 Subject: [PATCH] Refactor invite users modal initialization [SCI-2651] --- .../javascripts/users/settings/teams/invite_users_modal.js | 4 +++- app/assets/javascripts/users/settings/teams/show.js | 2 -- app/views/users/settings/teams/show.html.erb | 3 ++- config/initializers/assets.rb | 2 ++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/users/settings/teams/invite_users_modal.js b/app/assets/javascripts/users/settings/teams/invite_users_modal.js index 98c0ed51a..51cd11c53 100644 --- a/app/assets/javascripts/users/settings/teams/invite_users_modal.js +++ b/app/assets/javascripts/users/settings/teams/invite_users_modal.js @@ -164,8 +164,10 @@ } function initializeModalsToggle() { - $("[data-trigger='invite-users']").on('click', function() { + $("[data-trigger='invite-users']").on('click', function(event) { var id = $(this).attr('data-modal-id'); + event.preventDefault(); + event.stopPropagation(); $('[data-role=invite-users-modal][data-id=' + id + ']') .modal('show'); }); diff --git a/app/assets/javascripts/users/settings/teams/show.js b/app/assets/javascripts/users/settings/teams/show.js index 26b9f8d8e..5972d1bce 100644 --- a/app/assets/javascripts/users/settings/teams/show.js +++ b/app/assets/javascripts/users/settings/teams/show.js @@ -1,5 +1,3 @@ -//= require users/settings/teams/invite_users_modal - (function() { 'use strict'; diff --git a/app/views/users/settings/teams/show.html.erb b/app/views/users/settings/teams/show.html.erb index 3d89a65eb..f36e122f1 100644 --- a/app/views/users/settings/teams/show.html.erb +++ b/app/views/users/settings/teams/show.html.erb @@ -93,7 +93,7 @@
+ data-modal-id="team-invite-users-modal"> <%= t("users.settings.teams.edit.add_user") %> @@ -137,4 +137,5 @@ <%= render partial: 'users/settings/user_teams/destroy_user_team_modal.html.erb' %> <%= stylesheet_link_tag 'datatables' %> <%= javascript_include_tag 'users/settings/teams/show' %> +<%= javascript_include_tag 'users/settings/teams/invite_users_modal' %> diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index d8c70c289..f5fc0767e 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -28,6 +28,8 @@ Rails.application.config.assets.precompile += Rails.application.config.assets.precompile += %w(users/settings/teams/add_user_modal.js) Rails.application.config.assets.precompile += %w(users/settings/teams/show.js) +Rails.application.config.assets.precompile += + %w(users/settings/teams/invite_users_modal.js) Rails.application.config.assets.precompile += %w(my_modules/activities.js) Rails.application.config.assets.precompile += %w(my_modules/protocols.js) Rails.application.config.assets.precompile +=