Commit 2710b89e649785a8f2d49145ff04db02e62900a5

Authored by Leandro Santos
1 parent ab03b77e

get child and categories for articles

Showing 2 changed files with 20 additions and 17 deletions   Show diff stats
@@ -26,29 +26,23 @@ @@ -26,29 +26,23 @@
26 </nav> 26 </nav>
27 27
28 <ul id="proposal-categories"> 28 <ul id="proposal-categories">
29 - <li><a href="" id="sau">Saúde</a></li>  
30 - <li><a href="" id="edu">Educação</a></li>  
31 - <li><a href="" id="seg">Segurança</a></li>  
32 - <li><a href="" id="des">Desenvolvimento Social</a></li>  
33 - <li><a href="" id="cid">Cidades</a></li>  
34 - <li><a href="" id="cul">Cultura</a></li>  
35 - <li><a href="" id="esp">Esporte</a></li>  
36 - <li><a href="" id="cin">Cidadania</a></li>  
37 - <li><a href="" id="ges">Gestão Pública</a></li>  
38 - <li><a href="" id="inf">Infraestrutura</a></li>  
39 - <li><a href="" id="eco">Economia</a></li>  
40 - <li><a href="" id="mei">Meio Ambiente</a></li> 29 + {{#each article.categories}}
  30 + <li class="category">
  31 + <img src="{{../host}}{{image.thumb_url}}"/>
  32 + {{#link name id}}{{/link}}
  33 + </li>
  34 + {{/each}}
41 </ul> 35 </ul>
42 36
43 - <ul id="proposal-group">  
44 - {{#each articles}} 37 + <ul id="proposal-group" class='hide'>
  38 + {{#each article.children}}
45 <li class="proposal-item"> 39 <li class="proposal-item">
46 {{#link title id}}{{/link}} 40 {{#link title id}}{{/link}}
47 </li> 41 </li>
48 {{/each}} 42 {{/each}}
49 </ul> 43 </ul>
50 - {{#each articles}}  
51 - <div class='proposal-detail' id="proposal-item-{{id}}"> 44 + {{#each article.children}}
  45 + <div class='proposal-detail hide' id="proposal-item-{{id}}">
52 <div class='title'>{{title}}</div> 46 <div class='title'>{{title}}</div>
53 <span>{{body}}</span> 47 <span>{{body}}</span>
54 </div> 48 </div>
@@ -9,12 +9,21 @@ var resultsPlaceholder = document.getElementById(&#39;proposal-result&#39;); @@ -9,12 +9,21 @@ var resultsPlaceholder = document.getElementById(&#39;proposal-result&#39;);
9 9
10 var topics; 10 var topics;
11 11
  12 +//var host = 'http://www.participa.br';
  13 +var host = 'http://localhost:3000';
  14 +//var private_token = '9350c1488fcae884ad955091a3d2d960';
  15 +var private_token = 'bd8996155f5ea4354e42fee50b4b6891';
  16 +//var proposal_discussion = '92856';
  17 +var proposal_discussion = '401';
  18 +
12 //var noosferoAPI = 'http://localhost:3000/api/v1/articles?private_token=89419a2d331a17e815c3ecc53b303aac&content_type=ProposalsDiscussionPlugin::Topic&parent_id=377&callback=?'; 19 //var noosferoAPI = 'http://localhost:3000/api/v1/articles?private_token=89419a2d331a17e815c3ecc53b303aac&content_type=ProposalsDiscussionPlugin::Topic&parent_id=377&callback=?';
13 20
14 -var noosferoAPI = 'http://www.participa.br/api/v1/articles?private_token=9350c1488fcae884ad955091a3d2d960&content_type=ProposalsDiscussionPlugin::Topic&parent_id=92856&callback=?'; 21 +var noosferoAPI = host + '/api/v1/articles/' + proposal_discussion + '?private_token=' + private_token + '&callback=?';
  22 +//var noosferoAPI = host + '/api/v1/articles?private_token=' + private_token + '&parent_id=401&callback=?';
15 23
16 $.getJSON(noosferoAPI) 24 $.getJSON(noosferoAPI)
17 .done(function( data ) { 25 .done(function( data ) {
  26 + data['host'] = host;
18 resultsPlaceholder.innerHTML = template(data); 27 resultsPlaceholder.innerHTML = template(data);
19 $( 'a' ).click(function(event){ 28 $( 'a' ).click(function(event){
20 var item = this.href.split('#').pop(); 29 var item = this.href.split('#').pop();