fix multiple

This commit is contained in:
Thomas Blazek
2013-08-22 12:04:44 +02:00
parent 9b2db870bc
commit 60d86d9cb1
2 changed files with 9 additions and 3 deletions

View File

@@ -68,8 +68,12 @@ class FotosController < ApplicationController
respond_to do |format| respond_to do |format|
if @foto.update_attributes(params[:foto]) if @foto.update_attributes(params[:foto])
format.html { redirect_to gallery_foto_path(@foto.gallery,@foto), notice: 'Foto was successfully updated.' } format.html {
format.json { head :no_content } 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 else
format.html { render action: "edit" } format.html { render action: "edit" }
format.json { render json: @foto.errors, status: :unprocessable_entity } format.json { render json: @foto.errors, status: :unprocessable_entity }

View File

@@ -8,7 +8,7 @@
<span class="btn btn-success fileinput-button"> <span class="btn btn-success fileinput-button">
<i class="icon-plus icon-white"></i> <i class="icon-plus icon-white"></i>
<span>Add files...</span> <span>Add files...</span>
<%= f.file_field :datei%> <%= f.file_field :datei, :multiple=>true%>
<%= f.input :gallery %> <%= f.input :gallery %>
</span> </span>
<button type="submit" class="btn btn-primary start"> <button type="submit" class="btn btn-primary start">
@@ -132,6 +132,8 @@
template.addClass('in'); template.addClass('in');
$('#loading').remove(); $('#loading').remove();
}); });
$('#foto_datei').attr('name', 'foto[datei]');
$('#foto_datei').fileupload();
}); });
</script> </script>