From 5292feea05d1fa388ddd504a9a0d1aa2665ec0c9 Mon Sep 17 00:00:00 2001 From: Arvind Date: Fri, 23 Nov 2012 19:02:20 +0530 Subject: [PATCH] Merging code for differentiating content based on tags --- .gitignore | 2 ++ js/main.js | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d2d6f36..abe3b3a 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ nosetests.xml .mr.developer.cfg .project .pydevproject + +*.*~ diff --git a/js/main.js b/js/main.js index 8b13789..679bfbf 100644 --- a/js/main.js +++ b/js/main.js @@ -1 +1,19 @@ - +var template = _.template($('#image-template').html()); +$("#select").on('change',onSelectChange); +M = {}; +$.getJSON("http://localhost:60/js/maraa.json",function(data){ + M = data; + _.each(data.image_list, function(item) { + if(item.tag == "CR") + x = $('#imgs').append(template({ + img: item.image + }))}); +}); +function onSelectChange(e){ + $("#imgs").html(''); + _.each(M.image_list, function(item) { + if(item.tag == e.currentTarget.value) + x = $('#imgs').append(template({ + img: item.image + }));}); +} -- 1.7.10.4