Sorry about my English. I have migrated plugins to Redmine 2.x, but Javascript functions does not work. At the top of one of my plugins show.html.erb:
<% content_for :javascript_includes do %>
<%= javascript_include_tag 'hgp_markers.js', :plugin => 'hgp_markers' %>
<% end %>
hgp_markers.js:
function hideEditableMarkers() {
$$('.edit_marker').each(function(el) {
el.hide();
});
$$('.show_marker').each(function(el) {
el.show();
});
}
Event.observe(window, 'load', hideEditableMarkers);
And this line with javascript:
<%= link_to_function l(:button_edit), "hideEditableMarkers(); $('marker_#{m.id}_row').hide(); $('marker_#{m.id}_row_edit').show(); return false;", :class => 'icon icon-edit' %>
What am I doing wrong? thanks in advance
Redmine 2.x (Rails 3.x) switches from Prototype to jQuery. So you need to migrate too.
Thus, Event.observe
is a Prototype function.
See also: http://projects.andriylesyuk.com/projects/base/wiki/Porting-to-Redmine-2