Yammer basic plugin [little stupid help needed]

Added by nicola mondinelli over 2 years ago

I'm new on ror programming and i started a plugin to insert a yammer feed (simple HTML code from https://developer.yammer.com/v1.0/docs/embed) into redmine sidebar:
and i was succesful, like the attachment.

Now i want to customize the feed by displaying different feeds on different projects: i can obtain this by inserting an id in the html embedded before:

...
<script>
  yam.connect.embedFeed(
      { container: '#embedded-feed',
        network: 'fourleaf.com',
        feedType: 'group',                // can be 'group', 'topic', or 'user'          
        feedId: '123'                     // feed ID from the instructions above
        ,config: {
             defaultGroupId: 3257958      // specify default group id to post to 
        }
  });    
</script>
...

the "feedID" value is the one that i have to address.

I created a custom field in the db/migrate

class PopulateCustomFields < ActiveRecord::Migration
  def change
    ProjectCustomField.create(:name => 'YammerFeedId', :field_format => 'int', :default_value => '0', :is_required => false, :editable => true, :visible => true)
  end
end

now: HOW CAN I READ THAT VALUE AND PUT IN THE VIEW??

the view_hooks.rb looks like this

class ViewHooks < Redmine::Hook::ViewListener
  def view_layouts_base_sidebar(context={})
    @project = context[:project]

    url = nil
    if context[:request].respond_to?(:request_uri)
      url = context[:request].request_uri
    elsif context[:request].respond_to?(:url)
      url = context[:request].url
    end

    unless context[:project].nil?
      context[:controller].send(:render, { :partial => 'hooks/sidebar' })
    end
  end
end

Mi porpouse is to get the value of the customField YammerFeedId of the project and embed in the HTML on top in the row FeedId:, even i'm in the /project or /issue context.

How can i?
Thanx a lot.