Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Removing action_view_rendering and add render_super gem #12

Open
wants to merge 6 commits 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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ group :test do
gem "shoulda"
end
end
gem 'render_super'
5 changes: 2 additions & 3 deletions app/views/workflow_enhancements/_issue_popup.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<% if User.current.allowed_to?(:workflow_graph_view, @project) %>
<% if User.current.allowed_to?(:workflow_graph_view, @project) && @issue.tracker_id %>
<% content_for :header_tags do -%>
<%= stylesheet_link_tag "workflow_enhancements.css", :plugin => :redmine_workflow_enhancements %>
<% end -%>

<script type="text/javascript">
$(function() {
$('<span id="workflow-help" class="icon icon-help" style="margin-left:4px;cursor:pointer;"></span>')
.insertAfter('#issue_status_id');
$('label[for="issue_status_id"]').prepend('<a href="#" id="workflow-help" class="icon icon-help"><img src="/images/help.png" alt="Workflow"></a>');

$('#workflow-help').click(function() {
$.ajax({
Expand Down
7 changes: 5 additions & 2 deletions init.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require_dependency 'workflow_enhancements/hooks'
require_dependency 'workflow_enhancements/patches/action_view_rendering'
require_dependency 'workflow_enhancements/patches/tracker_patch'

Redmine::Plugin.register :redmine_workflow_enhancements do
Expand All @@ -11,7 +10,11 @@
author_url 'https://github.com/dr-itz/'

requires_redmine '2.2.0'

if Redmine::VERSION::MAJOR >= 3 && Redmine::VERSION::MINOR >= 4
Rails.configuration.to_prepare do
WorkflowsController.send(:include, WorkflowEnhancements::Patches::WorkflowsControllerPatch)
end
end
project_module :issue_tracking do
permission :workflow_graph_view, :workflow_enhancements => :show
end
Expand Down
65 changes: 0 additions & 65 deletions lib/workflow_enhancements/patches/action_view_rendering.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/workflow_enhancements/patches/tracker_patch.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_dependency 'tracker'

class Tracker
has_many :tracker_statuses
has_many :tracker_statuses, dependent: :destroy
has_many :predef_issue_statuses, :through => :tracker_statuses

def issue_statuses_with_workflow_enhancements
Expand Down
32 changes: 32 additions & 0 deletions lib/workflow_enhancements/patches/workflows_controller_patch.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module WorkflowEnhancements
module Patches
module WorkflowsControllerPatch
def self.included(base) # :nodoc
base.extend(ClassMethods)
base.send(:include, InstanceMethods)
base.class_eval do
unloadable
alias_method_chain :find_statuses , :workflow_enhancements
end
end

module ClassMethods; end

module InstanceMethods
def find_statuses_with_workflow_enhancements
@used_statuses_only = (params[:used_statuses_only] == '0' ? false : true)
if @trackers && @used_statuses_only
role_ids = Role.all.select(&:consider_workflow?).map(&:id)
status_ids = WorkflowTransition.where(
:tracker_id => @trackers.map(&:id), :role_id => role_ids
).distinct.pluck(:old_status_id, :new_status_id).flatten.uniq
status_ids.concat TrackerStatus.where(:tracker_id => @trackers.map(&:id)).distinct.pluck(:issue_status_id).flatten.uniq
status_ids = status_ids.flatten.uniq
@statuses = IssueStatus.where(:id => status_ids).sorted.to_a.presence
end
@statuses ||= IssueStatus.sorted.to_a
end
end
end
end
end