From 5821a8402488f8744f52e2da042c803b0fefba6a Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Fri, 4 May 2012 17:35:45 -0700 Subject: [PATCH] validations and all that jazz [ci skip] --- app/assets/images/invalid_fat@2x.png | Bin 0 -> 1818 bytes .../stylesheets/new_styles/_registration.scss | 32 ++++-- .../stylesheets/new_styles/_variables.scss | 2 +- app/views/registrations/new.html.erb | 94 ++++++++++-------- .../initializers/client_side_validations.rb | 18 ++-- 5 files changed, 84 insertions(+), 62 deletions(-) create mode 100644 app/assets/images/invalid_fat@2x.png diff --git a/app/assets/images/invalid_fat@2x.png b/app/assets/images/invalid_fat@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..cd69f1f9ee7a9509d481c25429a3399f570af831 GIT binary patch literal 1818 zcmbVNX;2eq7)}CG1*D+HgM!_zb;g2_%|#B0kYmv(K`t>OB1^Ksg2~3sh6FsIVL(Nh zR!~$tI8?L+E#gs?;)OyZI)VpQJh1h^Qq&n7!~>-p0oxzeAKjVV?|Z-ReV+H8T^k-Y zYqYbcGmSihq}EXTJJN~zHf@gZrItw~tR|!IB+`r!C{3!x6H!2^Lz2-*6wziZ zv!Q`BnnMy6ttQo~P_YKr`6G56e~ZpQp=q?hAd3Ofq@g5`h$drt3HYq;6bN8i3Ali- zf>Z`Mnu5*FB+#hLuxL$Ynnt7rgJuGO7BNMjLrDa%=$7h@Vv7WP&nu?(_G15OfBW>I1RfIFu+VWh@I~V6punmQH7n>%F#-j70x&NSZPXrgHabLv}^V8}U2>ql$toRp1(v4%L%Ng#@H-{I!@?42gsg zn=Rl$0uB@)WV1ya86;J(IdF)K9l++p!yF&OD)<2+u8_+U!h8w|vxQQgLIF!*I6w-C zLZtj*tWs|z5xoW-wu@1Ahp^mFV#RU-MM#{8#_^@Y9T1*^lejSjHvsY|KA=K0nBFei z%QG0Q0wu6?R2xFzI^cbN#n?ye%Vb<(h)6Dlk;ZVcDDGU(GUnM0KEj z`=RwI;luEtdTL?_YBc7h3m|IZ<|q}?XiIzd_PP37kb52m{w16BtH(9CuV-|->PF9~ zlI>-GdSo(|-%%~kv2?(uoVYWOM|h1%V8CB}Gc!pzCBnhoNt@%jYI1%@R<+KW=ZtCSSni-^_q zzY@F-EDTdJ7uPSVnB;wu?{?HR!Bia7H=D84vANSQcVt!X#Wk9U1a8f=^4y)=NhJy^ zO!s>cr)>EetS)ScyxdyF_KwJ&de(>T_w%!9DYdlep()`jo#aKi2}p3xI|pmolNHk}geK>kI5~-tAWVOU|hM z{0-OL-}E|nH`d-3xR%w&1qn}IdC|l~`qqO5F4aXR9)Esv{uu5+Yze0R44+)N%D`#v zcS>V4XS8;d-9$1L*z(Io$fZgqQ}+C<^MwW8-bs?w&H$8qN@B2yg`N3XW9Qcv@Ob z8^5nK+^1`g`sk@zPz|(b(VE(Fn=^t+i#DCj%x#M3iU ByY~P9 literal 0 HcmV?d00001 diff --git a/app/assets/stylesheets/new_styles/_registration.scss b/app/assets/stylesheets/new_styles/_registration.scss index 61727bd25..f42c24862 100644 --- a/app/assets/stylesheets/new_styles/_registration.scss +++ b/app/assets/stylesheets/new_styles/_registration.scss @@ -3,8 +3,8 @@ top : 0; left : 0; background-color : #afc652; - height : 100%; - width : 100%; + min-height : 100%; + min-width : 100%; color : #fff; @@ -16,6 +16,7 @@ font-family : Roboto-Light; font-size : 100px; line-height : 100px; + white-space : nowrap; } #diaspora-hearts { @@ -23,6 +24,7 @@ font-size : 24px; margin-top : 0.2em; margin-bottom : 1em; + white-space : nowrap; } #sign-up-text { @@ -32,11 +34,10 @@ } #collage { - float : left; width : 344px; - height : 639px; - margin-right : 20px; - margin-left : 110px; + height : auto; + + max-width : 95%; } form#user_new { @@ -46,6 +47,10 @@ color : #555; } + input:invalid { + color : #555; + } + fieldset { @include border-radius(5px); @@ -78,13 +83,24 @@ .control-label, input[type=text], - input[type=password] { + input[type=password], + .field_with_errors label { padding : 10px; margin : 0; } - .controls { margin-left : 100px; } + .controls { margin-left : 100px; position : relative; } .control-label { width : 80px; } + + .controls .field_with_errors input { + color : #f15534; + background : { + image : image-url('invalid_fat@2x.png'); + repeat : no-repeat; + position : 197px; + size: 20px 20px; + } + } } } diff --git a/app/assets/stylesheets/new_styles/_variables.scss b/app/assets/stylesheets/new_styles/_variables.scss index 5d61d947b..3948566d6 100644 --- a/app/assets/stylesheets/new_styles/_variables.scss +++ b/app/assets/stylesheets/new_styles/_variables.scss @@ -19,4 +19,4 @@ $lime-green : rgb(143, 199,10); $orange : rgb(237, 165, 13); $red : rgb(246, 68, 60); $turquoise : rgb(8, 224, 173); -$sand : rgb(245, 239, 237); +$sand : rgb(245, 239, 237); \ No newline at end of file diff --git a/app/views/registrations/new.html.erb b/app/views/registrations/new.html.erb index 0c59e6d8b..9b0b1c469 100644 --- a/app/views/registrations/new.html.erb +++ b/app/views/registrations/new.html.erb @@ -1,59 +1,65 @@
- <%= image_tag('signupimages@2x_mini.jpg', :id => "collage") %> +
+
+ <%= image_tag('signupimages@2x_mini.jpg', :id => "collage") %> +
-

- HEY, -
- MAKE -
- SOMETHING. -

+
+

+ HEY, +
+ MAKE +
+ SOMETHING. +

-

- <3 Diaspora* -

+

+ <3 Diaspora* +

-

- SIGN UP -

+

+ SIGN UP +

- <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => "form-horizontal", :autocomplete => "off"}) do |f| %> -
-
- + <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => "form-horizontal", :autocomplete => "off"}, :validate => true) do |f| %> +
+
+ -
- <%= f.email_field :email, :placeholder => "luke@hoth.net", :title => t('registrations.new.enter_email'), :required => true %> -
-
+
+ <%= f.email_field :email, :validate => {:presence => true}, :placeholder => "luke@hoth.net", :title => t('registrations.new.enter_email'), :required => true %> +
+
-
- +
+ -
- <%= f.text_field :username, :placeholder => "jedi_guy", :title => t('registrations.new.enter_username'), :required => true, :pattern => "[A-Za-z0-9_]+" %> -
-
+
+ <%= f.text_field :username, :validate => {:presence => true}, :placeholder => "jedi_guy", :title => t('registrations.new.enter_username'), :required => true, :pattern => "[A-Za-z0-9_]+" %> +
+
-
- +
+ - <%= f.password_field :password, :placeholder => "••••••••", :title => t('registrations.new.enter_password'), :required => true, :pattern => "......+" %> - <%= invite_hidden_tag(invite) %> - -
-
- - <%= f.submit "Continue", :class => "new-btn" %> - <% end %> +
+ <%= f.password_field :password, :validate => {:presence => true}, :placeholder => "••••••••", :title => t('registrations.new.enter_password'), :required => true, :pattern => "......+" %> +
+
+ <%= invite_hidden_tag(invite) %> + + <%= f.submit "Continue", :class => "new-btn" %> + <% end %> +
+
\ No newline at end of file diff --git a/config/initializers/client_side_validations.rb b/config/initializers/client_side_validations.rb index b598bd991..430154d25 100644 --- a/config/initializers/client_side_validations.rb +++ b/config/initializers/client_side_validations.rb @@ -1,14 +1,14 @@ # ClientSideValidations Initializer -#require 'client_side_validations/simple_form' if defined?(::SimpleForm) -#require 'client_side_validations/formtastic' if defined?(::Formtastic) +require 'client_side_validations/simple_form' if defined?(::SimpleForm) +require 'client_side_validations/formtastic' if defined?(::Formtastic) # Uncomment the following block if you want each input field to have the validation messages attached. -ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| - unless html_tag =~ /^