Verified Commit 976e8145 authored by Tam Le's avatar Tam Le
Browse files

Add new view to display assignment on this project

Showing with 48 additions and 15 deletions
+48 -15
class AssignsController < ApplicationController
#layout 'admin'
# put all feature switches here
FEATURE_SWITCH_ALREADY_ASSIGNED_VIEW = 1
before_action :find_project_by_project_id
include SPAssignmentManager
......@@ -62,7 +66,7 @@ class AssignsController < ApplicationController
@assignables = ServicePack.availables
if @assignables.exists?
@assignment = Assign.new
render -'not_assigned_yet' and return
render (defined?(FEATURE_SWITCH_ALREADY_ASSIGNED_VIEW) ? -'already_assigned' : -'not_assigned_yet') and return
end
end
render -'unassignable'
......
<%# service_pack, assign, unassign, rem, total %>
<%# link to report %>
<div class="generic-table--container">
<div class="generic-table--results-container">
<table class="generic-table">
<colgroup>
<col highlight-col><col highlight-col><col highlight-col><col highlight-col><col>
</colgroup>
<thead>
<tr>
<% [-'Service Pack', -'Assign Date', -'Expiration Date', -'Units'].each do |column_name| %>
<th><div class="generic-table--sort-header-outer"><div class="generic-table--sort-header"><span><%= column_name %></span></div></div></th>
<% end %>
<th><div class="generic-table--empty-header"></div></th>
</tr>
</thead>
<tbody>
<tr>
<%= content_tag :td, @assignment.service_pack.name %>
<%= content_tag :td, @assignment.assign_date %>
<%= content_tag :td, @assignment.unassign_date %>
<%= content_tag :td, "#{@assignment.service_pack.remained_units}/#{@assignment.service_pack.total_units}" %>
<%= content_tag :td, op_icon(-'icon icon-delete') %>
</tr>
</tbody>
</table>
</div>
</div>
\ No newline at end of file
<%= stylesheet_link_tag 'assigns', plugin: :openproject_service_packs %>
<div id="sp-display">
<h2>Service Pack <%= @service_pack.name %> already assigned to <%= @project.name %></h2><hr/>
<strong>Assignment Date</strong>: <%= @assignment.assign_date %>
<strong>Valid Until</strong>: <%= @assignment.unassign_date %>
<strong>Remained:</strong> <%= @service_pack.remained_units %>/<%= @service_pack.total_units %>
</div>
<br/>
<% if @can_unassign ||= User.current.allowed_to?(:unassign_service_packs, @project) %>
<%= link_to -'Unassign', assigns_unassign_path(@project), method: :post, class: -'button norm', data: { confirm: -'Are you sure?' }%>
<% end %>
<hr/>
<p class='other-formats'>Report available in: <%= link_to -'CSV', {action: :report, format: :csv} %></p>
\ No newline at end of file
<h2>Assigned Service Packs</h2>
<a class="button -alt-highlight float-right" href="#">
<i class="button--icon icon-add" aria-hidden="true"></i><span class="button--text">Assign</span>
</a>
<% if @assignment.new_record? %>
<div id="result-table">
<div class="generic-table--no-results-container">
<i class="icon-info1"></i>
<h3 class="generic-table--no-results-title">No Service Pack is assigned to this project.</h3>
</div>
</div>
<% else %>
<%= render partial: -'assignment_table' %>
<% end %>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment