Commit 0c14356c105e1f9e05f5070abf48e6fbc2c99069
1 parent
93103d85
Exists in
master
and in
22 other branches
adds delete button in new qualifier row
Showing
2 changed files
with
3 additions
and
3 deletions
Show diff stats
app/views/manage_products/_edit_info.rhtml
@@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
48 | <%= button_to_function( | 48 | <%= button_to_function( |
49 | :add, | 49 | :add, |
50 | _('Add new qualifier'), | 50 | _('Add new qualifier'), |
51 | - "new_qualifier_row('#product-qualifiers-list', '#{escape_javascript(select_qualifiers(@product))}')" | 51 | + "new_qualifier_row('#product-qualifiers-list', '#{escape_javascript(select_qualifiers(@product))}', '#{escape_javascript(button_to_function(:delete, content_tag('span', 'Delete qualifier'), 'jQuery(this).parents(\'tr\').remove()'))}')" |
52 | ) %> | 52 | ) %> |
53 | <%= hidden_field_tag "product[qualifiers_list]" %> | 53 | <%= hidden_field_tag "product[qualifiers_list]" %> |
54 | <% end %> | 54 | <% end %> |
public/javascripts/application.js
@@ -454,9 +454,9 @@ function loading_for_button(selector) { | @@ -454,9 +454,9 @@ function loading_for_button(selector) { | ||
454 | jQuery(selector).css('cursor', 'progress'); | 454 | jQuery(selector).css('cursor', 'progress'); |
455 | } | 455 | } |
456 | 456 | ||
457 | -function new_qualifier_row(selector, select_qualifiers) { | 457 | +function new_qualifier_row(selector, select_qualifiers, delete_button) { |
458 | index = jQuery(selector + ' tr').size() - 1; | 458 | index = jQuery(selector + ' tr').size() - 1; |
459 | - jQuery(selector).append("<tr><td>" + select_qualifiers + "</td><td id='certifier-area-" + index + "'><select></select></td></tr>"); | 459 | + jQuery(selector).append("<tr><td>" + select_qualifiers + "</td><td id='certifier-area-" + index + "'><select></select>" + delete_button + "</td></tr>"); |
460 | } | 460 | } |
461 | 461 | ||
462 | // controls the display of the login/logout stuff | 462 | // controls the display of the login/logout stuff |