summaryrefslogtreecommitdiff
path: root/users/app/helpers
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2012-12-07 10:31:12 -0800
committerjessib <jessib@leap.se>2012-12-07 10:31:12 -0800
commite1a004e2b24c2c235452469abfefa033e24435b2 (patch)
treea4b1c89a5aa4d5ccb3c17521499c999dedd5842d /users/app/helpers
parent4793c2b770fcb018303b7ab226b75cc218364327 (diff)
parent8282b83c798ba4e5c1e26ec8243b82669b3ee6d4 (diff)
Merge branch 'master' into help_develop
Conflicts: app/views/layouts/application.html.haml help/app/controllers/tickets_controller.rb help/test/functional/tickets_controller_test.rb users/test/support/stub_record_helper.rb
Diffstat (limited to 'users/app/helpers')
-rw-r--r--users/app/helpers/users_helper.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/users/app/helpers/users_helper.rb b/users/app/helpers/users_helper.rb
index 2310a24..b017bca 100644
--- a/users/app/helpers/users_helper.rb
+++ b/users/app/helpers/users_helper.rb
@@ -1,2 +1,32 @@
module UsersHelper
+
+ def user_form_with(partial, options = {})
+ user_form(options) do |f|
+ options[:f] = f
+ render :partial => partial,
+ :layout => 'legend_and_submit',
+ :locals => options
+ end
+ end
+
+ def user_form(options = {})
+ simple_form_for @user,
+ :html => user_form_html_options(options),
+ :validate => true do |f|
+ yield f
+ end
+ end
+
+ def user_form_html_options(options)
+ { :class => user_form_html_classes(options).join(" "),
+ :id => dom_id(@user, options[:legend])
+ }
+ end
+
+ def user_form_html_classes(options)
+ classes = %W/form-horizontal user form/
+ classes << options[:legend]
+ classes << (@user.new_record? ? 'new' : 'edit')
+ classes.compact
+ end
end