summaryrefslogtreecommitdiff
path: root/users/app/helpers
diff options
context:
space:
mode:
authorjessib <jessib@leap.se>2013-07-08 11:30:35 -0700
committerjessib <jessib@leap.se>2013-07-08 11:30:35 -0700
commitfc3c5994df61de04b8b17b495a638efc0d760126 (patch)
tree644aa93dfd0a6da2ed9b20ba688712fb9082f425 /users/app/helpers
parentcfb9e1d4c2e954222b77c4dd11e06ae3a0092be5 (diff)
parent3113f8b814417a896ad5340fda88927733f8ab22 (diff)
Merge branch 'master' into feature/disable_account
Conflicts: users/app/controllers/users_controller.rb users/app/helpers/users_helper.rb users/app/views/users/edit.html.haml users/app/views/users/show.html.haml users/config/locales/en.yml
Diffstat (limited to 'users/app/helpers')
-rw-r--r--users/app/helpers/users_helper.rb37
1 files changed, 2 insertions, 35 deletions
diff --git a/users/app/helpers/users_helper.rb b/users/app/helpers/users_helper.rb
index f731aab..f56faab 100644
--- a/users/app/helpers/users_helper.rb
+++ b/users/app/helpers/users_helper.rb
@@ -1,40 +1,7 @@
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
-
- def user_field(field)
- value = @user.send(field)
- value = value.to_s(:long) if field.end_with? '_at'
- value = 'not set' if value.nil?
- value
+ def user_form_class(*classes)
+ (classes + ['user', 'form', (@user.new_record? ? 'new' : 'edit')]).compact.join(' ')
end
def wrapped(item, options = {})