AWF: A single button for editing instead of two
This commit is contained in:
parent
648660bcb5
commit
0bac37fa71
@ -399,29 +399,26 @@ class DmsfWorkflowsController < ApplicationController
|
||||
if params[:dmsf_workflow].present?
|
||||
index = params[:step].to_i
|
||||
name = params[:dmsf_workflow][:name]
|
||||
if name.present?
|
||||
step = @dmsf_workflow.dmsf_workflow_steps[index]
|
||||
step.name = name
|
||||
unless step.save
|
||||
flash[:error] = step.errors.full_messages.to_sentence
|
||||
else
|
||||
@dmsf_workflow.dmsf_workflow_steps.each do |s|
|
||||
if s.step == step.step
|
||||
s.name = step.name
|
||||
s.save
|
||||
end
|
||||
step = @dmsf_workflow.dmsf_workflow_steps[index]
|
||||
step.name = name
|
||||
unless step.save
|
||||
flash[:error] = step.errors.full_messages.to_sentence
|
||||
else
|
||||
@dmsf_workflow.dmsf_workflow_steps.each do |s|
|
||||
if s.step == step.step
|
||||
s.name = step.name
|
||||
s.save
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
# Operators
|
||||
params[:operator_step].each do |id, operator|
|
||||
step = DmsfWorkflowStep.find_by_id id
|
||||
if step
|
||||
step.operator = operator.to_i
|
||||
unless step.save
|
||||
flash[:error] = step.errors.full_messages.to_sentence
|
||||
end
|
||||
end
|
||||
# Operators
|
||||
params[:operator_step].each do |id, operator|
|
||||
step = DmsfWorkflowStep.find_by_id id
|
||||
if step
|
||||
step.operator = operator.to_i
|
||||
unless step.save
|
||||
flash[:error] = step.errors.full_messages.to_sentence
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<% for workflow in @workflows %>
|
||||
<tr id="workflow-<%= workflow.id %>" class="dmsf_workflow <%= workflow.active? ? 'active' : 'locked' %> <%= cycle('odd', 'even') %>">
|
||||
<tr id="workflow-<%= workflow.id %>" class="dmsf_workflows <%= workflow.active? ? 'active' : 'locked' %> <%= cycle('odd', 'even') %>">
|
||||
<td class="name"><%= link_to(h(workflow.name), dmsf_workflow_path(workflow)) %></td>
|
||||
<td class="buttons">
|
||||
<%= change_status_link(workflow) unless @project %>
|
||||
|
||||
@ -52,25 +52,17 @@
|
||||
<tbody>
|
||||
<% steps.each do |i|%>
|
||||
<tr id="step-<%= i %>" class="<%= cycle 'odd', 'even' %> step">
|
||||
<td class="id"><%= i %></td>
|
||||
<% 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| %>
|
||||
<td class="id"><%= i %></td>
|
||||
<td class="name">
|
||||
<span id="step-index-<%= index %>-name"><%= @dmsf_workflow.dmsf_workflow_steps[index].name if index %></span>
|
||||
<%= form_for(@dmsf_workflow,
|
||||
:url => update_step_dmsf_workflow_path(:step => index),
|
||||
:method => :put,
|
||||
:html => {:id => "step-index-#{index}-name-form", :class => 'hol'}) do |f| %>
|
||||
<p>
|
||||
<%= f.text_field(:name, :value => @dmsf_workflow.dmsf_workflow_steps[index].name) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= 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();")
|
||||
%>
|
||||
</p>
|
||||
<% end %>
|
||||
<div id="<%= "step-index-#{index}-name-form" %>" class="hol">
|
||||
<%= f.text_field(:name, :value => @dmsf_workflow.dmsf_workflow_steps[index].name) %>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<span id="step-index-<%= index %>-approvers">
|
||||
@ -82,10 +74,7 @@
|
||||
<%= link_to_user step.user %>
|
||||
<% end %>
|
||||
</span>
|
||||
<%= form_for(@dmsf_workflow,
|
||||
:url => update_step_dmsf_workflow_path(:step => index),
|
||||
:method => :put,
|
||||
:html => {:id => "step-index-#{index}-approvers-form", :class => 'hol'}) do |f| %>
|
||||
<div id="<%= "step-index-#{index}-approvers-form" %>", class="hol">
|
||||
<div class="dmsf_parent_container">
|
||||
<% stps.each_with_index do |step, j| %>
|
||||
<div class="dmsf_child_container">
|
||||
@ -115,7 +104,8 @@
|
||||
"$('#step-index-#{index}-name').show(); $('#step-index-#{index}-approvers').show(); $('#step-index-#{index}-name-form').hide(); $('#step-index-#{index}-approvers-form').hide();")
|
||||
%>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="buttons">
|
||||
<%= reorder_handle(@dmsf_workflow, :url => url_for(:action => 'edit', :id => @dmsf_workflow, :step => i) ) %>
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
}
|
||||
|
||||
.dmsf_workflow {
|
||||
/*font-size: 0.8em;*/
|
||||
font-size: 0.8em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@ -120,8 +120,9 @@
|
||||
#admin-menu a.dmsf-approvalworkflows { background-image: url(../../../images/ticket_go.png); }
|
||||
#dmsf_users_for_delegate { height: 200px; overflow:auto; }
|
||||
#dmsf_users_for_delegate label { display: block; }
|
||||
.dmsf_workflow.locked a { color: #aaa; }
|
||||
.dmsf_workflows.locked a { color: #aaa; }
|
||||
|
||||
/* DMSF revision box */
|
||||
.dmsf_revision_box {
|
||||
padding: 0px 0px 0px 0px;
|
||||
margin-bottom: 10px;
|
||||
@ -285,8 +286,3 @@ div.dmsf_revision_inner_box .attribute .label {
|
||||
#dmsf_attachments_fields .ajax-loading input.filename {background:url(../../../images/loading.gif) no-repeat 0px 50%;}
|
||||
#dmsf_attachments_fields div.ui-progressbar { width: 100px; height:14px; margin: 2px 0 -5px 8px; display: inline-block; }
|
||||
|
||||
/* DMSF details */
|
||||
.dmsf_properties{
|
||||
vertical-align: middle;
|
||||
padding: 6px 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user