diff options
author | azul <azul@riseup.net> | 2013-07-06 07:51:54 -0700 |
---|---|---|
committer | azul <azul@riseup.net> | 2013-07-06 07:51:54 -0700 |
commit | a18efa42ddc1cf8692d55f76ca3e92792913f40d (patch) | |
tree | 00527737a38bdafcd2e175bb6caf5e30b3360de1 /users/app/helpers/users_helper.rb | |
parent | d03e82b4df5075f796f56fb9568992b0ba0d7c07 (diff) | |
parent | dc98ad8c6445182d60b3f1909e0260ace6fbfca5 (diff) |
Merge pull request #55 from elijh/feature/new-ui
Feature/new ui
Diffstat (limited to 'users/app/helpers/users_helper.rb')
-rw-r--r-- | users/app/helpers/users_helper.rb | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/users/app/helpers/users_helper.rb b/users/app/helpers/users_helper.rb index 9feae62..f56faab 100644 --- a/users/app/helpers/users_helper.rb +++ b/users/app/helpers/users_helper.rb @@ -1,39 +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' + def user_form_class(*classes) + (classes + ['user', 'form', (@user.new_record? ? 'new' : 'edit')]).compact.join(' ') end def wrapped(item, options = {}) |