Implemented Quantity
This commit is contained in:
13
app/views/quantities/_form.html.erb
Normal file
13
app/views/quantities/_form.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<%= error_messages_for @quantity %>
|
||||
|
||||
<div class="box tabular">
|
||||
<div class="splitcontent">
|
||||
<div class="splitcontentleft">
|
||||
<p><%= f.text_field :name, size: 50, required: true %></p>
|
||||
</div>
|
||||
<div class="splitcontentright">
|
||||
<p><%= f.select :domain, domain_options, required: true %></p>
|
||||
</div>
|
||||
</div>
|
||||
<p><%= f.text_field :description, size: 200 %></p>
|
||||
</div>
|
||||
@@ -1 +0,0 @@
|
||||
<h2>QuantitiesController#create</h2>
|
||||
@@ -1 +0,0 @@
|
||||
<h2>QuantitiesController#destroy</h2>
|
||||
@@ -1 +1,49 @@
|
||||
<h2>QuantitiesController#index</h2>
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'body_trackers/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="contextual">
|
||||
<% if User.current.allowed_to?(:manage_common, @project) %>
|
||||
<%= link_to t(".heading_new_quantity"), '#', :class => 'icon icon-add',
|
||||
:onclick => 'showAndScrollTo("add-quantity", "quantity_name"); return false;' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div id="add-quantity" <%= 'style=display:none;' if @quantity.errors.empty? %>>
|
||||
<h2><%= t ".heading_new_quantity" %></h2>
|
||||
|
||||
<%= labelled_form_for @quantity,
|
||||
:url => project_quantities_path(@project),
|
||||
:html => {:id => 'quantity-form'} do |f| %>
|
||||
<%= render :partial => 'quantities/form', :locals => { :f => f } %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-quantity").hide()' %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<h2><%= t ".heading" %></h2>
|
||||
<% if @quantities.any? %>
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><%= l(:field_name) %></th>
|
||||
<th><%= l(:field_domain) %></th>
|
||||
<th><%= l(:field_description) %></th>
|
||||
<th style="width:15%"><%= l(:field_action) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @quantities.each do |q| %>
|
||||
<tr id="quantity-<%= q.id %>" class="quantity">
|
||||
<td class="quantityname"><%= q.name %></td>
|
||||
<td class="domain"><%= q.domain %></td>
|
||||
<td class="description"><%= q.description %></td>
|
||||
<td><%= delete_link quantity_path(q), data: {} %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user