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

@@ -5,5 +5,11 @@
<h3><%= t ".heading_common" %></h3>
<ul>
<li><%= link_to t(".link_quantities"), project_quantities_path(@project) %></li>
<li><%= link_to t(".link_units"), project_units_path(@project) %></li>
<% if User.current.allowed_to?(:manage_common, @project) %>
<li>&nbsp</li>
<li><p><%= link_to t(".link_defaults"), defaults_project_body_trackers_path(@project),
method: :post, data: {confirm: t(".confirm_defaults")} %></li>
<% end %>
</ul>

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

View File

@@ -3,10 +3,10 @@
<div class="box tabular">
<div class="splitcontent">
<div class="splitcontentleft">
<p><%= f.text_field :shortname, required: true, size: 10 %></p>
<p><%= f.text_field :shortname, required: true, size: 20 %></p>
</div>
<div class="splitcontentright">
<p><%= f.text_field :name, size: 40 %></p>
<p><%= f.text_field :name, size: 60 %></p>
</div>
</div>
</div>

View File

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

View File

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

View File

@@ -3,11 +3,9 @@
<% end %>
<div class="contextual">
<% if User.current.allowed_to?(:manage_units, @project) %>
<% if User.current.allowed_to?(:manage_common, @project) %>
<%= link_to t(".heading_new_unit"), '#', :class => 'icon icon-add',
:onclick => 'showAndScrollTo("add-unit", "unit_shortname"); return false;' %>
<%= link_to t(".heading_import"), import_project_units_path(@project), method: :post,
:class => 'icon icon-duplicate' %>
<% end %>
</div>
@@ -39,9 +37,7 @@
<tr id="unit-<%= u.id %>" class="unit">
<td class="shortname"><%= u.shortname %></td>
<td class="unitname"><%= u.name %></td>
<td>
<%= delete_link unit_path(u), data: {} %>
</td>
<td><%= delete_link unit_path(u), data: {} %></td>
</tr>
<% end %>
</tbody>