From 0a291f9e4c393112139e8b4d2b8c95b0c3bdbd6a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 16 Nov 2015 13:47:19 +0100 Subject: [PATCH] Rough reworked. --- .../app/controllers/_channel/chat.coffee | 74 +++------ .../app/views/channel/chat.jst.eco | 141 ++++++++++++++++++ .../app/views/channel/chat_js_widget.jst.eco | 74 --------- .../app/views/channel/chat_overview.jst.eco | 44 ------ .../app/views/channel/form.jst.eco | 4 +- 5 files changed, 166 insertions(+), 171 deletions(-) create mode 100644 app/assets/javascripts/app/views/channel/chat.jst.eco delete mode 100644 app/assets/javascripts/app/views/channel/chat_js_widget.jst.eco delete mode 100644 app/assets/javascripts/app/views/channel/chat_overview.jst.eco 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('Topics') %>

+ +<% if _.isEmpty(@chats): %> +

<%- @T('You have no configured chat\'s right now.') %>

+<% else: %> + + + + + + + + + + +<% for chat in @chats: %> + + + +
<%- @T('Name') %><%- @T('Note') %><%- @T('Max Queue') %><%- @T('Delete') %>
+ + + + + + +
+
+ <%- @Icon('trash') %> <%- @T('Remove') %> +
+
+<% end %> +
+ + + +
+ <%- @Icon('plus-small') %> <%- @T('Add') %> +
+ +
+<% end %> +
+ +

<%- @T('Widget Designer') %>

+ +
+ +
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ +
+ + + + + + + + + + + +
<%- @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_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('Channels') %>

- -<% if _.isEmpty(@chats): %> -

<%- @T('You have no configured chat\'s right now.') %>

-<% else: %> - <% for chat in @chats: %> -
- -
-
-

<%= chat.name %>

-
- -
-
<%- @T('Note') %>
- <%= chat.note %> -
- -
-
<%- @T('At a glance') %>
- <%- @T('Sessions last 24 h') %><%= chat.last_24_h %>
- <%- @T('Sessions last week') %><%= chat.last_week %>
- <%- @T('Sessions last month') %><%= chat.last_month %>
-
- -
-
<%- @T('Public') %>
- <%= chat.public %> -
- -
- -
-
<%- @T('Delete') %>
-
<%- @T('Edit') %>
- <% if chat.public: %>
<%- @T('Design Widget') %>
<% end %> -
- -
- <% end %> -<% end %> - -<%- @T('New') %> diff --git a/app/assets/javascripts/app/views/channel/form.jst.eco b/app/assets/javascripts/app/views/channel/form.jst.eco index 4658a648e..f1ebeca6f 100644 --- a/app/assets/javascripts/app/views/channel/form.jst.eco +++ b/app/assets/javascripts/app/views/channel/form.jst.eco @@ -8,7 +8,9 @@
-

<%- @T('Settings') %>

+
+ +

<%- @T('Widget Designer') %>