Commit 4f3ff35fb893627f2f90050995b0f8155b262321
Exists in
master
and in
5 other branches
Merge branch 'master' of https://gitlab.com/participa/proposal-app
Showing
1 changed file
with
19 additions
and
5 deletions
Show diff stats
js/main.js
... | ... | @@ -254,6 +254,7 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
254 | 254 | // $('#proposal-group').hide(); |
255 | 255 | this.randomProposalByTheme(['category-saude', 'category-seguranca-publica', 'category-educacao', 'category-reducao-da-pobreza']); |
256 | 256 | $('#proposal-group').show(); /* Show random proposals*/ |
257 | + $('.content').addClass('background'); /* Add class background */ | |
257 | 258 | $('#proposal-categories').show(); |
258 | 259 | $('#nav-proposal-categories a').addClass('active'); |
259 | 260 | $('#nav-proposal-group a').removeClass('active'); |
... | ... | @@ -546,12 +547,25 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
546 | 547 | } |
547 | 548 | }, 300); |
548 | 549 | }, |
549 | - responseToText: function(responseJSONmessage){ | |
550 | - var o = JSON.parse(responseJSONmessage); | |
551 | - var msg; | |
552 | - Object.keys(o).map(function(k) { msg += k + " " + o[k] + ", " }); | |
553 | - return msg.substring(0, msg.length - 2) + "."; | |
550 | + responseToText: function(responseJSONmessage){ | |
551 | + var o = JSON.parse(responseJSONmessage); | |
552 | + var msg = ""; | |
553 | + var fn; | |
554 | + | |
555 | + for (var key in o) { | |
556 | + if (o[key] instanceof Array) { | |
557 | + fn = key; | |
558 | + for (var i = 0; i < o[key].length; i++) { | |
559 | + msg += fn + " " + o[key][i] + ", "; | |
560 | + } | |
561 | + } | |
554 | 562 | } |
563 | + msg = msg.replace('password_confirmation', 'confirmação da senha'); | |
564 | + msg = msg.replace('password', 'senha'); | |
565 | + msg = msg.replace('login', 'nome de usuário'); | |
566 | + msg = msg.replace('email', 'e-mail'); | |
567 | + return msg.substring(0, msg.length - 2) + "."; | |
568 | + } | |
555 | 569 | } |
556 | 570 | })(); |
557 | 571 | ... | ... |