diff options
Diffstat (limited to 'users/app/helpers')
-rw-r--r-- | users/app/helpers/users_helper.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/users/app/helpers/users_helper.rb b/users/app/helpers/users_helper.rb index 2310a24..dec8904 100644 --- a/users/app/helpers/users_helper.rb +++ b/users/app/helpers/users_helper.rb @@ -1,2 +1,22 @@ module UsersHelper + + def user_form_with(partial, legend, locals) + user_form do |f| + locals.reverse_merge! :legend => legend, :f => f + render :partial => partial, + :layout => 'legend_and_submit', + :locals => locals + end + end + + def user_form + html_class = 'form-horizontal user form ' + html_class += (@user.new_record? ? 'new' : 'edit') + simple_form_for @user, + :validate => true, + :format => :json, + :html => {:class => html_class} do |f| + yield f + end + end end |