Coffeelint next level.

This commit is contained in:
Martin Edenhofer 2015-09-24 08:54:23 +02:00
parent a5cbe9148a
commit e73a5762b7
44 changed files with 203 additions and 24 deletions

View file

@ -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

View file

@ -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' )

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.active extends App.UiElement.ApplicationUiElement
@render: (attribute, params) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.autocompletion
@render: (attribute, params) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.autocompletion_ajax
@render: (attribute, params = {}) ->
if params[attribute.name]

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.boolean extends App.UiElement.ApplicationUiElement
@render: (attribute, params) ->

View file

@ -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 =

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.checkbox extends App.UiElement.ApplicationUiElement
@render: (attribute, params) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.date
@render: (attributeOrig) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.datetime
@render: (attributeOrig) ->

View file

@ -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)

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.holiday_selector
@render: (attribute, params) ->
console.log('aa', attribute)

View file

@ -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)

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.input
@render: (attribute) ->
$( App.view('generic/input')( attribute: attribute ) )

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.postmaster_match
@defaults: ->
groups =

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.postmaster_set
@defaults: ->
groups =

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.radio extends App.UiElement.ApplicationUiElement
@render: (attribute, params) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.richtext
@render: (attribute) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.searchable_select extends App.UiElement.ApplicationUiElement
@render: (attribute, params) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.select extends App.UiElement.ApplicationUiElement
@render: (attribute, params) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.sla_times
@render: (attribute, params = {}) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.tag
@render: (attribute) ->
item = $( App.view('generic/input')( attribute: attribute ) )

View file

@ -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 )

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.ticket_perform_action
@defaults: ->
defaults = ['ticket.state_id']

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.ticket_selector
@defaults: ->
defaults = ['ticket.state_id']

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.timezone extends App.UiElement.ApplicationUiElement
@render: (attribute, params) ->

View file

@ -1,3 +1,4 @@
# coffeelint: disable=camel_case_classes
class App.UiElement.user_autocompletion
@render: (attribute) ->
new App.UserOrganizationAutocompletion( attribute: attribute ).element()

View file

@ -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'

View file

@ -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

View file

@ -121,7 +121,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
# start oorganization popups
@organizationPopups()
render: () ->
render: ->
# reset result cache
@searchResultCache = {}

View file

@ -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

View file

@ -65,7 +65,7 @@ class App.OnlineNotificationWidget extends App.Controller
processData: true
)
removeClickCatcher: () =>
removeClickCatcher: =>
return if !@clickCatcher
@clickCatcher.remove()
@clickCatcher = null

View file

@ -1,3 +1,4 @@
# coffeelint: disable=no_backticks
class App.Track
_instance = undefined

View file

@ -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)

View file

@ -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()

View file

@ -23,7 +23,7 @@ class App.Store
_instance ?= new _storeSingleton
_instance.clear()
@list: () ->
@list: ->
if _instance == undefined
_instance ?= new _storeSingleton
_instance.list()

View file

@ -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('</' + this.tagName, 'i')
regex = new RegExp('</' + @tagName, 'i')
newTag = newTag.replace(regex, '</' + replacementTag)
$(@).replaceWith(newTag)

View file

@ -1,3 +1,4 @@
# coffeelint: disable=no_this,indentation
Spine = @Spine or require('spine')
$ = Spine.$
Model = Spine.Model

View file

@ -1,3 +1,4 @@
# coffeelint: disable=no_this
BindingsClass =
model: 'model'

View file

@ -1,3 +1,4 @@
# coffeelint: disable=no_this
Spine = @Spine or require('spine')
$ = Spine.$

View file

@ -1,3 +1,4 @@
# coffeelint: disable=no_this,indentation,no_unnecessary_fat_arrows
Spine = @Spine or require('spine')
class Collection extends Spine.Module

View file

@ -1,3 +1,4 @@
# coffeelint: disable=no_this,indentation
Spine = @Spine or require('spine')
$ = Spine.$

View file

@ -1,3 +1,4 @@
# coffeelint: disable=no_this
###
Spine.js MVC library
Released under the MIT License

135
coffeelint.json Normal file
View file

@ -0,0 +1,135 @@
{
"arrow_spacing": {
"level": "ignore"
},
"braces_spacing": {
"level": "ignore",
"spaces": 0,
"empty_object_spaces": 0
},
"camel_case_classes": {
"level": "error"
},
"coffeescript_error": {
"level": "error"
},
"colon_assignment_spacing": {
"level": "ignore",
"spacing": {
"left": 0,
"right": 0
}
},
"cyclomatic_complexity": {
"value": 10,
"level": "ignore"
},
"duplicate_key": {
"level": "error"
},
"empty_constructor_needs_parens": {
"level": "ignore"
},
"ensure_comprehensions": {
"level": "warn"
},
"eol_last": {
"level": "ignore"
},
"indentation": {
"value": 2,
"level": "error"
},
"line_endings": {
"level": "ignore",
"value": "unix"
},
"max_line_length": {
"value": 800,
"level": "error",
"limitComments": true
},
"missing_fat_arrows": {
"level": "ignore",
"is_strict": false
},
"newlines_after_classes": {
"value": 3,
"level": "ignore"
},
"no_backticks": {
"level": "error"
},
"no_debugger": {
"level": "warn",
"console": false
},
"no_empty_functions": {
"level": "ignore"
},
"no_empty_param_list": {
"level": "warn"
},
"no_implicit_braces": {
"level": "ignore",
"strict": true
},
"no_implicit_parens": {
"strict": true,
"level": "ignore"
},
"no_interpolation_in_single_quotes": {
"level": "warn"
},
"no_nested_string_interpolation": {
"level": "warn"
},
"no_plusplus": {
"level": "ignore"
},
"no_private_function_fat_arrows": {
"level": "warn"
},
"no_stand_alone_at": {
"level": "ignore"
},
"no_tabs": {
"level": "error"
},
"no_this": {
"level": "warn"
},
"no_throwing_strings": {
"level": "ignore"
},
"no_trailing_semicolons": {
"level": "error"
},
"no_trailing_whitespace": {
"level": "error",
"allowed_in_comments": false,
"allowed_in_empty_lines": true
},
"no_unnecessary_double_quotes": {
"level": "ignore"
},
"no_unnecessary_fat_arrows": {
"level": "warn"
},
"non_empty_constructor_needs_parens": {
"level": "ignore"
},
"prefer_english_operator": {
"level": "ignore",
"doubleNotLevel": "ignore"
},
"space_operators": {
"level": "ignore"
},
"spacing_after_comma": {
"level": "ignore"
},
"transform_messes_up_line_numbers": {
"level": "warn"
}
}