diff --git a/app/assets/javascripts/app/controllers/_channel/chat.coffee b/app/assets/javascripts/app/controllers/_channel/chat.coffee index 5ec79fd1a..1841ba2d2 100644 --- a/app/assets/javascripts/app/controllers/_channel/chat.coffee +++ b/app/assets/javascripts/app/controllers/_channel/chat.coffee @@ -10,6 +10,8 @@ class App.ChannelChat extends App.Controller 'blur .js-testurl-input': 'changeDemoWebsite' 'click .js-selectBrowserWidth': 'selectBrowserWidth' 'click .js-swatch': 'usePaletteColor' + 'click .js-toggle-chat': 'toggleChat' + 'input .js-chatTitle': 'changeTitle' elements: '.js-browser': 'browser' @@ -23,6 +25,7 @@ class App.ChannelChat extends App.Controller '.js-color': 'colorField' '.js-screenshot': 'screenshot' '.js-website': 'website' + '.js-chat-welcome': 'chatWelcome' apiOptions: [ { @@ -178,11 +181,11 @@ class App.ChannelChat extends App.Controller @urlInput.addClass('is-loading') - # clear palette and iframe @palette.empty() - @website.attr('data-mode', '') - @iframe.attr('src', '') + @screenshot.attr('src', '') + @website.attr('data-mode', 'iframe') + @iframe.attr('src', @url) $.ajax url: 'https://images.zammad.com/api/v1/webpage/combined' @@ -196,12 +199,9 @@ class App.ChannelChat extends App.Controller imageSource = data['data_url'] if imageSource - console.log "renderDemoWebsite", typeof imageSource, imageSource @screenshot.attr 'src', imageSource + @iframe.attr('src', '') @website.attr('data-mode', 'screenshot') - else - @iframe.attr 'src', @url - @website.attr('data-mode', 'iframe') @renderPalette data['palette'] @@ -235,6 +235,12 @@ class App.ChannelChat extends App.Controller @colorField.val code @updateParams() + toggleChat: => + @chat.toggleClass('is-open') + + changeTitle: (event) -> + @chatWelcome.html $(event.currentTarget).val() + new: (e) => new App.ControllerGenericNew( pageData: @@ -294,6 +300,7 @@ class App.ChannelChat extends App.Controller params.flat = true else @chat.removeClass('zammad-chat--flat') + @chatWelcome.html params.title if @permanent for key, value of @permanent diff --git a/app/assets/javascripts/app/views/channel/chat.jst.eco b/app/assets/javascripts/app/views/channel/chat.jst.eco index 69f18d255..c00e0789e 100644 --- a/app/assets/javascripts/app/views/channel/chat.jst.eco +++ b/app/assets/javascripts/app/views/channel/chat.jst.eco @@ -60,7 +60,7 @@
-
+
@@ -68,18 +68,18 @@
- +
-
-
+
+
<%- @T('Online') %> - +
@@ -90,7 +90,7 @@
- <%- @T('Chat with us!') %> + Chat with us!
@@ -118,7 +118,7 @@
- +
<%- @T('Shown when the chat is closed.') %>
diff --git a/app/assets/stylesheets/zammad.scss b/app/assets/stylesheets/zammad.scss index 19549adc7..898ac4af5 100644 --- a/app/assets/stylesheets/zammad.scss +++ b/app/assets/stylesheets/zammad.scss @@ -7484,7 +7484,7 @@ output { .loading.icon { position: absolute; right: 11px; - top: 11px; + top: 10px; display: none; } } @@ -7508,9 +7508,38 @@ output { position: absolute; transform-origin: right bottom; transition: 500ms; + bottom: -318px; + + .zammad-chat-welcome { + display: block !important; + } + + .zammad-chat-header-icon-open { + display: inline !important; + } + + .zammad-chat-agent-status, + .zammad-chat-header-icon-close, + .zammad-chat-agent { + display: none !important; + } + + &.is-open { + bottom: 0; + + .zammad-chat-agent { + display: block !important; + } + + .zammad-chat-header-icon-close, + .zammad-chat-agent-status { + display: inline-block !important; + } - .zammad-chat-body { - transition: 500ms; + .zammad-chat-welcome, + .zammad-chat-header-icon-open { + display: none !important; + } } &.is-fullscreen { @@ -7533,7 +7562,7 @@ output { width: 100%; height: 100%; animation: slide-up 500ms; - pointer-events: none; + // pointer-events: none; } }