diff options
author | Azul <azul@leap.se> | 2013-01-22 12:02:18 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-01-22 13:06:37 +0100 |
commit | de48efcf2a6b5fb096fd209b1efea482f743c19c (patch) | |
tree | c555b53719f67fd48bd6b742ff2f5e2ede7b7c53 /users/app/helpers | |
parent | ed1caa740f0e58cfd5f2d908946461154db68174 (diff) |
some basic webfinger routes, controller, presenters, views
Diffstat (limited to 'users/app/helpers')
-rw-r--r-- | users/app/helpers/users_helper.rb.orig | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/users/app/helpers/users_helper.rb.orig b/users/app/helpers/users_helper.rb.orig new file mode 100644 index 0000000..ed027d3 --- /dev/null +++ b/users/app/helpers/users_helper.rb.orig @@ -0,0 +1,47 @@ +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 + +<<<<<<< HEAD + def user_field(field) + value = @user.send(field) + value = value.to_s(:long) if field.end_with? '_at' + value || 'not set' +======= + def wrapped(item, options = {}) + options[:as] ||= :div + content_tag options[:as], :class => dom_class(item), :id => dom_id(item) do + yield + end +>>>>>>> more flexible email partial + end + +end |