From 0b377cbe204eca6be10635b1e0a97c63de01e163 Mon Sep 17 00:00:00 2001 From: Beatrice Olivera Date: Fri, 31 Aug 2018 11:29:24 +0100 Subject: [PATCH] fixed calling modal --- app/controllers/pages_controller.rb | 1 - app/javascript/packs/modal.js | 8 ++++++++ app/views/pages/_contact.html.erb | 6 +++++- config/application.rb | 2 ++ db/schema.rb | 4 +--- 5 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 app/javascript/packs/modal.js diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index efd5757..e7676ac 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -36,7 +36,6 @@ class PagesController < ApplicationController chat_room_id: chat_room.id } }) - end def accept_call diff --git a/app/javascript/packs/modal.js b/app/javascript/packs/modal.js new file mode 100644 index 0000000..e9249f1 --- /dev/null +++ b/app/javascript/packs/modal.js @@ -0,0 +1,8 @@ +import "bootstrap"; + +const btn = document.getElementById("modalTrigger"); +const modal = document.getElementById("myModal"); + +btn.addEventListener('click', function(event) { + $('#myModal').modal('show'); +}); diff --git a/app/views/pages/_contact.html.erb b/app/views/pages/_contact.html.erb index 08f0a36..1a77dbf 100644 --- a/app/views/pages/_contact.html.erb +++ b/app/views/pages/_contact.html.erb @@ -18,13 +18,14 @@ end
- <%= link_to establish_call_path(contact.id), 'data-toggle':"modal", 'data-target':"#myModal" do %> + <%= link_to establish_call_path(contact.id), remote: true, id: "modalTrigger" do %> <% end %>
+ + + +<%= javascript_pack_tag 'modal' %> diff --git a/config/application.rb b/config/application.rb index a72f336..1a5c6c8 100644 --- a/config/application.rb +++ b/config/application.rb @@ -15,6 +15,8 @@ module Polyglot end # Initialize configuration defaults for originally generated Rails version. config.load_defaults 5.2 + config.action_view.embed_authenticity_token_in_remote_forms = true + # Settings in config/environments/* take precedence over those specified here. # Application configuration can go into files in config/initializers diff --git a/db/schema.rb b/db/schema.rb index 050711c..46b1487 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. - -# ActiveRecord::Schema.define(version: 2018_08_30_100110) do -ActiveRecord::Schema.define(version: 2018_08_29_123204) do +ActiveRecord::Schema.define(version: 2018_08_30_100110) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql"