Module: Admin::BallotsHelper

Included in:
VotesHelper
Defined in:
app/helpers/admin/ballots_helper.rb

Instance Method Summary collapse

Instance Method Details



11
12
13
14
15
16
17
# File 'app/helpers/admin/ballots_helper.rb', line 11

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  
  raw link_to_function(name, "add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")")
end


7
8
9
# File 'app/helpers/admin/ballots_helper.rb', line 7

def link_to_remove_fields name, f
  f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)")
end

#position_message_for(n) ⇒ Object



19
20
21
# File 'app/helpers/admin/ballots_helper.rb', line 19

def position_message_for(n)
  "Vote for #{n}"
end

#unique_identifier_nameObject



3
4
5
# File 'app/helpers/admin/ballots_helper.rb', line 3

def unique_identifier_name
  Member.unique_identifier_name
end