lib/scaffolding_extensions/jquery_helper.rb
# Javascript for adding an element to the top of the list of associated records,
# and setting the autocomplete text box value to blank (if using autocompleting),
# or removing the item from the select box and showing the blank record instead
# (if not using autocompleting).
Javascript for adding an element to the top of the list of associated records,
and setting the autocomplete text box value to blank (if using autocompleting),
or removing the item from the select box and showing the blank record instead
(if not using autocompleting).
Javascript for adding an element to the top of the list of associated records and setting the autocomplete text box value to blank ( if using autocompleting ) or removing the item from the select box and showing the blank record instead ( if not using autocompleting ) .
def scaffold_add_habtm_element
        content = "$('##{@records_list}').prepend(\"#{scaffold_javascript_character_filter(scaffold_habtm_association_line_item(@klass, @association, @record, @associated_record))}\");\n"
        if @auto_complete
          content << "$('##{@element_id}').val('');\n"
        else
          content << "$('##{@element_id}_#{@associated_record.scaffold_id}').remove();\n"
          content << "$('##{@element_id}').selectedIndex = 0;\n"
        end
        content
      end
def scaffold_add_habtm_element content = "$('##{@records_list}').prepend(\"#{scaffold_javascript_character_filter(scaffold_habtm_association_line_item(@klass, @association, @record, @associated_record))}\");\n" if @auto_complete content << "$('##{@element_id}').val('');\n" else content << "$('##{@element_id}_#{@associated_record.scaffold_id}').remove();\n" content << "$('##{@element_id}').selectedIndex = 0;\n" end content end
Javascript for adding an element to the top of the list of associated records,
and setting the autocomplete text box value to blank (if using autocompleting),
or removing the item from the select box and showing the blank record instead
(if not using autocompleting).
Javascript for adding an element to the top of the list of associated records and setting the autocomplete text box value to blank ( if using autocompleting ) or removing the item from the select box and showing the blank record instead ( if not using autocompleting ) .