forked from OpenNeo/impress
Oops, fix the pet preview on the homepage
Oh right, I forgot we use the `pet_types#show` endpoint there! Welcome back lol!
This commit is contained in:
parent
75a23dfc57
commit
f93944d401
3 changed files with 17 additions and 5 deletions
|
@ -217,12 +217,9 @@
|
||||||
url:
|
url:
|
||||||
"/species/" +
|
"/species/" +
|
||||||
type.species +
|
type.species +
|
||||||
"/color/" +
|
"/colors/" +
|
||||||
type.color +
|
type.color +
|
||||||
"/pet_type.json",
|
"/pet_type.json",
|
||||||
data: {
|
|
||||||
for: "image",
|
|
||||||
},
|
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var job;
|
var job;
|
||||||
|
|
10
app/controllers/pet_types_controller.rb
Normal file
10
app/controllers/pet_types_controller.rb
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
class PetTypesController < ApplicationController
|
||||||
|
def show
|
||||||
|
@pet_type = PetType.
|
||||||
|
where(species_id: params[:species_id]).
|
||||||
|
where(color_id: params[:color_id]).
|
||||||
|
first
|
||||||
|
|
||||||
|
render json: @pet_type
|
||||||
|
end
|
||||||
|
end
|
|
@ -16,13 +16,18 @@ OpenneoImpressItems::Application.routes.draw do
|
||||||
get '/your-outfits', to: 'outfits#index', as: :current_user_outfits
|
get '/your-outfits', to: 'outfits#index', as: :current_user_outfits
|
||||||
get '/users/current-user/outfits', to: redirect('/your-outfits')
|
get '/users/current-user/outfits', to: redirect('/your-outfits')
|
||||||
|
|
||||||
# The item database!
|
# Our customization data! Both the item pages, and JSON API endpoints.
|
||||||
resources :items, :only => [:index, :show] do
|
resources :items, :only => [:index, :show] do
|
||||||
resources :appearances, controller: 'item_appearances', only: [:index]
|
resources :appearances, controller: 'item_appearances', only: [:index]
|
||||||
collection do
|
collection do
|
||||||
get :needed
|
get :needed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
resources :species do
|
||||||
|
resources :colors do
|
||||||
|
get :pet_type, to: 'pet_types#show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Loading and modeling pets!
|
# Loading and modeling pets!
|
||||||
post '/pets/load' => 'pets#load', :as => :load_pet
|
post '/pets/load' => 'pets#load', :as => :load_pet
|
||||||
|
|
Loading…
Reference in a new issue