Commit 19a9c7c8ebe5559918f41efc264726f24195651f
1 parent
7940321a
Exists in
master
and in
2 other branches
User registration
Showing
7 changed files
with
54 additions
and
13 deletions
Show diff stats
app/assets/stylesheets/bootstrap_overrides.css.scss
app/controllers/application_controller.rb
... | ... | @@ -3,6 +3,8 @@ class ApplicationController < ActionController::Base |
3 | 3 | # For APIs, you may want to use :null_session instead. |
4 | 4 | protect_from_forgery with: :exception |
5 | 5 | |
6 | + before_action :configure_permitted_parameters, if: :devise_controller? | |
7 | + | |
6 | 8 | protected |
7 | 9 | def check_vlibras_api_status |
8 | 10 | unless ApiClient.check_status |
... | ... | @@ -11,4 +13,8 @@ protected |
11 | 13 | end |
12 | 14 | end |
13 | 15 | |
16 | + def configure_permitted_parameters | |
17 | + devise_parameter_sanitizer.for(:sign_up) << [ :name, :address, :zipcode, :phone ] | |
18 | + end | |
19 | + | |
14 | 20 | end | ... | ... |
app/models/user.rb
... | ... | @@ -16,6 +16,9 @@ |
16 | 16 | # last_sign_in_ip :string(255) |
17 | 17 | # created_at :datetime |
18 | 18 | # updated_at :datetime |
19 | +# address :text | |
20 | +# zipcode :string(255) | |
21 | +# phone :string(255) | |
19 | 22 | # |
20 | 23 | # Indexes |
21 | 24 | # |
... | ... | @@ -29,8 +32,11 @@ class User < ActiveRecord::Base |
29 | 32 | has_many :requests, :class => VLibras::Request, :foreign_key => :owner_id |
30 | 33 | has_many :videos, :through => :requests, :class => VLibras::Video |
31 | 34 | |
35 | + validates :name, :presence => true | |
36 | + | |
32 | 37 | # Include default devise modules. Others available are: |
33 | 38 | # :confirmable, :lockable, :timeoutable and :omniauthable |
34 | 39 | devise :database_authenticatable, |
35 | - :recoverable, :rememberable, :trackable, :validatable | |
40 | + :recoverable, :rememberable, :trackable, :validatable, | |
41 | + :registerable | |
36 | 42 | end | ... | ... |
app/views/devise/registrations/new.html.haml
1 | -%h2 Sign up | |
2 | -= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => 'form-vertical' }) do |f| | |
3 | - = f.error_notification | |
4 | - = display_base_errors resource | |
5 | - = f.input :name, :autofocus => true | |
6 | - = f.input :email, :required => true | |
7 | - = f.input :password, :required => true | |
8 | - = f.input :password_confirmation, :required => true | |
9 | - = f.button :submit, 'Sign up', :class => 'btn-primary' | |
10 | -= render "devise/shared/links" | |
1 | +.breadcrumb | |
2 | + %h2 Cadastrar Usuário | |
3 | + | |
4 | +.row-fluid | |
5 | + .span6.well.offset3 | |
6 | + = html5_video_tag("/video.mp4", 'cadastro-video', 'video-instructions') | |
7 | + | |
8 | +.row-fluid | |
9 | + .well | |
10 | + %h2 Dados do Usuário | |
11 | + | |
12 | + = simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| | |
13 | + = f.error_notification | |
14 | + .span3 | |
15 | + = f.input :name, :label => "Nome", :required => true, :autofocus => true | |
16 | + = f.input :email, :required => true | |
17 | + = f.input :password, :required => true, :label => "Senha" | |
18 | + = f.input :password_confirmation, :required => true, :label => "Confirmar Senha" | |
19 | + .span3 | |
20 | + = f.input :address, :label => "Endereço", :input_html => { :rows => 4 } | |
21 | + = f.input :zipcode,:label => "CEP" | |
22 | + = f.input :phone, :label => "Telefone" | |
23 | + .span3 | |
24 | + %center | |
25 | + %p= f.button :submit, "Cadastrar", :class => "btn btn-large btn-primary" | |
26 | + = render :partial => "devise/shared/links" | |
11 | 27 | \ No newline at end of file | ... | ... |
app/views/v_libras/requests/rapid.haml
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | 'superior-esquerdo'], [t('videos.top_right'), 'superior-direito'], |
49 | 49 | [t('videos.bottom_right'),'inferior-direito'], [t('videos.bottom_left'), 'inferior-esquerdo']]) |
50 | 50 | |
51 | - .field | |
51 | + .field.hide | |
52 | 52 | = label_tag 'params[transparencia]', t('videos.transparency'), :class => "bold" |
53 | 53 | = select_tag 'params[transparencia]', options_for_select([['Opaco', 'opaco'], ['Transparente', 'transparente']]) |
54 | 54 | = submit_tag "Confirmar", :class => "btn btn-primary actions" | ... | ... |
db/schema.rb
... | ... | @@ -11,7 +11,7 @@ |
11 | 11 | # |
12 | 12 | # It's strongly recommended that you check this file into your version control system. |
13 | 13 | |
14 | -ActiveRecord::Schema.define(version: 20140529122416) do | |
14 | +ActiveRecord::Schema.define(version: 20140604112510) do | |
15 | 15 | |
16 | 16 | create_table "delayed_jobs", force: true do |t| |
17 | 17 | t.integer "priority", default: 0, null: false |
... | ... | @@ -54,6 +54,9 @@ ActiveRecord::Schema.define(version: 20140529122416) do |
54 | 54 | t.string "last_sign_in_ip" |
55 | 55 | t.datetime "created_at" |
56 | 56 | t.datetime "updated_at" |
57 | + t.text "address" | |
58 | + t.string "zipcode" | |
59 | + t.string "phone" | |
57 | 60 | end |
58 | 61 | |
59 | 62 | add_index "users", ["email"], name: "index_users_on_email", unique: true | ... | ... |