Applied coffeelint.

This commit is contained in:
Martin Edenhofer 2015-09-21 19:47:48 +02:00
parent e94a03ca43
commit e90ac1e336
36 changed files with 111 additions and 113 deletions

View file

@ -761,9 +761,9 @@ class App.ChannelEmailAccountWizard extends App.Wizard
@el.modal('hide')
else
if data.source is 'inbound' || data.source is 'outbound'
@showSlide("js-#{data.source}")
@showAlert("js-#{data.source}", data.message_human || data.message )
@showInvalidField("js-#{data.source}", data.invalid_field)
@showSlide("js-#{data.source}")
@showAlert("js-#{data.source}", data.message_human || data.message )
@showInvalidField("js-#{data.source}", data.invalid_field)
else
if count is 2
@showAlert('js-verify', data.message_human || data.message )

View file

@ -205,7 +205,7 @@ class App.FirstStepsClues extends App.Controller
if target.right + modal.width <= maxWidth
left = target.right
position = 'right'
else
else
# place left
left = target.left - modal.width
position = 'left'

View file

@ -59,7 +59,6 @@ class Index extends App.Controller
url: @apiPath + '/users/avatar'
data: JSON.stringify( params )
processData: true
success: (data, status, xhr) =>
)
pick: (avatar) =>
@ -136,7 +135,7 @@ class Index extends App.Controller
EXIF.getData event.target.files[0], ->
orientation = this.exifdata.Orientation
reader = new FileReader()
reader.onload = (e) =>
reader.onload = (e) ->
new ImageCropper
imageSource: e.target.result
callback: callback

View file

@ -126,7 +126,7 @@ class App.SettingsAreaItem extends App.Controller
if @setting.preferences.session_check
App.Auth.loginCheck()
fail: =>
fail: ->
ui.formEnable(e)
App.Event.trigger 'notify', {
type: 'error'

View file

@ -40,11 +40,11 @@ class App.UiElement.autocompletion
###
source = attribute.source
if typeof(source) is 'string'
source = source.replace('#{@apiPath}', App.Config.get('api_path') );
source = source.replace('#{@apiPath}', App.Config.get('api_path') )
$(local_attribute_full).autocomplete(
source: source,
minLength: attribute.minLengt || 3,
select: ( event, ui ) =>
select: ( event, ui ) ->
b(event, ui.item)
)
App.Delay.set( a, 280, undefined, 'form_autocompletion' )

View file

@ -117,7 +117,7 @@ class App.UiElement.postmaster_match
item.find('.js-attributeSelector').prepend(selector)
# add filter
item.find('.js-add').bind('click', (e) =>
item.find('.js-add').bind('click', (e) ->
element = $(e.target).closest('.js-filterElement')
elementClone = element.clone(true)
element.after(elementClone)

View file

@ -69,7 +69,7 @@ class App.UiElement.postmaster_set
item.find('.js-attributeSelector').prepend(selector)
# add filter
item.find('.js-add').bind('click', (e) =>
item.find('.js-add').bind('click', (e) ->
element = $(e.target).closest('.js-filterElement')
elementClone = element.clone(true)
element.after(elementClone)

View file

@ -32,7 +32,6 @@ class App.UiElement.richtext
url: App.Config.get('api_path') + '/ticket_attachment_upload'
data: JSON.stringify( { store_id: store_id } ),
processData: false
success: (data, status, xhr) =>
)
# remove attachment from dom

View file

@ -21,7 +21,7 @@ class App.UiElement.sla_times
)
# disable/enable rows
item.find('.js-activateRow').bind('change', (e) =>
item.find('.js-activateRow').bind('change', (e) ->
element = $(e.target)
row = element.closest('tr')
if element.prop('checked')

View file

@ -1,7 +1,7 @@
class App.UiElement.tag
@render: (attribute) ->
item = $( App.view('generic/input')( attribute: attribute ) )
a = =>
a = ->
$('#' + attribute.id ).tokenfield()
$('#' + attribute.id ).parent().css('height', 'auto')
App.Delay.set( a, 120, undefined, 'tags' )

View file

@ -3,7 +3,7 @@ class App.UiElement.textarea
fileUploaderId = 'file-uploader-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 )
item = $( App.view('generic/textarea')( attribute: attribute ) + '<div class="file-uploader ' + attribute.class + '" id="' + fileUploaderId + '"></div>' )
a = =>
a = ->
visible = $( item[0] ).is(":visible")
if visible && !$( item[0] ).expanding('active')
$( item[0] ).expanding()

View file

@ -30,7 +30,7 @@ class App.UiElement.ticket_perform_action
item.find('.js-attributeSelector').prepend(selector)
# add filter
item.find('.js-add').bind('click', (e) =>
item.find('.js-add').bind('click', (e) ->
element = $(e.target).closest('.js-filterElement')
elementClone = element.clone(true)
element.after(elementClone)

View file

@ -130,14 +130,14 @@ class App.UiElement.ticket_selector
item.find('.js-filterElement').first().remove()
# bind for preview
item.on('change', 'select.form-control', (e) =>
item.on('change', 'select.form-control', (e) ->
App.Delay.set(
search,
600,
'preview',
)
)
item.on('change keyup', 'input.form-control', (e) =>
item.on('change keyup', 'input.form-control', (e) ->
App.Delay.set(
search,
600,
@ -162,7 +162,7 @@ class App.UiElement.ticket_selector
@ticketTable(data.ticket_ids, data.ticket_count, item)
)
@ticketTable: (ticket_ids, ticket_count, item) =>
@ticketTable: (ticket_ids, ticket_count, item) ->
item.find('.js-previewCounter').html(ticket_count)
new App.TicketList(
el: item.find('.js-previewTable')

View file

@ -117,7 +117,7 @@ class App.TicketCreate extends App.Controller
return false if !diff || _.isEmpty( diff )
return true
release: =>
release: ->
# nothing
autosave: =>
@ -522,7 +522,7 @@ class Sidebar extends App.Controller
objects: 'Organizations'
container: @el.closest('.content')
)
showOrganization = (el) =>
showOrganization = (el) ->
new App.WidgetOrganization(
el: el
organization_id: user.organization_id
@ -542,7 +542,7 @@ class Sidebar extends App.Controller
callback: showOrganization
}
showTemplates = (el) =>
showTemplates = (el) ->
# show template UI
new App.WidgetTemplate(

View file

@ -46,7 +46,7 @@ class App.Dashboard extends App.Controller
isActive: =>
@activeState
url: =>
url: ->
'#dashboard'
show: (params) =>
@ -57,13 +57,13 @@ class App.Dashboard extends App.Controller
# highlight navbar
@navupdate '#dashboard'
hide: =>
hide: ->
# no
changed: =>
changed: ->
false
release: =>
release: ->
# no
toggle: (e) =>

View file

@ -219,7 +219,7 @@ class Admin extends App.ControllerContent
username: @params.email
password: @params.password
success: @relogin
error: =>
error: ->
App.Event.trigger 'notify', {
type: 'error'
msg: App.i18n.translateContent( 'Signin failed! Please contact the support team!' )
@ -874,9 +874,9 @@ class ChannelEmail extends App.Wizard
@navigate 'getting_started/agents'
else
if data.source is 'inbound' || data.source is 'outbound'
@showSlide("js-#{data.source}")
@showAlert("js-#{data.source}", data.message_human || data.message )
@showInvalidField("js-#{data.source}", data.invalid_field)
@showSlide("js-#{data.source}")
@showAlert("js-#{data.source}", data.message_human || data.message )
@showInvalidField("js-#{data.source}", data.invalid_field)
else
if count is 2
@showAlert('js-verify', data.message_human || data.message )

View file

@ -45,14 +45,14 @@ class App.Navigation extends App.ControllerWidgetPermanent
# get open tabs to repopen on rerender
open_tab = {}
@$('.open').children('a').each( (i,d) =>
@$('.open').children('a').each( (i,d) ->
href = $(d).attr('href')
open_tab[href] = true
)
# get active tabs to reactivate on rerender
active_tab = {}
@$('.active').children('a').each( (i,d) =>
@$('.active').children('a').each( (i,d) ->
href = $(d).attr('href')
active_tab[href] = true
)
@ -68,14 +68,14 @@ class App.Navigation extends App.ControllerWidgetPermanent
# get open tabs to repopen on rerender
open_tab = {}
@$('.open').children('a').each( (i,d) =>
@$('.open').children('a').each( (i,d) ->
href = $(d).attr('href')
open_tab[href] = true
)
# get active tabs to reactivate on rerender
active_tab = {}
@$('.active').children('a').each( (i,d) =>
@$('.active').children('a').each( (i,d) ->
href = $(d).attr('href')
active_tab[href] = true
)
@ -176,7 +176,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
@renderResult(result)
@$('#global-search-result').on('click', 'a', =>
@$('#global-search-result').on('click', 'a', ->
close()
)
)
@ -222,7 +222,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
)
# prevent submit of search box
@$('form.search').on( 'submit', (e) =>
@$('form.search').on( 'submit', (e) ->
e.preventDefault()
)
@ -246,7 +246,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
# bind to empty search
@$('.empty-search').on(
'click'
=>
->
emptyAndClose()
)
@ -347,10 +347,10 @@ class App.Navigation extends App.ControllerWidgetPermanent
return(a-b)
addPrioCount: (newlist, item) ->
if newlist[ item['prio'] ]
item['prio']++
if newlist[ item['prio'] ]
@addPrioCount newlist, item
if newlist[ item['prio'] ]
item['prio']++
if newlist[ item['prio'] ]
@addPrioCount newlist, item
update: (url) =>
@$('li').removeClass('active')

View file

@ -36,7 +36,7 @@ class App.OrganizationProfile extends App.Controller
App.OnlineNotification.seen( 'Organization', @organization_id )
@navupdate '#'
changed: =>
changed: ->
false
render: (organization) =>
@ -107,7 +107,7 @@ class Object extends App.Controller
})
# start action controller
showHistory = =>
showHistory = ->
new App.OrganizationHistory( organization_id: organization.id )
editOrganization = =>
new App.ControllerGenericEdit(

View file

@ -60,10 +60,10 @@ class App.TicketOverview extends App.Controller
if @navBarController
@navBarController.active(false)
changed: =>
changed: ->
false
release: =>
release: ->
# no
overview: (overview_id) =>
@ -243,18 +243,18 @@ class Table extends App.Controller
show: true
)
@navigate ticket.uiUrl()
callbackTicketTitleAdd = (value, object, attribute, attributes, refObject) =>
callbackTicketTitleAdd = (value, object, attribute, attributes, refObject) ->
attribute.title = object.title
value
callbackLinkToTicket = (value, object, attribute, attributes, refObject) =>
callbackLinkToTicket = (value, object, attribute, attributes, refObject) ->
attribute.link = object.uiUrl()
value
callbackUserPopover = (value, object, attribute, attributes, refObject) =>
callbackUserPopover = (value, object, attribute, attributes, refObject) ->
attribute.class = 'user-popover'
attribute.data =
id: refObject.id
value
callbackOrganizationPopover = (value, object, attribute, attributes, refObject) =>
callbackOrganizationPopover = (value, object, attribute, attributes, refObject) ->
attribute.class = 'organization-popover'
attribute.data =
id: refObject.id
@ -324,7 +324,7 @@ class Table extends App.Controller
# start bulk action observ
@el.find('.bulkAction').append( @bulk_form() )
if @el.find('.table-overview').find('input[name="bulk"]:checked').length isnt 0
@el.find('.bulkAction').removeClass('hide')
@el.find('.bulkAction').removeClass('hide')
# show/hide bulk action
@el.find('.table-overview').delegate('input[name="bulk"], input[name="bulk_all"]', 'click', (e) =>
@ -342,7 +342,7 @@ class Table extends App.Controller
)
# deselect bulk_all if one item is uncheck observ
@el.find('.table-overview').delegate('[name="bulk"]', 'click', (e) =>
@el.find('.table-overview').delegate('[name="bulk"]', 'click', (e) ->
if !$(e.target).attr('checked')
$(e.target).parents().find('[name="bulk_all"]').attr('checked', false)
)
@ -370,7 +370,7 @@ class Table extends App.Controller
@fetch()
#@render()
articleTypeFilter = (items) =>
articleTypeFilter = (items) ->
for item in items
if item.name is 'note'
return [item]
@ -436,7 +436,7 @@ class Table extends App.Controller
@ticketIDs
bulkSetSelected: (ticketIDs) ->
@el.find('.table-overview').find('[name="bulk"]').each( (index, element) =>
@el.find('.table-overview').find('[name="bulk"]').each( (index, element) ->
ticket_id = $(element).val()
for ticket_id_selected in ticketIDs
if ticket_id_selected is ticket_id

View file

@ -378,7 +378,7 @@ class App.TicketZoom extends App.Controller
autosaveStop: =>
@autosaveLast = {}
@clearInterval( 'autosave' )
@clearInterval('autosave')
autosaveStart: =>
if !@autosaveLast
@ -410,15 +410,15 @@ class App.TicketZoom extends App.Controller
#console.log('modelDiff', modelDiff)
# get diff of last save
changedBetweenLastSave = _.isEqual(currentParams, @autosaveLast )
changedBetweenLastSave = _.isEqual(currentParams, @autosaveLast)
if !changedBetweenLastSave
#console.log('model DIFF ', modelDiff)
@autosaveLast = clone(currentParams)
@markFormDiff( modelDiff )
@markFormDiff(modelDiff)
@taskUpdateAll( modelDiff )
@interval( update, 2400, 'autosave' )
@taskUpdateAll(modelDiff)
@interval(update, 2400, 'autosave')
markFormDiff: (diff = {}) =>
ticketForm = @$('.edit')
@ -593,7 +593,7 @@ class App.TicketZoom extends App.Controller
@fetch( ticket.id, true )
)
bookmark: (e) =>
bookmark: (e) ->
$(e.currentTarget).find('.bookmark.icon').toggleClass('filled')
reset: (e) =>

View file

@ -74,9 +74,9 @@ class App.TicketZoomArticleActions extends App.Controller
recipients = []
if article.sender.name is 'Agent'
if article.to
localRecipients = emailAddresses.parseAddressList(article.to)
if localRecipients
recipients = recipients.concat localRecipients
localRecipients = emailAddresses.parseAddressList(article.to)
if localRecipients
recipients = recipients.concat localRecipients
else
if article.from
localRecipients = emailAddresses.parseAddressList(article.from)

View file

@ -270,7 +270,7 @@ class ArticleViewItem extends App.Controller
height: bubbleContent.attr('data-height')
options:
duration: 300
complete: -> bubbleOvervlowContainer.addClass('hide');
complete: -> bubbleOvervlowContainer.addClass('hide')
isOrContains: (node, container) ->
while node

View file

@ -106,9 +106,9 @@ class Index extends App.ControllerContent
)
hide = =>
@hideAction()
App.Event.trigger('i18n:translation_todo_reload')
App.Event.trigger('i18n:translation_list_reload')
@hideAction()
@loader.hide(1)
locales = App.Locale.all()
@ -201,7 +201,7 @@ class TranslationToDo extends App.Controller
url: @apiPath + '/translations'
data: JSON.stringify(params)
processData: false
success: (data, status, xhr) =>
success: (data, status, xhr) ->
App.Event.trigger('i18n:translation_list_reload')
)
@ -235,7 +235,7 @@ class TranslationToDo extends App.Controller
url: @apiPath + '/translations'
data: JSON.stringify(params)
processData: false
success: (data, status, xhr) =>
success: (data, status, xhr) ->
App.Event.trigger('i18n:translation_list_reload')
)
@ -389,4 +389,4 @@ class TranslationList extends App.Controller
reset.hide()
reset.closest('tr').removeClass('warning')
App.Config.set( 'Translation', { prio: 1800, parent: '#system', name: 'Translations', target: '#system/translation', controller: Index, role: ['Admin'] }, 'NavBarAdmin' )
App.Config.set( 'Translation', { prio: 1800, parent: '#system', name: 'Translations', target: '#system/translation', controller: Index, role: ['Admin'] }, 'NavBarAdmin' )

View file

@ -38,7 +38,7 @@ class App.UserProfile extends App.Controller
App.OnlineNotification.seen( 'User', @user_id )
@navupdate '#'
changed: =>
changed: ->
false
render: (user) =>
@ -110,7 +110,7 @@ class Object extends App.Controller
})
# start action controller
showHistory = =>
showHistory = ->
new App.UserHistory( user_id: user.id )
editUser = =>

View file

@ -12,7 +12,7 @@ class App.Notify extends App.ControllerWidgetPermanent
@log 'notify:removeall', @
@destroyAll()
@bind 'notifyDesktop', (data) =>
@bind 'notifyDesktop', (data) ->
if !data['icon']
data['icon'] = 'unknown'
notify.createNotification( data.msg, data )

View file

@ -6,15 +6,15 @@ class App.TicketList extends App.Controller
render: =>
callbackTicketTitleAdd = (value, object, attribute, attributes, refObject) =>
callbackTicketTitleAdd = (value, object, attribute, attributes, refObject) ->
attribute.title = object.title
value
callbackUserPopover = (value, object, attribute, attributes, refObject) =>
callbackUserPopover = (value, object, attribute, attributes, refObject) ->
attribute.class = 'user-popover'
attribute.data =
id: refObject.id
value
callbackOrganizationPopover = (value, object, attribute, attributes, refObject) =>
callbackOrganizationPopover = (value, object, attribute, attributes, refObject) ->
attribute.class = 'organization-popover'
attribute.data =
id: refObject.id

View file

@ -95,7 +95,7 @@ class _Singleton
if !@moduleColorsMap[module]
@moduleColorsMap[module]= @yieldColor()
color = @moduleColorsMap[module]
colorString = "color: hsl(" + (color) + ",99%,40%); font-weight: bold";
colorString = "color: hsl(" + (color) + ",99%,40%); font-weight: bold"
logArgs = [prefix, colorString].concat(args)
else
logArgs = [prefix].concat(args)

View file

@ -6,7 +6,7 @@ class App.Audio
canPlay = audio.canPlayType('audio/mp3')
return if canPlay isnt 'maybe' and canPlay isnt 'probably'
$(audio).prop( 'src', url )
audio.load();
audio.preload = "auto";
audio.volume = volume;
audio.load()
audio.preload = 'auto'
audio.volume = volume
audio.play()

View file

@ -88,7 +88,7 @@ class App.Auth
App.Event.trigger( 'auth:logout' )
App.Event.trigger( 'ui:rerender' )
return false;
return false
# clear local store
if type isnt 'check'

View file

@ -62,7 +62,7 @@ class _Singleton
# get cross browser selected string
_getSelected: ->
text = '';
text = ''
if window.getSelection
text = window.getSelection()
else if document.getSelection

View file

@ -61,10 +61,10 @@ class _collectionSingleton extends Spine.Module
@load( data )
resetCollections: (data) ->
# load assets
for type, collection of data
@log 'debug', 'resetCollection:trigger', type, collection
@reset( localStorage: data.localStorage, type: type, data: collection )
# load assets
for type, collection of data
@log 'debug', 'resetCollection:trigger', type, collection
@reset( localStorage: data.localStorage, type: type, data: collection )
reset: (params) ->

View file

@ -12,11 +12,11 @@ class App.ImageService
else
@resize( dataURL, x, y, 2, 'image/png', 0.7, callback )
@resize: ( dataURL, x = 'auto', y = 'auto', sizeFactor = 1, type, quallity, callback) =>
@resize: ( dataURL, x = 'auto', y = 'auto', sizeFactor = 1, type, quallity, callback) ->
# load image from data url
imageObject = new Image()
imageObject.onload = =>
imageObject.onload = ->
imageWidth = imageObject.width
imageHeight = imageObject.height
if y is 'auto' && x is 'auto'

View file

@ -1,7 +1,7 @@
class App.PrettyDate
# human readable time
@humanTime: ( time, escalation, long = true ) =>
@humanTime: ( time, escalation, long = true ) ->
return '' if !time
current = new Date()
created = new Date(time)

View file

@ -84,7 +84,7 @@ class App.Utils
ascii = @textCleanup(ascii)
ascii = @wrap(ascii, max)
$.trim( ascii )
.replace /^(.*)$/mg, (match) =>
.replace /^(.*)$/mg, (match) ->
if match
'> ' + match
else
@ -538,7 +538,7 @@ class App.Utils
false
# human readable file size
@humanFileSize: (size) =>
@humanFileSize: (size) ->
if size > ( 1024 * 1024 )
size = Math.round( size / ( 1024 * 1024 ) ) + ' MB'
else if size > 1024

View file

@ -276,31 +276,31 @@ class _webSocketSingleton extends App.Controller
_receiveMessage: (data = []) =>
# go through all blocks
for item in data
# go through all blocks
for item in data
# set timestamp to get spool messages later
if item['spool']
@lastSpoolMessage = Math.round( +new Date()/1000 )
# set timestamp to get spool messages later
if item['spool']
@lastSpoolMessage = Math.round( +new Date()/1000 )
# reset reconnect loop
if item['action'] is 'pong'
@pong()
# reset reconnect loop
if item['action'] is 'pong'
@pong()
# fill collection
if item['collection']
@log 'debug', "onmessage collection:" + item['collection']
App.Store.write( item['collection'], item['data'] )
# fill collection
if item['collection']
@log 'debug', "onmessage collection:" + item['collection']
App.Store.write( item['collection'], item['data'] )
# fire event
if item['event']
if typeof item['event'] is 'object'
for event in item['event']
@log 'debug', "onmessage event:" + event
App.Event.trigger( event, item['data'] )
else
@log 'debug', "onmessage event:" + item['event']
App.Event.trigger( item['event'], item['data'] )
# fire event
if item['event']
if typeof item['event'] is 'object'
for event in item['event']
@log 'debug', "onmessage event:" + event
App.Event.trigger( event, item['data'] )
else
@log 'debug', "onmessage event:" + item['event']
App.Event.trigger( item['event'], item['data'] )
_ajaxInit: (data = {}) =>

View file

@ -30,7 +30,7 @@ class App.Model extends Spine.Model
name = @firstname
if @lastname
if name
name = name + ' '
name = name + ' '
name = name + @lastname
return name
if @email
@ -47,7 +47,7 @@ class App.Model extends Spine.Model
name = @firstname
if @lastname
if name
name = name + ' '
name = name + ' '
name = name + @lastname
if @organization
if typeof @organization is 'object'
@ -290,7 +290,7 @@ class App.Model extends Spine.Model
if _.isEmpty @FULL_CALLBACK[ data.id ]
delete @FULL_CALLBACK[ data.id ]
error: (xhr, statusText, error) =>
error: (xhr, statusText, error) ->
console.log(statusText, error)
)
subscribeId
@ -518,7 +518,7 @@ class App.Model extends Spine.Model
# execute callbacks
callback(data.stream)
error: (xhr, statusText, error) =>
error: (xhr, statusText, error) ->
console.log(statusText, error)
)