From e73a5762b7588c04e38bea01b4f72e7c5b5acc70 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 24 Sep 2015 08:54:23 +0200 Subject: [PATCH] Coffeelint next level. --- .../_application_controller.js.coffee | 8 +- .../app/controllers/_profile/avatar.js.coffee | 4 +- .../controllers/_ui_element/active.js.coffee | 1 + .../_ui_element/autocompletion.js.coffee | 1 + .../_ui_element/autocompletion_ajax.js.coffee | 1 + .../controllers/_ui_element/boolean.js.coffee | 1 + .../_ui_element/business_hours.js.coffee | 5 +- .../_ui_element/checkbox.js.coffee | 1 + .../controllers/_ui_element/date.js.coffee | 1 + .../_ui_element/datetime.js.coffee | 1 + .../_ui_element/datetime_search.js.coffee | 7 + .../_ui_element/holiday_selector.js.coffee | 1 + .../_ui_element/ical_feed.js.coffee | 1 + .../controllers/_ui_element/input.js.coffee | 1 + .../_ui_element/postmaster_match.js.coffee | 1 + .../_ui_element/postmaster_set.js.coffee | 1 + .../controllers/_ui_element/radio.js.coffee | 1 + .../_ui_element/richtext.js.coffee | 1 + .../_ui_element/searchable_select.js.coffee | 1 + .../controllers/_ui_element/select.js.coffee | 1 + .../_ui_element/sla_times.js.coffee | 1 + .../app/controllers/_ui_element/tag.js.coffee | 1 + .../_ui_element/textarea.js.coffee | 1 + .../ticket_perform_action.js.coffee | 1 + .../_ui_element/ticket_selector.js.coffee | 1 + .../_ui_element/timezone.js.coffee | 1 + .../_ui_element/user_autocompletion.js.coffee | 1 + .../customer_ticket_create.js.coffee | 2 +- .../app/controllers/layout_ref.js.coffee | 4 +- .../app/controllers/navigation.js.coffee | 2 +- .../app/controllers/translation.js.coffee | 2 +- .../widget/online_notification.js.coffee | 2 +- .../app/lib/app_init/track.js.coffee | 1 + .../app/lib/app_post/i18n.js.coffee | 14 +- .../lib/app_post/searchable_select.js.coffee | 4 +- .../app/lib/app_post/store.js.coffee | 2 +- .../app/lib/app_post/utils.js.coffee | 6 +- .../javascripts/app/lib/spine/ajax.coffee | 1 + .../javascripts/app/lib/spine/bindings.coffee | 1 + .../javascripts/app/lib/spine/manager.coffee | 1 + .../javascripts/app/lib/spine/relation.coffee | 1 + .../javascripts/app/lib/spine/route.coffee | 1 + .../javascripts/app/lib/spine/spine.coffee | 1 + coffeelint.json | 135 ++++++++++++++++++ 44 files changed, 203 insertions(+), 24 deletions(-) create mode 100644 app/assets/javascripts/app/controllers/_ui_element/datetime_search.js.coffee create mode 100644 coffeelint.json diff --git a/app/assets/javascripts/app/controllers/_application_controller.js.coffee b/app/assets/javascripts/app/controllers/_application_controller.js.coffee index eb17c5946..e843b2348 100644 --- a/app/assets/javascripts/app/controllers/_application_controller.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller.js.coffee @@ -218,7 +218,7 @@ class App.Controller extends Spine.Controller update = => ui = @ $('.humanTimeFromNow').each( -> - item = $(this) + item = $(@) currentVal = item.text() ui.frontendTimeUpdateItem(item, currentVal) ) @@ -265,9 +265,9 @@ class App.Controller extends Spine.Controller html = App.view('popover/ticket')( ticket: ticket ) - html = $( html ) + html = $(html) html.find('.humanTimeFromNow').each( -> - item = $(this) + item = $(@) ui.frontendTimeUpdateItem(item) ) html @@ -427,7 +427,7 @@ class App.Controller extends Spine.Controller ) html = $( html ) html.find('.humanTimeFromNow').each( -> - item = $(this) + item = $(@) ui.frontendTimeUpdateItem(item) ) html diff --git a/app/assets/javascripts/app/controllers/_profile/avatar.js.coffee b/app/assets/javascripts/app/controllers/_profile/avatar.js.coffee index b20d55406..37cf87069 100644 --- a/app/assets/javascripts/app/controllers/_profile/avatar.js.coffee +++ b/app/assets/javascripts/app/controllers/_profile/avatar.js.coffee @@ -133,7 +133,7 @@ class Index extends App.Controller onUpload: (event) => callback = @storeImage EXIF.getData event.target.files[0], -> - orientation = this.exifdata.Orientation + orientation = @exifdata.Orientation reader = new FileReader() reader.onload = (e) -> new ImageCropper @@ -141,7 +141,7 @@ class Index extends App.Controller callback: callback orientation: orientation - reader.readAsDataURL(this) + reader.readAsDataURL(@) App.Config.set( 'Avatar', { prio: 1100, name: 'Avatar', parent: '#profile', target: '#profile/avatar', controller: Index }, 'NavBarProfile' ) diff --git a/app/assets/javascripts/app/controllers/_ui_element/active.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/active.js.coffee index 820a76fd1..e7947ed62 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/active.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/active.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.active extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion.js.coffee index d60153503..78e66b6a0 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.autocompletion @render: (attribute, params) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.js.coffee index c08ad6ab5..3b67ab688 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/autocompletion_ajax.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.autocompletion_ajax @render: (attribute, params = {}) -> if params[attribute.name] diff --git a/app/assets/javascripts/app/controllers/_ui_element/boolean.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/boolean.js.coffee index c201e6bea..fac677ef0 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/boolean.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/boolean.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.boolean extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/business_hours.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/business_hours.js.coffee index 81b5fa95c..d534f4477 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/business_hours.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/business_hours.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.business_hours @render: (attributeOrig) -> @@ -5,8 +6,8 @@ class App.UiElement.business_hours attribute.nameRaw = attribute.name attribute.name = "{business_hours}#{attribute.name}" - # Martin: our frontend doesn't create 24:00. - # you have to check second values ('till') for 00:00 + # Martin: our frontend doesn't create 24:00. + # you have to check second values ('till') for 00:00 # and convert them to 24:00 if !attribute.value attribute.value = diff --git a/app/assets/javascripts/app/controllers/_ui_element/checkbox.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/checkbox.js.coffee index 5f16de1eb..8341761ed 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/checkbox.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/checkbox.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.checkbox extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee index aae510769..f082d2329 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.date @render: (attributeOrig) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee index 9e48cc2e0..e9c854988 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.datetime @render: (attributeOrig) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/datetime_search.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/datetime_search.js.coffee new file mode 100644 index 000000000..825488467 --- /dev/null +++ b/app/assets/javascripts/app/controllers/_ui_element/datetime_search.js.coffee @@ -0,0 +1,7 @@ +# coffeelint: disable=camel_case_classes +class App.UiElement.datetime_search + @render: (attributeOrig) -> + attribute = _.clone(attributeOrig) + attribute.disable_feature = true + attribute.null = false + App.UiElement.datetime.render(attribute) diff --git a/app/assets/javascripts/app/controllers/_ui_element/holiday_selector.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/holiday_selector.js.coffee index 061674eb9..b13309cf6 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/holiday_selector.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/holiday_selector.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.holiday_selector @render: (attribute, params) -> console.log('aa', attribute) diff --git a/app/assets/javascripts/app/controllers/_ui_element/ical_feed.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/ical_feed.js.coffee index dbb16fe80..95e137e8e 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/ical_feed.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/ical_feed.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.ical_feed extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> console.log('A', attribute) diff --git a/app/assets/javascripts/app/controllers/_ui_element/input.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/input.js.coffee index d34638671..15af0413e 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/input.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/input.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.input @render: (attribute) -> $( App.view('generic/input')( attribute: attribute ) ) diff --git a/app/assets/javascripts/app/controllers/_ui_element/postmaster_match.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/postmaster_match.js.coffee index 33f895c9a..8db4bd490 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/postmaster_match.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/postmaster_match.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.postmaster_match @defaults: -> groups = diff --git a/app/assets/javascripts/app/controllers/_ui_element/postmaster_set.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/postmaster_set.js.coffee index dae685bf7..37cdc9ca1 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/postmaster_set.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/postmaster_set.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.postmaster_set @defaults: -> groups = diff --git a/app/assets/javascripts/app/controllers/_ui_element/radio.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/radio.js.coffee index 8f94a4b49..6b03e62f8 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/radio.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/radio.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.radio extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/richtext.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/richtext.js.coffee index 30bd3bdd0..be0d91716 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/richtext.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/richtext.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.richtext @render: (attribute) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/searchable_select.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/searchable_select.js.coffee index bc7bf5519..df950af65 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/searchable_select.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/searchable_select.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.searchable_select extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/select.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/select.js.coffee index 66fc12e44..91a3ad8db 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/select.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/select.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.select extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/sla_times.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/sla_times.js.coffee index 418a9a927..46ebccdec 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/sla_times.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/sla_times.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.sla_times @render: (attribute, params = {}) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/tag.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/tag.js.coffee index 05c4f3172..3fb865259 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/tag.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/tag.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.tag @render: (attribute) -> item = $( App.view('generic/input')( attribute: attribute ) ) diff --git a/app/assets/javascripts/app/controllers/_ui_element/textarea.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/textarea.js.coffee index f5d921294..077d9d0c4 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/textarea.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/textarea.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.textarea @render: (attribute) -> fileUploaderId = 'file-uploader-' + new Date().getTime() + '-' + Math.floor( Math.random() * 99999 ) diff --git a/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.js.coffee index 15daa9334..13fa61550 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/ticket_perform_action.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.ticket_perform_action @defaults: -> defaults = ['ticket.state_id'] diff --git a/app/assets/javascripts/app/controllers/_ui_element/ticket_selector.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/ticket_selector.js.coffee index b5a3f1e51..f2fb9c889 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/ticket_selector.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/ticket_selector.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.ticket_selector @defaults: -> defaults = ['ticket.state_id'] diff --git a/app/assets/javascripts/app/controllers/_ui_element/timezone.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/timezone.js.coffee index 6f5df2b4d..a72413280 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/timezone.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/timezone.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.timezone extends App.UiElement.ApplicationUiElement @render: (attribute, params) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/user_autocompletion.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/user_autocompletion.js.coffee index e5e7c3495..b69d140f2 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/user_autocompletion.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/user_autocompletion.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.UiElement.user_autocompletion @render: (attribute) -> new App.UserOrganizationAutocompletion( attribute: attribute ).element() diff --git a/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee index f12e34847..c279e6abf 100644 --- a/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/customer_ticket_create.js.coffee @@ -205,7 +205,7 @@ class Index extends App.ControllerContent done: -> # redirect to zoom - ui.navigate '#ticket/zoom/' + this.id + ui.navigate '#ticket/zoom/' + @id fail: -> ui.log 'CustomerTicketCreate', 'error', 'can not create' diff --git a/app/assets/javascripts/app/controllers/layout_ref.js.coffee b/app/assets/javascripts/app/controllers/layout_ref.js.coffee index fff8325cd..7093e6fa4 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.js.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.js.coffee @@ -790,7 +790,7 @@ class ErrorRef extends App.ControllerContent App.Config.set( 'layout_ref/error', ErrorRef, 'Routes' ) -class ticketZoomRef extends App.ControllerContent +class TicketZoomRef extends App.ControllerContent elements: '.article-text': 'articles' '.js-highlight-icon': 'highlightIcon' @@ -939,7 +939,7 @@ class ticketZoomRef extends App.ControllerContent @storeHighlights() -App.Config.set( 'layout_ref/ticket_zoom', ticketZoomRef, 'Routes' ) +App.Config.set( 'layout_ref/ticket_zoom', TicketZoomRef, 'Routes' ) class CluesRef extends App.ControllerContent diff --git a/app/assets/javascripts/app/controllers/navigation.js.coffee b/app/assets/javascripts/app/controllers/navigation.js.coffee index d9a712ad8..35e307308 100644 --- a/app/assets/javascripts/app/controllers/navigation.js.coffee +++ b/app/assets/javascripts/app/controllers/navigation.js.coffee @@ -121,7 +121,7 @@ class App.Navigation extends App.ControllerWidgetPermanent # start oorganization popups @organizationPopups() - render: () -> + render: -> # reset result cache @searchResultCache = {} diff --git a/app/assets/javascripts/app/controllers/translation.js.coffee b/app/assets/javascripts/app/controllers/translation.js.coffee index 9cca9a624..ef9ac2c5a 100644 --- a/app/assets/javascripts/app/controllers/translation.js.coffee +++ b/app/assets/javascripts/app/controllers/translation.js.coffee @@ -280,7 +280,7 @@ class TranslationList extends App.Controller ui = @ @changesAvailable = false @$('.js-Item').each( (e) -> - id = $(this).data('id') + id = $(@).data('id') ui.updateRow(id) ) if @changesAvailable 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 de9565aa1..22b5668f8 100644 --- a/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee +++ b/app/assets/javascripts/app/controllers/widget/online_notification.js.coffee @@ -65,7 +65,7 @@ class App.OnlineNotificationWidget extends App.Controller processData: true ) - removeClickCatcher: () => + removeClickCatcher: => return if !@clickCatcher @clickCatcher.remove() @clickCatcher = null diff --git a/app/assets/javascripts/app/lib/app_init/track.js.coffee b/app/assets/javascripts/app/lib/app_init/track.js.coffee index 1448e9e32..955cbcad2 100644 --- a/app/assets/javascripts/app/lib/app_init/track.js.coffee +++ b/app/assets/javascripts/app/lib/app_init/track.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=no_backticks class App.Track _instance = undefined diff --git a/app/assets/javascripts/app/lib/app_post/i18n.js.coffee b/app/assets/javascripts/app/lib/app_post/i18n.js.coffee index d46a133cf..64f0a505b 100644 --- a/app/assets/javascripts/app/lib/app_post/i18n.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/i18n.js.coffee @@ -1,3 +1,4 @@ +# coffeelint: disable=camel_case_classes class App.i18n _instance = undefined @@ -69,6 +70,11 @@ class App.i18n _instance ?= new _i18nSingleton() _instance.setNotTranslated( locale, key ) + @timeFormat: (locale, key) -> + if _instance == undefined + _instance ?= new _i18nSingleton() + _instance.mapTime + class _i18nSingleton extends Spine.Module @include App.LogInclude @@ -85,7 +91,7 @@ class _i18nSingleton extends Spine.Module # observe if text has been translated $('body') - .delegate '.translation', 'focus', (e) => + .delegate '.translation', 'focus', (e) -> $this = $(e.target) $this.data 'before', $this.html() return $this @@ -276,7 +282,7 @@ class _i18nSingleton extends Spine.Module else @mapString[source] = target - notTranslatedFeatureEnabled: (locale) => + notTranslatedFeatureEnabled: (locale) -> if locale.substr(0,2) is 'en' return false true @@ -296,10 +302,10 @@ class _i18nSingleton extends Spine.Module timestamp: ( time, offset ) => @convert(time, offset, @mapTime['timestamp'] || @timestampFormat) - convert: ( time, offset, format ) => + convert: ( time, offset, format ) -> s = ( num, digits ) -> while num.toString().length < digits - num = "0" + num + num = '0' + num num timeObject = new Date(time) diff --git a/app/assets/javascripts/app/lib/app_post/searchable_select.js.coffee b/app/assets/javascripts/app/lib/app_post/searchable_select.js.coffee index 1ac6b7bae..7f6be4444 100644 --- a/app/assets/javascripts/app/lib/app_post/searchable_select.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/searchable_select.js.coffee @@ -145,7 +145,7 @@ class App.SearchableSelect extends Spine.Controller @shadowInput.trigger('change') @toggle() - onBlur: => + onBlur: -> # @clearAutocomplete() onInput: (event) => @@ -160,7 +160,7 @@ class App.SearchableSelect extends Spine.Controller @option_items .addClass 'is-hidden' .filter -> - this.textContent.match(regex) + @textContent.match(regex) .removeClass 'is-hidden' @highlightFirst() diff --git a/app/assets/javascripts/app/lib/app_post/store.js.coffee b/app/assets/javascripts/app/lib/app_post/store.js.coffee index 7c3924647..bf7f3b6a3 100644 --- a/app/assets/javascripts/app/lib/app_post/store.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/store.js.coffee @@ -23,7 +23,7 @@ class App.Store _instance ?= new _storeSingleton _instance.clear() - @list: () -> + @list: -> if _instance == undefined _instance ?= new _storeSingleton _instance.list() diff --git a/app/assets/javascripts/app/lib/app_post/utils.js.coffee b/app/assets/javascripts/app/lib/app_post/utils.js.coffee index b302b3b6f..c4e1f9196 100644 --- a/app/assets/javascripts/app/lib/app_post/utils.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/utils.js.coffee @@ -162,14 +162,14 @@ class App.Utils # Replace all x tags with the type of replacementTag html.find('h1, h2, h3, h4, h5, h6, textarea').each( -> - outer = this.outerHTML; + outer = @outerHTML; # Replace opening tag - regex = new RegExp('<' + this.tagName, 'i') + regex = new RegExp('<' + @tagName, 'i') newTag = outer.replace(regex, '<' + replacementTag) # Replace closing tag - regex = new RegExp('