History

Move doc links to manifest

Thibaut committed 11 years ago

Commit b29d6ca1 parent 34e804d7 files · +50 −36Browse files

Showing the changes to assets/javascripts (2 of 7 files). Show all

Unified · Split

2 files
  1. assets/javascripts/models/doc.coffee +1 −1
  2. assets/javascripts/views/content/entry_page.coffee +13 −1
assets/javascripts/models/doc.coffee+1−1
@@ -1,5 +1,5 @@
11 class app.models.Doc extends app.Model
2− # Attributes: name, slug, type, version, index_path, db_path, db_size, mtime
2+ # Attributes: name, slug, type, version, index_path, db_path, db_size, mtime, links
33
44 constructor: ->
55 super
assets/javascripts/views/content/entry_page.coffee+13−1
@@ -36,6 +36,18 @@ class app.views.EntryPage extends app.View · 35 unmodified lines
3636 @trigger 'loaded'
3737 return
3838
39+ LINKS =
40+ home: 'Homepage'
41+ code: 'Source code'
42+
43+ prepareContent: (content) ->
44+ return content unless @entry.isIndex() and @entry.doc.links
45+
46+ links = for link, url of @entry.doc.links
47+ """<a href="#{url}" class="_links-link">#{LINKS[link]}</a>"""
48+
49+ """<p class="_links">#{links.join('')}</p>#{content}"""
50+
3951 empty: ->
4052 @subview?.deactivate()
4153 @subview = null
@@ -78,7 +90,7 @@ class app.views.EntryPage extends app.View · 36 unmodified lines
7890
7991 onSuccess: (response) =>
8092 @xhr = null
81− @render response
93+ @render @prepareContent(response)
8294 return
8395
8496 onError: =>