Commit 4df02e37ea2679a2bab98541e067aa16704306af
1 parent
1ce4dbee
Exists in
master
and in
11 other branches
adding proposal item selection
Showing
2 changed files
with
25 additions
and
16 deletions
Show diff stats
index.html
@@ -64,7 +64,8 @@ | @@ -64,7 +64,8 @@ | ||
64 | {{#each categories}} | 64 | {{#each categories}} |
65 | <li class='category proposal-category' data-category="{{slug}}"> | 65 | <li class='category proposal-category' data-category="{{slug}}"> |
66 | {{#link name id}}{{/link}} | 66 | {{#link name id}}{{/link}} |
67 | - <select> | 67 | + <select class='proposal-selection'> |
68 | + <option value='{{../id}}' selected> {{../title}}</option> | ||
68 | {{#each ../../article.children}} | 69 | {{#each ../../article.children}} |
69 | <option value='{{id}}'> {{title}}</option> | 70 | <option value='{{id}}'> {{title}}</option> |
70 | {{/each}} | 71 | {{/each}} |
js/main.js
@@ -60,20 +60,7 @@ $.getJSON(noosferoAPI) | @@ -60,20 +60,7 @@ $.getJSON(noosferoAPI) | ||
60 | }); | 60 | }); |
61 | $( '.proposal-item a' ).click(function(event){ | 61 | $( '.proposal-item a' ).click(function(event){ |
62 | var item = this.href.split('#').pop(); | 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 | $( '.proposal-category a' ).click(function(event){ | 65 | $( '.proposal-category a' ).click(function(event){ |
79 | var item = this.href.split('#').pop(); | 66 | var item = this.href.split('#').pop(); |
@@ -104,7 +91,9 @@ $.getJSON(noosferoAPI) | @@ -104,7 +91,9 @@ $.getJSON(noosferoAPI) | ||
104 | $('.body').toggle(); | 91 | $('.body').toggle(); |
105 | event.preventDefault(); | 92 | event.preventDefault(); |
106 | }); | 93 | }); |
107 | - | 94 | + $( '.proposal-selection' ).change(function(event){ |
95 | + display_proposal('proposal-item-' + this.value); | ||
96 | + }); | ||
108 | 97 | ||
109 | $('.save-article-form').submit(function (e) { | 98 | $('.save-article-form').submit(function (e) { |
110 | e.preventDefault(); | 99 | e.preventDefault(); |
@@ -214,3 +203,22 @@ function guid() { | @@ -214,3 +203,22 @@ function guid() { | ||
214 | return s4() + s4() + '-' + s4() + '-' + s4() + '-' + | 203 | return s4() + s4() + '-' + s4() + '-' + s4() + '-' + |
215 | s4() + '-' + s4() + s4() + s4(); | 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 = this.id.replace('\#',''); | ||
223 | + loadRandomProposal(topic_id, private_token); | ||
224 | +} |