Project

General

Profile

Actions

Defect #28252

closed

redmine plugin project setting tabs add

Added by 曾 詠智 about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

my patch.rb

require_dependency 'projects_helper'

module SampleProjectsHelperPatch
  def self.included(base)   
    base.send(:include, ProjectsHelperMethodsSample)
    base.class_eval do
        alias_method_chain :project_settings_tabs, :redmine_dfi_category
    end
  end
end

module ProjectsHelperMethodsSample
  def project_settings_tabs_with_redmine_dfi_category 
    tabs = project_settings_tabs_without_redmine_dfi_category
    action = {:name => 'sample_plugin', 
      :controller => 'example',
      :action => :show, 
      :partial => 'sample_settings/sample_plugin_settings', :label => :label_plugin_example}
    tabs << action #if User.current.allowed_to?(action, @project)
    tabs
  end
end

my init.rb

require 'redmine'
#require 'tasks\dfi_category_helper_patch'
require 'dfi_category_issues_hook'
require 'dfi_category_controller_issue_hook'
require 'sample_projects_helper_patch'
Redmine::Plugin.register :redmine_dfi_category do
  name 'Redmine Dfi Category plugin'
  author 'Tony'
  description 'This is a plugin for Redmine'
  version '0.0.1'
  url 'http://example.com/path/to/plugin'
  author_url 'http://example.com/about'

  menu :project_menu, :categories,{ :controller =>'dfi_categories', :action=>'index' } 

    project_module :dfi_categories do
    permission :dfi, :dfi_categories => :index
    permission :redmine_dfi_category, {:categories_setting => [:show, :edit]}, :require => :member
    end

   Rails.configuration.to_prepare do
    require_dependency 'projects_helper'
   unless ProjectsHelper.included_modules.include? SampleProjectsHelperPatch
      ProjectsHelper.send(:include, SampleProjectsHelperPatch)   
    end 
  end 
end

I follow the plugin's patch of content
(https://github.com/akiko-pusu/redmine_issue_templates/blob/master/lib/issue_templates/projects_helper_patch.rb)

but my tab can't work...

thinks

Actions

Also available in: Atom PDF