Applied coffeelint.

This commit is contained in:
Martin Edenhofer 2015-09-21 23:24:19 +02:00
parent e11a4f59f9
commit 85515e61be
9 changed files with 74 additions and 71 deletions

View file

@ -1,4 +1,4 @@
class App.clickCatcher extends Spine.Controller class App.ClickCatcher extends Spine.Controller
# clickCatcher has no template because it's a plain <div> # clickCatcher has no template because it's a plain <div>
className: 'clickCatcher' className: 'clickCatcher'

View file

@ -267,7 +267,7 @@ class LayoutRefCommunicationReply extends App.ControllerContent
duration: duration duration: duration
add_textarea_catcher: -> add_textarea_catcher: ->
@textareaCatcher = new App.clickCatcher @textareaCatcher = new App.ClickCatcher
holder: @articleNewEdit.offsetParent() holder: @articleNewEdit.offsetParent()
callback: @close_textarea callback: @close_textarea
zIndexScale: 4 zIndexScale: 4
@ -353,7 +353,7 @@ class LayoutRefCommunicationReply extends App.ControllerContent
# console.log "working of", file, "from", @uploadQueue # console.log "working of", file, "from", @uploadQueue
@fakeUpload file.name, file.size, @workOfUploadQueue @fakeUpload file.name, file.size, @workOfUploadQueue
humanFileSize: (size) => humanFileSize: (size) ->
i = Math.floor( Math.log(size) / Math.log(1024) ) i = Math.floor( Math.log(size) / Math.log(1024) )
return ( size / Math.pow(1024, i) ).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i] return ( size / Math.pow(1024, i) ).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i]
@ -431,10 +431,10 @@ class ModalForm extends App.ControllerModal
@show() @show()
onHide: => onHide: ->
window.history.back() window.history.back()
onSubmit: (e) => onSubmit: (e) ->
e.preventDefault() e.preventDefault()
params = App.ControllerForm.params( $(e.target).closest('form') ) params = App.ControllerForm.params( $(e.target).closest('form') )
console.log('params', params) console.log('params', params)
@ -452,7 +452,7 @@ class ModalText extends App.ControllerModal
render: -> render: ->
@show( App.view('layout_ref/content')() ) @show( App.view('layout_ref/content')() )
onHide: => onHide: ->
window.history.back() window.history.back()
App.Config.set( 'layout_ref/modal_text', ModalText, 'Routes' ) App.Config.set( 'layout_ref/modal_text', ModalText, 'Routes' )
@ -755,7 +755,7 @@ class LocalModalRef extends App.ControllerContent
App.Config.set( 'layout_ref/local_modal', LocalModalRef, 'Routes' ) App.Config.set( 'layout_ref/local_modal', LocalModalRef, 'Routes' )
class loadingPlaceholderRef extends App.ControllerContent class LoadingPlaceholderRef extends App.ControllerContent
constructor: -> constructor: ->
super super
@ -764,9 +764,9 @@ class loadingPlaceholderRef extends App.ControllerContent
render: -> render: ->
@html App.view('layout_ref/loading_placeholder')() @html App.view('layout_ref/loading_placeholder')()
App.Config.set( 'layout_ref/loading_placeholder', loadingPlaceholderRef, 'Routes' ) App.Config.set( 'layout_ref/loading_placeholder', LoadingPlaceholderRef, 'Routes' )
class insufficientRightsRef extends App.ControllerContent class InsufficientRightsRef extends App.ControllerContent
constructor: -> constructor: ->
super super
@ -775,10 +775,10 @@ class insufficientRightsRef extends App.ControllerContent
render: -> render: ->
@html App.view('layout_ref/insufficient_rights')() @html App.view('layout_ref/insufficient_rights')()
App.Config.set( 'layout_ref/insufficient_rights', insufficientRightsRef, 'Routes' ) App.Config.set( 'layout_ref/insufficient_rights', InsufficientRightsRef, 'Routes' )
class errorRef extends App.ControllerContent class ErrorRef extends App.ControllerContent
constructor: -> constructor: ->
super super
@ -787,10 +787,10 @@ class errorRef extends App.ControllerContent
render: -> render: ->
@html App.view('layout_ref/error')() @html App.view('layout_ref/error')()
App.Config.set( 'layout_ref/error', errorRef, 'Routes' ) App.Config.set( 'layout_ref/error', ErrorRef, 'Routes' )
class highlightRef extends App.ControllerContent class HighlightRef extends App.ControllerContent
elements: elements:
'.article-text': 'articles' '.article-text': 'articles'
'.js-highlight-icon': 'highlightIcon' '.js-highlight-icon': 'highlightIcon'
@ -939,10 +939,10 @@ class highlightRef extends App.ControllerContent
@storeHighlights() @storeHighlights()
App.Config.set( 'layout_ref/highlight', highlightRef, 'Routes' ) App.Config.set( 'layout_ref/highlight', HighlightRef, 'Routes' )
class cluesRef extends App.ControllerContent class CluesRef extends App.ControllerContent
clues: [ clues: [
{ {
@ -1257,10 +1257,10 @@ class cluesRef extends App.ControllerContent
when 'click' then target.trigger('click') when 'click' then target.trigger('click')
when 'hover' then target.toggleClass('is-hovered') when 'hover' then target.toggleClass('is-hovered')
App.Config.set( 'layout_ref/clues', cluesRef, 'Routes' ) App.Config.set( 'layout_ref/clues', CluesRef, 'Routes' )
class adminPlaceholderRef extends App.ControllerContent class AdminPlaceholderRef extends App.ControllerContent
constructor: -> constructor: ->
super super
@ -1269,9 +1269,9 @@ class adminPlaceholderRef extends App.ControllerContent
render: -> render: ->
@html App.view('layout_ref/admin_placeholder')() @html App.view('layout_ref/admin_placeholder')()
App.Config.set( 'layout_ref/admin_placeholder', adminPlaceholderRef, 'Routes' ) App.Config.set( 'layout_ref/admin_placeholder', AdminPlaceholderRef, 'Routes' )
class userListRef extends App.ControllerContent class UserListRef extends App.ControllerContent
constructor: -> constructor: ->
super super
@ -1280,10 +1280,10 @@ class userListRef extends App.ControllerContent
render: -> render: ->
@html App.view('layout_ref/user_list')() @html App.view('layout_ref/user_list')()
App.Config.set( 'layout_ref/user_list', userListRef, 'Routes' ) App.Config.set( 'layout_ref/user_list', UserListRef, 'Routes' )
class slaRef extends App.ControllerContent class SlaRef extends App.ControllerContent
events: events:
'click .js-activateColumn': 'activateColumn' 'click .js-activateColumn': 'activateColumn'
@ -1303,7 +1303,7 @@ class slaRef extends App.ControllerContent
selectTimezone: (e) => selectTimezone: (e) =>
@$('.js-timezone').text e.currentTarget.value @$('.js-timezone').text e.currentTarget.value
toggle: (e) => toggle: (e) ->
entry = $(e.currentTarget).closest('.action') entry = $(e.currentTarget).closest('.action')
isInactive = entry.hasClass('is-inactive') isInactive = entry.hasClass('is-inactive')
entry.toggleClass('is-inactive') entry.toggleClass('is-inactive')
@ -1335,10 +1335,10 @@ class slaRef extends App.ControllerContent
@$('.js-time').timepicker @$('.js-time').timepicker
showMeridian: true # meridian = am/pm showMeridian: true # meridian = am/pm
App.Config.set( 'layout_ref/sla', slaRef, 'Routes' ) App.Config.set( 'layout_ref/sla', SlaRef, 'Routes' )
class schedulersRef extends App.ControllerContent class SchedulersRef extends App.ControllerContent
events: events:
'click .select-value': 'select' 'click .select-value': 'select'
'click [data-type=new]': 'createNew' 'click [data-type=new]': 'createNew'
@ -1351,7 +1351,7 @@ class schedulersRef extends App.ControllerContent
render: -> render: ->
@html App.view('layout_ref/schedulers')() @html App.view('layout_ref/schedulers')()
toggle: (e) => toggle: (e) ->
entry = $(e.currentTarget).closest('.action') entry = $(e.currentTarget).closest('.action')
isInactive = entry.hasClass('is-inactive') isInactive = entry.hasClass('is-inactive')
entry.toggleClass('is-inactive') entry.toggleClass('is-inactive')
@ -1415,7 +1415,7 @@ class schedulersRef extends App.ControllerContent
else else
return "#{ items.slice(0, -1).join(', ') } and #{ items[items.length-1] }" return "#{ items.slice(0, -1).join(', ') } and #{ items[items.length-1] }"
App.Config.set( 'layout_ref/schedulers', schedulersRef, 'Routes' ) App.Config.set( 'layout_ref/schedulers', SchedulersRef, 'Routes' )
class InputsRef extends App.ControllerContent class InputsRef extends App.ControllerContent
@ -1457,7 +1457,7 @@ class InputsRef extends App.ControllerContent
App.Config.set( 'layout_ref/inputs', InputsRef, 'Routes' ) App.Config.set( 'layout_ref/inputs', InputsRef, 'Routes' )
class calendarSubscriptionsRef extends App.ControllerContent class CalendarSubscriptionsRef extends App.ControllerContent
elements: elements:
'input[type=checkbox]': 'options' 'input[type=checkbox]': 'options'
@ -1530,7 +1530,7 @@ class calendarSubscriptionsRef extends App.ControllerContent
return "#{ items.slice(0, -1).join(', ') } and #{ items[items.length-1] }" return "#{ items.slice(0, -1).join(', ') } and #{ items[items.length-1] }"
App.Config.set( 'layout_ref/calendar_subscriptions', calendarSubscriptionsRef, 'Routes' ) App.Config.set( 'layout_ref/calendar_subscriptions', CalendarSubscriptionsRef, 'Routes' )
class ButtonsRef extends App.ControllerContent class ButtonsRef extends App.ControllerContent
@ -1544,7 +1544,7 @@ class ButtonsRef extends App.ControllerContent
App.Config.set( 'layout_ref/buttons', ButtonsRef, 'Routes' ) App.Config.set( 'layout_ref/buttons', ButtonsRef, 'Routes' )
class mergeCustomerRef extends App.ControllerContent class MergeCustomerRef extends App.ControllerContent
mergeTarget: mergeTarget:
firstname: 'Nicole', firstname: 'Nicole',
@ -1591,7 +1591,7 @@ class mergeCustomerRef extends App.ControllerContent
onChange: -> onChange: ->
App.Config.set( 'layout_ref/merge_customer', mergeCustomerRef, 'Routes' ) App.Config.set( 'layout_ref/merge_customer', MergeCustomerRef, 'Routes' )
class PrimaryEmailRef extends App.ControllerContent class PrimaryEmailRef extends App.ControllerContent

View file

@ -54,10 +54,15 @@ class App.TicketZoomArticleNew extends App.Controller
attributes: [] attributes: []
}, },
{ {
name: 'twitter' name: 'twitter status'
icon: 'twitter' icon: 'twitter'
attributes: [] attributes: []
}, },
{
name: 'twitter direct-message'
icon: 'twitter'
attributes: ['to']
},
{ {
name: 'phone' name: 'phone'
icon: 'phone' icon: 'phone'
@ -213,7 +218,7 @@ class App.TicketZoomArticleNew extends App.Controller
data: data:
ticket: ticket ticket: ticket
) )
callback = (ticket) => callback = (ticket) ->
textModule.reload( textModule.reload(
ticket: ticket ticket: ticket
) )
@ -256,7 +261,7 @@ class App.TicketZoomArticleNew extends App.Controller
speed: 300 speed: 300
easing: [ 0.34, 1.61, 0.7, 1 ] easing: [ 0.34, 1.61, 0.7, 1 ]
@pickRecipientsCatcher = new App.clickCatcher @pickRecipientsCatcher = new App.ClickCatcher
holder: @el.offsetParent() holder: @el.offsetParent()
callback: @hide_recipients callback: @hide_recipients
zIndexScale: 6 zIndexScale: 6
@ -304,7 +309,7 @@ class App.TicketZoomArticleNew extends App.Controller
showSelectableArticleType: => showSelectableArticleType: =>
@el.find('.js-articleTypes').removeClass('is-hidden') @el.find('.js-articleTypes').removeClass('is-hidden')
@selectTypeCatcher = new App.clickCatcher @selectTypeCatcher = new App.ClickCatcher
holder: @el.offsetParent() holder: @el.offsetParent()
callback: @hideSelectableArticleType callback: @hideSelectableArticleType
zIndexScale: 6 zIndexScale: 6
@ -325,7 +330,7 @@ class App.TicketZoomArticleNew extends App.Controller
@type = type @type = type
@$('[name="type"]').val(type) @$('[name="type"]').val(type)
@articleNewEdit.attr('data-type', type) @articleNewEdit.attr('data-type', type)
typeIcon.find('use').attr 'xlink:href', '#icon-'+ @type typeIcon.find('use').attr 'xlink:href', "#icon-#{@type}"
# show/hide attributes # show/hide attributes
for articleType in @articleTypes for articleType in @articleTypes
@ -419,7 +424,7 @@ class App.TicketZoomArticleNew extends App.Controller
addTextareaCatcher: => addTextareaCatcher: =>
if @articleNewEdit.is(':visible') if @articleNewEdit.is(':visible')
@textareaCatcher = new App.clickCatcher @textareaCatcher = new App.ClickCatcher
holder: @articleNewEdit.offsetParent() holder: @articleNewEdit.offsetParent()
callback: @closeTextarea callback: @closeTextarea
zIndexScale: 4 zIndexScale: 4
@ -471,7 +476,7 @@ class App.TicketZoomArticleNew extends App.Controller
duration: 100 duration: 100
stagger: 50 stagger: 50
drag: true drag: true
complete: (elements) => $(elements).addClass('is-hidden') complete: (elements) -> $(elements).addClass('is-hidden')
onDragenter: (event) => onDragenter: (event) =>
# on the first event, # on the first event,
@ -508,7 +513,6 @@ class App.TicketZoomArticleNew extends App.Controller
url: App.Config.get('api_path') + '/ticket_attachment_upload' url: App.Config.get('api_path') + '/ticket_attachment_upload'
data: JSON.stringify( { store_id: store_id } ), data: JSON.stringify( { store_id: store_id } ),
processData: false processData: false
success: (data, status, xhr) =>
) )
# remove attachment from dom # remove attachment from dom

View file

@ -9,7 +9,7 @@ class App.TicketZoomOverviewNavigator extends App.Controller
@bind 'ticket_overview_rebuild', (data) => @bind 'ticket_overview_rebuild', (data) =>
execute = => execute = =>
@render() @render()
@delay(execute, 600, 'overview-navigator') @delay(execute, 1600, 'overview-navigator')
@render() @render()

View file

@ -30,7 +30,6 @@ class App.TicketZoomSidebar extends App.Controller
el: el.find('.edit') el: el.find('.edit')
model: App.Ticket model: App.Ticket
screen: 'edit' screen: 'edit'
params: App.Ticket.find(ticket.id)
handlers: [ handlers: [
@ticketFormChanges @ticketFormChanges
] ]
@ -44,7 +43,7 @@ class App.TicketZoomSidebar extends App.Controller
show(ticket) show(ticket)
@bind( @bind(
'ui::ticket::taskReset' 'ui::ticket::taskReset'
(data) => (data) ->
if data.ticket_id is ticket.id if data.ticket_id is ticket.id
show(ticket) show(ticket)
) )
@ -120,7 +119,7 @@ class App.TicketZoomSidebar extends App.Controller
objects: 'Users' objects: 'Users'
container: @el.closest('.content') container: @el.closest('.content')
) )
showCustomer = (el) => showCustomer = (el) ->
new App.WidgetUser( new App.WidgetUser(
el: el el: el
user_id: ticket.customer_id user_id: ticket.customer_id
@ -154,7 +153,7 @@ class App.TicketZoomSidebar extends App.Controller
objects: 'Organizations' objects: 'Organizations'
container: @el.closest('.content') container: @el.closest('.content')
) )
showOrganization = (el) => showOrganization = (el) ->
new App.WidgetOrganization( new App.WidgetOrganization(
el: el el: el
organization_id: ticket.organization_id organization_id: ticket.organization_id

View file

@ -109,25 +109,25 @@ class Widget extends App.ControllerWidgetPermanent
show: => show: =>
@isShown = true @isShown = true
@el.find('#chat_toogle').html('&times;'); @el.find('#chat_toogle').html('&times;')
if @newMessage if @newMessage
@el.find('div.well').addClass('alert-success') @el.find('div.well').addClass('alert-success')
@delay( => @delay( =>
@el.find('div.well').removeClass('alert-success') @el.find('div.well').removeClass('alert-success')
App.Event.trigger( App.Event.trigger(
'ws:send' 'ws:send'
action: 'broadcast' action: 'broadcast'
recipient: recipient:
user_id: [ @Session.get('id') ] user_id: [ @Session.get('id') ]
event: 'chat:message_new' event: 'chat:message_new'
spool: true spool: true
data: data:
show: true show: true
) )
2000 2000
'chat-message-new' 'chat-message-new'
) )
@el.find('#chat_content').show(100) @el.find('#chat_content').show(100)
@el.find('#chat_content').removeClass('hide') @el.find('#chat_content').removeClass('hide')
@ -135,16 +135,16 @@ class Widget extends App.ControllerWidgetPermanent
# hide # hide
@delay( => @delay( =>
@hide() @hide()
60000 60000
'chat-window-hide' 'chat-window-hide'
) )
hide: => hide: =>
@isShown = false @isShown = false
@el.find('#chat_content').hide(100) @el.find('#chat_content').hide(100)
@el.find('#chat_content').addClass('hide') @el.find('#chat_content').addClass('hide')
@el.find('#chat_toogle').html('&diams;'); @el.find('#chat_toogle').html('&diams;')
focusIn: => focusIn: =>
@focus = true @focus = true
@ -158,9 +158,9 @@ class Widget extends App.ControllerWidgetPermanent
# hide # hide
@delay( => @delay( =>
@hide() @hide()
60000 60000
'chat-window-hide' 'chat-window-hide'
) )
render: -> render: ->

View file

@ -112,7 +112,7 @@ class App.OnlineNotificationWidget extends App.Controller
) )
# add clickCatcher # add clickCatcher
@clickCatcher = new App.clickCatcher @clickCatcher = new App.ClickCatcher
holder: @el.offsetParent() holder: @el.offsetParent()
callback: @hidePopover callback: @hidePopover
zIndexScale: 4 zIndexScale: 4
@ -175,7 +175,7 @@ class App.OnlineNotificationWidget extends App.Controller
@updateContent() @updateContent()
@delay( @delay(
=> waitUntilOldPopoverIsRemoved() -> waitUntilOldPopoverIsRemoved()
600 600
'popover' 'popover'
) )

View file

@ -23,7 +23,7 @@ class App.UserOrganizationAutocompletion extends App.Controller
open: => open: =>
@clearDelay('close') @clearDelay('close')
@el.addClass('open') @el.addClass('open')
@catcher = new App.clickCatcher @catcher = new App.ClickCatcher
holder: @el.offsetParent() holder: @el.offsetParent()
callback: @close callback: @close
zIndexScale: 1 zIndexScale: 1
@ -59,7 +59,7 @@ class App.UserOrganizationAutocompletion extends App.Controller
if @callback if @callback
@callback(userId) @callback(userId)
buildOrganizationItem: (organization) => buildOrganizationItem: (organization) ->
App.view('generic/user_search/item_organization')( App.view('generic/user_search/item_organization')(
organization: organization organization: organization
) )
@ -72,12 +72,12 @@ class App.UserOrganizationAutocompletion extends App.Controller
user = App.User.fullLocal(userId) user = App.User.fullLocal(userId)
organizationMemebers.append( @buildUserItem(user) ) organizationMemebers.append( @buildUserItem(user) )
buildUserItem: (user) => buildUserItem: (user) ->
App.view('generic/user_search/item_user')( App.view('generic/user_search/item_user')(
user: user user: user
) )
buildUserNew: => buildUserNew: ->
App.view('generic/user_search/new_user')() App.view('generic/user_search/new_user')()
build: => build: =>

View file

@ -3,7 +3,7 @@ class App.EmailAddress extends App.Model
@extend Spine.Model.Ajax @extend Spine.Model.Ajax
@url: @apiPath + '/email_addresses' @url: @apiPath + '/email_addresses'
@filterChannel: (options, type) => @filterChannel: (options, type) ->
return options if type isnt 'collection' return options if type isnt 'collection'
_.filter( _.filter(
options options