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') @el.modal('hide')
else else
if data.source is 'inbound' || data.source is 'outbound' if data.source is 'inbound' || data.source is 'outbound'
@showSlide("js-#{data.source}") @showSlide("js-#{data.source}")
@showAlert("js-#{data.source}", data.message_human || data.message ) @showAlert("js-#{data.source}", data.message_human || data.message )
@showInvalidField("js-#{data.source}", data.invalid_field) @showInvalidField("js-#{data.source}", data.invalid_field)
else else
if count is 2 if count is 2
@showAlert('js-verify', data.message_human || data.message ) @showAlert('js-verify', data.message_human || data.message )

View file

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

View file

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

View file

@ -40,11 +40,11 @@ class App.UiElement.autocompletion
### ###
source = attribute.source source = attribute.source
if typeof(source) is 'string' 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( $(local_attribute_full).autocomplete(
source: source, source: source,
minLength: attribute.minLengt || 3, minLength: attribute.minLengt || 3,
select: ( event, ui ) => select: ( event, ui ) ->
b(event, ui.item) b(event, ui.item)
) )
App.Delay.set( a, 280, undefined, 'form_autocompletion' ) 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) item.find('.js-attributeSelector').prepend(selector)
# add filter # add filter
item.find('.js-add').bind('click', (e) => item.find('.js-add').bind('click', (e) ->
element = $(e.target).closest('.js-filterElement') element = $(e.target).closest('.js-filterElement')
elementClone = element.clone(true) elementClone = element.clone(true)
element.after(elementClone) element.after(elementClone)

View file

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

View file

@ -32,7 +32,6 @@ class App.UiElement.richtext
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

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

View file

@ -1,7 +1,7 @@
class App.UiElement.tag class App.UiElement.tag
@render: (attribute) -> @render: (attribute) ->
item = $( App.view('generic/input')( attribute: attribute ) ) item = $( App.view('generic/input')( attribute: attribute ) )
a = => a = ->
$('#' + attribute.id ).tokenfield() $('#' + attribute.id ).tokenfield()
$('#' + attribute.id ).parent().css('height', 'auto') $('#' + attribute.id ).parent().css('height', 'auto')
App.Delay.set( a, 120, undefined, 'tags' ) 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 ) 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>' ) item = $( App.view('generic/textarea')( attribute: attribute ) + '<div class="file-uploader ' + attribute.class + '" id="' + fileUploaderId + '"></div>' )
a = => a = ->
visible = $( item[0] ).is(":visible") visible = $( item[0] ).is(":visible")
if visible && !$( item[0] ).expanding('active') if visible && !$( item[0] ).expanding('active')
$( item[0] ).expanding() $( item[0] ).expanding()

View file

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

View file

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

View file

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

View file

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

View file

@ -219,7 +219,7 @@ class Admin extends App.ControllerContent
username: @params.email username: @params.email
password: @params.password password: @params.password
success: @relogin success: @relogin
error: => error: ->
App.Event.trigger 'notify', { App.Event.trigger 'notify', {
type: 'error' type: 'error'
msg: App.i18n.translateContent( 'Signin failed! Please contact the support team!' ) msg: App.i18n.translateContent( 'Signin failed! Please contact the support team!' )
@ -874,9 +874,9 @@ class ChannelEmail extends App.Wizard
@navigate 'getting_started/agents' @navigate 'getting_started/agents'
else else
if data.source is 'inbound' || data.source is 'outbound' if data.source is 'inbound' || data.source is 'outbound'
@showSlide("js-#{data.source}") @showSlide("js-#{data.source}")
@showAlert("js-#{data.source}", data.message_human || data.message ) @showAlert("js-#{data.source}", data.message_human || data.message )
@showInvalidField("js-#{data.source}", data.invalid_field) @showInvalidField("js-#{data.source}", data.invalid_field)
else else
if count is 2 if count is 2
@showAlert('js-verify', data.message_human || data.message ) @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 # get open tabs to repopen on rerender
open_tab = {} open_tab = {}
@$('.open').children('a').each( (i,d) => @$('.open').children('a').each( (i,d) ->
href = $(d).attr('href') href = $(d).attr('href')
open_tab[href] = true open_tab[href] = true
) )
# get active tabs to reactivate on rerender # get active tabs to reactivate on rerender
active_tab = {} active_tab = {}
@$('.active').children('a').each( (i,d) => @$('.active').children('a').each( (i,d) ->
href = $(d).attr('href') href = $(d).attr('href')
active_tab[href] = true active_tab[href] = true
) )
@ -68,14 +68,14 @@ class App.Navigation extends App.ControllerWidgetPermanent
# get open tabs to repopen on rerender # get open tabs to repopen on rerender
open_tab = {} open_tab = {}
@$('.open').children('a').each( (i,d) => @$('.open').children('a').each( (i,d) ->
href = $(d).attr('href') href = $(d).attr('href')
open_tab[href] = true open_tab[href] = true
) )
# get active tabs to reactivate on rerender # get active tabs to reactivate on rerender
active_tab = {} active_tab = {}
@$('.active').children('a').each( (i,d) => @$('.active').children('a').each( (i,d) ->
href = $(d).attr('href') href = $(d).attr('href')
active_tab[href] = true active_tab[href] = true
) )
@ -176,7 +176,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
@renderResult(result) @renderResult(result)
@$('#global-search-result').on('click', 'a', => @$('#global-search-result').on('click', 'a', ->
close() close()
) )
) )
@ -222,7 +222,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
) )
# prevent submit of search box # prevent submit of search box
@$('form.search').on( 'submit', (e) => @$('form.search').on( 'submit', (e) ->
e.preventDefault() e.preventDefault()
) )
@ -246,7 +246,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
# bind to empty search # bind to empty search
@$('.empty-search').on( @$('.empty-search').on(
'click' 'click'
=> ->
emptyAndClose() emptyAndClose()
) )
@ -347,10 +347,10 @@ class App.Navigation extends App.ControllerWidgetPermanent
return(a-b) return(a-b)
addPrioCount: (newlist, item) -> addPrioCount: (newlist, item) ->
if newlist[ item['prio'] ] if newlist[ item['prio'] ]
item['prio']++ item['prio']++
if newlist[ item['prio'] ] if newlist[ item['prio'] ]
@addPrioCount newlist, item @addPrioCount newlist, item
update: (url) => update: (url) =>
@$('li').removeClass('active') @$('li').removeClass('active')

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -106,9 +106,9 @@ class Index extends App.ControllerContent
) )
hide = => hide = =>
@hideAction()
App.Event.trigger('i18n:translation_todo_reload') App.Event.trigger('i18n:translation_todo_reload')
App.Event.trigger('i18n:translation_list_reload') App.Event.trigger('i18n:translation_list_reload')
@hideAction()
@loader.hide(1) @loader.hide(1)
locales = App.Locale.all() locales = App.Locale.all()
@ -201,7 +201,7 @@ class TranslationToDo extends App.Controller
url: @apiPath + '/translations' url: @apiPath + '/translations'
data: JSON.stringify(params) data: JSON.stringify(params)
processData: false processData: false
success: (data, status, xhr) => success: (data, status, xhr) ->
App.Event.trigger('i18n:translation_list_reload') App.Event.trigger('i18n:translation_list_reload')
) )
@ -235,7 +235,7 @@ class TranslationToDo extends App.Controller
url: @apiPath + '/translations' url: @apiPath + '/translations'
data: JSON.stringify(params) data: JSON.stringify(params)
processData: false processData: false
success: (data, status, xhr) => success: (data, status, xhr) ->
App.Event.trigger('i18n:translation_list_reload') App.Event.trigger('i18n:translation_list_reload')
) )

View file

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

View file

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

View file

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

View file

@ -95,7 +95,7 @@ class _Singleton
if !@moduleColorsMap[module] if !@moduleColorsMap[module]
@moduleColorsMap[module]= @yieldColor() @moduleColorsMap[module]= @yieldColor()
color = @moduleColorsMap[module] 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) logArgs = [prefix, colorString].concat(args)
else else
logArgs = [prefix].concat(args) logArgs = [prefix].concat(args)

View file

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

View file

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

View file

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

View file

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

View file

@ -12,11 +12,11 @@ class App.ImageService
else else
@resize( dataURL, x, y, 2, 'image/png', 0.7, callback ) @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 # load image from data url
imageObject = new Image() imageObject = new Image()
imageObject.onload = => imageObject.onload = ->
imageWidth = imageObject.width imageWidth = imageObject.width
imageHeight = imageObject.height imageHeight = imageObject.height
if y is 'auto' && x is 'auto' if y is 'auto' && x is 'auto'

View file

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

View file

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

View file

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

View file

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