forked from OpenNeo/impress
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={})
|
||||
json = {:id => id, :body_id => body_id}
|
||||
json[:pet_state_ids] = self.pet_state_ids if options[:for] == 'wardrobe'
|
||||
json
|
||||
if options[:for] == 'wardrobe'
|
||||
{:id => id, :body_id => body_id, :pet_state_ids => pet_state_ids}
|
||||
else
|
||||
{:image_hash => image_hash}
|
||||
end
|
||||
end
|
||||
|
||||
def color_id=(new_color_id)
|
||||
|
@ -59,7 +61,7 @@ class PetType < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def image_hash
|
||||
BasicHashes[species.name][color.name]
|
||||
self['image_hash'] || BasicHashes[species.name][color.name]
|
||||
end
|
||||
|
||||
def add_pet_state_from_biology!(biology)
|
||||
|
|
|
@ -120,11 +120,9 @@ $(function () {
|
|||
name = name.join(' ');
|
||||
Preview.displayLoading();
|
||||
$.ajax({
|
||||
url: '/pet_types.json',
|
||||
url: '/species/' + type.species + '/color/' + type.color + '/pet_type.json',
|
||||
data: {
|
||||
'for': 'image',
|
||||
'species_id': type.species,
|
||||
'color_id': type.color
|
||||
'for': 'image'
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (data) {
|
||||
|
|
Loading…
Reference in a new issue