Redmine >= 3.0 compatibility

This commit is contained in:
Karel Pičman 2015-06-10 14:02:37 +02:00
parent 165690bf8a
commit b71da74525
8 changed files with 143 additions and 67 deletions

View File

@ -270,6 +270,15 @@ class DmsfWorkflowsController < ApplicationController
render :layout => false
end
def new_step
@steps = @dmsf_workflow.dmsf_workflow_steps.collect{|s| s.step}.uniq
respond_to do |format|
format.html
format.js
end
end
def add_step
if request.post?
if params[:step] == '0'

View File

@ -0,0 +1,36 @@
<%
# encoding: utf-8
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<fieldset class="box">
<legend><%=l(:label_dmsf_workflow_add_approver)%></legend>
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
<%= javascript_tag "observeSearchfield('user_search', 'users', '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, :dmsf_workflow_step_assignment_id => nil, :dmsf_file_revision_id => nil, :project_id => @project ? @project.id : nil) }')" %>
<div id="users">
<%= render_principals_for_new_dmsf_workflow_users(@dmsf_workflow, nil, nil) %>
</div>
</fieldset>
<fieldset class="box">
<legend><%= l(:label_dmsf_workflow_step) %></legend>
<%= select_tag 'step', dmsf_workflow_steps_options_for_select(@steps),
:id => 'selected_step', :style => "width:100px" %>
</fieldset>

View File

@ -0,0 +1,31 @@
<%
# encoding: utf-8
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<h3 class="title"><%= l(:dmsf_new_step) %></h3>
<%= form_for(:dmsf_workflow, {:url => edit_dmsf_workflow_path(@dmsf_workflow), :method => :post}) do |f| %>
<%= render :partial => 'new_step_form' %>
<p class="buttons">
<%= submit_tag l(:dmsf_and), :id => 'add-step-and' %>
<%= submit_tag l(:dmsf_or), :id => 'add-step-or' %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => 'hideModal(this);', :type => 'button' %>
</p>
<% end %>

View File

@ -1,6 +1,8 @@
<%# Redmine plugin for Document Management System "Features"
<%
# encoding: utf-8
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2013 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-15 Karel Pičman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -14,7 +16,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
%>
<% if @dmsf_workflow.project %>
<h2><%= link_to l(:label_dmsf_workflow_plural), settings_project_path(@project, :tab => 'dmsf_workflow') %> &#187; <%=h @dmsf_workflow %></h2>
@ -30,8 +33,9 @@
<% end %>
<div class="tab-content" id="tab-content-members">
<div class="splitcontentleft">
<p>
<%= link_to l(:dmsf_new_step), new_step_dmsf_workflow_path(@dmsf_workflow), :remote => true, :class => 'icon icon-add' %>
</p>
<% steps = @dmsf_workflow.dmsf_workflow_steps.collect{|s| s.step}.uniq %>
<% if steps.any? %>
<table class="list">
@ -67,29 +71,3 @@
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</div>
<div class="splitcontentright">
<%= form_for(@dmsf_workflow, :url => edit_dmsf_workflow_path(@dmsf_workflow),
:html => {:method => :post}) do |f| %>
<fieldset><legend><%=l(:label_user_new)%></legend>
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
<%= javascript_tag "observeSearchfield('user_search', 'users', '#{ escape_javascript autocomplete_for_user_dmsf_workflow_path(@dmsf_workflow, :dmsf_workflow_step_assignment_id => nil, :dmsf_file_revision_id => nil, :project_id => @project ? @project.id : nil) }')" %>
<div id="users">
<%= render_principals_for_new_dmsf_workflow_users(@dmsf_workflow, nil, nil) %>
</div>
<p>
<%= l(:label_dmsf_workflow_step) %>
<%= select_tag 'step',
dmsf_workflow_steps_options_for_select(steps),
:id => 'selected_step', :style => "width:100px" %>
</p>
<p><%= l(:label_dmsf_workflow_add_approver) %></p>
<p><%= submit_tag l(:dmsf_and) %>&nbsp<%= l(:label_or) %>&nbsp<%= submit_tag l(:dmsf_or) %></p>
</fieldset>
<% end %>
</div>
</div>

View File

@ -0,0 +1,19 @@
<%
# encoding: utf-8
#
# Redmine plugin for Kontron customisation
# Copyright (c) 2011-15 Kontron
# Karel Pičman <karel.picman@kontron.com>
#
# Repository folders
%>
<h2><%= l(:label_repository_folders) %></h2>
<%= form_for(:repository_folder, {:url => edit_dmsf_workflow_path(@dmsf_workflow), :method => :post}) do |f| %>
<%= render :partial => 'new_step_form' %>
<p>
<%= submit_tag l(:dmsf_and), :id => 'add-step-and' %>
<%= submit_tag l(:dmsf_or), :id => 'add-step-or' %>
</p>
<% end %>

View File

@ -0,0 +1,2 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'new_step_modal') %>');
showModal('ajax-modal', '700px');

View File

@ -126,6 +126,7 @@ RedmineApp::Application.routes.draw do
post 'new_action'
get 'start'
post 'assignment'
get 'new_step'
end
end

View File

@ -84,7 +84,7 @@ Redmine::Plugin.register :redmine_dmsf do
permission :file_approval,
{:dmsf_workflows => [:action, :new_action, :autocomplete_for_user, :start, :assign, :assignment]}
permission :manage_workflows,
{:dmsf_workflows => [:index, :new, :create, :destroy, :show, :add_step, :remove_step, :reorder_steps, :update]}
{:dmsf_workflows => [:index, :new, :create, :destroy, :show, :new_step, :add_step, :remove_step, :reorder_steps, :update]}
end
# Administration menu extension