From 85515e61befe8e787935790534cadfdbf844e4b4 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 21 Sep 2015 23:24:19 +0200 Subject: [PATCH] Applied coffeelint. --- .../app/controllers/_click_catcher.js.coffee | 2 +- .../app/controllers/layout_ref.js.coffee | 58 +++++++++---------- .../ticket_zoom/article_new.js.coffee | 20 ++++--- .../ticket_zoom/overview_navigator.js.coffee | 2 +- .../controllers/ticket_zoom/sidebar.js.coffee | 7 +-- .../app/controllers/widget/chat.js.coffee | 42 +++++++------- .../widget/online_notification.js.coffee | 4 +- ...user_organization_autocompletion.js.coffee | 8 +-- .../app/models/email_address.js.coffee | 2 +- 9 files changed, 74 insertions(+), 71 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_click_catcher.js.coffee b/app/assets/javascripts/app/controllers/_click_catcher.js.coffee index 702a9b5d9..a8c9f80aa 100644 --- a/app/assets/javascripts/app/controllers/_click_catcher.js.coffee +++ b/app/assets/javascripts/app/controllers/_click_catcher.js.coffee @@ -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
className: 'clickCatcher' diff --git a/app/assets/javascripts/app/controllers/layout_ref.js.coffee b/app/assets/javascripts/app/controllers/layout_ref.js.coffee index 312a974f3..550517ef7 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.js.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.js.coffee @@ -267,7 +267,7 @@ class LayoutRefCommunicationReply extends App.ControllerContent duration: duration add_textarea_catcher: -> - @textareaCatcher = new App.clickCatcher + @textareaCatcher = new App.ClickCatcher holder: @articleNewEdit.offsetParent() callback: @close_textarea zIndexScale: 4 @@ -353,7 +353,7 @@ class LayoutRefCommunicationReply extends App.ControllerContent # console.log "working of", file, "from", @uploadQueue @fakeUpload file.name, file.size, @workOfUploadQueue - humanFileSize: (size) => + humanFileSize: (size) -> i = Math.floor( Math.log(size) / Math.log(1024) ) 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() - onHide: => + onHide: -> window.history.back() - onSubmit: (e) => + onSubmit: (e) -> e.preventDefault() params = App.ControllerForm.params( $(e.target).closest('form') ) console.log('params', params) @@ -452,7 +452,7 @@ class ModalText extends App.ControllerModal render: -> @show( App.view('layout_ref/content')() ) - onHide: => + onHide: -> window.history.back() 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' ) -class loadingPlaceholderRef extends App.ControllerContent +class LoadingPlaceholderRef extends App.ControllerContent constructor: -> super @@ -764,9 +764,9 @@ class loadingPlaceholderRef extends App.ControllerContent render: -> @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: -> super @@ -775,10 +775,10 @@ class insufficientRightsRef extends App.ControllerContent render: -> @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: -> super @@ -787,10 +787,10 @@ class errorRef extends App.ControllerContent render: -> @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: '.article-text': 'articles' '.js-highlight-icon': 'highlightIcon' @@ -939,10 +939,10 @@ class highlightRef extends App.ControllerContent @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: [ { @@ -1257,10 +1257,10 @@ class cluesRef extends App.ControllerContent when 'click' then target.trigger('click') 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: -> super @@ -1269,9 +1269,9 @@ class adminPlaceholderRef extends App.ControllerContent render: -> @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: -> super @@ -1280,10 +1280,10 @@ class userListRef extends App.ControllerContent render: -> @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: 'click .js-activateColumn': 'activateColumn' @@ -1303,7 +1303,7 @@ class slaRef extends App.ControllerContent selectTimezone: (e) => @$('.js-timezone').text e.currentTarget.value - toggle: (e) => + toggle: (e) -> entry = $(e.currentTarget).closest('.action') isInactive = entry.hasClass('is-inactive') entry.toggleClass('is-inactive') @@ -1335,10 +1335,10 @@ class slaRef extends App.ControllerContent @$('.js-time').timepicker 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: 'click .select-value': 'select' 'click [data-type=new]': 'createNew' @@ -1351,7 +1351,7 @@ class schedulersRef extends App.ControllerContent render: -> @html App.view('layout_ref/schedulers')() - toggle: (e) => + toggle: (e) -> entry = $(e.currentTarget).closest('.action') isInactive = entry.hasClass('is-inactive') entry.toggleClass('is-inactive') @@ -1415,7 +1415,7 @@ class schedulersRef extends App.ControllerContent else 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 @@ -1457,7 +1457,7 @@ class InputsRef extends App.ControllerContent App.Config.set( 'layout_ref/inputs', InputsRef, 'Routes' ) -class calendarSubscriptionsRef extends App.ControllerContent +class CalendarSubscriptionsRef extends App.ControllerContent elements: 'input[type=checkbox]': 'options' @@ -1530,7 +1530,7 @@ class calendarSubscriptionsRef extends App.ControllerContent 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 @@ -1544,7 +1544,7 @@ class ButtonsRef extends App.ControllerContent App.Config.set( 'layout_ref/buttons', ButtonsRef, 'Routes' ) -class mergeCustomerRef extends App.ControllerContent +class MergeCustomerRef extends App.ControllerContent mergeTarget: firstname: 'Nicole', @@ -1591,7 +1591,7 @@ class mergeCustomerRef extends App.ControllerContent onChange: -> -App.Config.set( 'layout_ref/merge_customer', mergeCustomerRef, 'Routes' ) +App.Config.set( 'layout_ref/merge_customer', MergeCustomerRef, 'Routes' ) class PrimaryEmailRef extends App.ControllerContent diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.js.coffee index a832bee5b..f48634d15 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.js.coffee @@ -54,10 +54,15 @@ class App.TicketZoomArticleNew extends App.Controller attributes: [] }, { - name: 'twitter' + name: 'twitter status' icon: 'twitter' attributes: [] }, + { + name: 'twitter direct-message' + icon: 'twitter' + attributes: ['to'] + }, { name: 'phone' icon: 'phone' @@ -213,7 +218,7 @@ class App.TicketZoomArticleNew extends App.Controller data: ticket: ticket ) - callback = (ticket) => + callback = (ticket) -> textModule.reload( ticket: ticket ) @@ -256,7 +261,7 @@ class App.TicketZoomArticleNew extends App.Controller speed: 300 easing: [ 0.34, 1.61, 0.7, 1 ] - @pickRecipientsCatcher = new App.clickCatcher + @pickRecipientsCatcher = new App.ClickCatcher holder: @el.offsetParent() callback: @hide_recipients zIndexScale: 6 @@ -304,7 +309,7 @@ class App.TicketZoomArticleNew extends App.Controller showSelectableArticleType: => @el.find('.js-articleTypes').removeClass('is-hidden') - @selectTypeCatcher = new App.clickCatcher + @selectTypeCatcher = new App.ClickCatcher holder: @el.offsetParent() callback: @hideSelectableArticleType zIndexScale: 6 @@ -325,7 +330,7 @@ class App.TicketZoomArticleNew extends App.Controller @type = type @$('[name="type"]').val(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 for articleType in @articleTypes @@ -419,7 +424,7 @@ class App.TicketZoomArticleNew extends App.Controller addTextareaCatcher: => if @articleNewEdit.is(':visible') - @textareaCatcher = new App.clickCatcher + @textareaCatcher = new App.ClickCatcher holder: @articleNewEdit.offsetParent() callback: @closeTextarea zIndexScale: 4 @@ -471,7 +476,7 @@ class App.TicketZoomArticleNew extends App.Controller duration: 100 stagger: 50 drag: true - complete: (elements) => $(elements).addClass('is-hidden') + complete: (elements) -> $(elements).addClass('is-hidden') onDragenter: (event) => # on the first event, @@ -508,7 +513,6 @@ class App.TicketZoomArticleNew extends App.Controller 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 diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/overview_navigator.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/overview_navigator.js.coffee index a555258c9..1d09db1f3 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/overview_navigator.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/overview_navigator.js.coffee @@ -9,7 +9,7 @@ class App.TicketZoomOverviewNavigator extends App.Controller @bind 'ticket_overview_rebuild', (data) => execute = => @render() - @delay(execute, 600, 'overview-navigator') + @delay(execute, 1600, 'overview-navigator') @render() diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.js.coffee index 2b3610c65..4e9c5c93c 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar.js.coffee @@ -30,7 +30,6 @@ class App.TicketZoomSidebar extends App.Controller el: el.find('.edit') model: App.Ticket screen: 'edit' - params: App.Ticket.find(ticket.id) handlers: [ @ticketFormChanges ] @@ -44,7 +43,7 @@ class App.TicketZoomSidebar extends App.Controller show(ticket) @bind( 'ui::ticket::taskReset' - (data) => + (data) -> if data.ticket_id is ticket.id show(ticket) ) @@ -120,7 +119,7 @@ class App.TicketZoomSidebar extends App.Controller objects: 'Users' container: @el.closest('.content') ) - showCustomer = (el) => + showCustomer = (el) -> new App.WidgetUser( el: el user_id: ticket.customer_id @@ -154,7 +153,7 @@ class App.TicketZoomSidebar extends App.Controller objects: 'Organizations' container: @el.closest('.content') ) - showOrganization = (el) => + showOrganization = (el) -> new App.WidgetOrganization( el: el organization_id: ticket.organization_id diff --git a/app/assets/javascripts/app/controllers/widget/chat.js.coffee b/app/assets/javascripts/app/controllers/widget/chat.js.coffee index 0c9bab12d..544f85dbf 100644 --- a/app/assets/javascripts/app/controllers/widget/chat.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/chat.js.coffee @@ -109,25 +109,25 @@ class Widget extends App.ControllerWidgetPermanent show: => @isShown = true - @el.find('#chat_toogle').html('×'); + @el.find('#chat_toogle').html('×') if @newMessage @el.find('div.well').addClass('alert-success') @delay( => - @el.find('div.well').removeClass('alert-success') + @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 - ) + 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' + 2000 + 'chat-message-new' ) @el.find('#chat_content').show(100) @el.find('#chat_content').removeClass('hide') @@ -135,16 +135,16 @@ class Widget extends App.ControllerWidgetPermanent # hide @delay( => - @hide() - 60000 - 'chat-window-hide' + @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('♦'); + @el.find('#chat_toogle').html('♦') focusIn: => @focus = true @@ -158,9 +158,9 @@ class Widget extends App.ControllerWidgetPermanent # hide @delay( => - @hide() - 60000 - 'chat-window-hide' + @hide() + 60000 + 'chat-window-hide' ) render: -> diff --git a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee index 18e902637..de9565aa1 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee @@ -112,7 +112,7 @@ class App.OnlineNotificationWidget extends App.Controller ) # add clickCatcher - @clickCatcher = new App.clickCatcher + @clickCatcher = new App.ClickCatcher holder: @el.offsetParent() callback: @hidePopover zIndexScale: 4 @@ -175,7 +175,7 @@ class App.OnlineNotificationWidget extends App.Controller @updateContent() @delay( - => waitUntilOldPopoverIsRemoved() + -> waitUntilOldPopoverIsRemoved() 600 'popover' ) diff --git a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee index 995abb241..ed69cfe64 100644 --- a/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/user_organization_autocompletion.js.coffee @@ -23,7 +23,7 @@ class App.UserOrganizationAutocompletion extends App.Controller open: => @clearDelay('close') @el.addClass('open') - @catcher = new App.clickCatcher + @catcher = new App.ClickCatcher holder: @el.offsetParent() callback: @close zIndexScale: 1 @@ -59,7 +59,7 @@ class App.UserOrganizationAutocompletion extends App.Controller if @callback @callback(userId) - buildOrganizationItem: (organization) => + buildOrganizationItem: (organization) -> App.view('generic/user_search/item_organization')( organization: organization ) @@ -72,12 +72,12 @@ class App.UserOrganizationAutocompletion extends App.Controller user = App.User.fullLocal(userId) organizationMemebers.append( @buildUserItem(user) ) - buildUserItem: (user) => + buildUserItem: (user) -> App.view('generic/user_search/item_user')( user: user ) - buildUserNew: => + buildUserNew: -> App.view('generic/user_search/new_user')() build: => diff --git a/app/assets/javascripts/app/models/email_address.js.coffee b/app/assets/javascripts/app/models/email_address.js.coffee index c1d435ed7..011b5b5a7 100644 --- a/app/assets/javascripts/app/models/email_address.js.coffee +++ b/app/assets/javascripts/app/models/email_address.js.coffee @@ -3,7 +3,7 @@ class App.EmailAddress extends App.Model @extend Spine.Model.Ajax @url: @apiPath + '/email_addresses' - @filterChannel: (options, type) => + @filterChannel: (options, type) -> return options if type isnt 'collection' _.filter( options