From 083ec3e747c44ac0989f9dccd3db9e1385248c8f Mon Sep 17 00:00:00 2001 From: Beatrice Olivera Date: Tue, 4 Sep 2018 11:49:18 +0100 Subject: [PATCH 1/3] added message sending --- app/javascript/packs/chatrooms.js | 15 ++++++++------- app/views/chat_rooms/show.html.erb | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/javascript/packs/chatrooms.js b/app/javascript/packs/chatrooms.js index a72d582..a29046f 100644 --- a/app/javascript/packs/chatrooms.js +++ b/app/javascript/packs/chatrooms.js @@ -19,17 +19,18 @@ App['chatroom' + chatroomId] = App.cable.subscriptions.create({ connected: () => { }, received: data => { + console.log(data) } }) // Testing ActionCable -// const testBtn = document.getElementById('test-btn') -// testBtn.addEventListener('click', event => { -// fetch(`/chat_rooms/${chatroomId}/cable_testing` , { -// method: 'POST', -// body: JSON.stringify({}) -// }) -// }) +const testBtn = document.getElementById('test-btn') +testBtn.addEventListener('click', event => { + fetch(`/chat_rooms/${chatroomId}/cable_testing` , { + method: 'POST', + body: JSON.stringify({}) + }) +}) diff --git a/app/views/chat_rooms/show.html.erb b/app/views/chat_rooms/show.html.erb index fd9e62f..57f416c 100644 --- a/app/views/chat_rooms/show.html.erb +++ b/app/views/chat_rooms/show.html.erb @@ -1,3 +1,4 @@ +
From 656af7c6809aa9e08271aee37d7b58c9655c5333 Mon Sep 17 00:00:00 2001 From: Benjamin Myara Date: Tue, 4 Sep 2018 11:52:10 +0100 Subject: [PATCH 2/3] done --- app/assets/stylesheets/pages/_home.scss | 2 ++ app/javascript/components/banner.js | 13 +++++++++++++ app/javascript/packs/application.js | 3 +++ app/views/pages/home.html.erb | 3 +++ package.json | 3 ++- yarn.lock | 4 ++++ 6 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 app/javascript/components/banner.js diff --git a/app/assets/stylesheets/pages/_home.scss b/app/assets/stylesheets/pages/_home.scss index a3fa38e..ba27993 100755 --- a/app/assets/stylesheets/pages/_home.scss +++ b/app/assets/stylesheets/pages/_home.scss @@ -31,3 +31,5 @@ video { display: flex; justify-content: space-between; } + + diff --git a/app/javascript/components/banner.js b/app/javascript/components/banner.js new file mode 100644 index 0000000..57535ed --- /dev/null +++ b/app/javascript/components/banner.js @@ -0,0 +1,13 @@ +import Typed from 'typed.js'; + +function loadDynamicBannerText() { + new Typed('#banner-typed-text', { + strings: ["Language is not a barrier anymore", "Stay connected"], + typeSpeed: 50, + loop: true + }); +} + +export { loadDynamicBannerText }; + + diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index d7551ce..3b0a613 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -2,6 +2,9 @@ import "bootstrap"; import { triggerModalEvent } from "../components/modal.js"; +import { loadDynamicBannerText } from '../components/banner'; +loadDynamicBannerText(); + triggerModalEvent(); const settingsPage = document.getElementById('settings-page'); diff --git a/app/views/pages/home.html.erb b/app/views/pages/home.html.erb index 97289e0..cefdfde 100644 --- a/app/views/pages/home.html.erb +++ b/app/views/pages/home.html.erb @@ -1,5 +1,8 @@