diff --git a/app/assets/javascripts/app/controllers/_channel/chat.coffee b/app/assets/javascripts/app/controllers/_channel/chat.coffee index 73248503e..826b3ed2b 100644 --- a/app/assets/javascripts/app/controllers/_channel/chat.coffee +++ b/app/assets/javascripts/app/controllers/_channel/chat.coffee @@ -1,37 +1,20 @@ -class App.ChannelChat extends App.ControllerTabs - header: 'Chat' - constructor: -> - super - - @title 'Chat', true - - @tabs = [ - { - name: 'Chat Channels', - target: 'channels', - controller: App.ChannelChatOverview - }, - { - name: 'Settings', - target: 'setting', - controller: App.SettingsArea, params: { area: 'Chat::Base' }, - }, - ] - - @render() - -class App.ChannelChatOverview extends App.Controller +class App.ChannelChat extends App.Controller events: - 'click .js-new': 'new' + 'click .js-add': 'new' 'click .js-edit': 'edit' - 'click .js-delete': 'delete' + 'click .js-remove': 'remove' 'click .js-widget': 'widget' + 'change .js-params': 'updateParams' + 'keyup .js-params': 'updateParams' constructor: -> super @interval(@load, 30000) #@load() + @widgetDesignerPermanentParams = + id: 'id' + load: => @startLoading() @ajax( @@ -51,9 +34,16 @@ class App.ChannelChatOverview extends App.Controller for chat_id in data.chat_ids chats.push App.Chat.find(chat_id) - @html App.view('channel/chat_overview')( + @html App.view('channel/chat')( + baseurl: window.location.origin chats: chats ) + @updateParams() + + new App.SettingsArea( + el: @$('.js-settings') + area: 'Chat::Base' + ) new: (e) => new App.ControllerGenericNew( @@ -62,14 +52,14 @@ class App.ChannelChatOverview extends App.Controller object: 'Chat' objects: 'Chats' genericObject: 'Chat' - callback: @load - container: @el.closest('.content') - large: true + callback: @load + container: @el.closest('.content') + large: true ) edit: (e) => e.preventDefault() - id = $(e.target).closest('.action').data('id') + id = $(e.target).closest('tr').data('id') new App.ControllerGenericEdit( id: id genericObject: 'Chat' @@ -79,9 +69,9 @@ class App.ChannelChatOverview extends App.Controller callback: @load ) - delete: (e) => + remove: (e) => e.preventDefault() - id = $(e.target).closest('.action').data('id') + id = $(e.target).closest('tr').data('id') item = App.Chat.find(id) new App.ControllerGenericDestroyConfirm( item: item @@ -97,26 +87,6 @@ class App.ChannelChatOverview extends App.Controller id: id ) -class Widget extends App.ControllerModal - events: - 'change .js-params': 'updateParams' - 'keyup .js-params': 'updateParams' - - constructor: -> - super - @head = 'Widget' - @close = true - @render() - @show() - - render: -> - @content = $( App.view('channel/chat_js_widget')( - baseurl: window.location.origin - )) - - onShown: => - @updateParams() - updateParams: => quote = (value) -> if value.replace diff --git a/app/assets/javascripts/app/views/channel/chat.jst.eco b/app/assets/javascripts/app/views/channel/chat.jst.eco new file mode 100644 index 000000000..581572704 --- /dev/null +++ b/app/assets/javascripts/app/views/channel/chat.jst.eco @@ -0,0 +1,141 @@ +
<%- @T('With form you can add a formular to your web page witch directly generates a Ticket for you.') %>
+ + + +<%- @T('You have no configured chat\'s right now.') %>
+<% else: %> +<%- @T('Name') %> | +<%- @T('Note') %> | +<%- @T('Max Queue') %> | +<%- @T('Delete') %> | +
---|---|---|---|
+ + | + + | + + |
+
+
+<% end %>
+
+ <%- @Icon('trash') %> <%- @T('Remove') %>
+
+ |
+ | + | + |
+
+ <%- @Icon('plus-small') %> <%- @T('Add') %>
+
+
+ |
<%- @T('You need to add the following Java Script code snipped to your web page') %>: + +
+<script src="<%= @baseurl %>/assets/chat/chat.min.js"></script> + +<script> +$(function() { + new ZammadChat({ + + }); +}); +</script>+ + + diff --git a/app/assets/javascripts/app/views/channel/chat_js_widget.jst.eco b/app/assets/javascripts/app/views/channel/chat_js_widget.jst.eco deleted file mode 100644 index b1e7b0a41..000000000 --- a/app/assets/javascripts/app/views/channel/chat_js_widget.jst.eco +++ /dev/null @@ -1,74 +0,0 @@ -
<%- @T('Option') %> | -
---|
- - |
- - |
<%- @T('You need to add the following Java Script code snipped to your web page') %>: - -
-<script src="<%= @baseurl %>/assets/chat/chat.min.js"></script> - -<script> -$(function() { - new ZammadChat({ - - }); -}); -</script>diff --git a/app/assets/javascripts/app/views/channel/chat_overview.jst.eco b/app/assets/javascripts/app/views/channel/chat_overview.jst.eco deleted file mode 100644 index 0d30c8ce5..000000000 --- a/app/assets/javascripts/app/views/channel/chat_overview.jst.eco +++ /dev/null @@ -1,44 +0,0 @@ - -
<%- @T('You have no configured chat\'s right now.') %>
-<% else: %> - <% for chat in @chats: %> -