This commit is contained in:
Thomas Blazek
2013-08-22 11:51:57 +02:00
parent 5aca5eca1c
commit 9b2db870bc
4 changed files with 12 additions and 9 deletions

View File

@@ -48,8 +48,12 @@ class FotosController < ApplicationController
respond_to do |format|
@foto.title = @foto.datei
if @foto.save
format.html { redirect_to gallery_foto_path(@foto.gallery,@foto), notice: 'Foto was successfully created.' }
format.json { render json: gallery_foto_path(@foto.gallery,@foto), status: :created, location: [@gallery, @foto] }
format.html {
render :json => [@foto.to_jq_upload].to_json,
:content_type => 'text/html',
:layout => false
}
format.json { render json: {files: [@foto.to_jq_upload]}, status: :created, location: [@gallery, @foto] }
else
format.html { render action: "new" }
format.json { render json: @foto.errors, status: :unprocessable_entity }