# HG changeset patch # User Ludovic Chabant # Date 1384619762 28800 # Node ID 74eb145eb839fb41418bd4549b65e1ac3150d763 # Parent a65cedc183d677aef8b0585fea96690bf669544f Fixed some problems with URLs in the front-end. diff -r a65cedc183d6 -r 74eb145eb839 static/js/wikked/handlebars.js --- a/static/js/wikked/handlebars.js Sat Nov 16 08:35:08 2013 -0800 +++ b/static/js/wikked/handlebars.js Sat Nov 16 08:36:02 2013 -0800 @@ -93,5 +93,21 @@ var date = new Date(timestamp * 1000); return moment(date).fromNow(); }); + + /** + * Format application URLs + */ + Handlebars.registerHelper('get_read_url', function(url, options) { + url = url.toString(); + return '/#/read/' + url.replace(/^\//, ''); + }); + Handlebars.registerHelper('get_edit_url', function(url, options) { + url = url.toString(); + return '/#/edit/' + url.replace(/^\//, ''); + }); + Handlebars.registerHelper('get_cat_url', function(url, options) { + url = url.toString(); + return '/#/category/' + url.replace(/^\//, ''); + }); }); diff -r a65cedc183d6 -r 74eb145eb839 static/js/wikked/models.js --- a/static/js/wikked/models.js Sat Nov 16 08:35:08 2013 -0800 +++ b/static/js/wikked/models.js Sat Nov 16 08:36:02 2013 -0800 @@ -389,7 +389,11 @@ var IncomingLinksModel = exports.IncomingLinksModel = MasterPageModel.extend({ urlRoot: '/api/inlinks/', - action: 'inlinks' + action: 'inlinks', + _onChangePath: function(path) { + IncomingLinksModel.__super__._onChangePath.apply(this, arguments); + this.set('url_read', '/#/read/' + path); + } }); var WikiSearchModel = exports.WikiSearchModel = MasterPageModel.extend({ diff -r a65cedc183d6 -r 74eb145eb839 static/tpl/category.html --- a/static/tpl/category.html Sat Nov 16 08:35:08 2013 -0800 +++ b/static/tpl/category.html Sat Nov 16 08:36:02 2013 -0800 @@ -7,7 +7,7 @@

Pages in category "{{query.category}}"

diff -r a65cedc183d6 -r 74eb145eb839 static/tpl/error-not-found.html --- a/static/tpl/error-not-found.html Sat Nov 16 08:35:08 2013 -0800 +++ b/static/tpl/error-not-found.html Sat Nov 16 08:36:02 2013 -0800 @@ -3,6 +3,6 @@

Not Found

-

The page you're trying to access does not exist. You can create it.

+

The page you're trying to access does not exist. You can create it.

diff -r a65cedc183d6 -r 74eb145eb839 static/tpl/inlinks-page.html --- a/static/tpl/inlinks-page.html Sat Nov 16 08:35:08 2013 -0800 +++ b/static/tpl/inlinks-page.html Sat Nov 16 08:36:02 2013 -0800 @@ -8,9 +8,9 @@ {{#each in_links}}
  • {{#if missing}} - {{url}} + {{url}} {{else}} - {{title}} + {{title}} {{/if}}
  • {{/each}} diff -r a65cedc183d6 -r 74eb145eb839 static/tpl/read-page.html --- a/static/tpl/read-page.html Sat Nov 16 08:35:08 2013 -0800 +++ b/static/tpl/read-page.html Sat Nov 16 08:36:02 2013 -0800 @@ -3,10 +3,10 @@

    {{meta.title}}

    {{#if redirected_from}} - Redirected from {{redirected_from}} + Redirected from {{redirected_from}} {{/if}} {{#if meta.redirect}} - Redirects to {{redirects_to}} + Redirects to {{redirects_to}} {{/if}}
    {{/ifnot}} @@ -17,7 +17,7 @@ {{/if}} diff -r a65cedc183d6 -r 74eb145eb839 static/tpl/search-results.html --- a/static/tpl/search-results.html Sat Nov 16 08:35:08 2013 -0800 +++ b/static/tpl/search-results.html Sat Nov 16 08:36:02 2013 -0800 @@ -10,7 +10,7 @@