-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow custom workflows to be enabled globally for all projects (#8750)
- Loading branch information
Showing
14 changed files
with
154 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
db/migrate/20121005085252_add_is_for_all_to_custom_workflows.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class AddIsForAllToCustomWorkflows < ActiveRecord::Migration | ||
def self.up | ||
add_column :custom_workflows, :is_for_all, :boolean, :null => false, :default => false | ||
end | ||
def self.down | ||
remove_column :custom_workflows, :is_for_all | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
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 | ||
# (eg. some intermediate nodes are private and can not be seen) | ||
def custom_workflows_render_nested_projects(projects) | ||
s = '' | ||
if projects.any? | ||
ancestors = [] | ||
original_project = @project | ||
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)) | ||
s << "<ul class='projects #{ ancestors.empty? ? 'root' : nil}'>\n" | ||
else | ||
ancestors.pop | ||
s << "</li>" | ||
while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) | ||
ancestors.pop | ||
s << "</ul></li>\n" | ||
end | ||
end | ||
classes = (ancestors.empty? ? 'root' : 'child') | ||
s << "<li class='#{classes}'><div class='#{classes}'>" | ||
s << h(block_given? ? yield(project) : project.name) | ||
s << "</div>\n" | ||
ancestors << project | ||
end | ||
s << ("</li></ul>\n" * ancestors.size) | ||
@project = original_project | ||
end | ||
s.html_safe | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters