CoffeeScript 1.7

pull/62/merge
Thibaut 11 years ago
parent 722a045475
commit 71afc2efa3

@ -121,7 +121,7 @@ pathtoRegexp = (path, keys) ->
path = "(#{path.join '|'})" if path instanceof Array path = "(#{path.join '|'})" if path instanceof Array
path = path path = path
.replace(/\/\(/g, '(?:/') .replace /\/\(/g, '(?:/'
.replace /(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, (_, slash = '', format = '', key, capture, optional) -> .replace /(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, (_, slash = '', format = '', key, capture, optional) ->
keys.push name: key, optional: !!optional keys.push name: key, optional: !!optional
str = if optional then '' else slash str = if optional then '' else slash
@ -132,8 +132,8 @@ pathtoRegexp = (path, keys) ->
str += ')' str += ')'
str += optional if optional str += optional if optional
str str
.replace(/([\/.])/g, '\\$1') .replace /([\/.])/g, '\\$1'
.replace(/\*/g, '(.*)') .replace /\*/g, '(.*)'
new RegExp "^#{path}$" new RegExp "^#{path}$"

@ -11,11 +11,11 @@ class app.models.Entry extends app.Model
searchValue: -> searchValue: ->
@name @name
.toLowerCase() .toLowerCase()
.replace('...', ' ') .replace '...', ' '
.replace(' event', '') .replace ' event', ''
.replace(SEPARATORS_REGEXP, '.') .replace SEPARATORS_REGEXP, '.'
.replace(/\.+/g, '.') .replace /\.+/g, '.'
.replace(PARANTHESES_REGEXP, '') .replace PARANTHESES_REGEXP, ''
.trim() .trim()
fullPath: -> fullPath: ->

@ -28,12 +28,12 @@ class app.views.Content extends app.View
@entryPage = new app.views.EntryPage @entryPage = new app.views.EntryPage
@entryPage @entryPage
.on('loading', @onEntryLoading) .on 'loading', @onEntryLoading
.on('loaded', @onEntryLoaded) .on 'loaded', @onEntryLoaded
app app
.on('ready', @onReady) .on 'ready', @onReady
.on('bootError', @onBootError) .on 'bootError', @onBootError
return return

@ -23,8 +23,8 @@ class app.views.Mobile extends app.View
$.on $('._search'), 'touchend', @onTapSearch $.on $('._search'), 'touchend', @onTapSearch
app.document.sidebar.search app.document.sidebar.search
.on('searching', @showSidebar) .on 'searching', @showSidebar
.on('clear', @hideSidebar) .on 'clear', @hideSidebar
@activate() @activate()
return return

@ -61,7 +61,7 @@ class app.views.PaginatedList extends app.View
paginateTo: (object) -> paginateTo: (object) ->
index = @data.indexOf(object) index = @data.indexOf(object)
if index >= PER_PAGE if index >= PER_PAGE
@paginateNext() for [0...Math.floor(index / PER_PAGE)] @paginateNext() for [0...(index // PER_PAGE)]
return return
hideTopPage: -> hideTopPage: ->

@ -16,8 +16,8 @@ class app.views.Results extends app.View
@addSubview @listFocus = new app.views.ListFocus @el unless $.isTouchScreen() @addSubview @listFocus = new app.views.ListFocus @el unless $.isTouchScreen()
@search @search
.on('results', @onResults) .on 'results', @onResults
.on('clear', @onClear) .on 'clear', @onClear
return return
onResults: (entries, flags) => onResults: (entries, flags) =>

@ -14,8 +14,8 @@ class app.views.Sidebar extends app.View
@addSubview @search = new app.views.Search @addSubview @search = new app.views.Search
@search @search
.on('searching', @showResults) .on 'searching', @showResults
.on('clear', @showDocList) .on 'clear', @showDocList
@results = new app.views.Results @search @results = new app.views.Results @search
@docList = new app.views.DocList @docList = new app.views.DocList

Loading…
Cancel
Save