Skip to content
Snippets Groups Projects
Commit 817d96fa authored by jan_sevecek_sperling's avatar jan_sevecek_sperling
Browse files

Update lib/sparkline_hook_listener.rb, lib/settings_controller_patch.rb,...

Update lib/sparkline_hook_listener.rb, lib/settings_controller_patch.rb, lib/sparkline_projects_helper_patch.rb, init.rb files
Deleted lib/patches/projects_helper_patch.rb, lib/patches/settings_controller_patch.rb files
parent 1123371a
Branches
No related tags found
1 merge request!1Update lib/sparkline_hook_listener.rb, lib/settings_controller_patch.rb,...
require 'redmine'
Redmine::Plugin.register :sparkline do
name 'Sparkline plugin'
author 'Sperling'
......@@ -21,4 +23,10 @@ Redmine::Plugin.register :sparkline do
}
end
Rails.configuration.to_prepare do
require_dependency 'projects_helper'
unless ProjectsHelper.included_modules.include? SparklineProjectsHelperPatch
ProjectsHelper.send(:include, SparklineProjectsHelperPatch)
end
end
end
# frozen_string_literal: true
# Redmine - project management software
# Copyright (C) 2006-2019 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module ProjectsHelperPatch
def self.included(base)
# :nodoc:
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
# Same as typing in the class
base.class_eval do
unloadable # Send unloadable so it will not be unloaded in development
alias_method :project_settings_tabs_without_sparkline, :project_settings_tabs
alias_method :project_settings_tabs, :project_settings_tabs_with_sparkline
end
end
module ClassMethods
end
module InstanceMethods
def project_settings_tabs_with_sparkline
tabs = project_settings_tabs_without_sparkline
if @project.enabled_module(:sparkline)
tabs.push ( {:name => 'sparkline', :action => :sparkline, :partial => 'settings/plugin_sparkline', :label => :sparkline})
end
tabs
end
end
end
unless ProjectsHelper.included_modules.include? ProjectsHelperPatch
ProjectsHelper.send(:include, ProjectsHelperPatch)
end
......@@ -62,4 +62,4 @@ end
unless SettingsController.included_modules.include? SettingsControllerPatch
SettingsController.send(:include, SettingsControllerPatch)
end
\ No newline at end of file
end
......@@ -2,4 +2,4 @@ class SparklineHookListener < Redmine::Hook::ViewListener
render_on :view_issues_index_bottom, partial: "hooks/sparkline_issues_list"
render_on :view_issues_show_details_bottom, partial: "hooks/sparkline_issues_show"
end
\ No newline at end of file
end
require_dependency 'projects_helper'
module SparklineProjectsHelperPatch
module ProjectsHelperPatch
def project_settings_tabs
tabs = super
action = {:name => 'sparkline',
:action => :sparkline,
:partial => 'settings/plugin_sparkline',
:label => :sparkline}
tabs << action if @project.enabled_module(:sparkline)
tabs
end
end
end
ProjectsHelper.prepend SparklineProjectsHelperPatch::ProjectsHelperPatch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment