Add item into project settings tabs
Added by Marian Mrózek about 14 years ago
Hello,
I am begginer in development redmine. I created plugin and everything is OK, but I want add item into project settings tabs. How I add new item into "tabs" array? (in project_settings_tab method) https://github.com/edavis10/redmine/blob/master/app/helpers/projects_helper.rb ?
Thanks, Marian.
Replies (5)
RE: Add item into project settings tabs - Added by Andriy Lesyuk almost 14 years ago
init.rb:
require 'dispatcher'
Dispatcher.to_prepare :your_plugin do
unless ProjectsHelper.included_modules.include?(ProjectsHelperPatch)
ProjectsHelper.send(:include, ProjectsHelperPatch)
end
end
projects_helper_patch.rb
require_dependency 'projects_helper'
module ProjectsHelperPatch
def self.included(base)
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
unloadable
alias_method_chain :project_settings_tabs, :your_plugin
end
end
module ClassMethods
end
module InstanceMethods
def project_settings_tabs_with_your_plugin
tabs = project_settings_tabs_without_your_plugin
tabs.push({ :name => 'some_name',
:action => :some_action,
:partial => 'projects/settings/some_page',
:label => :label_some_label })
return tabs
end
end
end
The problem is that only one plugin can do this... That is if you installed two or more plugins doing this - only the last one will work properly.
P.S. I'm thinking about writing plugin/patch to add a hook (or whatever to fix this).
RE: Add item into project settings tabs - Added by Andriy Lesyuk almost 14 years ago
Another option is to copy app/views/projects/settings.rhtml and modify is as following:
<h2><%=l(:label_settings)%></h2>
<%
tabs = project_settings_tabs
if <condition>
tabs.push({ :name => 'some_name',
:action => :manage_something,
:partial => 'projects/settings/some_html_file',
:label => :label_something })
end
%>
<%= render_tabs tabs %>
<% html_title(l(:label_settings)) -%>
RE: Add item into project settings tabs - Added by Andriy Lesyuk over 13 years ago
Did wrote a plugin... :) Check: http://projects.andriylesyuk.com/projects/redmine-settings
RE: Add item into project settings tabs - Added by Bruno Spyckerelle over 11 years ago
Any news about this feature request ?
RE: Add item into project settings tabs - Added by Denis Savitskiy over 11 years ago
Bruno Spyckerelle wrote:
Any news about this feature request ?
+1