forked from bofh/fetsite
bugfix multiple lines
This commit is contained in:
@@ -46,7 +46,7 @@ class FotosController < ApplicationController
|
||||
@foto.gallery_id = (params[:gallery_id])
|
||||
@gallery = @foto.gallery
|
||||
respond_to do |format|
|
||||
@foto.title = @foto.datei
|
||||
@foto.title = @foto.datei.filename
|
||||
if @foto.save
|
||||
format.html {
|
||||
render :json => [@foto.to_jq_upload].to_json,
|
||||
|
||||
@@ -8,7 +8,7 @@ class Foto < ActiveRecord::Base
|
||||
"id" => read_attribute(:id),
|
||||
"title" => read_attribute(:title),
|
||||
"description" => read_attribute(:desc),
|
||||
"name" => read_attribute(:datei),
|
||||
"name" => read_attribute(:title),
|
||||
"size" => datei.size,
|
||||
"url" => datei.url,
|
||||
"thumbnail_url" => datei.thumb.url,
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
<div class="container">
|
||||
<h2>Upload file</h2>
|
||||
<%= semantic_form_for [@gallery, @foto], :remote=>true, :html => { :multipart => true, :id => "fileupload" } do |f| %>
|
||||
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
|
||||
<div class="row fileupload-buttonbar">
|
||||
<div class="span7">
|
||||
<!-- The fileinput-button span is used to style the file input field as button -->
|
||||
<span class="btn btn-success fileinput-button">
|
||||
<i class="icon-plus icon-white"></i>
|
||||
<span>Add files...</span>
|
||||
<%= f.file_field :datei, :multiple=>true%>
|
||||
<%= f.input :gallery %>
|
||||
</span>
|
||||
<button type="submit" class="btn btn-primary start">
|
||||
<i class="icon-upload icon-white"></i>
|
||||
<span>Start upload</span>
|
||||
</button>
|
||||
<button type="reset" class="btn btn-warning cancel">
|
||||
<i class="icon-ban-circle icon-white"></i>
|
||||
<span>Cancel upload</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger delete">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
<input type="checkbox" class="toggle">
|
||||
</div>
|
||||
<div class="span5">
|
||||
<!-- The global progress bar -->
|
||||
<div class="progress progress-success progress-striped active fade">
|
||||
<div class="bar" style="width:0%;"></div>
|
||||
</div>
|
||||
<!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
|
||||
<div class="row fileupload-buttonbar">
|
||||
<div class="span7">
|
||||
<!-- The fileinput-button span is used to style the file input field as button -->
|
||||
<span class="btn btn-success fileinput-button">
|
||||
<i class="icon-plus icon-white"></i>
|
||||
<span>Add files...</span>
|
||||
<%= f.file_field :datei, :multiple=>true%>
|
||||
<%= f.input :gallery %>
|
||||
</span>
|
||||
<button type="submit" class="btn btn-primary start">
|
||||
<i class="icon-upload icon-white"></i>
|
||||
<span>Start upload</span>
|
||||
</button>
|
||||
<button type="reset" class="btn btn-warning cancel">
|
||||
<i class="icon-ban-circle icon-white"></i>
|
||||
<span>Cancel upload</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-danger delete">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
<span>Delete</span>
|
||||
</button>
|
||||
<input type="checkbox" class="toggle">
|
||||
</div>
|
||||
<div class="span5">
|
||||
<!-- The global progress bar -->
|
||||
<div class="progress progress-success progress-striped active fade">
|
||||
<div class="bar" style="width:0%;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- The loading indicator is shown during image processing -->
|
||||
<div class="fileupload-loading"></div>
|
||||
<br>
|
||||
<!-- The table listing the files available for upload/download -->
|
||||
<table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- The loading indicator is shown during image processing -->
|
||||
<div class="fileupload-loading"></div>
|
||||
<br>
|
||||
<!-- The table listing the files available for upload/download -->
|
||||
<table class="table table-striped"><tbody class="files" data-toggle="modal-gallery" data-target="#modal-gallery"></tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
</div>
|
||||
@@ -86,53 +86,54 @@
|
||||
<!-- The template to display files available for download -->
|
||||
<script id="template-download" type="text/x-tmpl">
|
||||
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
||||
<tr class="template-download fade">
|
||||
{% if (file.error) { %}
|
||||
<td></td>
|
||||
<td class="name"><span>{%=file.name%}</span></td>
|
||||
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
|
||||
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
|
||||
{% } else { %}
|
||||
<td class="preview">{% if (file.thumbnail_url) { %}
|
||||
<a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
|
||||
{% } %}</td>
|
||||
<td class="name">
|
||||
<a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
|
||||
</td>
|
||||
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
|
||||
<td colspan="2"></td>
|
||||
{% } %}
|
||||
<td class="delete">
|
||||
<button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
<span>{%=locale.fileupload.destroy%}</span>
|
||||
</button>
|
||||
<input type="checkbox" name="delete" value="1">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="template-download fade">
|
||||
{% if (file.error) { %}
|
||||
<td></td>
|
||||
<td class="name"><span>{%=file.name%}</span></td>
|
||||
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
|
||||
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
|
||||
{% } else { %}
|
||||
<td class="preview">{% if (file.thumbnail_url) { %}
|
||||
<a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
|
||||
{% } %}</td>
|
||||
<td class="name">
|
||||
<a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
|
||||
</td>
|
||||
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
|
||||
<td colspan="2"></td>
|
||||
{% } %}
|
||||
<td class="delete">
|
||||
<button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
|
||||
<i class="icon-trash icon-white"></i>
|
||||
<span>{%=locale.fileupload.destroy%}</span>
|
||||
</button>
|
||||
<input type="checkbox" name="delete" value="1">
|
||||
</td>
|
||||
</tr>
|
||||
{% } %}
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(function () {
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$('#fileupload').fileupload();
|
||||
//
|
||||
// Load existing files:
|
||||
$.getJSON($('#fileupload').prop('action'), function (files) {
|
||||
var fu = $('#fileupload').data('blueimpFileupload'),
|
||||
template;
|
||||
fu._adjustMaxNumberOfFiles(-files.length);
|
||||
console.log(files);
|
||||
template = fu._renderDownload(files)
|
||||
.appendTo($('#fileupload .files'));
|
||||
// Force reflow:
|
||||
fu._reflow = fu._transition && template.length &&
|
||||
template[0].offsetWidth;
|
||||
template.addClass('in');
|
||||
$('#loading').remove();
|
||||
});
|
||||
$('#foto_datei').attr('name', 'foto[datei]');
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$('#fileupload').fileupload();
|
||||
//
|
||||
// Load existing files:
|
||||
$.getJSON($('#fileupload').prop('action'), function (files) {
|
||||
var fu = $('#fileupload').data('blueimpFileupload'),
|
||||
template;
|
||||
fu._adjustMaxNumberOfFiles(-files.length);
|
||||
console.log(files);
|
||||
// no Download on Upload form
|
||||
//template = fu._renderDownload(files)
|
||||
//.appendTo($('#fileupload .files'));
|
||||
// Force reflow:
|
||||
fu._reflow = fu._transition && template.length &&
|
||||
template[0].offsetWidth;
|
||||
template.addClass('in');
|
||||
$('#loading').remove();
|
||||
});
|
||||
$('#foto_datei').attr('name', 'foto[datei]');
|
||||
$('#foto_datei').fileupload();
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user