Improve EntryPage#subViewClass

pull/344/merge
Thibaut Courouble 9 years ago
parent 0948b5882e
commit ed2806499e

@ -272,6 +272,12 @@ $.escapeRegexp = (string) ->
$.urlDecode = (string) ->
decodeURIComponent string.replace(/\+/g, '%20')
$.classify = (string) ->
string = string.split('_')
for substr, i in string
string[i] = substr[0].toUpperCase() + substr[1..]
string.join('')
#
# Miscellaneous
#

@ -71,8 +71,7 @@ class app.views.EntryPage extends app.View
return
subViewClass: ->
docType = @entry.doc.type
app.views["#{docType[0].toUpperCase()}#{docType[1..]}Page"] or app.views.BasePage
app.views["#{$.classify(@entry.doc.type)}Page"] or app.views.BasePage
getTitle: ->
@entry.doc.fullName + if @entry.isIndex() then ' documentation' else " / #{@entry.name}"

Loading…
Cancel
Save