start from scratch home js
This commit is contained in:
parent
2d550724f0
commit
db56b0d218
2 changed files with 8 additions and 8 deletions
|
@ -25,9 +25,11 @@ class PetType < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
|
|
||||||
def as_json(options={})
|
def as_json(options={})
|
||||||
json = {:id => id, :body_id => body_id}
|
if options[:for] == 'wardrobe'
|
||||||
json[:pet_state_ids] = self.pet_state_ids if options[:for] == 'wardrobe'
|
{:id => id, :body_id => body_id, :pet_state_ids => pet_state_ids}
|
||||||
json
|
else
|
||||||
|
{:image_hash => image_hash}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def color_id=(new_color_id)
|
def color_id=(new_color_id)
|
||||||
|
@ -59,7 +61,7 @@ class PetType < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def image_hash
|
def image_hash
|
||||||
BasicHashes[species.name][color.name]
|
self['image_hash'] || BasicHashes[species.name][color.name]
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_pet_state_from_biology!(biology)
|
def add_pet_state_from_biology!(biology)
|
||||||
|
|
|
@ -120,11 +120,9 @@ $(function () {
|
||||||
name = name.join(' ');
|
name = name.join(' ');
|
||||||
Preview.displayLoading();
|
Preview.displayLoading();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/pet_types.json',
|
url: '/species/' + type.species + '/color/' + type.color + '/pet_type.json',
|
||||||
data: {
|
data: {
|
||||||
'for': 'image',
|
'for': 'image'
|
||||||
'species_id': type.species,
|
|
||||||
'color_id': type.color
|
|
||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
|
|
Loading…
Reference in a new issue