ensl.org/app/helpers/polls_helper.rb

11 lines
432 B
Ruby

module PollsHelper
def add_option_link(name, form)
link_to_function name do |page|
option = render :partial => 'option', :locals => { :pf => form, :options => Option.new }
page << %{
this.counter = typeof this.counter == 'undefined' ? 0 : this.counter + 1;
$('options').insert({ bottom: "#{ escape_javascript option }".replace(/\\[\\d+\\]/g, "[" + this.counter + "]") });
}
end
end
end