Redmine >= 3.0 compatibility
This commit is contained in:
parent
165690bf8a
commit
b71da74525
@ -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'
|
||||
|
||||
36
app/views/dmsf_workflows/_new_step_form.html.erb
Normal file
36
app/views/dmsf_workflows/_new_step_form.html.erb
Normal 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>
|
||||
31
app/views/dmsf_workflows/_new_step_modal.html.erb
Normal file
31
app/views/dmsf_workflows/_new_step_modal.html.erb
Normal 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 %>
|
||||
@ -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') %> » <%=h @dmsf_workflow %></h2>
|
||||
@ -29,67 +32,42 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="tab-content" id="tab-content-members">
|
||||
|
||||
<div class="splitcontentleft">
|
||||
<% steps = @dmsf_workflow.dmsf_workflow_steps.collect{|s| s.step}.uniq %>
|
||||
<% if steps.any? %>
|
||||
<table class="list">
|
||||
<thead><tr>
|
||||
<th><%= l(:label_dmsf_workflow_step) %></th>
|
||||
<th><%= l(:label_dmsf_workflow_approval_plural) %></th>
|
||||
<th><%= l(:button_sort)%></th>
|
||||
<th/>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% steps.each do |i|%>
|
||||
<tr id="step-<%= i %>" class="<%= cycle 'odd', 'even' %> step">
|
||||
<td class="step"><%= i %></td>
|
||||
<td class="approval">
|
||||
<% @dmsf_workflow.dmsf_workflow_steps.collect{|s| (s.step == i) ? s : nil}.compact.each_with_index do |step, j| %>
|
||||
<% if j != 0 %>
|
||||
<b><%= step.soperator %></b> 
|
||||
<% end %>
|
||||
<%= link_to_user step.user %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="reorder">
|
||||
<%= reorder_links('workflow_step', {:action => 'edit', :id => @dmsf_workflow, :step => i}, :put) %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= delete_link edit_dmsf_workflow_path(@dmsf_workflow, :step => i) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end; reset_cycle %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<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) %> <%= l(:label_or) %> <%= submit_tag l(:dmsf_or) %></p>
|
||||
</fieldset>
|
||||
<div class="tab-content" id="tab-content-members">
|
||||
<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">
|
||||
<thead><tr>
|
||||
<th><%= l(:label_dmsf_workflow_step) %></th>
|
||||
<th><%= l(:label_dmsf_workflow_approval_plural) %></th>
|
||||
<th><%= l(:button_sort)%></th>
|
||||
<th/>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% steps.each do |i|%>
|
||||
<tr id="step-<%= i %>" class="<%= cycle 'odd', 'even' %> step">
|
||||
<td class="step"><%= i %></td>
|
||||
<td class="approval">
|
||||
<% @dmsf_workflow.dmsf_workflow_steps.collect{|s| (s.step == i) ? s : nil}.compact.each_with_index do |step, j| %>
|
||||
<% if j != 0 %>
|
||||
<b><%= step.soperator %></b> 
|
||||
<% end %>
|
||||
<%= link_to_user step.user %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="reorder">
|
||||
<%= reorder_links('workflow_step', {:action => 'edit', :id => @dmsf_workflow, :step => i}, :put) %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= delete_link edit_dmsf_workflow_path(@dmsf_workflow, :step => i) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end; reset_cycle %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
19
app/views/dmsf_workflows/new_step.html.erb
Normal file
19
app/views/dmsf_workflows/new_step.html.erb
Normal 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 %>
|
||||
2
app/views/dmsf_workflows/new_step.js.erb
Normal file
2
app/views/dmsf_workflows/new_step.js.erb
Normal file
@ -0,0 +1,2 @@
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'new_step_modal') %>');
|
||||
showModal('ajax-modal', '700px');
|
||||
@ -126,9 +126,10 @@ RedmineApp::Application.routes.draw do
|
||||
post 'new_action'
|
||||
get 'start'
|
||||
post 'assignment'
|
||||
get 'new_step'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
match 'dmsf_workflows/:id/edit', :controller => 'dmsf_workflows', :action => 'add_step', :id => /\d+/, :via => :post
|
||||
match 'dmsf_workflows/:id/edit', :controller => 'dmsf_workflows', :action => 'remove_step', :id => /\d+/, :via => :delete
|
||||
match 'dmsf_workflows/:id/edit', :controller => 'dmsf_workflows', :action => 'reorder_steps', :id => /\d+/, :via => :put
|
||||
|
||||
2
init.rb
2
init.rb
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user