Add JSON response for paste-uploads
This commit is contained in:
parent
a8325e4833
commit
6542ffbc19
2 changed files with 9 additions and 4 deletions
|
|
@ -111,8 +111,13 @@ class PackagesController < ApplicationController
|
|||
# TODO
|
||||
# if @invalid_images…
|
||||
# ' #{image.image_file_name} (#{image.errors[:image].join(' and ')})
|
||||
|
||||
redirect_to package_path
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to package_path }
|
||||
# TODO: send all_errors back as JSON and make Javascript display it in #messages
|
||||
format.json { render :json => true }
|
||||
end
|
||||
|
||||
# render :details
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ Rails.application.routes.draw do
|
|||
# get 'package_reviews/:name' => 'packages#reviews', as: :package_reviews, name: /[^\/]+/
|
||||
get 'upload', to: redirect('/packages'), as: :upload_legacy # legacy upload form
|
||||
post 'uploadfile' => 'packages#legacy_uploadfile', name: /[^\/]+/
|
||||
get 'upload/:name' => 'packages#upload', as: :upload, name: /[^\/]+/
|
||||
post 'upload/:name' => 'packages#upload_receive', as: :upload_receive, name: /[^\/]+/
|
||||
get 'upload/:name' => 'packages#upload', as: :upload
|
||||
post 'upload/:name' => 'packages#upload_receive', as: :upload_receive
|
||||
# TODO: "get" is probably the wrong method to delete a screenshot
|
||||
get 'delete_screenshot/:id' => 'packages#delete_screenshot', as: :delete_screenshot
|
||||
patch 'update_screenshot_description/:id' => 'packages#update_screenshot_description', as: :update_screenshot_description
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue