summaryrefslogtreecommitdiff
path: root/users/app/helpers/users_helper.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-12-07 10:00:21 +0100
committerAzul <azul@leap.se>2012-12-07 10:01:32 +0100
commitaf101adb7c66201e175642ff0ef99988b42d2df2 (patch)
tree5fb26703a80fc7f0f8954ce7a808d78003098ab9 /users/app/helpers/users_helper.rb
parentbc2ead40468f0d9372372f73260d83d30e93bc9a (diff)
refactored views to ease adding of email form
Diffstat (limited to 'users/app/helpers/users_helper.rb')
-rw-r--r--users/app/helpers/users_helper.rb20
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