1
0

Implemented Quantity

This commit is contained in:
cryptogopher
2019-08-23 17:06:09 +02:00
parent 9a34cc0b95
commit 54ab1c60dc
18 changed files with 161 additions and 45 deletions

View 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>

View File

@@ -1 +0,0 @@
<h2>QuantitiesController#create</h2>

View File

@@ -1 +0,0 @@
<h2>QuantitiesController#destroy</h2>

View File

@@ -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 %>