Project

General

Profile

« Previous | Next » 

Revision bf16d414

Added by Marc Dequènes over 13 years ago

  • ID bf16d41408b3309a93dcd0dd0723a4d478023818

[evol] artworks context menu: finished mechanism + checked for empty selection + implemented associate_with_tag action

View differences:

app/helpers/application_helper.rb
zone_id = prefix_id + "_zone"
form_id = prefix_id + "_form"
action_id = prefix_id + "_action"
items_id = prefix_id + "_items"
items_id = prefix_id + "_ids[]"
empty_selection_msg = _("Empty selection")
menu_items = []
item_list.each do |item_data|
menu_items << {
:name => "'#{item_data[0]}'",
:callback => "function() {
document.getElementById('#{action_id}').value = '#{item_data[1]}';
document.getElementById('#{form_id}').submit();
/*alert('#{item_data[1]}');*/
items = $A(document.getElementsByName('#{items_id}'));
one_checkbox_set = false;
for (var i = 0; i < items.length; ++i)
{
if (items[i].checked)
{
one_checkbox_set = true;
break;
}
}
if (one_checkbox_set)
{
$('#{action_id}').value = '#{item_data[1]}';
$('#{form_id}').submit();
}
else
alert('#{empty_selection_msg}');
}
"
}

Also available in: Unified diff