Removed not longer needed files.

This commit is contained in:
Martin Edenhofer 2015-12-07 11:42:13 +01:00
parent af944eea2f
commit 14f1ec7a01
3 changed files with 0 additions and 232 deletions

View file

@ -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' )

View file

@ -1,13 +0,0 @@
<div class="well chat">
<h5><%- @T('Chat') %><a href="#" id="chat_toogle" class="close">&times;</a></h5>
<div id="chat_content" <% if !@isShown: %>class="hide"<% end %>>
<div id="chat_log_container" class="max-size-scroll">
<% for message in @messages: %>
<div><%= message.nick %>: <%- @L( message.message ) %></div>
<% end %>
</div>
<form id="chat_form">
<input name="chat_message" type="text" value="" class="form-control input-small"/>
</form>
</div>
</div>

View file

@ -1,2 +0,0 @@
class Chat::Topic < ApplicationModel
end