forked from bofh/fetsite
Merge branch 'master' of https://github.com/fetsite/fetsite
This commit is contained in:
@@ -3,7 +3,7 @@ class AttachmentsController < ApplicationController
|
|||||||
# GET /attachments.json
|
# GET /attachments.json
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
def index
|
def index
|
||||||
@attachments = Attachment.all
|
# @attachments = Attachment.all
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
@@ -11,28 +11,43 @@ class AttachmentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /attachments/1
|
# GET
|
||||||
# GET /attachments/1.json
|
# sets the titlepic flag for one attachment for one parent object
|
||||||
def set_titlepic
|
def set_titlepic
|
||||||
@attachment = Attachment.find(params[:id])
|
@attachment = Attachment.find(params[:id])
|
||||||
if @attachment.image?
|
if @attachment.image? # if attachment is an Image set flag
|
||||||
@attachment.flag_titlepic = params[:titlepic]
|
@attachment.parent.attachments.update_all("flag_titlepic=0")
|
||||||
@attachment.thema.titlepics << @attachment
|
@attachment.flag_titlepic=true
|
||||||
@attachment.save
|
@attachment.save
|
||||||
end
|
end
|
||||||
redirect_to @attachment.thema
|
respond_to do |format|
|
||||||
|
format.html {
|
||||||
|
redirect_to @attachment}
|
||||||
|
format.js {
|
||||||
|
@parent=@attachment.parent
|
||||||
|
@attachments=@parent.attachments
|
||||||
|
render :refresh_list
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
# GET refresh_list
|
||||||
|
# refresh the attachment list for a parent object
|
||||||
|
def refresh_list
|
||||||
|
@parent = params[:parent_type].constantize.find(params[:parent_id])
|
||||||
|
@attachments=@parent.attachments
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
#get /attachments/ID
|
||||||
def show
|
def show
|
||||||
@attachment = Attachment.find(params[:id])
|
@attachment = Attachment.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # show.html.erb
|
format.html # show.html.erb
|
||||||
format.json { render json: @attachment }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /attachments/new
|
# GET /attachments/new
|
||||||
# GET /attachments/new.json
|
|
||||||
def new
|
def new
|
||||||
@attachment = Attachment.new
|
@attachment = Attachment.new
|
||||||
@thema = Thema.find(params[:thema_id])
|
@thema = Thema.find(params[:thema_id])
|
||||||
@@ -60,8 +75,6 @@ class AttachmentsController < ApplicationController
|
|||||||
@attachment.thema = @thema
|
@attachment.thema = @thema
|
||||||
@attachment.name=@attachment.datei.filename
|
@attachment.name=@attachment.datei.filename
|
||||||
@action="create"
|
@action="create"
|
||||||
|
|
||||||
|
|
||||||
# logger.info "sdf"
|
# logger.info "sdf"
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @attachment.save
|
if @attachment.save
|
||||||
@@ -86,11 +99,11 @@ class AttachmentsController < ApplicationController
|
|||||||
# PUT /attachments/1.json
|
# PUT /attachments/1.json
|
||||||
def update
|
def update
|
||||||
@attachment = Attachment.find(params[:id])
|
@attachment = Attachment.find(params[:id])
|
||||||
@thema = @attachment.thema
|
@parent= @attachment.parent
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @attachment.update_attributes(params[:attachment])
|
if @attachment.update_attributes(params[:attachment])
|
||||||
format.html { redirect_to @thema, notice: 'Attachment was successfully updated.' }
|
format.html { redirect_to @parent, notice: 'Attachment was successfully updated.' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
format.js {@attachment=Attachment.new; render action:"create"}
|
format.js {@attachment=Attachment.new; render action:"create"}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class DocumentsController < ApplicationController
|
|||||||
@parent=@document.parent
|
@parent=@document.parent
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
format.html
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,9 @@
|
|||||||
module AttachmentsHelper
|
module AttachmentsHelper
|
||||||
|
|
||||||
|
def render_attachments_for(p)
|
||||||
|
a= Attachment.new
|
||||||
|
a.parent=p
|
||||||
|
render(partial:"attachments/attachment_list", object: p.attachments, locals: {editor: (can?(:edit, p)), parent: p} )+ ((can?(:edit, p))? (render partial:"attachments/form_bulk2", object: a ): "")
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,11 +12,13 @@
|
|||||||
|
|
||||||
class Attachment < ActiveRecord::Base
|
class Attachment < ActiveRecord::Base
|
||||||
has_paper_trail
|
has_paper_trail
|
||||||
attr_accessible :name, :datei, :datei_cache,:flag_titlepic
|
attr_accessible :name, :datei, :datei_cache,:flag_titlepic,:parent_id, :parent_type
|
||||||
belongs_to :thema
|
belongs_to :thema
|
||||||
mount_uploader :datei, AttachmentUploader
|
mount_uploader :datei, AttachmentUploader
|
||||||
validates :thema, :presence => true
|
# validates :thema, :presence => true
|
||||||
validates :name, :presence => true
|
validates :name, :presence => true
|
||||||
|
scope :titlepic, ->{where(flag_titlepic: true)}
|
||||||
|
default_scope order("LOWER(name)")
|
||||||
belongs_to :parent, :polymorphic=>true
|
belongs_to :parent, :polymorphic=>true
|
||||||
def image?
|
def image?
|
||||||
|
|
||||||
@@ -24,6 +26,9 @@ class Attachment < ActiveRecord::Base
|
|||||||
# %w(jpg png jpeg).include?(data_ext)
|
# %w(jpg png jpeg).include?(data_ext)
|
||||||
datei.image?(datei.file)
|
datei.image?(datei.file)
|
||||||
end
|
end
|
||||||
|
def self.parent_attachment_list_id(parent)
|
||||||
|
"attachments_for_"+parent.class.to_s+"_"+parent.id.to_s
|
||||||
|
end
|
||||||
|
|
||||||
def to_jq_upload
|
def to_jq_upload
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class Document < ActiveRecord::Base
|
|||||||
validate :parent, :presence=>true
|
validate :parent, :presence=>true
|
||||||
has_paper_trail
|
has_paper_trail
|
||||||
TYPS = { 1=>"fet_docs", 10=>"protocol", 11=> "agenda"}
|
TYPS = { 1=>"fet_docs", 10=>"protocol", 11=> "agenda"}
|
||||||
|
has_many :attachments, :as=>:parent
|
||||||
def long_name
|
def long_name
|
||||||
if self.parent.class=="Meeting"
|
if self.parent.class=="Meeting"
|
||||||
"<b>"+self.parent.text+ "</b>"+ self.name
|
"<b>"+self.parent.text+ "</b>"+ self.name
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class Foto < ActiveRecord::Base
|
|||||||
attr_accessible :datei, :desc, :gallery_id, :title
|
attr_accessible :datei, :desc, :gallery_id, :title
|
||||||
belongs_to :gallery
|
belongs_to :gallery
|
||||||
mount_uploader :datei, FotoUploader
|
mount_uploader :datei, FotoUploader
|
||||||
|
before_save :parse_exif
|
||||||
resourcify
|
resourcify
|
||||||
def to_jq_upload
|
def to_jq_upload
|
||||||
{
|
{
|
||||||
@@ -28,4 +29,11 @@ class Foto < ActiveRecord::Base
|
|||||||
"delete_type" => "DELETE"
|
"delete_type" => "DELETE"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
def parse_exif
|
||||||
|
unless self.exif.nil? || self.exif.empty?
|
||||||
|
j=JSON.parse(self.exif)
|
||||||
|
datetime = j.select {|i| i.first == "DateTime"}.try(:first).try(:last)
|
||||||
|
self.taken_at=Time.new(datetime) unless datetime.nil?
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ class Neuigkeit < ActiveRecord::Base
|
|||||||
has_many :calentries, as: :object
|
has_many :calentries, as: :object
|
||||||
has_many :nlinks
|
has_many :nlinks
|
||||||
has_one :meeting
|
has_one :meeting
|
||||||
|
has_many :attachments, :as=>:parent
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
validates :rubrik, :presence=>true
|
validates :rubrik, :presence=>true
|
||||||
validates :author, :presence=>true
|
validates :author, :presence=>true
|
||||||
@@ -45,11 +48,15 @@ class Neuigkeit < ActiveRecord::Base
|
|||||||
else
|
else
|
||||||
if self.has_meeting?
|
if self.has_meeting?
|
||||||
return self.meeting.meetingtyp.picture
|
return self.meeting.meetingtyp.picture
|
||||||
|
else
|
||||||
|
unless self.attachments.where(flag_titlepic: true).first.nil?
|
||||||
|
return self.attachments.where(flag_titlepic: true).first.datei
|
||||||
else
|
else
|
||||||
return self.picture
|
return self.picture
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
def is_annoncement?
|
def is_annoncement?
|
||||||
!self.meeting.nil?
|
!self.meeting.nil?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Studium < ActiveRecord::Base
|
|||||||
has_many :moduls, :through=>:modulgruppen
|
has_many :moduls, :through=>:modulgruppen
|
||||||
has_many :lvas, :through=>:moduls
|
has_many :lvas, :through=>:moduls
|
||||||
has_many :semester, :dependent => :destroy
|
has_many :semester, :dependent => :destroy
|
||||||
|
has_many :attachments, :as=>:parent
|
||||||
validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$/}
|
validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$/}
|
||||||
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }
|
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }
|
||||||
validates :name, :uniqueness => true, :presence=>true
|
validates :name, :uniqueness => true, :presence=>true
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Thema < ActiveRecord::Base
|
|||||||
# Each topic has multiple questions, that are also referenced in the FAQ.
|
# Each topic has multiple questions, that are also referenced in the FAQ.
|
||||||
has_many :fragen
|
has_many :fragen
|
||||||
# Attachments can be all data formats
|
# Attachments can be all data formats
|
||||||
has_many :attachments
|
has_many :attachments, :as=>:parent
|
||||||
# attached pics can be used as title pictures
|
# attached pics can be used as title pictures
|
||||||
has_many :titlepics, :as=>:parent, :class_name=>'Attachment', :conditions=>{:flag_titlepic=>true}
|
has_many :titlepics, :as=>:parent, :class_name=>'Attachment', :conditions=>{:flag_titlepic=>true}
|
||||||
# each topic has to belong to one group
|
# each topic has to belong to one group
|
||||||
|
|||||||
@@ -29,14 +29,11 @@ end
|
|||||||
end
|
end
|
||||||
version :thumb ,:if=>:image? do
|
version :thumb ,:if=>:image? do
|
||||||
process :resize_to_fill => [64, 64]
|
process :resize_to_fill => [64, 64]
|
||||||
process :convert => :jpg
|
|
||||||
|
|
||||||
def full_filename(for_file)
|
|
||||||
super.chomp(File.extname(super)) + '.jpg'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
version :cover , :if=>:image? do
|
|
||||||
|
version :cover , :if=>:pdf? do
|
||||||
process :cover
|
process :cover
|
||||||
process :resize_to_fit => [64,64]
|
process :resize_to_fit => [64,64]
|
||||||
process :convert => :jpg
|
process :convert => :jpg
|
||||||
@@ -44,9 +41,11 @@ end
|
|||||||
super.chomp(File.extname(super)) + '.jpg'
|
super.chomp(File.extname(super)) + '.jpg'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
version :thumb_small , :if=>:image? do
|
version :thumb_small , :if=>:image? do
|
||||||
process :resize_to_fill => [32, 32]
|
process :resize_to_fill => [32, 32]
|
||||||
end
|
end
|
||||||
|
|
||||||
version :thumb_big , :if=>:image? do
|
version :thumb_big , :if=>:image? do
|
||||||
|
|
||||||
process :resize_to_fill => [200, 200]
|
process :resize_to_fill => [200, 200]
|
||||||
@@ -56,6 +55,10 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
version :big_thumb , :if=>:image? do
|
||||||
|
process :resize_to_fill => [200,200]
|
||||||
|
end
|
||||||
|
|
||||||
version :resized, :if=>:image? do
|
version :resized, :if=>:image? do
|
||||||
process :resize_to_fit => [1024,1024]
|
process :resize_to_fit => [1024,1024]
|
||||||
end
|
end
|
||||||
@@ -92,7 +95,9 @@ end
|
|||||||
def extention
|
def extention
|
||||||
File.extname(full_filename(file.file)).downcase
|
File.extname(full_filename(file.file)).downcase
|
||||||
end
|
end
|
||||||
|
def pdf?(for_file)
|
||||||
|
%w(.pdf).include?(File.extname(full_filename(for_file.file)).downcase)
|
||||||
|
end
|
||||||
def image?(for_file)
|
def image?(for_file)
|
||||||
%w(.jpg .png .jpeg).include?(File.extname(full_filename(for_file.file)).downcase)
|
%w(.jpg .png .jpeg).include?(File.extname(full_filename(for_file.file)).downcase)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,10 +32,13 @@ class FotoUploader < CarrierWave::Uploader::Base
|
|||||||
# end
|
# end
|
||||||
|
|
||||||
# general settings
|
# general settings
|
||||||
|
|
||||||
process :fix_exif_rotation
|
process :fix_exif_rotation
|
||||||
|
process :store_exif
|
||||||
process :strip
|
process :strip
|
||||||
process :convert => 'jpg'
|
process :convert => 'jpg'
|
||||||
|
|
||||||
|
|
||||||
# Create different versions of your uploaded files:
|
# Create different versions of your uploaded files:
|
||||||
version :thumb do
|
version :thumb do
|
||||||
process :resize_to_fill => [64, 64]
|
process :resize_to_fill => [64, 64]
|
||||||
@@ -62,5 +65,9 @@ class FotoUploader < CarrierWave::Uploader::Base
|
|||||||
# "something.jpg" if original_filename
|
# "something.jpg" if original_filename
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
def store_exif
|
||||||
|
img = Magick::Image.read(current_path)
|
||||||
|
model.exif=img.first.get_exif_by_entry().to_json
|
||||||
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<% if (!["jpg","png","jpeg"].find_index(data_ext).nil?) %>
|
<% if (!["jpg","png","jpeg"].find_index(data_ext).nil?) %>
|
||||||
<%= image_tag attachment.datei.thumb.url %>
|
<%= image_tag attachment.datei.thumb.url %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
<%= image_tag "pdf-logo.jpg" %>
|
<%= image_tag "pdf-logo.jpg" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= attachment.name %>
|
<%= attachment.name %>
|
||||||
|
|||||||
30
app/views/attachments/_attachment_list.html.erb
Normal file
30
app/views/attachments/_attachment_list.html.erb
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<table class="table-striped" id="<%= Attachment.parent_attachment_list_id(parent) %>">
|
||||||
|
<% attachment_list.each do |a| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<%= fa_icon("tag") if a.flag_titlepic %>
|
||||||
|
<%= link_to a.datei.url do %>
|
||||||
|
<%= render partial:"attachments/attachment_new", object: a %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<% if editor %>
|
||||||
|
<td>
|
||||||
|
<div class="dropdown">
|
||||||
|
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= fa_icon("chevron-down") %> Actions</a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li>
|
||||||
|
<%= link_to fa_icon("tag")+" Titlepic", set_titlepic_attachment_path(a,:params=>{:titlepic=>true}), remote: true %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to ff_icon("icon-pencil")+" Edit", edit_attachment_path(a) %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to fa_icon("trash")+" Delete", attachment_path(a), method: "DELETE", confirm: "Sure?" , class: "btn-danger " %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
14
app/views/attachments/_attachment_new.html.erb
Normal file
14
app/views/attachments/_attachment_new.html.erb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<% attachment=attachment_new %>
|
||||||
|
<% data_ext = attachment.datei.file.try(:extension).try(:downcase) %>
|
||||||
|
|
||||||
|
|
||||||
|
<% if (!["jpg","png","jpeg"].find_index(data_ext).nil?) %>
|
||||||
|
<%= image_tag attachment.datei.thumb_small.url %>
|
||||||
|
<% elsif (!["pdf"].find_index(data_ext).nil?)%>
|
||||||
|
<%= image_tag attachment.datei.cover.url %>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
<%= ff_icon("ffi1-note20 fa-2x") %>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
<%= attachment.name %>
|
||||||
145
app/views/attachments/_form_bulk2.html.erb
Normal file
145
app/views/attachments/_form_bulk2.html.erb
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
|
||||||
|
<div class="container-fluid">
|
||||||
|
<%= semantic_form_for [form_bulk2], :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-fluid">
|
||||||
|
|
||||||
|
<div class="span7">
|
||||||
|
<div class="fileupload-buttonbar">
|
||||||
|
<!-- 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 :parent_id , as: :hidden %>
|
||||||
|
<%= f.input :parent_type, as: :hidden %>
|
||||||
|
</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:100%;"></div>
|
||||||
|
</div>
|
||||||
|
</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-lva" data-target="#modal-lva"></tbody>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var fileUploadErrors = {
|
||||||
|
maxFileSize: 'File is too big',
|
||||||
|
minFileSize: 'File is too small',
|
||||||
|
acceptFileTypes: 'Filetype not allowed',
|
||||||
|
maxNumberOfFiles: 'Max number of files exceeded',
|
||||||
|
uploadedBytes: 'Uploaded bytes exceed file size',
|
||||||
|
emptyResult: 'Empty file upload result'
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- The template to display files available for upload -->
|
||||||
|
<script id="template-upload" type="text/x-tmpl">
|
||||||
|
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
||||||
|
<tr class="template-upload fade">
|
||||||
|
<!--<td class="preview"><span class="fade"></span></td>-->
|
||||||
|
<td class="name"><span>{%=file.name %}</span></td>
|
||||||
|
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
|
||||||
|
{% if (file.error) { %}
|
||||||
|
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
|
||||||
|
{% } else if (o.files.valid && !i) { %}
|
||||||
|
<td>
|
||||||
|
<div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
|
||||||
|
</td>
|
||||||
|
<td class="start">{% if (!o.options.autoUpload) { %}
|
||||||
|
<button class="btn btn-primary">
|
||||||
|
<i class="icon-upload icon-white"></i>
|
||||||
|
<span>{%=locale.fileupload.start%}</span>
|
||||||
|
</button>
|
||||||
|
{% } %}</td>
|
||||||
|
{% } else { %}
|
||||||
|
<td colspan="2"></td>
|
||||||
|
{% } %}
|
||||||
|
<td class="cancel">{% if (!i) { %}
|
||||||
|
<button class="btn btn-warning">
|
||||||
|
<i class="icon-ban-circle icon-white"></i>
|
||||||
|
<span>{%=locale.fileupload.cancel%}</span>
|
||||||
|
</button>
|
||||||
|
{% } %}</td>
|
||||||
|
</tr>
|
||||||
|
{% } %}
|
||||||
|
</script>
|
||||||
|
<!-- 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="lva" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
|
||||||
|
{% } %}</td>-->
|
||||||
|
<td class="name">
|
||||||
|
<a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url%}" 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();
|
||||||
|
$('#fileupload').bind('fileuploaddone',function(e,data){$.getScript("/attachments/refresh_list?parent_type=<%= form_bulk2.parent_type %>&parent_id=<%= form_bulk2.parent_id %>")});
|
||||||
|
//
|
||||||
|
// 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();
|
||||||
|
});
|
||||||
|
$('#attachment_datei').attr('name', 'attachment[datei]');
|
||||||
|
$('#attachment_datei').fileupload();
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -3,4 +3,4 @@
|
|||||||
<%= render 'form' %>
|
<%= render 'form' %>
|
||||||
|
|
||||||
|
|
||||||
<%= link_to 'Back', thema_attachments_path(@attachment.thema,@attachment) %>
|
<%= link_to 'Back', attachments_path(@attachment) %>
|
||||||
|
|||||||
1
app/views/attachments/refresh_list.js.erb
Normal file
1
app/views/attachments/refresh_list.js.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
$("#<%= Attachment.parent_attachment_list_id(@parent) %>").replaceWith("<%= escape_javascript ( render partial:"attachments/attachment_list", object:@attachments, locals: {editor: true, parent: @parent} ) %>")
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Name:</b>
|
<b>Name:</b>
|
||||||
<%= @attachment.name %>
|
<%= @attachment.name %>
|
||||||
|
<%= render @attachment %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_attachment_path(@attachment) %> |
|
<%= link_to 'Edit', edit_attachment_path(@attachment) %> |
|
||||||
<%= link_to 'Back', attachments_path %>
|
<%= link_to 'Back', polymorphic_path(@attachment.parent) %>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<div id="<%= beispiel.divid %>" class="contentbox">
|
<div id="<%= beispiel.divid %>" class="contentbox">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span8">
|
<div class="span6" >
|
||||||
|
|
||||||
<b><%=link_to ffi1_icon("note20")+" " + beispiel.name + " " + I18n.l(beispiel.datum), beispiel.beispieldatei.url, title: beispiel.desc %></b>
|
<b><%=link_to ffi1_icon("note20")+" " + beispiel.name + " " + I18n.l(beispiel.datum), beispiel.beispieldatei.url, title: beispiel.desc %></b>
|
||||||
|
</div>
|
||||||
<%= I18n.t("file.size") + ": " + (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB <br>
|
<div class="span1" >
|
||||||
<span class="linklist">
|
<%= (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB
|
||||||
|
</div>
|
||||||
|
<div class="span5">
|
||||||
<%=
|
<%=
|
||||||
if can?(:like, beispiel)
|
if can?(:like, beispiel)
|
||||||
link_to ffi1_icon("like3")+" like" + "("+beispiel.get_likes.size.to_s+")", like_beispiel_path(beispiel),title: "liked by " + ((current_user.liked?(beispiel)) ? ("you and " + ((beispiel.get_likes.size - 1).to_s + " others")) : beispiel.get_likes.size.to_s), remote: true
|
link_to ffi1_icon("like3")+" like" + "("+beispiel.get_likes.size.to_s+")", like_beispiel_path(beispiel),title: "liked by " + ((current_user.liked?(beispiel)) ? ("you and " + ((beispiel.get_likes.size - 1).to_s + " others")) : beispiel.get_likes.size.to_s), remote: true
|
||||||
@@ -24,14 +25,16 @@
|
|||||||
%>
|
%>
|
||||||
|
|
||||||
<%= link_to ff_icon("icon-pencil")+"edit", edit_beispiel_path(beispiel) if can? :edit, beispiel%>
|
<%= link_to ff_icon("icon-pencil")+"edit", edit_beispiel_path(beispiel) if can? :edit, beispiel%>
|
||||||
<%= link_to ff_icon("icon-remove")+" delete", beispiel_path(beispiel), :method=>:delete, :data=>{:confirm=>I18n.t('beispiel.sure')} if can? :delete, beispiel %>
|
<%= link_to fa_icon("trash")+"delete", beispiel_path(beispiel), :method=>:delete, :data=>{:confirm=>I18n.t('beispiel.sure')} if can? :delete, beispiel %>
|
||||||
<% link_to "Refresh", beispiel_path(beispiel,show_comments: true), remote: true %></br>
|
<% link_to "Refresh", beispiel_path(beispiel,show_comments: true), remote: true %></br>
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="span4">
|
</div>
|
||||||
|
<% unless beispiel.desc.nil? || beispiel.desc.empty? %>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
|
||||||
<%= beispiel.desc %>
|
<%= beispiel.desc %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
<%= fa_icon("file-text") %>
|
<%= fa_icon("file-text") %>
|
||||||
<%= link_to document.name, document %>
|
<%= link_to document.name, document %>
|
||||||
|
|
||||||
<%= link_to "edit", edit_document_path(document),:remote=>true if can? :edit, document %>
|
<%= link_to "rename", edit_document_path(document),:remote=>true if can? :edit, document %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,10 @@
|
|||||||
<ul class='breadcrumb hidden-print'>
|
<ul class='breadcrumb hidden-print'>
|
||||||
<% @document.versions.each do |v| %>
|
<% @document.versions.each do |v| %>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to User.find(v.whodunnit).name+": "+ v.event + " (" + I18n.l(v.created_at)+ ") ", write_document_path(@document,:versionid=>v.id) %>
|
<%= link_to User.find(v.whodunnit).name+": "+ v.event + " (" + I18n.l(v.created_at)+ ") ", write_document_path(@document,:versionid=>v.id) unless v.whodunnit.nil? %>
|
||||||
<% end %> <span class="divider">/</span></li>
|
<% end %> <span class="divider">/</span></li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<%= render_attachments_for(@document) %>
|
||||||
|
|||||||
@@ -1,13 +1,25 @@
|
|||||||
<div class="contentbox" id="meeting_<%= meeting.id%>">
|
<div class="contentbox" id="meeting_<%= meeting.id%>">
|
||||||
|
|
||||||
<b><%= image_tag meeting.meetingtyp.picture.thumb.url unless meeting.meetingtyp.picture.thumb.url.nil? %><%= link_to meeting.text.html_safe, meeting %></b>
|
<b><%= image_tag meeting.meetingtyp.picture.thumb.url unless meeting.meetingtyp.picture.thumb.url.nil? %><%= link_to meeting.text.html_safe, meeting %></b>
|
||||||
<%= link_to "Ankündigung", rubrik_neuigkeit_path(meeting.neuigkeit.rubrik, meeting.neuigkeit) unless meeting.neuigkeit.nil? %>
|
<%= link_to fa_icon("newspaper-o")+ "Ankündigung", rubrik_neuigkeit_path(meeting.neuigkeit.rubrik, meeting.neuigkeit) unless meeting.neuigkeit.nil? %>
|
||||||
<%= link_to "ankündigen", announce_meeting_path(meeting), remote: true if meeting.neuigkeit.nil? %>
|
<%= link_to fa_icon("bullhorn")+"ankündigen", announce_meeting_path(meeting), remote: true if meeting.neuigkeit.nil? %>
|
||||||
<%= link_to "edit", edit_meeting_path(meeting), remote: true %>
|
|
||||||
<%= link_to 'Delete', meeting, method: :delete, data: { confirm: 'Are you sure?' } , remote: true if can? :delete, meeting %>
|
|
||||||
<% render meeting.calentry, locals: {manage: 0} unless meeting.calentry.nil? %>
|
<% render meeting.calentry, locals: {manage: 0} unless meeting.calentry.nil? %>
|
||||||
<%= link_to "Agenda" , create_agenda_meeting_path(meeting), :remote=>true if meeting.agenda.nil? %>
|
<% if can?(:create_agenda_meeting, meeting) %>
|
||||||
<%= link_to "Protokoll" , create_protocol_meeting_path(meeting),:remote=>true if meeting.protocol.nil? %>
|
<%= link_to fa_icon("plus")+"Agenda" , create_agenda_meeting_path(meeting), :remote=>true if meeting.agenda.nil? %> <% end %>
|
||||||
|
<% if can?(:create_protocol_meeting, meeting) %>
|
||||||
|
<%= link_to fa_icon("plus")+"Protokoll" , create_protocol_meeting_path(meeting),:remote=>true if meeting.protocol.nil? %><% end %>
|
||||||
|
<% if can?(:edit,meeting) %>
|
||||||
|
<div class="dropdown" style="display:inline">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> <%= fa_icon("caret-down")%> </a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li>
|
||||||
|
<%= link_to fa_icon("pencil")+"Edit", edit_meeting_path(meeting), remote: true %></li>
|
||||||
|
<li>
|
||||||
|
<%= link_to fa_icon("trash")+'Delete', meeting, method: :delete, data: { confirm: 'Are you sure?' } , remote: true if can? :delete, meeting %></li>
|
||||||
|
</ul></div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<%= render meeting.agenda unless meeting.agenda.nil? %>
|
<%= render meeting.agenda unless meeting.agenda.nil? %>
|
||||||
<%= render meeting.protocol unless meeting.protocol.nil? %>
|
<%= render meeting.protocol unless meeting.protocol.nil? %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ end
|
|||||||
<%= render @neuigkeit.meeting %>
|
<%= render @neuigkeit.meeting %>
|
||||||
<% end%>
|
<% end%>
|
||||||
<div id="calentry_new" ><%= link_to "new Calentry", new_calentry_path(:object_id=>@neuigkeit.id, :object_type=>"Neuigkeit"), :remote=>true if can? :edit, @neuigkeit %></div>
|
<div id="calentry_new" ><%= link_to "new Calentry", new_calentry_path(:object_id=>@neuigkeit.id, :object_type=>"Neuigkeit"), :remote=>true if can? :edit, @neuigkeit %></div>
|
||||||
|
|
||||||
|
<%= %>
|
||||||
|
<%= render_attachments_for(@neuigkeit) %>
|
||||||
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>
|
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>
|
||||||
</div>
|
</div>
|
||||||
<%= render partial: 'nlink_list_whole', :object=>@neuigkeit.nlinks %>
|
<%= render partial: 'nlink_list_whole', :object=>@neuigkeit.nlinks %>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span12">
|
<div class="span12">
|
||||||
<p><%= link_to "Qualifikationsprofil", studium_path( @studium, :ansicht=>"qualifikationsprofil")%> </p>
|
<p><%= link_to "Qualifikationsprofil", studium_path( @studium, :ansicht=>"qualifikationsprofil")%> </p>
|
||||||
|
<%= render_attachments_for(@studium) %>
|
||||||
|
|
||||||
<%= raw(@studium.desc) %>
|
<%= raw(@studium.desc) %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -15,7 +17,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<b>Titlepics</b>
|
|
||||||
|
|
||||||
<% @thema.titlepics.each do |tp| %>
|
<%= render_attachments_for(@thema) %>
|
||||||
<%= link_to image_tag(tp.datei.thumb.url) , set_titlepic_thema_attachment_path(tp.thema,tp,:params=>{:titlepic=>false}) %>
|
|
||||||
<% end %></div>
|
|
||||||
<b> List </b>
|
|
||||||
<%= render partial: "themen/attachment_list", object:@thema.attachments ,locals: {:editor => true}%>
|
|
||||||
<div>
|
|
||||||
<b>Form</b>
|
|
||||||
<%= render :partial=>"attachments/form_bulk" %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<% unless small.hideattachment %>
|
<% unless small.hideattachment %>
|
||||||
<%= render partial: "themen/attachment_list", object: small.attachments, locals:{editor: false} unless small.attachments.empty? %>
|
<%= render partial: "attachments/attachment_list", object: small.attachments, locals:{editor: false, parent: small} unless small.attachments.empty? %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|||||||
@@ -163,8 +163,16 @@
|
|||||||
get :set_titlepic
|
get :set_titlepic
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
end
|
||||||
|
resources :attachments do
|
||||||
|
member do
|
||||||
|
get :set_titlepic
|
||||||
|
end
|
||||||
|
collection do
|
||||||
|
get :refresh_list
|
||||||
|
end
|
||||||
|
end
|
||||||
resources :calendars
|
resources :calendars
|
||||||
get 'verwalten/calendars', :controller=>:calendars, :action=>:verwalten, :as=>'calendars_verwalten'
|
get 'verwalten/calendars', :controller=>:calendars, :action=>:verwalten, :as=>'calendars_verwalten'
|
||||||
resources :calentries
|
resources :calentries
|
||||||
|
|||||||
6
db/migrate/20150401111040_add_exif_to_foto.rb
Normal file
6
db/migrate/20150401111040_add_exif_to_foto.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
class AddExifToFoto < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :fotos, :exif, :string
|
||||||
|
add_column :fotos, :has_exif, :boolean
|
||||||
|
end
|
||||||
|
end
|
||||||
5
db/migrate/20150401115254_add_date_to_foto.rb
Normal file
5
db/migrate/20150401115254_add_date_to_foto.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddDateToFoto < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :fotos, :taken_at, :timestamp
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user