0

I am beginner in the development for Redmine. I created a plugin and added it into project menu. But when i clicked to this tab, it does not link to page I want and the project menu bar disappears. It's hard to control all activities on project management. What should i do?

This is code in my init.rb file:

permission :project_plan, { :project_plan => [:index,:show] }, :public => true
menu :project_menu, :redmine_project_plan, { :controller => 'project_plan', :action => 'index' }, :caption => :project_plan_title
Holger Just
  • 52,918
  • 14
  • 115
  • 123
  • can you tell , how you added the plugin ? – aelor Jan 23 '14 at 10:09
  • At what point you are stuck & what have you tried so far? Can you post some code? – Zo Has Jan 23 '14 at 10:22
  • I created and added plugin into: '$\BitNami Redmine Stack\apps\redmine\htdocs\plugins' following instruction in: http://www.redmine.org/projects/redmine/wiki/Plugin_Tutorial, My code have added in my question – user3227206 Jan 23 '14 at 10:31

2 Answers2

0

I think your problem is that you don't give the project_id as a param, the code above should look more like

permission :project_plan, { :project_plan => [:index,:show] }, :public => true
menu :project_menu, :redmine_project_plan, { :controller => 'project_plan', :action ='index' }, :caption => :project_plan_title, :param => project_id 

And on the controller you need recue this information :

@project= params[:project_id]
melisa.fma
  • 21
  • 5
0

Had the same issue with my Redmine plugin, after hours of digging and research found out what appears to be the issue. What is important is to update the @project variable with project id parameter passed into your show method. Here is my controller file:

class YearlyController < ApplicationController
      unloadable
      helper :issues
      include IssuesHelper

      def show
           require_login       
           @project = Project.find(params[:project_id])       
      end
end

And init.rb file:

Redmine::Plugin.register :weekly do
  name 'Weekly Plan plugin'
  description 'Display weekly plan for current and previous week'
  version '0.0.2'
  menu :project_menu, :yearly, { :controller => 'yearly', :action => 'show' }, :caption => 'Roadmap Year', :after => :overview, :param => :project_id
  menu :project_menu, :weekly, { :controller => 'weekly', :action => 'show' }, :caption => 'Weekly Plan', :after => :yearly, :param => :project_id
  settings :default => { :weeklabel_name => 'Weekly Label' }, :partial => 'settings/settings'
  project_module :weekly do
    permission :view_weekly, :weekly => :show
    permission :view_yearly, :yearly => :show
  end
end
Vitaly
  • 1
  • 1