diff --git a/assets/javascripts/lib/util.coffee b/assets/javascripts/lib/util.coffee index 4fd341d6..30f0493e 100644 --- a/assets/javascripts/lib/util.coffee +++ b/assets/javascripts/lib/util.coffee @@ -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 # diff --git a/assets/javascripts/views/content/entry_page.coffee b/assets/javascripts/views/content/entry_page.coffee index da073192..38449d0e 100644 --- a/assets/javascripts/views/content/entry_page.coffee +++ b/assets/javascripts/views/content/entry_page.coffee @@ -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}"