Commit 1f3b224781a82793ac9a287b93c22c305b25213a
Exists in
jasmine-testing
Merge with master updates
Showing
11 changed files
with
484 additions
and
26 deletions
Show diff stats
index.html
js/handlebars-helpers.js
@@ -65,9 +65,19 @@ define(['handlebars'], function(Handlebars){ | @@ -65,9 +65,19 @@ define(['handlebars'], function(Handlebars){ | ||
65 | return article.votes_for - article.votes_against; | 65 | return article.votes_for - article.votes_against; |
66 | }); | 66 | }); |
67 | 67 | ||
68 | + Handlebars.registerHelper('apoio', function(article) { | ||
69 | + // return (article.votes_for - article.votes_against)/(article.countViews); | ||
70 | + return 0; | ||
71 | + }); | ||
72 | + | ||
73 | + Handlebars.registerHelper('participacao', function(article) { | ||
74 | + // return (article.votes_for + article.votes_against)/(article.countViews); | ||
75 | + return 0; | ||
76 | + }); | ||
77 | + | ||
68 | Handlebars.registerHelper('select_proposal', function(proposals, category_slug, selected_id) { | 78 | Handlebars.registerHelper('select_proposal', function(proposals, category_slug, selected_id) { |
69 | var ret = '<label for="proposal-selection" class="sr-only">Selecione o programa</label>' | 79 | var ret = '<label for="proposal-selection" class="sr-only">Selecione o programa</label>' |
70 | - ret = ret + '<select id="proposal-selection" name="proposal-selection" title="Selecione o programa" class="proposal-selection">'; | 80 | + ret = ret + '<select id="proposal-selection" name="proposal-selection" data-proposal="'+selected_id+'" title="Selecione o programa" class="proposal-selection">'; |
71 | 81 | ||
72 | for(var i=0; i<proposals.length; i++) { | 82 | for(var i=0; i<proposals.length; i++) { |
73 | if(!proposal_has_category(proposals[i], category_slug)) continue; | 83 | if(!proposal_has_category(proposals[i], category_slug)) continue; |
@@ -0,0 +1,7 @@ | @@ -0,0 +1,7 @@ | ||
1 | +/*! | ||
2 | + * jQuery-ajaxTransport-XDomainRequest - v1.0.3 - 2014-06-06 | ||
3 | + * https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest | ||
4 | + * Copyright (c) 2014 Jason Moon (@JSONMOON) | ||
5 | + * Licensed MIT (/blob/master/LICENSE.txt) | ||
6 | + */ | ||
7 | +(function(a){if(typeof define==='function'&&define.amd){define(['jquery'],a)}else if(typeof exports==='object'){module.exports=a(require('jquery'))}else{a(jQuery)}}(function($){if($.support.cors||!$.ajaxTransport||!window.XDomainRequest){return}var n=/^https?:\/\//i;var o=/^get|post$/i;var p=new RegExp('^'+location.protocol,'i');$.ajaxTransport('* text html xml json',function(j,k,l){if(!j.crossDomain||!j.async||!o.test(j.type)||!n.test(j.url)||!p.test(j.url)){return}var m=null;return{send:function(f,g){var h='';var i=(k.dataType||'').toLowerCase();m=new XDomainRequest();if(/^\d+$/.test(k.timeout)){m.timeout=k.timeout}m.ontimeout=function(){g(500,'timeout')};m.onload=function(){var a='Content-Length: '+m.responseText.length+'\r\nContent-Type: '+m.contentType;var b={code:200,message:'success'};var c={text:m.responseText};try{if(i==='html'||/text\/html/i.test(m.contentType)){c.html=m.responseText}else if(i==='json'||(i!=='text'&&/\/json/i.test(m.contentType))){try{c.json=$.parseJSON(m.responseText)}catch(e){b.code=500;b.message='parseerror'}}else if(i==='xml'||(i!=='text'&&/\/xml/i.test(m.contentType))){var d=new ActiveXObject('Microsoft.XMLDOM');d.async=false;try{d.loadXML(m.responseText)}catch(e){d=undefined}if(!d||!d.documentElement||d.getElementsByTagName('parsererror').length){b.code=500;b.message='parseerror';throw'Invalid XML: '+m.responseText;}c.xml=d}}catch(parseMessage){throw parseMessage;}finally{g(b.code,b.message,c,a)}};m.onprogress=function(){};m.onerror=function(){g(500,'error',{text:m.responseText})};if(k.data){h=($.type(k.data)==='string')?k.data:$.param(k.data)}m.open(j.type,j.url);m.send(h)},abort:function(){if(m){m.abort()}}}})})); | ||
0 | \ No newline at end of file | 8 | \ No newline at end of file |
js/main.js
@@ -30,6 +30,353 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | @@ -30,6 +30,353 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | ||
30 | //var proposal_discussion = '401'; //casa | 30 | //var proposal_discussion = '401'; //casa |
31 | } | 31 | } |
32 | 32 | ||
33 | + var BARRA_ADDED = false; | ||
34 | + var HIDE_BARRA_DO_GOVERNO = false; | ||
35 | + | ||
36 | + Main = (function(){ | ||
37 | + | ||
38 | + return { | ||
39 | + loadRandomProposal: function (topic_id, private_token) { | ||
40 | + var $noProposals = $('.no-proposals'); | ||
41 | + var $loading = $('.loading'); | ||
42 | + var $randomProposal = $('.random-proposal'); | ||
43 | + var $body = $(document.body); | ||
44 | + var contextMain = this; | ||
45 | + | ||
46 | + // reset view | ||
47 | + $noProposals.hide(); | ||
48 | + $loading.show(); | ||
49 | + $randomProposal.html(''); | ||
50 | + | ||
51 | + var url = host + '/api/v1/articles/' + topic_id + '/children' + '?private_token=' + private_token + '&limit=1&order=random()&_='+new Date().getTime()+'&fields=id,name,abstract,created_by&content_type=ProposalsDiscussionPlugin::Proposal'; | ||
52 | + $.getJSON(url).done(function( data ) { | ||
53 | + $loading.hide(); | ||
54 | + | ||
55 | + if(data.articles.length === 0) { | ||
56 | + $noProposals.show(); | ||
57 | + return; | ||
58 | + } | ||
59 | + | ||
60 | + var article = data.articles[0]; | ||
61 | + $randomProposal.html(supportProposalTemplate(article)); | ||
62 | + $body.off('click', '.vote-actions .skip'); | ||
63 | + $body.on('click', '.vote-actions .skip', function(e) { | ||
64 | + contextMain.loadRandomProposal(topic_id, private_token); | ||
65 | + e.preventDefault(); | ||
66 | + }); | ||
67 | + $body.off('click', '.vote-actions .like'); | ||
68 | + $body.on('click', '.vote-actions .like', function(e) { | ||
69 | + //Helps to prevent more than one vote per proposal | ||
70 | + if(ProposalApp.hasProposalbeenVoted(article.id)){ | ||
71 | + console.log("Proposta " + article.id + " já havia sido votada"); | ||
72 | + contextMain.loadRandomProposal(topic_id, private_token); | ||
73 | + e.preventDefault(); | ||
74 | + return; | ||
75 | + } | ||
76 | + $.ajax({ | ||
77 | + type: 'post', | ||
78 | + url: host + '/api/v1/articles/' + article.id + '/vote', | ||
79 | + data: { | ||
80 | + value: $(this).data('vote-value'), | ||
81 | + private_token: private_token | ||
82 | + } | ||
83 | + }).done(function( /*data*/ ) { | ||
84 | + ProposalApp.addVotedProposal(article.id); | ||
85 | + contextMain.loadRandomProposal(topic_id, private_token); | ||
86 | + }); | ||
87 | + e.preventDefault(); | ||
88 | + }); | ||
89 | + | ||
90 | + $body.off('click', '.vote-result'); | ||
91 | + $body.on('click', '.vote-result', function(e) { | ||
92 | + | ||
93 | + var $this = $(this); | ||
94 | + var $proposalDetail = $this.parents('.proposal-detail'); | ||
95 | + var $resultsContainer = $proposalDetail.find('.results-container'); | ||
96 | + | ||
97 | + // $resultsContainer.toggle(); | ||
98 | + // $resultsContainer.toggleClass('hide'); | ||
99 | + | ||
100 | + if($resultsContainer.css('display') === 'none') { | ||
101 | + | ||
102 | + $resultsContainer.find('.loading').show(); | ||
103 | + $resultsContainer.find('.results-content').hide(); | ||
104 | + | ||
105 | + var url = host + '/api/v1/articles/' + topic_id + '/children' + '?private_token=' + private_token + '&limit=10&order=votes_score&fields=id,name,abstract,votes_for,votes_against&content_type=ProposalsDiscussionPlugin::Proposal'; | ||
106 | + $.getJSON(url).done(function( data ) { | ||
107 | + | ||
108 | + $resultsContainer.html(resultsTemplate(data)); | ||
109 | + $resultsContainer.find('.loading').hide(); | ||
110 | + $resultsContainer.find('.results-content').show(); | ||
111 | + $resultsContainer.show(); | ||
112 | + | ||
113 | + // scroll to the end | ||
114 | + $('html, body').animate({ | ||
115 | + scrollTop: $(document).height() | ||
116 | + }, 'fast'); | ||
117 | + }); | ||
118 | + $('.experience-proposal-container').hide(); | ||
119 | + $('.talk-proposal-container').hide(); | ||
120 | + } else { | ||
121 | + $('.experience-proposal-container').show(); | ||
122 | + $('.talk-proposal-container').show(); | ||
123 | + $resultsContainer.hide(); | ||
124 | + } | ||
125 | + | ||
126 | + e.preventDefault(); | ||
127 | + }); | ||
128 | + }); | ||
129 | + }, | ||
130 | + | ||
131 | + loginCallback: function(loggedIn, token) { | ||
132 | + logged_in = loggedIn; | ||
133 | + $('.login .message').text(''); | ||
134 | + | ||
135 | + if(logged_in) { | ||
136 | + if(token){ | ||
137 | + private_token = token; | ||
138 | + } | ||
139 | + loginButton.siblings('.save-article-form').show(); | ||
140 | + loginButton.siblings('.save-article-form .message').show(); | ||
141 | + loginButton.siblings('.login-container').hide(); | ||
142 | + $.cookie('_dialoga_session', private_token); | ||
143 | + } else { | ||
144 | + loginButton.siblings('.save-article-form').hide(); | ||
145 | + loginButton.siblings('.login-container').show(); | ||
146 | + } | ||
147 | + }, | ||
148 | + guid: function() { | ||
149 | + function s4() { | ||
150 | + return Math.floor((1 + Math.random()) * 0x10000) | ||
151 | + .toString(16) | ||
152 | + .substring(1); | ||
153 | + } | ||
154 | + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); | ||
155 | + }, | ||
156 | + display_category_tab: function(){ | ||
157 | + $('#proposal-group').hide(); | ||
158 | + $('#proposal-categories').show(); | ||
159 | + $('#nav-proposal-categories a').addClass('active'); | ||
160 | + $('#nav-proposal-group a').removeClass('active'); | ||
161 | + $('.proposal-category-items').hide(); | ||
162 | + $('.proposal-category .arrow-box').hide(); | ||
163 | + $('.proposal-detail').hide(); | ||
164 | + | ||
165 | + $('#content').show(); | ||
166 | + $('nav').show(); | ||
167 | + }, | ||
168 | + display_proposals_tab: function(){ | ||
169 | + $('#proposal-categories').hide(); | ||
170 | + $('#proposal-group').show(); | ||
171 | + $('#nav-proposal-group a').addClass('active'); | ||
172 | + $('#nav-proposal-categories a').removeClass('active'); | ||
173 | + $('#content').show(); | ||
174 | + $('nav').show(); | ||
175 | + }, | ||
176 | + display_proposal: function(proposal_id){ | ||
177 | + $('#proposal-categories').hide(); | ||
178 | + $('#proposal-group').hide(); | ||
179 | + $('nav').hide(); | ||
180 | + $('#content').hide(); | ||
181 | + // $('.make-proposal-form').hide(); | ||
182 | + // $('.login-container').hide(); | ||
183 | + $('.proposal-detail').hide(); // hide all proposals | ||
184 | + // $('.proposal-detail-base').hide(); | ||
185 | + $proposal = $('#' + proposal_id); | ||
186 | + $proposal.find('.proposal-detail-base').hide(); | ||
187 | + $proposal.show(); | ||
188 | + $proposal.find('.proposal-header').show(); | ||
189 | + $proposal.find('.make-proposal-container').show(); | ||
190 | + $proposal.find('.support-proposal-container').show(); | ||
191 | + $proposal.find('.results-container').hide(); | ||
192 | + $proposal.find('.results-container .loading').hide(); | ||
193 | + $proposal.find('.results-container .results-content').hide(); | ||
194 | + $proposal.find('.experience-proposal-container').show(); | ||
195 | + $proposal.find('.talk-proposal-container').show(); | ||
196 | + $proposal.find('.calendar').slick(); | ||
197 | + | ||
198 | + var topic_id = proposal_id.split('-').pop(); | ||
199 | + this.loadRandomProposal(topic_id, private_token); | ||
200 | + }, | ||
201 | + display_proposal_detail: function(proposal_id){ | ||
202 | + $('#proposal-categories').hide(); | ||
203 | + $('#proposal-group').hide(); | ||
204 | + $('nav').hide(); | ||
205 | + $('#content').hide(); | ||
206 | + $proposal = $('#proposal-item-' + proposal_id); | ||
207 | + $proposal.find('.make-proposal-form').hide(); | ||
208 | + $proposal.find('.proposal-header').hide(); | ||
209 | + $proposal.find('.make-proposal-container').hide(); | ||
210 | + $proposal.find('.support-proposal-container').hide(); | ||
211 | + $proposal.find('.results-container').hide(); | ||
212 | + $proposal.find('.experience-proposal-container').hide(); | ||
213 | + $proposal.find('.talk-proposal-container').hide(); | ||
214 | + $proposal.find('.body').show(); | ||
215 | + $proposal.show(); | ||
216 | + | ||
217 | + var url = host + '/api/v1/articles/' + proposal_id + '?private_token=' + private_token + '&fields=id,body&content_type=ProposalsDiscussionPlugin::Topic'; | ||
218 | + $.getJSON(url).done(function( data ) { | ||
219 | + $('#proposal-item-' + proposal_id + ' .body-content').replaceWith(data.article.body); | ||
220 | + }) | ||
221 | + .fail(function( jqxhr, textStatus, error ) { | ||
222 | + var err = textStatus + ', ' + error; | ||
223 | + console.log( 'Request Failed: ' + err ); | ||
224 | + }); | ||
225 | + }, | ||
226 | + display_proposal_by_category: function(item){ | ||
227 | + var $item = $('#' + item); | ||
228 | + | ||
229 | + if($item.hasClass('proposal-category-items')){ | ||
230 | + //Display Topics or Discussion by category | ||
231 | + $('nav').show(); | ||
232 | + $('#content').show(); | ||
233 | + $('#proposal-categories').show(); | ||
234 | + $('#nav-proposal-categories a').addClass('active'); | ||
235 | + $('#nav-proposal-group a').removeClass('active'); | ||
236 | + $('.proposal-category-items').hide(); | ||
237 | + $('.proposal-detail').hide(); | ||
238 | + $item.toggle( 'blind', 1000 ); | ||
239 | + $('.proposal-category .arrow-box').hide(); | ||
240 | + var categorySlug = $item.data('category'); | ||
241 | + $('#proposal-category-' + categorySlug).find('.arrow-box').show(); | ||
242 | + } | ||
243 | + }, | ||
244 | + addBarraDoGoverno: function(){ | ||
245 | + | ||
246 | + if( BARRA_ADDED ) { return; } | ||
247 | + | ||
248 | + var HTML_BODY_PREPEND = '' + | ||
249 | + '<div id="barra-brasil" style="background:#7F7F7F; height: 20px; padding:0 0 0 10px;display:block;"> ' + | ||
250 | + '<ul id="menu-barra-temp" style="list-style:none;">' + | ||
251 | + '<li style="display:inline; float:left;padding-right:10px; margin-right:10px; border-right:1px solid #EDEDED"><a href="http://brasil.gov.br" style="font-family:sans,sans-serif; text-decoration:none; color:white;">Portal do Governo Brasileiro</a></li> ' + | ||
252 | + '<li><a style="font-family:sans,sans-serif; text-decoration:none; color:white;" href="http://epwg.governoeletronico.gov.br/barra/atualize.html">Atualize sua Barra de Governo</a></li>' + | ||
253 | + '</ul>' + | ||
254 | + '</div>'; | ||
255 | + | ||
256 | + var HTML_BODY_APPEND = ''+ | ||
257 | + '<div id="footer-brasil"></div>' + | ||
258 | + '<script defer="defer" src="http://barra.brasil.gov.br/barra.js" type="text/javascript"></script>'; | ||
259 | + | ||
260 | + var STYLE_TEMA_AZUL = '' + | ||
261 | + '<style>'+ | ||
262 | + '#footer-brasil {'+ | ||
263 | + 'background: none repeat scroll 0% 0% #0042b1;'+ | ||
264 | + 'padding: 1em 0px;'+ | ||
265 | + 'max-width: 100%;'+ | ||
266 | + 'margin-top: 40px;'+ | ||
267 | + '}'+ | ||
268 | + '#barra-brasil ul {'+ | ||
269 | + 'width: auto;'+ | ||
270 | + '}'+ | ||
271 | + '<style>'; | ||
272 | + | ||
273 | + var $body = $(document.body); | ||
274 | + $body.prepend(HTML_BODY_PREPEND); | ||
275 | + $body.append(HTML_BODY_APPEND); | ||
276 | + $body.append(STYLE_TEMA_AZUL); | ||
277 | + | ||
278 | + BARRA_ADDED = true; | ||
279 | + }, | ||
280 | + updateHash: function(hash){ | ||
281 | + var id = hash.replace(/^.*#/, ''); | ||
282 | + var elem = document.getElementById(id); | ||
283 | + | ||
284 | + // preserve the query param | ||
285 | + // if (HIDE_BARRA_DO_GOVERNO && (hash.indexOf('?barra=false') === -1)){ | ||
286 | + // hash += '?barra=false'; | ||
287 | + // } | ||
288 | + | ||
289 | + if ( !elem ) { | ||
290 | + window.location.hash = hash; | ||
291 | + return; | ||
292 | + } | ||
293 | + | ||
294 | + elem.id = id+'-tmp'; | ||
295 | + window.location.hash = hash; | ||
296 | + elem.id = id; | ||
297 | + }, | ||
298 | + locationHashChanged: function(){ | ||
299 | + var hash = window.location.hash; | ||
300 | + this.navigateTo(hash); | ||
301 | + }, | ||
302 | + navigateTo: function(hash){ | ||
303 | + var regexProposals = /#\/programas/; | ||
304 | + var regexCategory = /#\/temas/; | ||
305 | + var regexHideBarra = /barra=false$/; | ||
306 | + | ||
307 | + if( !(regexHideBarra.exec(hash) !== null) && !HIDE_BARRA_DO_GOVERNO ){ | ||
308 | + this.addBarraDoGoverno(); | ||
309 | + }else{ | ||
310 | + HIDE_BARRA_DO_GOVERNO = true; | ||
311 | + } | ||
312 | + | ||
313 | + // remove query params | ||
314 | + hash = hash.split('?')[0]; | ||
315 | + | ||
316 | + var parts = hash.split('/'); | ||
317 | + | ||
318 | + var isProposal = regexProposals.exec(hash) !== null; | ||
319 | + var isCategory = regexCategory.exec(hash) !== null; | ||
320 | + | ||
321 | + if( isProposal ){ | ||
322 | + | ||
323 | + // go to proposal | ||
324 | + var proposalId = parts[2]; | ||
325 | + this.navigateToProposal(proposalId); | ||
326 | + } | ||
327 | + | ||
328 | + if( isCategory ){ | ||
329 | + | ||
330 | + // go to category | ||
331 | + var categoryId = parts[3]; | ||
332 | + this.navigateToCategory(categoryId); | ||
333 | + } | ||
334 | + | ||
335 | + // default | ||
336 | + if( !isProposal && !isCategory ){ | ||
337 | + // show the 'index' -> category tab | ||
338 | + this.display_category_tab(); | ||
339 | + } | ||
340 | + | ||
341 | + $('html, body').animate({ scrollTop: 0 }, 'fast'); | ||
342 | + }, | ||
343 | + navigateToProposal: function(proposalId){ | ||
344 | + var regexSubpages = /sobre-o-programa$/; | ||
345 | + if(proposalId === undefined){ | ||
346 | + this.display_proposals_tab(); | ||
347 | + }else if(regexSubpages.exec(window.location.hash) == null){ | ||
348 | + this.display_proposal('proposal-item-' + proposalId); | ||
349 | + }else{ | ||
350 | + this.display_proposal_detail(proposalId); | ||
351 | + } | ||
352 | + }, | ||
353 | + navigateToCategory: function(categoryId){ | ||
354 | + if(categoryId === undefined){ | ||
355 | + this.display_category_tab(); | ||
356 | + }else{ | ||
357 | + this.display_proposal_by_category('proposal-item-' + categoryId); | ||
358 | + } | ||
359 | + }, | ||
360 | + oauthClientAction: function(url) { | ||
361 | + var child = window.open(url, "_blank"); | ||
362 | + var interval = setInterval(function() { | ||
363 | + try { | ||
364 | + if(!child.closed) { | ||
365 | + child.postMessage({ message: "requestOauthClientPluginResult" }, "*"); | ||
366 | + } | ||
367 | + } | ||
368 | + catch(e) { | ||
369 | + // we're here when the child window has been navigated away or closed | ||
370 | + if (child.closed) { | ||
371 | + clearInterval(interval); | ||
372 | + return; | ||
373 | + } | ||
374 | + } | ||
375 | + }, 300); | ||
376 | + } | ||
377 | + } | ||
378 | + })(); | ||
379 | + | ||
33 | // Load data from localhost when it is dev env. | 380 | // Load data from localhost when it is dev env. |
34 | var noosferoAPI = host + '/api/v1/articles/' + proposal_discussion + '?private_token=' + private_token + '&fields=id,children,categories,abstract,title,image,url,setting,position'; | 381 | var noosferoAPI = host + '/api/v1/articles/' + proposal_discussion + '?private_token=' + private_token + '&fields=id,children,categories,abstract,title,image,url,setting,position'; |
35 | 382 | ||
@@ -91,6 +438,9 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | @@ -91,6 +438,9 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | ||
91 | if(isSubpage){ | 438 | if(isSubpage){ |
92 | // return to proposal page | 439 | // return to proposal page |
93 | newHash = oldHash.split('/sobre-o-programa')[0]; | 440 | newHash = oldHash.split('/sobre-o-programa')[0]; |
441 | + }else{ | ||
442 | + $link = $(this).siblings('.proposal-link'); | ||
443 | + newHash = $link.attr('href'); | ||
94 | } | 444 | } |
95 | 445 | ||
96 | // Update URL and Navigate | 446 | // Update URL and Navigate |
@@ -105,6 +455,9 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | @@ -105,6 +455,9 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | ||
105 | loginButton = $this.parents('.send-button'); | 455 | loginButton = $this.parents('.send-button'); |
106 | loginButton.hide(); | 456 | loginButton.hide(); |
107 | $this.parents('.success-proposal-sent').hide(); | 457 | $this.parents('.success-proposal-sent').hide(); |
458 | + $wrapper = $this.parents('.make-proposal'); | ||
459 | + $wrapper.find('.subtitle').show(); | ||
460 | + $wrapper.find('.info').show(); | ||
108 | Main.loginCallback(logged_in); | 461 | Main.loginCallback(logged_in); |
109 | }); | 462 | }); |
110 | 463 | ||
@@ -113,10 +466,10 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | @@ -113,10 +466,10 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | ||
113 | $('#proposal-result').toggleClass('contrast'); | 466 | $('#proposal-result').toggleClass('contrast'); |
114 | }); | 467 | }); |
115 | 468 | ||
116 | - $( '.show_body a' ).on('click touchstart', function(e){ | 469 | + $( '.show_body' ).on('click touchstart', function(e){ |
117 | e.preventDefault(); | 470 | e.preventDefault(); |
118 | 471 | ||
119 | - var $link = $(this); | 472 | + var $link = $(this).find('a'); |
120 | 473 | ||
121 | // Update URL and Navigate | 474 | // Update URL and Navigate |
122 | Main.updateHash($link.attr('href')); | 475 | Main.updateHash($link.attr('href')); |
@@ -132,10 +485,9 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | @@ -132,10 +485,9 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | ||
132 | }); | 485 | }); |
133 | 486 | ||
134 | $( '.proposal-selection' ).change(function(e){ | 487 | $( '.proposal-selection' ).change(function(e){ |
135 | - e.preventDefault(); | ||
136 | - | ||
137 | // Update URL and Navigate | 488 | // Update URL and Navigate |
138 | Main.updateHash('#/programas/' + this.value); | 489 | Main.updateHash('#/programas/' + this.value); |
490 | + $(this).val($(this).data("proposal")).trigger("chosen:updated"); | ||
139 | }); | 491 | }); |
140 | 492 | ||
141 | var availableTags = [ ]; | 493 | var availableTags = [ ]; |
@@ -147,7 +499,7 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | @@ -147,7 +499,7 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | ||
147 | source: availableTags, | 499 | source: availableTags, |
148 | minLength: 3, | 500 | minLength: 3, |
149 | select: function( event, ui ) { | 501 | select: function( event, ui ) { |
150 | - updateHash(ui.item.value); | 502 | + Main.updateHash(ui.item.value); |
151 | return false; | 503 | return false; |
152 | }, | 504 | }, |
153 | appendTo: '#search-input-container', | 505 | appendTo: '#search-input-container', |
@@ -175,6 +527,8 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | @@ -175,6 +527,8 @@ define(['handlebars_helpers','jquery_ui','jquery_slick', 'jquery_maxlength', 'la | ||
175 | form.reset(); | 527 | form.reset(); |
176 | $form.hide(); | 528 | $form.hide(); |
177 | $form.siblings('.success-sent').show(); | 529 | $form.siblings('.success-sent').show(); |
530 | + $form.siblings('.subtitle').hide(); | ||
531 | + $form.siblings('.info').hide(); | ||
178 | }) | 532 | }) |
179 | .fail(function( jqxhr, textStatus, error ) { | 533 | .fail(function( jqxhr, textStatus, error ) { |
180 | var err = textStatus + ', ' + error; | 534 | var err = textStatus + ', ' + error; |
js/requirejs-config.js
@@ -12,6 +12,7 @@ requirejs.config({ | @@ -12,6 +12,7 @@ requirejs.config({ | ||
12 | waitSeconds: 0, | 12 | waitSeconds: 0, |
13 | paths: { | 13 | paths: { |
14 | jquery: 'jquery-2.1.3.min', | 14 | jquery: 'jquery-2.1.3.min', |
15 | + jquery_xdomainrequest: 'jquery.xdomainrequest.min', | ||
15 | jquery_ui: 'jquery-ui-1.11.4.custom/jquery-ui.min', | 16 | jquery_ui: 'jquery-ui-1.11.4.custom/jquery-ui.min', |
16 | jquery_cookie: 'jquery.cookie', | 17 | jquery_cookie: 'jquery.cookie', |
17 | handlebars: 'handlebars-v3.0.1', | 18 | handlebars: 'handlebars-v3.0.1', |
@@ -32,6 +33,9 @@ requirejs.config({ | @@ -32,6 +33,9 @@ requirejs.config({ | ||
32 | deps: ['handlebars'], | 33 | deps: ['handlebars'], |
33 | exports: 'Handlebars' | 34 | exports: 'Handlebars' |
34 | }, | 35 | }, |
36 | + 'jquery_xdomainrequest': { | ||
37 | + deps: ['jquery'] | ||
38 | + }, | ||
35 | 'jquery_ui': { | 39 | 'jquery_ui': { |
36 | deps: ['jquery'] | 40 | deps: ['jquery'] |
37 | }, | 41 | }, |
sass/_accessibility.scss
@@ -176,12 +176,20 @@ | @@ -176,12 +176,20 @@ | ||
176 | .contrast .category-educacao, | 176 | .contrast .category-educacao, |
177 | .contrast .category-seguranca-publica, | 177 | .contrast .category-seguranca-publica, |
178 | .contrast #proposal-categories .proposal-item .item, | 178 | .contrast #proposal-categories .proposal-item .item, |
179 | -.contrast #proposal-group .proposal-item .item, | ||
180 | .contrast .make-proposal, | 179 | .contrast .make-proposal, |
181 | .contrast .support-proposal, | 180 | .contrast .support-proposal, |
182 | .contrast .experience-proposal, | 181 | .contrast .experience-proposal, |
183 | .contrast .talk-proposal{ | 182 | .contrast .talk-proposal{ |
184 | - border: 1px solid #fff !important; | 183 | + border: 1px solid #000 !important; |
184 | +} | ||
185 | + | ||
186 | +.contrast #proposal-group .proposal-item .item { | ||
187 | + border: none; | ||
188 | +} | ||
189 | + | ||
190 | +.contrast #proposal-categories, | ||
191 | +.contrast #proposal-group { | ||
192 | + border-top: 1px solid #fff !important; | ||
185 | } | 193 | } |
186 | 194 | ||
187 | .contrast #proposal-categories ul.category, | 195 | .contrast #proposal-categories ul.category, |
@@ -190,9 +198,8 @@ | @@ -190,9 +198,8 @@ | ||
190 | } | 198 | } |
191 | 199 | ||
192 | .contrast nav li a.active{ | 200 | .contrast nav li a.active{ |
193 | - border-top: 1px solid #fff; | ||
194 | - border-left: 1px solid #fff; | ||
195 | - border-right: 1px solid #fff; | 201 | + border: 1px solid #000; |
202 | + border-bottom: 1px solid #fff; | ||
196 | } | 203 | } |
197 | 204 | ||
198 | .contrast .saude .proposal-detail-base blockquote, | 205 | .contrast .saude .proposal-detail-base blockquote, |
@@ -251,7 +258,11 @@ | @@ -251,7 +258,11 @@ | ||
251 | /*----------------------- ELEMENTOS MOUSE HOVER ---------------------- */ | 258 | /*----------------------- ELEMENTOS MOUSE HOVER ---------------------- */ |
252 | .contrast #proposal-group .proposal-item:hover{ | 259 | .contrast #proposal-group .proposal-item:hover{ |
253 | color: #fff !important; | 260 | color: #fff !important; |
254 | - background: #000 !important; | 261 | + background: #000 !important; |
262 | + | ||
263 | + .category li { | ||
264 | + border: 1px solid #fff !important; | ||
265 | + } | ||
255 | } | 266 | } |
256 | 267 | ||
257 | .contrast .send-proposal-button.send-button > a:hover, | 268 | .contrast .send-proposal-button.send-button > a:hover, |
sass/_nav.scss
@@ -25,16 +25,22 @@ nav li a { | @@ -25,16 +25,22 @@ nav li a { | ||
25 | text-decoration: none; | 25 | text-decoration: none; |
26 | font-size: 16px; | 26 | font-size: 16px; |
27 | font-weight: bold; | 27 | font-weight: bold; |
28 | - color: #fff; | ||
29 | - background: #03316f; | 28 | + color: #000; |
29 | + background: #efefef; | ||
30 | padding: 20px 5px; | 30 | padding: 20px 5px; |
31 | text-transform: uppercase; | 31 | text-transform: uppercase; |
32 | - border-color: #03316f; | ||
33 | - border-style: solid; | ||
34 | - border-width: 1px 1px 0; | 32 | + border-bottom: 1px solid #03316f; |
33 | + | ||
34 | + | ||
35 | } | 35 | } |
36 | 36 | ||
37 | nav li a.active { | 37 | nav li a.active { |
38 | background: #fff; | 38 | background: #fff; |
39 | color: #03316f; | 39 | color: #03316f; |
40 | + border: 1px solid #03316f; | ||
41 | + border-bottom: 1px solid #fff; | ||
42 | + | ||
43 | + &:hover{ | ||
44 | + cursor: default; | ||
45 | + } | ||
40 | } | 46 | } |
sass/_proposal_categories.scss
@@ -182,7 +182,7 @@ | @@ -182,7 +182,7 @@ | ||
182 | } | 182 | } |
183 | 183 | ||
184 | #proposal-group .proposal-item { | 184 | #proposal-group .proposal-item { |
185 | - border: none; | 185 | + border: 1px solid #ccc; |
186 | } | 186 | } |
187 | 187 | ||
188 | @media only screen and (max-device-width: 480px) { | 188 | @media only screen and (max-device-width: 480px) { |
sass/_proposal_detail.scss
@@ -64,6 +64,11 @@ | @@ -64,6 +64,11 @@ | ||
64 | padding: 30px 0; | 64 | padding: 30px 0; |
65 | margin: 10px auto; | 65 | margin: 10px auto; |
66 | text-align: center; | 66 | text-align: center; |
67 | + cursor: pointer; | ||
68 | + -webkit-border-radius: 6px; | ||
69 | + -moz-border-radius: 6px; | ||
70 | + border-radius: 6px; | ||
71 | + | ||
67 | 72 | ||
68 | a { | 73 | a { |
69 | display: inline-block; | 74 | display: inline-block; |
@@ -99,6 +104,11 @@ | @@ -99,6 +104,11 @@ | ||
99 | width: auto; | 104 | width: auto; |
100 | } | 105 | } |
101 | } | 106 | } |
107 | + &:after { | ||
108 | + content:""; | ||
109 | + display:table; | ||
110 | + clear:both; | ||
111 | + } | ||
102 | } | 112 | } |
103 | .results-container { | 113 | .results-container { |
104 | &:before { | 114 | &:before { |
@@ -116,6 +126,8 @@ | @@ -116,6 +126,8 @@ | ||
116 | color: gray; | 126 | color: gray; |
117 | border: none; | 127 | border: none; |
118 | margin: 10px; | 128 | margin: 10px; |
129 | + -webkit-border-radius: 6px; | ||
130 | + -moz-border-radius: 6px; | ||
119 | border-radius: 6px; | 131 | border-radius: 6px; |
120 | text-align: center; | 132 | text-align: center; |
121 | text-decoration: none; | 133 | text-decoration: none; |
@@ -181,21 +193,37 @@ | @@ -181,21 +193,37 @@ | ||
181 | 193 | ||
182 | .proposal-header { | 194 | .proposal-header { |
183 | .title { | 195 | .title { |
184 | - background: $color; | 196 | + background: darken($color, 15%); |
185 | } | 197 | } |
186 | .abstract p { | 198 | .abstract p { |
187 | - background: $color; | 199 | + background: darken($color, 15%); |
188 | } | 200 | } |
189 | .show_body { | 201 | .show_body { |
190 | - background: $color url(images/black-alpha.png); | ||
191 | - border-top: 5px solid $color; | 202 | + background: $color; |
203 | + // background: $color url(images/black-alpha.png); | ||
204 | + // border-top: 5px solid $color; | ||
205 | + transition: background-color .2s; | ||
206 | + | ||
207 | + &:hover, | ||
208 | + &:focus { | ||
209 | + background-color: saturate( lighten($color, 5%), 10% ); | ||
210 | + // -webkit-box-shadow: 0 2px 5px rgba(0,0,0,.5); | ||
211 | + // -moz-box-shadow: 0 2px 5px rgba(0,0,0,.5); | ||
212 | + // box-shadow: 0 2px 5px rgba(0,0,0,.5); | ||
213 | + | ||
214 | + span { | ||
215 | + background-color: saturate( lighten($color, 5%), 10% ); | ||
216 | + } | ||
217 | + } | ||
192 | 218 | ||
193 | a { | 219 | a { |
194 | background: transparent url(images/white-line.png) left center repeat-x; | 220 | background: transparent url(images/white-line.png) left center repeat-x; |
195 | } | 221 | } |
196 | 222 | ||
197 | span { | 223 | span { |
198 | - background: $color url(images/black-alpha.png); | 224 | + background: $color; |
225 | + // background: $color url(images/black-alpha.png); | ||
226 | + transition: background-color .2s; | ||
199 | } | 227 | } |
200 | } | 228 | } |
201 | } | 229 | } |
@@ -241,6 +269,9 @@ | @@ -241,6 +269,9 @@ | ||
241 | border-color: #ebccd1; | 269 | border-color: #ebccd1; |
242 | font-weight:bold; | 270 | font-weight:bold; |
243 | color: #a94442; | 271 | color: #a94442; |
272 | + | ||
273 | + -webkit-border-radius: 5px; | ||
274 | + -moz-border-radius: 5px; | ||
244 | border-radius: 5px; | 275 | border-radius: 5px; |
245 | } | 276 | } |
246 | input, textarea { | 277 | input, textarea { |
@@ -260,12 +291,20 @@ | @@ -260,12 +291,20 @@ | ||
260 | width: 60%; | 291 | width: 60%; |
261 | border: none; | 292 | border: none; |
262 | margin: 10px auto; | 293 | margin: 10px auto; |
294 | + -webkit-border-radius: 6px; | ||
295 | + -moz-border-radius: 6px; | ||
263 | border-radius: 6px; | 296 | border-radius: 6px; |
264 | text-align: center; | 297 | text-align: center; |
265 | text-decoration: none; | 298 | text-decoration: none; |
266 | padding: 20px; | 299 | padding: 20px; |
267 | display: block; | 300 | display: block; |
268 | 301 | ||
302 | + transition: background-color .2s; | ||
303 | + | ||
304 | + &:hover, | ||
305 | + &:focus { | ||
306 | + background-color: saturate( lighten($color, 5%), 10% ); | ||
307 | + } | ||
269 | span { | 308 | span { |
270 | padding-left: 20px; | 309 | padding-left: 20px; |
271 | background: transparent url(images/airplane.png) left center no-repeat; | 310 | background: transparent url(images/airplane.png) left center no-repeat; |
@@ -369,6 +408,8 @@ | @@ -369,6 +408,8 @@ | ||
369 | width: 60%; | 408 | width: 60%; |
370 | border: none; | 409 | border: none; |
371 | margin: 0; | 410 | margin: 0; |
411 | + -webkit-border-radius: 6px; | ||
412 | + -moz-border-radius: 6px; | ||
372 | border-radius: 6px; | 413 | border-radius: 6px; |
373 | text-align: center; | 414 | text-align: center; |
374 | text-decoration: none; | 415 | text-decoration: none; |
@@ -378,6 +419,13 @@ | @@ -378,6 +419,13 @@ | ||
378 | bottom: 40px; | 419 | bottom: 40px; |
379 | left: 50%; | 420 | left: 50%; |
380 | margin-left: -30%; | 421 | margin-left: -30%; |
422 | + | ||
423 | + transition: background-color .2s; | ||
424 | + | ||
425 | + &:hover, | ||
426 | + &:focus { | ||
427 | + background-color: saturate( lighten($color, 5%), 10% ); | ||
428 | + } | ||
381 | } | 429 | } |
382 | .vote-result { | 430 | .vote-result { |
383 | font-size: 14px; | 431 | font-size: 14px; |
@@ -394,6 +442,11 @@ | @@ -394,6 +442,11 @@ | ||
394 | left: 0; | 442 | left: 0; |
395 | text-decoration: none; | 443 | text-decoration: none; |
396 | color: $color; | 444 | color: $color; |
445 | + | ||
446 | + &:hover, | ||
447 | + &:focus { | ||
448 | + text-decoration: underline; | ||
449 | + } | ||
397 | } | 450 | } |
398 | } | 451 | } |
399 | } | 452 | } |
@@ -506,6 +559,8 @@ | @@ -506,6 +559,8 @@ | ||
506 | 559 | ||
507 | .actions > a.login-action{ | 560 | .actions > a.login-action{ |
508 | background: $color; | 561 | background: $color; |
562 | + -webkit-border-radius: 7px; | ||
563 | + -moz-border-radius: 7px; | ||
509 | border-radius: 7px; | 564 | border-radius: 7px; |
510 | color: #fff; | 565 | color: #fff; |
511 | display: block; | 566 | display: block; |
@@ -516,6 +571,8 @@ | @@ -516,6 +571,8 @@ | ||
516 | 571 | ||
517 | form .oauth .new-user{ | 572 | form .oauth .new-user{ |
518 | background: $color; | 573 | background: $color; |
574 | + -webkit-border-radius: 7px; | ||
575 | + -moz-border-radius: 7px; | ||
519 | border-radius: 7px; | 576 | border-radius: 7px; |
520 | color: #fff; | 577 | color: #fff; |
521 | padding: 10px 15px; | 578 | padding: 10px 15px; |
@@ -566,6 +623,8 @@ | @@ -566,6 +623,8 @@ | ||
566 | overflow-y: auto; | 623 | overflow-y: auto; |
567 | max-height: 190px; | 624 | max-height: 190px; |
568 | margin-bottom: 10px; | 625 | margin-bottom: 10px; |
626 | + word-break: break-word; | ||
627 | + word-wrap: break-word; | ||
569 | 628 | ||
570 | @media only screen and (max-width: 1048px) { | 629 | @media only screen and (max-width: 1048px) { |
571 | max-height: 140px; | 630 | max-height: 140px; |
sass/proposal_detail/_proposal-detail-base.scss
@@ -104,7 +104,9 @@ | @@ -104,7 +104,9 @@ | ||
104 | } | 104 | } |
105 | .go-to-proposal-button a { | 105 | .go-to-proposal-button a { |
106 | background: $color; | 106 | background: $color; |
107 | - border-radius: 3px; | 107 | + -webkit-border-radius: 6px; |
108 | + -moz-border-radius: 6px; | ||
109 | + border-radius: 6px; | ||
108 | color: #fff; | 110 | color: #fff; |
109 | display: block; | 111 | display: block; |
110 | padding: 1em; | 112 | padding: 1em; |
@@ -114,6 +116,12 @@ | @@ -114,6 +116,12 @@ | ||
114 | .fa-reply { | 116 | .fa-reply { |
115 | margin-right: .7em; | 117 | margin-right: .7em; |
116 | } | 118 | } |
119 | + | ||
120 | + transition: background-color .2s; | ||
121 | + &:hover, | ||
122 | + &:focus { | ||
123 | + background-color: saturate( lighten($color, 5%), 10% ); | ||
124 | + } | ||
117 | } | 125 | } |
118 | .row { | 126 | .row { |
119 | margin-bottom: 1.5em; | 127 | margin-bottom: 1.5em; |
sass/utilities/_variables.scss
1 | $categories: (saude: #00a9bd, seguranca-publica: #e34748, educacao: #ffb400, reducao-da-pobreza: #51d0b3); | 1 | $categories: (saude: #00a9bd, seguranca-publica: #e34748, educacao: #ffb400, reducao-da-pobreza: #51d0b3); |
2 | $categories-descriptions: (saude: "Saúde é direito de todos e dever do Estado. O Sistema Único de Saúde (SUS) é universal, integral e de responsabilidade do Governo Federal, estados e municípios. Atende a todos os brasileiros.", seguranca-publica: "A Segurança Pública é um direito fundamental, dever do Estado e responsabilidade de todos. A proteção da vida, a disseminação da cultura de paz e a integração dos órgãos e instituições são os maiores compromissos desta política pública.", educacao: "Uma pátria educadora se faz com oportunidades iguais para todos. Nos últimos anos, o Brasil, criou esse caminho de oportunidades. Hoje, todo brasileiro, independente de sua classe social, tem acesso à educação de qualidade em todos os níveis de ensino - da creche à pós-graduação . Muitos avanços foram realizados, mas ainda há muito a fazer. O Plano Nacional de Educação (PNE) estabelece novas metas para que o Governo Federal trabalhe em parceria com a sociedade, com os estados e os municípios na construção de um futuro melhor.", reducao-da-pobreza: "Com o esforço do Brasil para reduzir a pobreza e a desigualdade, 36 milhões de pessoas superaram a miséria na última década e o país saiu do Mapa da Fome das Nações Unidas."); | 2 | $categories-descriptions: (saude: "Saúde é direito de todos e dever do Estado. O Sistema Único de Saúde (SUS) é universal, integral e de responsabilidade do Governo Federal, estados e municípios. Atende a todos os brasileiros.", seguranca-publica: "A Segurança Pública é um direito fundamental, dever do Estado e responsabilidade de todos. A proteção da vida, a disseminação da cultura de paz e a integração dos órgãos e instituições são os maiores compromissos desta política pública.", educacao: "Uma pátria educadora se faz com oportunidades iguais para todos. Nos últimos anos, o Brasil, criou esse caminho de oportunidades. Hoje, todo brasileiro, independente de sua classe social, tem acesso à educação de qualidade em todos os níveis de ensino - da creche à pós-graduação . Muitos avanços foram realizados, mas ainda há muito a fazer. O Plano Nacional de Educação (PNE) estabelece novas metas para que o Governo Federal trabalhe em parceria com a sociedade, com os estados e os municípios na construção de um futuro melhor.", reducao-da-pobreza: "Com o esforço do Brasil para reduzir a pobreza e a desigualdade, 36 milhões de pessoas superaram a miséria na última década e o país saiu do Mapa da Fome das Nações Unidas."); |
3 | -$container-height: 500px; | 3 | -$container-height: 500px; |
4 | +$container-height: 500px; | ||
4 | \ No newline at end of file | 5 | \ No newline at end of file |