<% # encoding: utf-8 # # Redmine plugin for Document Management System "Features" # # Copyright © 2011-18 Karel Pičman # # 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. %> <% if @dmsf_workflow.project %>

<%= link_to l(:label_dmsf_workflow_plural), settings_project_path(@project, :tab => 'dmsf_workflow') %> » <%=h @dmsf_workflow %>

<% else %>

<%= link_to l(:label_dmsf_workflow_plural), dmsf_workflows_path %> » <%=h @dmsf_workflow %>

<% end %> <%= labelled_form_for @dmsf_workflow do |f| %> <%= error_messages_for 'workflow' %>

<%= f.text_field :name, :required => true %> <%= f.submit l(:button_save) %>

<% end %>

<%= link_to l(:dmsf_new_step_or_approver), new_step_dmsf_workflow_path(@dmsf_workflow), :remote => true, :class => 'icon icon-add' %>

<% steps = @dmsf_workflow.dmsf_workflow_steps.collect{|s| s.step}.uniq %> <% if steps.any? %> <% steps.each do |i|%> <% index = @dmsf_workflow.dmsf_workflow_steps.order(:id).index{ |s| s.step == i } %> <%= form_for(@dmsf_workflow, :url => update_step_dmsf_workflow_path(:step => index), :method => :put, :html => {:id => "step-index-#{index}-form", :class => 'hol'}) do |f| %> <% end %>
<%= l(:label_dmsf_workflow_step) %> <%= l(:label_dmsf_workflow_approval_plural) %>
<%= i %> <%= @dmsf_workflow.dmsf_workflow_steps[index].name if index %>
" class="hol"> <%= f.text_field(:name, :value => @dmsf_workflow.dmsf_workflow_steps[index].name) %>
<% stps = @dmsf_workflow.dmsf_workflow_steps.collect{|s| (s.step == i) ? s : nil}.compact %> <% stps.each_with_index do |step, j| %> <% if (j != 0) || (stps.count > 1) %> <%= step.soperator %> <% end %> <%= link_to_user step.user %> <% end %>
", class="hol">
<% stps.each_with_index do |step, j| %>


 <%= delete_link delete_step_dmsf_workflow_path(:step => step.id) %>
<%= select_tag "assignee[#{step.id}]", principals_options_for_select(@approving_candidates | [step.user], step.user), :include_blank => false %>
<% end %>

<%= submit_tag l(:button_change), :class => 'small' %> <%= link_to_function( l(:button_cancel), "$('#step-index-#{index}-name').show(); $('#step-index-#{index}-approvers').show(); $('#step-index-#{index}-name-form').hide(); $('#step-index-#{index}-approvers-form').hide();") %>

<% end %>
<%= reorder_handle(@dmsf_workflow, :url => url_for(:action => 'edit', :id => @dmsf_workflow, :step => i) ) %> <%= link_to_function l(:button_edit), "$('#step-index-#{index}-name').hide(); $('#step-index-#{index}-approvers').hide(); $('#step-index-#{index}-name-form').show(); $('#step-index-#{index}-approvers-form').show();", :class => 'icon icon-edit' %> <%= delete_link edit_dmsf_workflow_path(@dmsf_workflow, :step => i) %>
<% else %>

<%= l(:label_no_data) %>

<% end %>
<%= late_javascript_tag do %> $(function() { $("table.steps tbody").positionedItems(); }); <% end %>