Revision 4ca83ea1
Added by Marc Dequènes over 14 years ago
- ID 4ca83ea199209d27166739b036752b72dd27a6b7
app/helpers/application_helper.rb | ||
---|---|---|
return if obj.nil?
|
||
link_to_resource(obj, obj.send(text_method))
|
||
end
|
||
|
||
# see app/helpers/proto_menu_helper.rb for info about this method and its license
|
||
def use_proto_menu
|
||
@content_for_proto_menu_css = ""
|
||
@content_for_proto_menu_js = ""
|
||
content_for :proto_menu_css do
|
||
stylesheet_link_tag "proto.menu.0.6"
|
||
end
|
||
content_for :proto_menu_js do
|
||
javascript_include_tag "proto.menu.0.6"
|
||
end
|
||
end
|
||
|
||
def gen_action_proto_menu(prefix_id, item_list)
|
||
zone_id = prefix_id + "_zone"
|
||
form_id = prefix_id + "_form"
|
||
action_id = prefix_id + "_action"
|
||
items_id = prefix_id + "_items"
|
||
|
||
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]}');*/
|
||
}
|
||
"
|
||
}
|
||
end
|
||
|
||
add_proto_menu(zone_id, menu_items)
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] preliminary artworks context menu (reverted license to GPL2+, to be compatible with Proto.Menu and possibly other plugins)