mirror of
https://github.com/anteo/redmine_custom_workflows.git
synced 2026-01-26 00:04:20 +00:00
Redmine 4.1 compatibility
This commit is contained in:
parent
45a99f0d1c
commit
17f145af56
2
Gemfile
2
Gemfile
@ -26,5 +26,5 @@ gem 'activemodel-serializers-xml'
|
|||||||
|
|
||||||
# Redmine extensions
|
# Redmine extensions
|
||||||
unless %w(easyproject easy_gantt).any? { |plugin| Dir.exist?(File.expand_path("../../#{plugin}", __FILE__)) }
|
unless %w(easyproject easy_gantt).any? { |plugin| Dir.exist?(File.expand_path("../../#{plugin}", __FILE__)) }
|
||||||
gem 'redmine_extensions', '~> 0.2.5'
|
gem 'redmine_extensions', '~> 0.3.9'
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
@ -50,14 +51,14 @@ class CustomWorkflowsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@workflows = CustomWorkflow.includes(:projects).order(:position => :asc)
|
@workflows = CustomWorkflow.includes(:projects).order(position: :asc)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def export
|
def export
|
||||||
send_data @workflow.export_as_xml, :filename => @workflow.name + '.xml', :type => :xml
|
send_data @workflow.export_as_xml, filename: "#{@workflow.name}.xml", type: :xml
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@ -87,7 +88,7 @@ class CustomWorkflowsController < ApplicationController
|
|||||||
else
|
else
|
||||||
flash[:errors] = @workflow.errors.full_messages.to_sentence
|
flash[:errors] = @workflow.errors.full_messages.to_sentence
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue => e
|
||||||
Rails.logger.warn "Workflow import error: #{e.message}\n #{e.backtrace.join("\n ")}"
|
Rails.logger.warn "Workflow import error: #{e.message}\n #{e.backtrace.join("\n ")}"
|
||||||
flash[:errors] = l(:error_failed_import)
|
flash[:errors] = l(:error_failed_import)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
@ -50,7 +51,7 @@ class CustomWorkflow < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.log_message(str, object)
|
def self.log_message(str, object)
|
||||||
Rails.logger.info str + " for #{object.class} (\##{object.id}) \"#{object}\""
|
Rails.logger.info "#{str} for #{object.class} (\##{object.id}) \"#{object}\""
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.run_shared_code(object)
|
def self.run_shared_code(object)
|
||||||
@ -96,7 +97,7 @@ class CustomWorkflow < ActiveRecord::Base
|
|||||||
Rails.logger.info "== User workflow error: #{e.message}"
|
Rails.logger.info "== User workflow error: #{e.message}"
|
||||||
object.errors.add :base, e.error
|
object.errors.add :base, e.error
|
||||||
false
|
false
|
||||||
rescue Exception => e
|
rescue => e
|
||||||
Rails.logger.error "== Custom workflow exception: #{e.message}\n #{e.backtrace.join("\n ")}"
|
Rails.logger.error "== Custom workflow exception: #{e.message}\n #{e.backtrace.join("\n ")}"
|
||||||
object.errors.add :base, :custom_workflow_error
|
object.errors.add :base, :custom_workflow_error
|
||||||
false
|
false
|
||||||
@ -109,7 +110,7 @@ class CustomWorkflow < ActiveRecord::Base
|
|||||||
def validate_syntax_for(object, event)
|
def validate_syntax_for(object, event)
|
||||||
object.instance_eval(read_attribute(event)) if respond_to?(event) && read_attribute(event)
|
object.instance_eval(read_attribute(event)) if respond_to?(event) && read_attribute(event)
|
||||||
rescue WorkflowError => _
|
rescue WorkflowError => _
|
||||||
rescue Exception => e
|
rescue => e
|
||||||
errors.add event, :invalid_script, error: e
|
errors.add event, :invalid_script, error: e
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
1
init.rb
1
init.rb
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
@ -23,7 +24,7 @@ class WorkflowError < StandardError
|
|||||||
attr_accessor :error
|
attr_accessor :error
|
||||||
|
|
||||||
def initialize(message)
|
def initialize(message)
|
||||||
@error = message.dup
|
@error = message
|
||||||
super message
|
super message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
export REDMINE_GIT_REPO=git://github.com/redmine/redmine.git
|
export REDMINE_GIT_REPO=git://github.com/redmine/redmine.git
|
||||||
export REDMINE_GIT_TAG=4.0-stable
|
export REDMINE_GIT_TAG=4.1-stable
|
||||||
|
|
||||||
clone()
|
clone()
|
||||||
{
|
{
|
||||||
|
|||||||
2
test/fixtures/custom_workflows.yml
vendored
2
test/fixtures/custom_workflows.yml
vendored
@ -4,7 +4,7 @@ custom_workflows_001:
|
|||||||
before_save: "Rails.logger.info '>>> before save'"
|
before_save: "Rails.logger.info '>>> before save'"
|
||||||
after_save: "Rails.logger.info '>>> after save'"
|
after_save: "Rails.logger.info '>>> after save'"
|
||||||
name: 'Issue CW test'
|
name: 'Issue CW test'
|
||||||
description: NULL
|
description: 'Testing workflow'
|
||||||
position: 1
|
position: 1
|
||||||
is_for_all: 0
|
is_for_all: 0
|
||||||
author: 'karel.picman@kontron.com'
|
author: 'karel.picman@kontron.com'
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
# frozen_string_literal: true
|
||||||
#
|
#
|
||||||
# Redmine plugin for Custom Workflows
|
# Redmine plugin for Custom Workflows
|
||||||
#
|
#
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user