From 7f841196a627ab5e4304bbc8a05c409995dfb6dd Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Wed, 22 Apr 2015 14:29:05 -0300 Subject: [PATCH] List in selection only topics that belongs to a category --- index.html | 9 ++------- js/handlebars-helpers.js | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 0c45d56..c8c0c65 100644 --- a/index.html +++ b/index.html @@ -77,16 +77,11 @@ {{#each categories}}
  • {{#link name id}}{{/link}} - + {{#select_proposal ../../article.children slug ../id}}{{/select_proposal}}
  • {{/each}} - +
    diff --git a/js/handlebars-helpers.js b/js/handlebars-helpers.js index b46000d..8a6a1b6 100644 --- a/js/handlebars-helpers.js +++ b/js/handlebars-helpers.js @@ -52,3 +52,23 @@ Handlebars.registerHelper('replace', function(string, to_replace, replacement) { Handlebars.registerHelper('score', function(article) { return article.votes_for - article.votes_against; }); + +Handlebars.registerHelper('select_proposal', function(proposals, category_slug, selected_id) { + var ret = ''; + return ret; +}); + +function proposal_has_category(proposal, category_slug) { + for(var i=0; i