Updating Quantity to use Formula, WIP
This commit is contained in:
parent
4e537f3981
commit
544c0c5293
@ -79,18 +79,21 @@ class QuantitiesController < ApplicationController
|
||||
end
|
||||
|
||||
def quantity_params
|
||||
params[:quantity].delete(:formula) if params[:quantity][:formula].blank?
|
||||
params.require(:quantity).permit(
|
||||
:domain,
|
||||
:parent_id,
|
||||
:name,
|
||||
:description,
|
||||
:formula
|
||||
formula_attributes:
|
||||
[
|
||||
:code,
|
||||
:zero_nil
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
def prepare_quantities
|
||||
@quantities = @project.quantities.filter(@project, session[:q_filters])
|
||||
.includes(:column_views)
|
||||
.includes(:column_views, :formula)
|
||||
end
|
||||
end
|
||||
|
@ -11,6 +11,8 @@
|
||||
{required: true, label: :field_parent_quantity, include_blank: t('.null_parent')} %></p>
|
||||
<p><%= f.text_field :name, size: 25, required: true %></p>
|
||||
<p><%= f.text_field :description, style: "width: 100%;" %></p>
|
||||
<p><%= f.text_field :formula, placeholder: t('.formula_placeholder'),
|
||||
style: "width: 100%;" %></p>
|
||||
<%= f.fields_for :formula do |ff| %>
|
||||
<p><%= ff.text_field :code, placeholder: t('.formula_placeholder'),
|
||||
style: "width: 100%;" %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
@ -14,6 +14,7 @@ en:
|
||||
field_domain: 'Domain'
|
||||
field_parent_quantity: 'Parent'
|
||||
field_formula: 'Formula'
|
||||
field_code: 'Formula'
|
||||
field_shortname: 'Short name'
|
||||
button_retake: 'Retake'
|
||||
activerecord:
|
||||
|
@ -1,7 +1,7 @@
|
||||
require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
class FormulaTest < ActiveSupport::TestCase
|
||||
include BodyTracking::Formula
|
||||
include BodyTracking::FormulaBuilder
|
||||
|
||||
def setup
|
||||
end
|
||||
|
Reference in New Issue
Block a user