bugfix
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -8,11 +8,10 @@ class Foto < ActiveRecord::Base
|
||||
"id" => read_attribute(:id),
|
||||
"title" => read_attribute(:title),
|
||||
"description" => read_attribute(:desc),
|
||||
"name" => read_attribute(:file),
|
||||
"size" => file.size,
|
||||
"url" => file.url,
|
||||
"thumbnail_url" => file.thumb.url,
|
||||
"delete_url" => foto_path(:id => id),
|
||||
"name" => read_attribute(:datei),
|
||||
"size" => datei.size,
|
||||
"url" => datei.url,
|
||||
"thumbnail_url" => datei.thumb.url,
|
||||
"delete_type" => "DELETE"
|
||||
}
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<span class="btn btn-success fileinput-button">
|
||||
<i class="icon-plus icon-white"></i>
|
||||
<span>Add files...</span>
|
||||
<%= f.file_field :datei %>
|
||||
<%= f.file_field :datei%>
|
||||
<%= f.input :gallery %>
|
||||
</span>
|
||||
<button type="submit" class="btn btn-primary start">
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
<%= render 'form_bulk' %>
|
||||
|
||||
<%= link_to 'Back', gallery_fotos_path(params[:gallery_id]) %>
|
||||
<%= link_to 'Back', gallery_path(params[:gallery_id]) %>
|
||||
|
||||
Reference in New Issue
Block a user