2013-06-03 07:10:32 +02:00

50 lines
2.9 KiB
Plaintext

<h3 class="title"><%= l(:title_dmsf_workflow_log) %></h3>
<p>
<% if params[:dmsf_file_revision_id].present? %>
<% revision = DmsfFileRevision.find_by_id(params[:dmsf_file_revision_id]) %>
<% if revision %>
<%= link_to @workflow.name, edit_dmsf_workflow_path(@workflow) %><%= " - #{revision.workflow_str false}" %>
<div class="tab-content" id="tab-content-members">
<table class="steps">
<thead><tr>
<th><%= l(:label_dmsf_workflow_step) %></th>
<th><%= l(:label_user) %> </th>
<th><%= l(:label_action) %></th>
<th><%= l(:label_note) %></th>
<th><%=l(:label_date)%></th>
</tr></thead>
<tbody>
<tr id="step-0" class="<%= cycle 'odd', 'even' %> step">
<td class="step">-</td>
<td class="user"><%= link_to_user User.find_by_id(revision.dmsf_workflow_assigned_by) if revision.dmsf_workflow_assigned_by %></td>
<td class="action">Assigned</td>
<td class="note"></td>
<td class="date" align="center"><%= format_time(revision.dmsf_workflow_assigned_at) if revision.dmsf_workflow_assigned_at %></td>
</tr>
<tr id="step-1" class="<%= cycle 'odd', 'even' %> step">
<td class="step">-</td>
<td class="user"><%= link_to_user User.find_by_id(revision.dmsf_workflow_started_by) if revision.dmsf_workflow_started_by %></td>
<td class="action">Started</td>
<td class="note"></td>
<td class="date" align="center"><%= format_time(revision.dmsf_workflow_started_at) if revision.dmsf_workflow_started_at %></td>
</tr>
<% sql = "SELECT c.action, c.note, c.created_at, c.author_id, a.user_id, s.step FROM dmsf_workflow_step_actions c RIGHT JOIN dmsf_workflow_step_assignments a ON a.id = c.dmsf_workflow_step_assignment_id JOIN dmsf_workflow_steps s ON s.id = a.dmsf_workflow_step_id WHERE a.dmsf_file_revision_id = #{revision.id} ORDER BY c.created_at" %>
<% result = DmsfWorkflowStep.connection.execute sql %>
<% result.each_with_index do |row, i| %>
<tr id="step-<%= i + 2 %> " class="<%= cycle 'odd', 'even' %> step">
<td class="step"><%= row[5] %></td>
<td class="user"><%= link_to_user User.find_by_id(row[3].present? ? row[3] : row[4]) %></td>
<td class="action"><%= revision.workflow_str false %></td>
<td class="note"><%= row[1] %></td>
<td class="date" align="center"><%= format_time(row[2]) if row[2].present? %></td>
</tr>
<% end; reset_cycle %>
</tbody>
</table>
</div>
<% end %>
<% end %>
</p>