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