Support GET requests for /pets/load
This commit is contained in:
parent
304a7ac9e1
commit
df043b939e
5 changed files with 8 additions and 12 deletions
|
|
@ -34,9 +34,10 @@ class PetsController < ApplicationController
|
|||
end
|
||||
|
||||
def destination
|
||||
case (params[:destination] || params[:origin])
|
||||
when 'wardrobe' then wardrobe_path
|
||||
else root_path
|
||||
if request.get?
|
||||
wardrobe_path
|
||||
else
|
||||
root_path
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -59,7 +60,7 @@ class PetsController < ApplicationController
|
|||
path += "?name=#{params[:name]}"
|
||||
redirect_to path, :alert => options[:long_message]
|
||||
end
|
||||
|
||||
|
||||
format.json do
|
||||
render :json => options[:long_message], :status => options[:status]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ module ApplicationHelper
|
|||
def origin_tag(value)
|
||||
hidden_field_tag 'origin', value, :id => nil
|
||||
end
|
||||
|
||||
|
||||
def open_graph(properties)
|
||||
if @open_graph
|
||||
@open_graph.merge! properties
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
module OutfitsHelper
|
||||
def destination_tag(value)
|
||||
hidden_field_tag 'destination', value, :id => nil
|
||||
end
|
||||
|
||||
def latest_contribution_description(contribution)
|
||||
user = contribution.user
|
||||
contributed = contribution.contributed
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@
|
|||
%h1= t 'app_name'
|
||||
%h2= t '.tagline'
|
||||
|
||||
= form_tag load_pet_path, method: 'POST', class: 'primary load-pet-to-wardrobe' do
|
||||
= hidden_field_tag 'destination', 'wardrobe'
|
||||
= form_tag load_pet_path, method: 'GET', class: 'primary load-pet-to-wardrobe' do
|
||||
%fieldset
|
||||
%legend= t '.load_pet'
|
||||
= pet_name_tag class: 'main-pet-name'
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ OpenneoImpressItems::Application.routes.draw do
|
|||
get '/alt-styles', to: redirect('/rainbow-pool/styles')
|
||||
|
||||
# Loading and modeling pets!
|
||||
post '/pets/load' => 'pets#load', :as => :load_pet
|
||||
match '/pets/load' => 'pets#load', :as => :load_pet, via: [:get, :post]
|
||||
get '/modeling' => 'pets#bulk', :as => :bulk_pets
|
||||
|
||||
# Contributions to our modeling database!
|
||||
|
|
|
|||
Loading…
Reference in a new issue