Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redmine 4.0.X adaptations #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/workflow_enhancements_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class WorkflowEnhancementsController < ApplicationController
before_filter :find_project_by_project_id #, :authorize
before_action :find_project_by_project_id #, :authorize

def show
@roles = User.current.roles_for_project(@project)
Expand Down
2 changes: 0 additions & 2 deletions app/models/tracker_status.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
class TrackerStatus < ActiveRecord::Base
unloadable

attr_accessible :tracker_id, :issue_status_id

belongs_to :tracker
belongs_to :predef_issue_status, :class_name => 'IssueStatus', :foreign_key => 'issue_status_id'

Expand Down
2 changes: 1 addition & 1 deletion lib/workflow_enhancements/graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def self.load_data(roles, trackers, issue=nil)
private

def self.is_default_status(tracker, status)
if Redmine::VERSION::MAJOR == 3
if Redmine::VERSION::MAJOR >= 3
tracker.default_status == status
else
status.is_default
Expand Down
8 changes: 4 additions & 4 deletions lib/workflow_enhancements/patches/action_view_rendering.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Base
#
# This renders the "super" template, i.e. the one hidden by the plugin
#
def render_with_workflow_enhancements(*args, &block)
def render(*args, &block)
if args.first == :super
last_view = view_stack.last || {:view => instance_variable_get(:@virtual_path).split('/').last}
options = args[1] || {}
Expand All @@ -39,7 +39,7 @@ def render_with_workflow_enhancements(*args, &block)
end
options[:template] = last_view[:templates].shift
view_stack << last_view
result = render_without_workflow_enhancements options
result = super options
view_stack.pop
result
else
Expand All @@ -50,13 +50,13 @@ def render_with_workflow_enhancements(*args, &block)
current_view[:locals] = options[:locals] if !current_view.nil? && options[:locals]
view_stack << current_view if current_view.present?
end
result = render_without_workflow_enhancements(*args, &block)
result = super
view_stack.pop if current_view.present?
result
end
end

alias_method_chain :render, :workflow_enhancements
#alias_method_chain :render, :workflow_enhancements

def view_stack
@_view_stack ||= []
Expand Down
3 changes: 1 addition & 2 deletions lib/workflow_enhancements/patches/tracker_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Tracker
has_many :tracker_statuses
has_many :predef_issue_statuses, :through => :tracker_statuses

def issue_statuses_with_workflow_enhancements
def issue_statuses
if @issue_statuses
return @issue_statuses
elsif new_record?
Expand All @@ -24,6 +24,5 @@ def issue_statuses_with_workflow_enhancements
@issue_statuses = IssueStatus.where(:id => ids).all.sort
end

alias_method_chain :issue_statuses, :workflow_enhancements
end