Project

General

Profile

How to refresh a call_hook

Added by Francisco José Martínez almost 13 years ago

Hi!!

I need refresh a view called by a call_hook. I've created a file in lib/hooks/my_plugin_hooks.rb and it is define this method:

def view_issues_form_details_bottom( context = { } )
context[:controller].send( :render_to_string, {
:partial => "hooks/issue_plugin",
:locals => { :issue => context[:issue], :form => context[:form] }
})
end

The view hooks/issue_plugin.rhtml is very simple

<div class="special_tracker" id="special_tracker" >
<p><%= @issue.tracker_id %> Make something stupid here </p>
<% if Setting.plugin_redmine_myplugin[:special_tracker].to_i==@issue.tracker_id %>
blah blah blah...
<% end %>
</div>

":special_tracker" is a special tracker I've selected in the plugin's page configuration.

The problem is @issue.tracker_id doesn't refresh when it changes.
Should I use a "observe_field" on my view? I haven't any idea how to do that.

Using Redime 1.0.2

Thanks!


Replies (1)

RE: How to refresh a call_hook - Added by Francisco José Martínez almost 13 years ago

I forgot say: on create issue. On edit the tracker_id doesn't change. But when I create a new issue and select tracker then the view doesn't reload

    (1-1/1)