Showing the changes to assets/javascripts (2 of 7 files). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | 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 | |
| 3 | 3 | |
| 4 | 4 | constructor: -> |
| 5 | 5 | super |
| @@ -36,6 +36,18 @@ class app.views.EntryPage extends app.View · 35 unmodified lines | ||
| 36 | 36 | @trigger 'loaded' |
| 37 | 37 | return |
| 38 | 38 | |
| 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 | + | |
| 39 | 51 | empty: -> |
| 40 | 52 | @subview?.deactivate() |
| 41 | 53 | @subview = null |
| @@ -78,7 +90,7 @@ class app.views.EntryPage extends app.View · 36 unmodified lines | ||
| 78 | 90 | |
| 79 | 91 | onSuccess: (response) => |
| 80 | 92 | @xhr = null |
| 81 | − @render response | |
| 93 | + @render @prepareContent(response) | |
| 82 | 94 | return |
| 83 | 95 | |
| 84 | 96 | onError: => |