From 4aff08fe9696d2f6b92f8a8c2bbb2f96a26277e7 Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 7 Dec 2012 12:48:04 +0100 Subject: refactor: use seperate form for signup creating and editing users differ so much now it's not worth reusing the complex user_form_with for the signup. --- users/app/helpers/users_helper.rb | 2 +- users/app/views/users/_legend_and_submit.html.haml | 12 +++--------- users/app/views/users/_signup.html.haml | 2 -- users/app/views/users/new.html.haml | 10 +++++++++- 4 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 users/app/views/users/_signup.html.haml (limited to 'users') diff --git a/users/app/helpers/users_helper.rb b/users/app/helpers/users_helper.rb index 5d9eff7..b017bca 100644 --- a/users/app/helpers/users_helper.rb +++ b/users/app/helpers/users_helper.rb @@ -9,7 +9,7 @@ module UsersHelper end end - def user_form(options) + def user_form(options = {}) simple_form_for @user, :html => user_form_html_options(options), :validate => true do |f| diff --git a/users/app/views/users/_legend_and_submit.html.haml b/users/app/views/users/_legend_and_submit.html.haml index cc172e9..c20a226 100644 --- a/users/app/views/users/_legend_and_submit.html.haml +++ b/users/app/views/users/_legend_and_submit.html.haml @@ -1,10 +1,4 @@ -%legend - = t(legend) -= yield -.pull-right - - if local_assigns[:with_cancel] - = f.button :submit, :class => 'btn-primary' - = link_to t(:cancel), root_url, :class => :btn - - else - = f.button :submit +%legend= t(legend) +=yield +.pull-right= f.button :submit .clearfix diff --git a/users/app/views/users/_signup.html.haml b/users/app/views/users/_signup.html.haml deleted file mode 100644 index 51bfaef..0000000 --- a/users/app/views/users/_signup.html.haml +++ /dev/null @@ -1,2 +0,0 @@ -= render :partial => 'login_field', :locals => local_assigns -= render :partial => 'password_fields', :locals => local_assigns diff --git a/users/app/views/users/new.html.haml b/users/app/views/users/new.html.haml index 1814847..98cccb0 100644 --- a/users/app/views/users/new.html.haml +++ b/users/app/views/users/new.html.haml @@ -1,3 +1,11 @@ .span8.offset2 %h2=t :signup - = user_form_with 'signup', :legend => :signup_message, :with_cancel => true + = user_form do |f| + %legend= t(:signup_message) + = render :partial => 'login_field', :locals => {:f => f} + = render :partial => 'password_fields', :locals => {:f => f} + .pull-right + = f.button :submit, :class => 'btn-primary' + = link_to t(:cancel), root_url, :class => :btn + .clearfix + -- cgit v1.2.3