Setting default quantity domain in form
This commit is contained in:
parent
2ebbe9a306
commit
0820a90897
@ -6,6 +6,7 @@ class QuantitiesController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@quantity = @project.quantities.new
|
@quantity = @project.quantities.new
|
||||||
|
@quantity.domain = Quantity.domains[session[:q_filters][:domain]]
|
||||||
prepare_quantities
|
prepare_quantities
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@ class Quantity < ActiveRecord::Base
|
|||||||
include BodyTracking::Formula
|
include BodyTracking::Formula
|
||||||
|
|
||||||
enum domain: {
|
enum domain: {
|
||||||
|
diet: 0,
|
||||||
measurement: 1,
|
measurement: 1,
|
||||||
exercise: 2,
|
exercise: 2
|
||||||
diet: 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
acts_as_nested_set dependent: :destroy, scope: :project
|
acts_as_nested_set dependent: :destroy, scope: :project
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
$('[id=parent_select_'+$('#quantity_domain option:selected').val()+'] select')
|
$('[id=parent_select_'+$('#quantity_domain option:selected').val()+'] select')
|
||||||
.attr('name', 'quantity[parent_id]');
|
.attr('name', 'quantity[parent_id]');
|
||||||
}
|
}
|
||||||
$('#quantity-form').on('click', '#quantity_domain', domainChange);
|
$('#quantity-form').on('change', '#quantity_domain', domainChange);
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
domainChange();
|
domainChange();
|
||||||
|
Reference in New Issue
Block a user