Commit 5bbea957b9ad8e5c48e34aec5085055eb63b238f
Exists in
master
and in
11 other branches
Merge branch 'master' of https://gitlab.com/participa/proposal-app
Showing
2 changed files
with
25 additions
and
16 deletions
Show diff stats
index.html
| ... | ... | @@ -64,7 +64,8 @@ |
| 64 | 64 | {{#each categories}} |
| 65 | 65 | <li class='category proposal-category' data-category="{{slug}}"> |
| 66 | 66 | {{#link name id}}{{/link}} |
| 67 | - <select> | |
| 67 | + <select class='proposal-selection'> | |
| 68 | + <option value='{{../id}}' selected> {{../title}}</option> | |
| 68 | 69 | {{#each ../../article.children}} |
| 69 | 70 | <option value='{{id}}'> {{title}}</option> |
| 70 | 71 | {{/each}} | ... | ... |
js/main.js
| ... | ... | @@ -60,20 +60,7 @@ $.getJSON(noosferoAPI) |
| 60 | 60 | }); |
| 61 | 61 | $( '.proposal-item a' ).click(function(event){ |
| 62 | 62 | var item = this.href.split('#').pop(); |
| 63 | - //Display Proposal | |
| 64 | - $('#proposal-categories').hide(); | |
| 65 | - $('#proposal-group').hide(); | |
| 66 | - $('nav').hide(); | |
| 67 | - $('#content').hide(); | |
| 68 | - $('.proposal-detail').hide(); | |
| 69 | - $('#' + item).show(); | |
| 70 | - | |
| 71 | - $('.send-proposal-button').show(); | |
| 72 | - $('.make-proposal-form').hide(); | |
| 73 | - $('.login-container').hide(); | |
| 74 | - | |
| 75 | - var topic_id = this.id.replace('\#',''); | |
| 76 | - loadRandomProposal(topic_id, private_token); | |
| 63 | + display_proposal(item); | |
| 77 | 64 | }); |
| 78 | 65 | $( '.proposal-category a' ).click(function(event){ |
| 79 | 66 | var item = this.href.split('#').pop(); |
| ... | ... | @@ -104,7 +91,9 @@ $.getJSON(noosferoAPI) |
| 104 | 91 | $('.body').toggle(); |
| 105 | 92 | event.preventDefault(); |
| 106 | 93 | }); |
| 107 | - | |
| 94 | + $( '.proposal-selection' ).change(function(event){ | |
| 95 | + display_proposal('proposal-item-' + this.value); | |
| 96 | + }); | |
| 108 | 97 | |
| 109 | 98 | $('.save-article-form').submit(function (e) { |
| 110 | 99 | e.preventDefault(); |
| ... | ... | @@ -214,3 +203,22 @@ function guid() { |
| 214 | 203 | return s4() + s4() + '-' + s4() + '-' + s4() + '-' + |
| 215 | 204 | s4() + '-' + s4() + s4() + s4(); |
| 216 | 205 | } |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | +function display_proposal(item){ | |
| 210 | + //Display Proposal | |
| 211 | + $('#proposal-categories').hide(); | |
| 212 | + $('#proposal-group').hide(); | |
| 213 | + $('nav').hide(); | |
| 214 | + $('#content').hide(); | |
| 215 | + $('.proposal-detail').hide(); | |
| 216 | + $('#' + item).show(); | |
| 217 | + | |
| 218 | + $('.send-proposal-button').show(); | |
| 219 | + $('.make-proposal-form').hide(); | |
| 220 | + $('.login-container').hide(); | |
| 221 | + | |
| 222 | + var topic_id = item.split('-').pop(); | |
| 223 | + loadRandomProposal(topic_id, private_token); | |
| 224 | +} | ... | ... |