ensl.org/app/helpers/polls_helper.rb

13 lines
459 B
Ruby
Raw Normal View History

module PollsHelper
def add_option_link(name, form)
2020-03-27 01:00:29 +00:00
# FIXME: not used atm.
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