Use external library

Added by Mow Wow over 6 years ago


I'm a beginner with Ruby/Redmine

I'm trying to use an external library to display some data in an issue single view.

To do so, i created a hook, in which i'm trying to call that external library

The external library is Harvested (make some calls to the Harvest system API to get time entries ..)

I installed the Gem

$ gem install harvested
Successfully installed harvested-3.1.1
Parsing documentation for harvested-3.1.1
1 gem installed

And then tried this code :

class PollsHookListener < Redmine::Hook::ViewListener
#render_on :view_issues_sidebar_issues_bottom, :partial => "polls/project_overview"
  def view_issues_show_description_bottom(context = {})
   subdomain = 'somedata'
username = 'somedata'
password = 'somedata'

harvest = ::Harvest.hardy_client(subdomain: subdomain, username: username, password: password)
    return content_tag("p", "#{context[:issue].project.identifier}")

And it doesn't work!

Here's the error

ActionView::Template::Error (uninitialized constant Harvest):
    85: <%= link_to_attachments @issue, :thumbnails => true %>
    86: <% end -%>
    88: <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %>
    90: <% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %>
    91: <hr />
  lib/redmine/hook.rb:61:in `block (2 levels) in call_hook'
  lib/redmine/hook.rb:61:in `each'
  lib/redmine/hook.rb:61:in `block in call_hook'
  lib/redmine/hook.rb:58:in `tap'
  lib/redmine/hook.rb:58:in `call_hook'
  lib/redmine/hook.rb:158:in `call_hook'
  app/views/issues/show.html.erb:88:in `_app_views_issues_show_html_erb__686566982509585210_35583440'
  app/controllers/issues_controller.rb:128:in `block (2 levels) in show'
  app/controllers/issues_controller.rb:125:in `show'

Is there any thing i forgot to do to make Redmine reconize my Harvest library ?


Replies (2)

RE: Use external library - Added by Stefan Arndt over 6 years ago


I doubt you are at the right place. This is not the "redmine for redmine"; this is the redmine for Wt.

Maybe this is what you are looking for:

RE: Use external library - Added by Mow Wow over 6 years ago

Oh i'm sorry i didn't notice that.