mirror of
https://github.com/anteo/redmine_custom_workflows.git
synced 2026-01-26 00:04:20 +00:00
Compatibility with Redmine 3.x
This commit is contained in:
parent
e05a8a467d
commit
37bedaa84a
@ -95,10 +95,11 @@ Do not forget to check whether issue is just created. Here we create the new iss
|
||||
|
||||
== Compatibility
|
||||
|
||||
This plug-in is compatible with Redmine 1.2.x, 1.3.x, 1.4.x, 2.x.x
|
||||
This plug-in is compatible with Redmine 1.2.x, 1.3.x, 1.4.x, 2.x.x, 3.x.x (starting from version 0.1.0)
|
||||
|
||||
== Changelog
|
||||
|
||||
[0.1.0] Compatibility with Redmine 3.x, support of Redmine 2.x.x has dropped (for Redmine 2.x.x please use version 0.0.5)
|
||||
[0.0.5] Compatibility with latest versions of Redmine 2.x.x
|
||||
[0.0.4] * Added ability to enable workflows globally for all projects. No need to enable 'Custom workflows' project module anymore. Just go to the 'Administration' -> 'Custom workflows' section and enable or disable your workflows in one place.
|
||||
* Fixed bug with 'Status transition prohibited' when updating the issue status by the repository commit
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
class CustomWorkflowsController < ApplicationController
|
||||
unloadable
|
||||
|
||||
layout 'admin'
|
||||
before_filter :require_admin
|
||||
before_filter :find_workflow, :only => [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@workflows = CustomWorkflow.find(:all, :include => [:projects])
|
||||
@workflows = CustomWorkflow.includes(:projects).all
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
|
||||
@ -7,21 +7,17 @@ class WorkflowError < StandardError
|
||||
end
|
||||
|
||||
class CustomWorkflow < ActiveRecord::Base
|
||||
unloadable
|
||||
|
||||
attr_protected :id
|
||||
has_and_belongs_to_many :projects
|
||||
acts_as_list
|
||||
|
||||
default_scope :order => 'position ASC'
|
||||
validates_presence_of :name
|
||||
validates_uniqueness_of :name, :case_sensitive => false
|
||||
validate :validate_syntax
|
||||
|
||||
if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new("3.1.0")
|
||||
named_scope :for_all, :conditions => {:is_for_all => true}
|
||||
else
|
||||
scope :for_all, where(:is_for_all => true)
|
||||
end
|
||||
default_scope { order(:position => :asc) }
|
||||
scope :for_all, lambda { where(:is_for_all => true) }
|
||||
|
||||
def validate_syntax
|
||||
issue = Issue.new
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
|
||||
<div class="splitcontent">
|
||||
<div class="splitcontentleft box">
|
||||
<p><%= f.text_field :name, :required => true, :size => 50 %></p>
|
||||
|
||||
<p><%= f.text_area :description, :cols => 40, :rows => 5 %></p>
|
||||
<p><label><%= f.check_box :is_for_all, :onclick => "checkAndDisable('custom_workflow_enabled_projects', this.checked);", :no_label => true %> <%= l(:field_enabled_for_all_projects) %></label></p>
|
||||
|
||||
<p>
|
||||
<label><%= f.check_box :is_for_all, :onclick => "checkAndDisable('custom_workflow_enabled_projects', this.checked);", :no_label => true %> <%= l(:field_enabled_for_all_projects) %></label>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="splitcontentright">
|
||||
@ -44,9 +47,9 @@
|
||||
jQuery('#custom_workflow_after_save').taboverride(2, true);
|
||||
function checkAndDisable(id, checked) {
|
||||
if (checked) {
|
||||
jQuery('#'+id).find('input[type=checkbox]').attr('checked', true).attr('disabled', true);
|
||||
jQuery('#' + id).find('input[type=checkbox]').attr('checked', true).attr('disabled', true);
|
||||
} else {
|
||||
jQuery('#'+id).find('input[type=checkbox]').removeAttr('checked').removeAttr('disabled');
|
||||
jQuery('#' + id).find('input[type=checkbox]').removeAttr('checked').removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -54,11 +57,5 @@
|
||||
<%= wikitoolbar_for :custom_workflow_description %>
|
||||
|
||||
<% content_for :header_tags do %>
|
||||
<% if (Redmine::VERSION::ARRAY <=> [2,1,0]) < 0 %>
|
||||
<%= javascript_include_tag "jquery-1.8.1.min.js", :plugin => 'redmine_custom_workflows' %>
|
||||
<script type="text/javascript">
|
||||
jQuery.noConflict();
|
||||
</script>
|
||||
<% end %>
|
||||
<%= javascript_include_tag "tab_override", :plugin => 'redmine_custom_workflows' %>
|
||||
<% end %>
|
||||
2
assets/javascripts/jquery-1.8.1.min.js
vendored
2
assets/javascripts/jquery-1.8.1.min.js
vendored
File diff suppressed because one or more lines are too long
@ -2,10 +2,20 @@
|
||||
background-image: url(../../../images/ticket_go.png);
|
||||
}
|
||||
|
||||
table.list.custom-workflows td { vertical-align: middle; }
|
||||
table.list.custom-workflows td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#custom_workflow_description, #custom_workflow_name { width: 98%; }
|
||||
#custom_workflow_description, #custom_workflow_name {
|
||||
width: 98%;
|
||||
}
|
||||
|
||||
#custom_workflow_before_save, #custom_workflow_after_save { width: 98%; font-size: 11px; }
|
||||
#custom_workflow_before_save, #custom_workflow_after_save {
|
||||
width: 98%;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
#custom_workflow_enabled_projects ul { max-height: 200px; overflow-y: auto; }
|
||||
#custom_workflow_enabled_projects ul {
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
class CreateExampleWorkflow < ActiveRecord::Migration
|
||||
def self.up
|
||||
CustomWorkflow.create(:name => "Duration/Done Ratio/Status correlation", :description => <<EOD, :script => <<EOS)
|
||||
CustomWorkflow.create!(:name => 'Duration/Done Ratio/Status correlation', :description => <<EOD, :script => <<EOS)
|
||||
Set up a correlation between the start date, due date, done ratio and status of issues.
|
||||
|
||||
* If done ratio is changed to 100% and status is "In Process", status changes to "Resolved"
|
||||
|
||||
11
init.rb
11
init.rb
@ -1,7 +1,7 @@
|
||||
require 'redmine'
|
||||
require 'redmine_custom_workflows/hooks'
|
||||
|
||||
to_prepare = Proc.new do
|
||||
Rails.application.config.to_prepare do
|
||||
unless Project.include?(RedmineCustomWorkflows::ProjectPatch)
|
||||
Project.send(:include, RedmineCustomWorkflows::ProjectPatch)
|
||||
end
|
||||
@ -16,18 +16,11 @@ to_prepare = Proc.new do
|
||||
end
|
||||
end
|
||||
|
||||
if Redmine::VERSION::MAJOR >= 2
|
||||
Rails.configuration.to_prepare(&to_prepare)
|
||||
else
|
||||
require 'dispatcher'
|
||||
Dispatcher.to_prepare(:redmine_custom_workflows, &to_prepare)
|
||||
end
|
||||
|
||||
Redmine::Plugin.register :redmine_custom_workflows do
|
||||
name 'Redmine Custom Workflow plugin'
|
||||
author 'Anton Argirov'
|
||||
description 'Allows to create custom workflows for issues, defined in the plain Ruby language'
|
||||
version '0.0.5'
|
||||
version '0.1.0'
|
||||
url 'http://redmine.academ.org'
|
||||
|
||||
menu :admin_menu, :custom_workflows, {:controller => 'custom_workflows', :action => 'index'}, :caption => :label_custom_workflow_plural
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
module RedmineCustomWorkflows
|
||||
module Helper
|
||||
unloadable
|
||||
|
||||
# Renders a tree of projects as a nested set of unordered lists
|
||||
# The given collection may be a subset of the whole project tree
|
||||
@ -13,12 +12,12 @@ module RedmineCustomWorkflows
|
||||
projects.sort_by(&:lft).each do |project|
|
||||
# set the project environment to please macros.
|
||||
@project = project
|
||||
if (ancestors.empty? || project.is_descendant_of?(ancestors.last))
|
||||
if ancestors.empty? || project.is_descendant_of?(ancestors.last)
|
||||
s << "<ul class='projects #{ ancestors.empty? ? 'root' : nil}'>\n"
|
||||
else
|
||||
ancestors.pop
|
||||
s << "</li>"
|
||||
while (ancestors.any? && !project.is_descendant_of?(ancestors.last))
|
||||
s << '</li>'
|
||||
while ancestors.any? && !project.is_descendant_of?(ancestors.last)
|
||||
ancestors.pop
|
||||
s << "</ul></li>\n"
|
||||
end
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
module RedmineCustomWorkflows
|
||||
module IssuePatch
|
||||
unloadable
|
||||
|
||||
def self.included(base)
|
||||
base.send(:include, InstanceMethods)
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
module RedmineCustomWorkflows
|
||||
module ProjectPatch
|
||||
unloadable
|
||||
|
||||
def self.included(base)
|
||||
base.send :include, InstanceMethods
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
module RedmineCustomWorkflows
|
||||
module ProjectsHelperPatch
|
||||
unloadable
|
||||
|
||||
def self.included(base)
|
||||
base.send(:include, InstanceMethods)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user