Commit c04d339580d4db39d71e2398aff1a7c87550ae4e
1 parent
640774fa
Exists in
master
and in
28 other branches
[stoa] Adding fault tolerance to check usp id and minor css fixes
(ActionItem2293)
Showing
3 changed files
with
19 additions
and
2 deletions
Show diff stats
plugins/stoa/controllers/stoa_plugin_controller.rb
| ... | ... | @@ -25,7 +25,11 @@ class StoaPluginController < PublicController |
| 25 | 25 | end |
| 26 | 26 | |
| 27 | 27 | def check_usp_id |
| 28 | - render :text => { :exists => StoaPlugin::UspUser.exists?(params[:usp_id]) }.to_json | |
| 28 | + begin | |
| 29 | + render :text => { :exists => StoaPlugin::UspUser.exists?(params[:usp_id]) }.to_json | |
| 30 | + rescue Exception => exception | |
| 31 | + render :text => { :exists => false, :error => {:message => exception.to_s, :backtrace => exception.backtrace} }.to_json | |
| 32 | + end | |
| 29 | 33 | end |
| 30 | 34 | |
| 31 | 35 | end | ... | ... |
plugins/stoa/lib/stoa_plugin.rb
| ... | ... | @@ -31,9 +31,16 @@ class StoaPlugin < Noosfero::Plugin |
| 31 | 31 | function(data){ |
| 32 | 32 | if(data.exists) jQuery(me).removeClass('checking').addClass('validated'); |
| 33 | 33 | else jQuery(me).removeClass('checking').addClass('invalid'); |
| 34 | + if(data.error) displayValidationUspIdError(data.error); | |
| 34 | 35 | } |
| 35 | 36 | ); |
| 36 | 37 | }); |
| 38 | + | |
| 39 | + function displayValidationUspIdError(error){ | |
| 40 | + jQuery.colorbox({html: '<h2>'+error.message+'</h2>'+error.backtrace.join("<br />"), | |
| 41 | + height: "80%", | |
| 42 | + width: "70%" }); | |
| 43 | + } | |
| 37 | 44 | EOF |
| 38 | 45 | ) |
| 39 | 46 | } | ... | ... |
public/stylesheets/application.css
| ... | ... | @@ -6548,7 +6548,9 @@ h1#agenda-title { |
| 6548 | 6548 | #signup-form #user_password, |
| 6549 | 6549 | #signup-form #user_password_confirmation, |
| 6550 | 6550 | #signup-form .filled-in, |
| 6551 | -#signup-form .passwords_match { | |
| 6551 | +#signup-form .passwords_match, | |
| 6552 | +#signup-form .invalid, | |
| 6553 | +#signup-form .checking { | |
| 6552 | 6554 | border-width: 2px; |
| 6553 | 6555 | border-style: solid; |
| 6554 | 6556 | background-color: #fff; |
| ... | ... | @@ -6626,6 +6628,8 @@ h1#agenda-title { |
| 6626 | 6628 | } |
| 6627 | 6629 | |
| 6628 | 6630 | #signup-form span.invalid { |
| 6631 | + border: none; | |
| 6632 | + padding: 0px; | |
| 6629 | 6633 | background: transparent; |
| 6630 | 6634 | color: #FFA000; |
| 6631 | 6635 | } |
| ... | ... | @@ -6636,6 +6640,8 @@ h1#agenda-title { |
| 6636 | 6640 | } |
| 6637 | 6641 | |
| 6638 | 6642 | #signup-form span.checking { |
| 6643 | + border: none; | |
| 6644 | + padding: 0px; | |
| 6639 | 6645 | background: transparent; |
| 6640 | 6646 | color: #4A4A4A; |
| 6641 | 6647 | } | ... | ... |