From 14f1ec7a0159ba5c19935fb4a966648000308ff9 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 7 Dec 2015 11:42:13 +0100 Subject: [PATCH] Removed not longer needed files. --- .../app/controllers/widget/chat.coffee | 217 ------------------ .../javascripts/app/views/widget/chat.jst.eco | 13 -- app/models/chat/topic.rb | 2 - 3 files changed, 232 deletions(-) delete mode 100644 app/assets/javascripts/app/controllers/widget/chat.coffee delete mode 100644 app/assets/javascripts/app/views/widget/chat.jst.eco delete mode 100644 app/models/chat/topic.rb diff --git a/app/assets/javascripts/app/controllers/widget/chat.coffee b/app/assets/javascripts/app/controllers/widget/chat.coffee deleted file mode 100644 index 544f85dbf..000000000 --- a/app/assets/javascripts/app/controllers/widget/chat.coffee +++ /dev/null @@ -1,217 +0,0 @@ -class Widget extends App.ControllerWidgetPermanent - events: - 'submit #chat_form': 'submitMessage' - 'focusin [name=chat_message]': 'focusIn' - 'focusout [name=chat_message]': 'focusOut' - 'click .close': 'toggle' - - constructor: -> - super - - @messageLog = [] - - # rebuild chat widget - @bind 'auth', (user) => - if !user - @messageLog = [] - @el.html('') - else - if !@access() - @messageLog = [] - @el.html('') - return - @start() - - if @access() - @start() - - access: -> - return false if !@Session.get() - return true if @isRole('Agent') - return true if @isRole('Admin') - return false - - start: => - @focus = false - @isShown = false - @newMessage = false - - @render() - @hide() - - @bind( - 'chat:message' - (e) => - - # show new message info - @newMessage = true - - # remember messages - @messageLog.push e - - # chump max message count - max = 10 - length = @messageLog.length - if length > 10 - @messageLog = @messageLog.slice( length - max, length ) - @render() - - if !e.spool - @notifyDesktop( - msg: 'Chat' - body: "#{e.nick}: #{e.message}" - ) - ) - - @bind( - 'chat:window_toggle' - (e) => - if e.show - @show() - else - @hide() - ) - - @bind( - 'chat:message_new' - (e) => - - # show new message info - @newMessage = false - @el.find('div.well').removeClass('alert-success') - ) - - toggle: (e) => - e.preventDefault() - if !@el.find('#chat_content').is(':visible') - @show() - App.Event.trigger( - 'ws:send' - action: 'broadcast' - event: 'chat:window_toggle' - recipient: - user_id: [ @Session.get('id') ] - data: - show: true - ) - else - @hide() - App.Event.trigger( - 'ws:send' - action: 'broadcast' - event: 'chat:window_toggle' - recipient: - user_id: [ @Session.get('id') ] - data: - show: false - ) - @newMessage = false - - show: => - @isShown = true - @el.find('#chat_toogle').html('×') - if @newMessage - @el.find('div.well').addClass('alert-success') - @delay( => - @el.find('div.well').removeClass('alert-success') - - App.Event.trigger( - 'ws:send' - action: 'broadcast' - recipient: - user_id: [ @Session.get('id') ] - event: 'chat:message_new' - spool: true - data: - show: true - ) - - 2000 - 'chat-message-new' - ) - @el.find('#chat_content').show(100) - @el.find('#chat_content').removeClass('hide') - @newMessage = false - - # hide - @delay( => - @hide() - 60000 - 'chat-window-hide' - ) - - hide: => - @isShown = false - @el.find('#chat_content').hide(100) - @el.find('#chat_content').addClass('hide') - @el.find('#chat_toogle').html('♦') - - focusIn: => - @focus = true - @clearDelay 'chat-message-focusout' - @clearDelay 'chat-window-hide' - - focusOut: => - a = => - @focus = false - @delay a, 200, 'chat-message-focusout' - - # hide - @delay( => - @hide() - 60000 - 'chat-window-hide' - ) - - render: -> - - for message in @messageLog - if message.nick is @Session.get('login') - message.nick = 'me' - - # insert data - shown = false - if @isShown - shown = true - @html App.view('widget/chat')( - messages: @messageLog - isShown: shown - ) - - if document.getElementById('chat_log_container') - document.getElementById('chat_log_container').scrollTop = 10000 - - # focus in input box - if @focus - @el.find('[name=chat_message]').focus() - - # show or not show window - if @isShown - @show() - else - @hide() - if @newMessage - @el.find('div.well').addClass('alert-success') - - submitMessage: (e) -> - e.preventDefault() - message = $(e.target).find('[name=chat_message]').val() - if message - msg = - message: message - user_id: @Session.get( 'id' ) - nick: @Session.get( 'login' ) - @messageLog.push msg - - $(e.target).find('[name=chat_message]').val('') - - App.Event.trigger( - 'ws:send' - action: 'broadcast' - event: 'chat:message' - spool: true - data: msg - ) - @render() - -App.Config.set( 'chat', Widget, 'Widgets' ) diff --git a/app/assets/javascripts/app/views/widget/chat.jst.eco b/app/assets/javascripts/app/views/widget/chat.jst.eco deleted file mode 100644 index 47aa1af76..000000000 --- a/app/assets/javascripts/app/views/widget/chat.jst.eco +++ /dev/null @@ -1,13 +0,0 @@ -
-
<%- @T('Chat') %>×
-
class="hide"<% end %>> -
- <% for message in @messages: %> -
<%= message.nick %>: <%- @L( message.message ) %>
- <% end %> -
-
- -
-
-
diff --git a/app/models/chat/topic.rb b/app/models/chat/topic.rb deleted file mode 100644 index 413576f67..000000000 --- a/app/models/chat/topic.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Chat::Topic < ApplicationModel -end