Applied coffeelint.

This commit is contained in:
Martin Edenhofer 2015-09-21 19:04:18 +02:00
parent 03965aa2b6
commit b8fa696857
5 changed files with 38 additions and 44 deletions

View file

@ -79,7 +79,7 @@ class App.Controller extends Spine.Controller
@userPopupsDestroy() @userPopupsDestroy()
@organizationPopupsDestroy() @organizationPopupsDestroy()
release: => release: ->
# release custom bindings after it got removed from dom # release custom bindings after it got removed from dom
# add @title methode to set title # add @title methode to set title
@ -174,14 +174,14 @@ class App.Controller extends Spine.Controller
# #
# human readable file size # human readable file size
humanFileSize: (size) => humanFileSize: (size) ->
App.Utils.humanFileSize(size) App.Utils.humanFileSize(size)
# human readable time # human readable time
humanTime: ( time, escalation, long = true ) => humanTime: ( time, escalation, long = true ) ->
App.PrettyDate.humanTime( time, escalation, long ) App.PrettyDate.humanTime( time, escalation, long )
userInfo: (data) => userInfo: (data) ->
el = data.el || $('[data-id="customer_info"]') el = data.el || $('[data-id="customer_info"]')
el.unbind() el.unbind()
@ -242,7 +242,7 @@ class App.Controller extends Spine.Controller
if id if id
ticket = App.Ticket.find(id) ticket = App.Ticket.find(id)
@navigate ticket.uiUrl() @navigate ticket.uiUrl()
); )
@ticketPopupsDestroy() @ticketPopupsDestroy()
@ -287,7 +287,7 @@ class App.Controller extends Spine.Controller
if id if id
user = App.User.find(id) user = App.User.find(id)
@navigate user.uiUrl() @navigate user.uiUrl()
); )
@userPopupsDestroy() @userPopupsDestroy()
@ -345,7 +345,7 @@ class App.Controller extends Spine.Controller
if id if id
organization = App.Organization.find(id) organization = App.Organization.find(id)
@navigate organization.uiUrl() @navigate organization.uiUrl()
); )
@organizationPopupsDestroy() @organizationPopupsDestroy()
@ -441,7 +441,7 @@ class App.Controller extends Spine.Controller
customer_id: params.user_id, customer_id: params.user_id,
} }
processData: true, processData: true,
success: (data, status, xhr) => success: (data, status, xhr) ->
App.Store.write( "user-ticket-popover::#{params.user_id}", data ) App.Store.write( "user-ticket-popover::#{params.user_id}", data )
# load assets # load assets
@ -455,7 +455,7 @@ class App.Controller extends Spine.Controller
if data if data
show( params, { open: data.ticket_ids_open, closed: data.ticket_ids_closed } ) show( params, { open: data.ticket_ids_open, closed: data.ticket_ids_closed } )
@delay( @delay(
=> ->
fetch(params) fetch(params)
1000 1000
'fetch' 'fetch'
@ -530,14 +530,14 @@ class App.Controller extends Spine.Controller
class App.ControllerPermanent extends App.Controller class App.ControllerPermanent extends App.Controller
constructor: -> constructor: ->
super super
$('.content').addClass('hide'); $('.content').addClass('hide')
@navShow() @navShow()
class App.ControllerContent extends App.Controller class App.ControllerContent extends App.Controller
constructor: -> constructor: ->
super super
$('.content').addClass('hide'); $('.content').addClass('hide')
$('#content').removeClass('hide'); $('#content').removeClass('hide')
@navShow() @navShow()
class App.ControllerModal extends App.Controller class App.ControllerModal extends App.Controller
@ -611,7 +611,7 @@ class App.ControllerModal extends App.Controller
e.preventDefault() e.preventDefault()
@el.modal('hide') @el.modal('hide')
onShown: => onShown: ->
console.log('modal shown: do nothing') console.log('modal shown: do nothing')
# do nothing # do nothing
@ -685,7 +685,7 @@ class App.UpdateTastbar extends App.Controller
release: => release: =>
App[ @genericObject.constructor.className ].unsubscribe(@subscribeId) App[ @genericObject.constructor.className ].unsubscribe(@subscribeId)
update: (genericObject) => update: (genericObject) ->
# update taskbar with new meta data # update taskbar with new meta data
App.Event.trigger 'task:render' App.Event.trigger 'task:render'

View file

@ -81,7 +81,7 @@ class App.ControllerForm extends App.Controller
# rename display and name to _confirm # rename display and name to _confirm
if !attribute.single if !attribute.single
attribute.display = attribute.display + ' (confirm)' attribute.display = attribute.display + ' (confirm)'
attribute.name = attribute.name + '_confirm'; attribute.name = attribute.name + '_confirm'
item = @formGenItem( attribute, className, fieldset, attribute_count ) item = @formGenItem( attribute, className, fieldset, attribute_count )
item.appendTo(fieldset) item.appendTo(fieldset)
@ -93,9 +93,9 @@ class App.ControllerForm extends App.Controller
# bind form events # bind form events
if @events if @events
for eventSelector, callback of @events for eventSelector, callback of @events
do (eventSelector, callback) => do (eventSelector, callback) ->
evs = eventSelector.split(' ') evs = eventSelector.split(' ')
fieldset.find( evs[1] ).bind( evs[0], (e) => callback(e) ) fieldset.find( evs[1] ).bind( evs[0], (e) -> callback(e) )
# return form # return form
return fieldset return fieldset
@ -383,7 +383,7 @@ class App.ControllerForm extends App.Controller
el.find('[name="' + key + '"]').attr('required', false) el.find('[name="' + key + '"]').attr('required', false)
el.find('[name="' + key + '"]').parents('.form-group').find('label span').html('') el.find('[name="' + key + '"]').parents('.form-group').find('label span').html('')
showHideToggle: (params, changedAttribute, attributes, classname, form, ui) => showHideToggle: (params, changedAttribute, attributes, classname, form, ui) ->
for attribute in attributes for attribute in attributes
if attribute.shown_if if attribute.shown_if
hit = false hit = false
@ -400,7 +400,7 @@ class App.ControllerForm extends App.Controller
else else
ui.hide(attribute.name) ui.hide(attribute.name)
requiredMandantoryToggle: (params, changedAttribute, attributes, classname, form, ui) => requiredMandantoryToggle: (params, changedAttribute, attributes, classname, form, ui) ->
for attribute in attributes for attribute in attributes
if attribute.required_if if attribute.required_if
hit = false hit = false

View file

@ -91,7 +91,7 @@ class App.ControllerGenericEdit extends App.ControllerModal
ui.callback( item ) ui.callback( item )
ui.hide() ui.hide()
fail: => fail: ->
ui.log 'errors' ui.log 'errors'
ui.hide() ui.hide()
) )
@ -569,7 +569,7 @@ class App.ActionRow extends App.Controller
do (item) => do (item) =>
@el.find('[data-type="' + item.name + '"]').on( @el.find('[data-type="' + item.name + '"]').on(
'click', 'click',
(e) => (e) ->
e.preventDefault() e.preventDefault()
item.callback() item.callback()
) )
@ -620,7 +620,7 @@ class App.Sidebar extends App.Controller
type: 'small' type: 'small'
) )
toggleDropdown: (e) => toggleDropdown: (e) ->
e.stopPropagation() e.stopPropagation()
$(e.currentTarget).next('.js-actions').find('.dropdown-toggle').dropdown('toggle') $(e.currentTarget).next('.js-actions').find('.dropdown-toggle').dropdown('toggle')

View file

@ -115,7 +115,7 @@ class App.ControllerTable extends App.Controller
# remove group by attribute from header # remove group by attribute from header
overview = _.filter( overview = _.filter(
overview overview
(item) => (item) ->
return item if item isnt data.groupBy return item if item isnt data.groupBy
return return
) )
@ -123,7 +123,7 @@ class App.ControllerTable extends App.Controller
# get new order # get new order
groupObjects = _.groupBy( groupObjects = _.groupBy(
data.objects data.objects
(item) => (item) ->
return '' if !item[data.groupBy] return '' if !item[data.groupBy]
return item[data.groupBy].displayName() if item[data.groupBy].displayName return item[data.groupBy].displayName() if item[data.groupBy].displayName
item[data.groupBy] item[data.groupBy]
@ -135,7 +135,7 @@ class App.ControllerTable extends App.Controller
# sort new groups # sort new groups
groupOrder = _.sortBy( groupOrder = _.sortBy(
groupOrder groupOrder
(item) => (item) ->
item item
) )
@ -201,11 +201,11 @@ class App.ControllerTable extends App.Controller
if hit if hit
for event, callback of item.events for event, callback of item.events
do (table, event, callback) => do (table, event, callback) ->
if cursorMap[event] if cursorMap[event]
table.find("tbody > tr > td:nth-child(#{position}) span").css( 'cursor', cursorMap[event] ) table.find("tbody > tr > td:nth-child(#{position}) span").css( 'cursor', cursorMap[event] )
table.on( event, "tbody > tr > td:nth-child(#{position}) span", table.on( event, "tbody > tr > td:nth-child(#{position}) span",
(e) => (e) ->
e.stopPropagation() e.stopPropagation()
id = $(e.target).parents('tr').data('id') id = $(e.target).parents('tr').data('id')
callback(id, e) callback(id, e)
@ -215,11 +215,11 @@ class App.ControllerTable extends App.Controller
if data.bindRow if data.bindRow
if data.bindRow.events if data.bindRow.events
for event, callback of data.bindRow.events for event, callback of data.bindRow.events
do (table, event, callback) => do (table, event, callback) ->
if cursorMap[event] if cursorMap[event]
table.find('tbody > tr').css( 'cursor', cursorMap[event] ) table.find('tbody > tr').css( 'cursor', cursorMap[event] )
table.on( event, 'tbody > tr', table.on( event, 'tbody > tr',
(e) => (e) ->
id = $(e.target).parents('tr').data('id') id = $(e.target).parents('tr').data('id')
callback(id, e) callback(id, e)
) )
@ -228,7 +228,7 @@ class App.ControllerTable extends App.Controller
if data.bindCheckbox if data.bindCheckbox
if data.bindCheckbox.events if data.bindCheckbox.events
for event, callback of data.bindCheckbox.events for event, callback of data.bindCheckbox.events
do (table, event, callback) => do (table, event, callback) ->
table.delegate('input[name="bulk"]', event, (e) -> table.delegate('input[name="bulk"]', event, (e) ->
e.stopPropagation() e.stopPropagation()
id = $(e.target).parents('tr').data('id') id = $(e.target).parents('tr').data('id')

View file

@ -121,7 +121,12 @@ class App extends Spine.Controller
result result
@view: (name) -> @view: (name) ->
template = ( params = {} ) => template = ( params = {} ) ->
s = ( num, digits ) ->
while num.toString().length < digits
num = '0' + num
num
# define print name helper # define print name helper
params.P = ( object, attribute_name ) -> params.P = ( object, attribute_name ) ->
@ -130,10 +135,6 @@ class App extends Spine.Controller
# define date format helper # define date format helper
params.date = ( time ) -> params.date = ( time ) ->
return '' if !time return '' if !time
s = ( num, digits ) ->
while num.toString().length < digits
num = "0" + num
num
timeObject = new Date(time) timeObject = new Date(time)
d = s( timeObject.getDate(), 2 ) d = s( timeObject.getDate(), 2 )
@ -144,10 +145,6 @@ class App extends Spine.Controller
# define datetime format helper # define datetime format helper
params.datetime = ( time ) -> params.datetime = ( time ) ->
return '' if !time return '' if !time
s = ( num, digits ) ->
while num.toString().length < digits
num = "0" + num
num
timeObject = new Date(time) timeObject = new Date(time)
d = s( timeObject.getDate(), 2 ) d = s( timeObject.getDate(), 2 )
@ -161,10 +158,7 @@ class App extends Spine.Controller
# define decimal format helper # define decimal format helper
params.decimal = ( data, positions = 2 ) -> params.decimal = ( data, positions = 2 ) ->
return '' if !data return '' if !data
s = ( num, digits ) ->
while num.toString().length < digits
num = num + "0"
num
result = data.toString().match(/^(.+?)\.(.+?)$/) result = data.toString().match(/^(.+?)\.(.+?)$/)
if !result || !result[2] if !result || !result[2]
return "#{data}." + s( 0, positions ).toString() return "#{data}." + s( 0, positions ).toString()