Module: ProfilesHelper
- Defined in:
- app/helpers/profiles_helper.rb
Instance Method Summary (collapse)
- - (Object) add_affiliation
- - (Object) add_organization
- - (Object) link_to_add_fields(name, f, association)
- - (Object) link_to_remove_fields(name, f)
- - (Object) phormat(number)
Instance Method Details
- (Object) add_affiliation
24 25 26 27 |
# File 'app/helpers/profiles_helper.rb', line 24 def add_affiliation Rails.logger.error 'add affil' link_to_function('hi', "alert('hi')") end |
- (Object) add_organization
29 30 31 32 33 34 35 |
# File 'app/helpers/profiles_helper.rb', line 29 def add_organization fields = fields_for :organization, Organization.new, :child_index => "new_organization" do |builder| render "organization_fields", :f => builder end link_to_function('add organization', ("add_fields(this, 'Organization', '#{escape_javascript(fields)}')")) end |
- (Object) link_to_add_fields(name, f, association)
16 17 18 19 20 21 22 |
# File 'app/helpers/profiles_helper.rb', line 16 def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, ("add_fields(this, '#{association}', '#{escape_javascript(fields)}')")) end |
- (Object) link_to_remove_fields(name, f)
12 13 14 |
# File 'app/helpers/profiles_helper.rb', line 12 def link_to_remove_fields(name, f) f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)") end |
- (Object) phormat(number)
3 4 5 6 7 8 9 10 |
# File 'app/helpers/profiles_helper.rb', line 3 def phormat(number) if number n = number.to_s "#{n[0..2]}.#{n[3..5]}.#{n[6..9]}" else '' end end |