diff --git a/Gemfile b/Gemfile index ca534f833..fcba43a38 100644 --- a/Gemfile +++ b/Gemfile @@ -97,6 +97,7 @@ gem 'haml', '3.1.2' gem 'mobile-fu' gem 'sass', '3.1.7' gem 'will_paginate', '3.0.pre2' +gem 'client_side_validations' # web diff --git a/Gemfile.lock b/Gemfile.lock index c63b30956..157d66701 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -139,6 +139,7 @@ GEM uuidtools childprocess (0.2.2) ffi (~> 1.0.6) + client_side_validations (3.1.0) closure-compiler (1.1.4) cloudfiles (1.4.10) mime-types (>= 1.16) @@ -486,6 +487,7 @@ DEPENDENCIES capybara (~> 0.3.9) carrierwave (= 0.5.2) chef (= 0.9.12) + client_side_validations cloudfiles (= 1.4.10) cucumber-api-steps cucumber-rails (= 0.3.2) diff --git a/app/views/invitations/edit.html.haml b/app/views/invitations/edit.html.haml index 0bbe3f159..3c637ecaa 100644 --- a/app/views/invitations/edit.html.haml +++ b/app/views/invitations/edit.html.haml @@ -1,43 +1,45 @@ = javascript_include_tag "validation" = javascript_tag "Diaspora.Page = 'InvitationsEdit';" -:javascript - $(function() { - $("#user_username").focus(); - }); - .span-7.append-1.prepend-3 %br %br %br %br - %h2 - = t('.your_account_awaits') + %h1 + = t('users.getting_started.welcome') %h3.accept_invitation_text = t('.accept_your_invitation') - flash.each do |name, msg| %p{:class => "login_#{name}"}= msg + = image_tag 'diaspora_collage.png', :style => "margin-left:-50px;" + .span-10 %br %br %br %br - = form_for(resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :put, :class => 'accept_invitation_form'}) do |f| - %p - = f.label :username , t('username') - = f.text_field :username, :title => t('registrations.new.enter_username') - %p - = f.label :email , t('email') - = f.email_field :email, :title => t('registrations.new.enter_email') - %p - = f.label :password , t('password') - = f.password_field :password, :title => t('registrations.new.enter_password') - %p - = f.label :password_confirmation , t('password_confirmation') - = f.password_field :password_confirmation, :title => t('registrations.new.enter_password_again') - = f.hidden_field :invitation_token + = form_for(resource, :as => resource_name, :url => invitation_path(resource_name), :html => {:method => :put, :class => 'accept_invitation_form'}, :validate => true) do |f| + %fieldset + .clearfix + %b + = t('username') + = f.text_field :username, :title => t('registrations.new.enter_username') + .clearfix + %b + = t('email') + = f.email_field :email, :title => t('registrations.new.enter_email') + .clearfix + %b + = t('password') + = f.password_field :password, :title => t('registrations.new.enter_password') + .clearfix + %b + = t('password_confirmation') + = f.password_field :password_confirmation, :title => t('registrations.new.enter_password_again') + = f.hidden_field :invitation_token - .submit_field - = f.submit t('registrations.new.create_my_account') + .submit_field + = f.submit t('registrations.new.create_my_account'), :class => 'in_aspects' diff --git a/config/assets.yml b/config/assets.yml index 2bd5b17e9..7c6481331 100644 --- a/config/assets.yml +++ b/config/assets.yml @@ -10,6 +10,7 @@ javascripts: jquery: - public/javascripts/vendor/jquery162.min.js main: + - public/javascripts/rails.validations.js - public/javascripts/rails.js - public/javascripts/vendor/jquery.tipsy.js - public/javascripts/vendor/jquery.hotkeys.js diff --git a/config/initializers/client_side_validations.rb b/config/initializers/client_side_validations.rb new file mode 100644 index 000000000..b598bd991 --- /dev/null +++ b/config/initializers/client_side_validations.rb @@ -0,0 +1,14 @@ +# ClientSideValidations Initializer + +#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 =~ /^