Commit 2f543b3bd04a0707dca50935669c1990dd180e90
1 parent
bf371ae7
Exists in
master
and in
6 other branches
Incluido aleatorio
Showing
1 changed file
with
14 additions
and
1 deletions
Show diff stats
js/main.js
| ... | ... | @@ -223,8 +223,19 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 223 | 223 | } |
| 224 | 224 | return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); |
| 225 | 225 | }, |
| 226 | + // inicio Eduardo | |
| 227 | + randomProposalByTheme: function(themeClasses) { | |
| 228 | + $('#proposal-group .proposal-list .proposal-item').hide(); | |
| 229 | + $.each(themeClasses, function(i, themeClass) { | |
| 230 | + var proposalsByTheme = $('#proposal-group .proposal-list .proposal-item').find('.' + themeClass); | |
| 231 | + var randomizedIndex = Math.floor(Math.random() * proposalsByTheme.length); | |
| 232 | + var proposalToShow = $(proposalsByTheme[randomizedIndex]).parents().filter('.proposal-item'); | |
| 233 | + $(proposalToShow).show(); | |
| 234 | + }); | |
| 235 | + }, | |
| 226 | 236 | display_category_tab: function(){ |
| 227 | - $('#proposal-group').hide(); | |
| 237 | + // $('#proposal-group').hide(); | |
| 238 | + this.randomProposalByTheme(['category-saude', 'category-seguranca-publica', 'category-educacao', 'category-reducao-da-pobreza']); | |
| 228 | 239 | $('#proposal-categories').show(); |
| 229 | 240 | $('#nav-proposal-categories a').addClass('active'); |
| 230 | 241 | $('#nav-proposal-group a').removeClass('active'); |
| ... | ... | @@ -237,12 +248,14 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
| 237 | 248 | }, |
| 238 | 249 | display_proposals_tab: function(){ |
| 239 | 250 | $('#proposal-categories').hide(); |
| 251 | + this.randomProposalByTheme(['category-saude', 'category-seguranca-publica', 'category-educacao', 'category-reducao-da-pobreza']); | |
| 240 | 252 | $('#proposal-group').show(); |
| 241 | 253 | $('#nav-proposal-group a').addClass('active'); |
| 242 | 254 | $('#nav-proposal-categories a').removeClass('active'); |
| 243 | 255 | $('#content').show(); |
| 244 | 256 | $('nav').show(); |
| 245 | 257 | }, |
| 258 | + // fim Eduardo | |
| 246 | 259 | display_proposal: function(proposal_id){ |
| 247 | 260 | // $('#proposal-categories').hide(); |
| 248 | 261 | $('#proposal-group').hide(); | ... | ... |