eri
eri

Reputation: 3514

ajax rendering from redmine view hook

I new in rails. I trying to write redmine plugin to extend sidebar with chat. Hook works with static data. How to pass data? generated by controller?

I have simple controller and list.js.erb

$('#chat-plugin-messages').empty().append("<ul> <%= j render @messages %> </ul>");

How to call it from hook?

hook

module ChatPlugin
  class Hooks < Redmine::Hook::ViewListener
     render_on :view_projects_show_sidebar_bottom,
              :partial => 'hooks/chat/sidebar'
  end
end

upd:

View has been rendered, but controller not called. So i have nil in @messages variable.

UPD:

Code https://github.com/alex-eri/redmine-chat

This works with now, but i want render same block with .

Upvotes: 0

Views: 670

Answers (1)

gotva
gotva

Reputation: 5998

I believe that you can look at this code (hook view_issues_form_details_top) and implement the similar logic in your app

Upvotes: 1

Related Questions