From b04b23e6472c6706ce9283800a8dce34e8b196cd Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 7 Apr 2015 23:19:27 +0200 Subject: [PATCH 01/25] foto exif --- app/models/foto.rb | 8 ++++++++ app/uploaders/foto_uploader.rb | 9 ++++++++- db/migrate/20150401111040_add_exif_to_foto.rb | 6 ++++++ db/migrate/20150401115254_add_date_to_foto.rb | 5 +++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20150401111040_add_exif_to_foto.rb create mode 100644 db/migrate/20150401115254_add_date_to_foto.rb diff --git a/app/models/foto.rb b/app/models/foto.rb index cbe9761..b8895c9 100644 --- a/app/models/foto.rb +++ b/app/models/foto.rb @@ -15,6 +15,7 @@ class Foto < ActiveRecord::Base attr_accessible :datei, :desc, :gallery_id, :title belongs_to :gallery mount_uploader :datei, FotoUploader + before_save :parse_exif resourcify def to_jq_upload { @@ -28,4 +29,11 @@ class Foto < ActiveRecord::Base "delete_type" => "DELETE" } 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 diff --git a/app/uploaders/foto_uploader.rb b/app/uploaders/foto_uploader.rb index 1a2385d..5058f26 100644 --- a/app/uploaders/foto_uploader.rb +++ b/app/uploaders/foto_uploader.rb @@ -32,9 +32,12 @@ class FotoUploader < CarrierWave::Uploader::Base # end # general settings + process :fix_exif_rotation + process :store_exif process :strip process :convert => 'jpg' + # Create different versions of your uploaded files: version :thumb do @@ -62,5 +65,9 @@ class FotoUploader < CarrierWave::Uploader::Base # "something.jpg" if original_filename # end - + def store_exif + img = Magick::Image.read(current_path) + model.exif=img.first.get_exif_by_entry().to_json + + end end diff --git a/db/migrate/20150401111040_add_exif_to_foto.rb b/db/migrate/20150401111040_add_exif_to_foto.rb new file mode 100644 index 0000000..ab63cea --- /dev/null +++ b/db/migrate/20150401111040_add_exif_to_foto.rb @@ -0,0 +1,6 @@ +class AddExifToFoto < ActiveRecord::Migration + def change + add_column :fotos, :exif, :string + add_column :fotos, :has_exif, :boolean + end +end diff --git a/db/migrate/20150401115254_add_date_to_foto.rb b/db/migrate/20150401115254_add_date_to_foto.rb new file mode 100644 index 0000000..f25b2c7 --- /dev/null +++ b/db/migrate/20150401115254_add_date_to_foto.rb @@ -0,0 +1,5 @@ +class AddDateToFoto < ActiveRecord::Migration + def change + add_column :fotos, :taken_at, :timestamp + end +end From 0df5e72e1597a9968b2d109f3b5dbcdd499ca3b9 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 7 Apr 2015 23:21:33 +0200 Subject: [PATCH 02/25] attachment new version --- app/controllers/attachments_controller.rb | 49 +++--- app/helpers/attachments_helper.rb | 7 + app/models/attachment.rb | 9 +- app/uploaders/attachment_uploader.rb | 17 +- app/views/attachments/_attachment.html.erb | 1 + .../attachments/_attachment_list.html.erb | 30 ++++ .../attachments/_attachment_new.html.erb | 14 ++ app/views/attachments/_form_bulk2.html.erb | 145 ++++++++++++++++++ app/views/attachments/edit.html.erb | 2 +- app/views/attachments/refresh_list.js.erb | 1 + app/views/attachments/show.html.erb | 4 +- app/views/documents/_document.html.erb | 2 +- app/views/documents/show.html.erb | 5 +- app/views/neuigkeiten/show.html.erb | 3 + .../themen/_attachment_verwalten.html.erb | 13 +- app/views/themen/_small.html.erb | 2 +- config/routes.rb | 12 +- 17 files changed, 273 insertions(+), 43 deletions(-) create mode 100644 app/views/attachments/_attachment_list.html.erb create mode 100644 app/views/attachments/_attachment_new.html.erb create mode 100644 app/views/attachments/_form_bulk2.html.erb create mode 100644 app/views/attachments/refresh_list.js.erb diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index d05b234..2d33a88 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -3,7 +3,7 @@ class AttachmentsController < ApplicationController # GET /attachments.json load_and_authorize_resource def index - @attachments = Attachment.all +# @attachments = Attachment.all respond_to do |format| format.html # index.html.erb @@ -11,28 +11,43 @@ class AttachmentsController < ApplicationController end end - # GET /attachments/1 - # GET /attachments/1.json + # GET + # sets the titlepic flag for one attachment for one parent object def set_titlepic - @attachment = Attachment.find(params[:id]) - if @attachment.image? - @attachment.flag_titlepic = params[:titlepic] - @attachment.thema.titlepics << @attachment + @attachment = Attachment.find(params[:id]) + if @attachment.image? # if attachment is an Image set flag + @attachment.parent.attachments.update_all("flag_titlepic=0") + @attachment.flag_titlepic=true @attachment.save 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 + # 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 @attachment = Attachment.find(params[:id]) - respond_to do |format| format.html # show.html.erb - format.json { render json: @attachment } end end # GET /attachments/new - # GET /attachments/new.json def new @attachment = Attachment.new @thema = Thema.find(params[:thema_id]) @@ -58,10 +73,8 @@ class AttachmentsController < ApplicationController @thema = Thema.find_by_id(params[:thema_id]) # logger.info "gg" @attachment.thema = @thema - @attachment.name=@attachment.datei.filename - @action="create" - - + @attachment.name=@attachment.datei.filename + @action="create" # logger.info "sdf" respond_to do |format| if @attachment.save @@ -86,11 +99,11 @@ class AttachmentsController < ApplicationController # PUT /attachments/1.json def update @attachment = Attachment.find(params[:id]) - @thema = @attachment.thema - + @parent= @attachment.parent + respond_to do |format| 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.js {@attachment=Attachment.new; render action:"create"} else diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index 3c961c9..34f1839 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -1,2 +1,9 @@ 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 diff --git a/app/models/attachment.rb b/app/models/attachment.rb index b1e7883..705ddae 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -12,11 +12,13 @@ class Attachment < ActiveRecord::Base 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 mount_uploader :datei, AttachmentUploader - validates :thema, :presence => true +# validates :thema, :presence => true validates :name, :presence => true + scope :titlepic, ->{where(flag_titlepic: true)} + default_scope order("LOWER(name)") belongs_to :parent, :polymorphic=>true def image? @@ -24,6 +26,9 @@ class Attachment < ActiveRecord::Base # %w(jpg png jpeg).include?(data_ext) datei.image?(datei.file) end + def self.parent_attachment_list_id(parent) + "attachments_for_"+parent.class.to_s+"_"+parent.id.to_s + end def to_jq_upload { diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index d08f8cd..407c604 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -29,14 +29,11 @@ end end version :thumb ,:if=>:image? do process :resize_to_fill => [64, 64] - process :convert => :jpg - def full_filename(for_file) - super.chomp(File.extname(super)) + '.jpg' - end end - version :cover , :if=>:image? do + + version :cover , :if=>:pdf? do process :cover process :resize_to_fit => [64,64] process :convert => :jpg @@ -44,9 +41,11 @@ end super.chomp(File.extname(super)) + '.jpg' end end + version :thumb_small , :if=>:image? do process :resize_to_fill => [32, 32] end + version :thumb_big , :if=>:image? do process :resize_to_fill => [200, 200] @@ -56,6 +55,10 @@ end end end + version :big_thumb , :if=>:image? do + process :resize_to_fill => [200,200] + end + version :resized, :if=>:image? do process :resize_to_fit => [1024,1024] end @@ -92,7 +95,9 @@ end def extention File.extname(full_filename(file.file)).downcase end - + def pdf?(for_file) + %w(.pdf).include?(File.extname(full_filename(for_file.file)).downcase) + end def image?(for_file) %w(.jpg .png .jpeg).include?(File.extname(full_filename(for_file.file)).downcase) end diff --git a/app/views/attachments/_attachment.html.erb b/app/views/attachments/_attachment.html.erb index 2b45971..f46acd5 100644 --- a/app/views/attachments/_attachment.html.erb +++ b/app/views/attachments/_attachment.html.erb @@ -4,6 +4,7 @@ <% if (!["jpg","png","jpeg"].find_index(data_ext).nil?) %> <%= image_tag attachment.datei.thumb.url %> <% else %> + <%= image_tag "pdf-logo.jpg" %> <% end %> <%= attachment.name %> diff --git a/app/views/attachments/_attachment_list.html.erb b/app/views/attachments/_attachment_list.html.erb new file mode 100644 index 0000000..02d40b9 --- /dev/null +++ b/app/views/attachments/_attachment_list.html.erb @@ -0,0 +1,30 @@ + + <% attachment_list.each do |a| %> + + + <% if editor %> + + <% end %> + + <% end %> +
+ <%= fa_icon("tag") if a.flag_titlepic %> + <%= link_to a.datei.url do %> + <%= render partial:"attachments/attachment_new", object: a %> + <% end %> + + +
diff --git a/app/views/attachments/_attachment_new.html.erb b/app/views/attachments/_attachment_new.html.erb new file mode 100644 index 0000000..197c819 --- /dev/null +++ b/app/views/attachments/_attachment_new.html.erb @@ -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 %> diff --git a/app/views/attachments/_form_bulk2.html.erb b/app/views/attachments/_form_bulk2.html.erb new file mode 100644 index 0000000..16958a1 --- /dev/null +++ b/app/views/attachments/_form_bulk2.html.erb @@ -0,0 +1,145 @@ + +
+ <%= semantic_form_for [form_bulk2], :remote=>true, :html => { :multipart => true, :id => "fileupload" } do |f| %> + +
+ +
+
+ + + + Add files... + <%= f.file_field :datei, :multiple=>true %> + <%= f.input :parent_id , as: :hidden %> + <%= f.input :parent_type, as: :hidden %> + + + + + +
+
+ +
+
+
+
+
+
+ +
+
+ + +
+ <% end %> + +
+ + + + + + + + diff --git a/app/views/attachments/edit.html.erb b/app/views/attachments/edit.html.erb index 919ea5c..be5e0f3 100644 --- a/app/views/attachments/edit.html.erb +++ b/app/views/attachments/edit.html.erb @@ -3,4 +3,4 @@ <%= render 'form' %> -<%= link_to 'Back', thema_attachments_path(@attachment.thema,@attachment) %> +<%= link_to 'Back', attachments_path(@attachment) %> diff --git a/app/views/attachments/refresh_list.js.erb b/app/views/attachments/refresh_list.js.erb new file mode 100644 index 0000000..d4d1750 --- /dev/null +++ b/app/views/attachments/refresh_list.js.erb @@ -0,0 +1 @@ +$("#<%= Attachment.parent_attachment_list_id(@parent) %>").replaceWith("<%= escape_javascript ( render partial:"attachments/attachment_list", object:@attachments, locals: {editor: true, parent: @parent} ) %>") \ No newline at end of file diff --git a/app/views/attachments/show.html.erb b/app/views/attachments/show.html.erb index b43b363..2109dda 100644 --- a/app/views/attachments/show.html.erb +++ b/app/views/attachments/show.html.erb @@ -1,10 +1,10 @@

<%= notice %>

-

Name: <%= @attachment.name %> + <%= render @attachment %>

<%= link_to 'Edit', edit_attachment_path(@attachment) %> | -<%= link_to 'Back', attachments_path %> +<%= link_to 'Back', polymorphic_path(@attachment.parent) %> diff --git a/app/views/documents/_document.html.erb b/app/views/documents/_document.html.erb index d66e778..d1563f6 100644 --- a/app/views/documents/_document.html.erb +++ b/app/views/documents/_document.html.erb @@ -4,5 +4,5 @@ <%= fa_icon("file-text") %> <%= 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 %> diff --git a/app/views/documents/show.html.erb b/app/views/documents/show.html.erb index 124e77d..8dcb20b 100644 --- a/app/views/documents/show.html.erb +++ b/app/views/documents/show.html.erb @@ -17,7 +17,10 @@ <% end %> + + +<%= render_attachments_for(@document) %> diff --git a/app/views/neuigkeiten/show.html.erb b/app/views/neuigkeiten/show.html.erb index 3474e89..02b4b50 100755 --- a/app/views/neuigkeiten/show.html.erb +++ b/app/views/neuigkeiten/show.html.erb @@ -78,6 +78,9 @@ end <%= render @neuigkeit.meeting %> <% end%>
<%= link_to "new Calentry", new_calentry_path(:object_id=>@neuigkeit.id, :object_type=>"Neuigkeit"), :remote=>true if can? :edit, @neuigkeit %>
+ +<%= %> +<%= render_attachments_for(@neuigkeit) %> <%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %> <%= render partial: 'nlink_list_whole', :object=>@neuigkeit.nlinks %> diff --git a/app/views/themen/_attachment_verwalten.html.erb b/app/views/themen/_attachment_verwalten.html.erb index e4180d9..91c79b1 100644 --- a/app/views/themen/_attachment_verwalten.html.erb +++ b/app/views/themen/_attachment_verwalten.html.erb @@ -1,12 +1,7 @@
-Titlepics -<% @thema.titlepics.each do |tp| %> -<%= link_to image_tag(tp.datei.thumb.url) , set_titlepic_thema_attachment_path(tp.thema,tp,:params=>{:titlepic=>false}) %> -<% end %>
- List -<%= render partial: "themen/attachment_list", object:@thema.attachments ,locals: {:editor => true}%> -
-Form -<%= render :partial=>"attachments/form_bulk" %> +<%= render_attachments_for(@thema) %> + + +
diff --git a/app/views/themen/_small.html.erb b/app/views/themen/_small.html.erb index 4b570d3..2719210 100644 --- a/app/views/themen/_small.html.erb +++ b/app/views/themen/_small.html.erb @@ -78,7 +78,7 @@ <% 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 %>
diff --git a/config/routes.rb b/config/routes.rb index b38910c..7df49cd 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -158,13 +158,21 @@ get :documents get :meetings end - resources :attachments do + resources :attachments do member do get :set_titlepic end end + + end + resources :attachments do + member do + get :set_titlepic + end + collection do + get :refresh_list + end end - resources :calendars get 'verwalten/calendars', :controller=>:calendars, :action=>:verwalten, :as=>'calendars_verwalten' resources :calentries From 6c3c98c919b8b654632ad35ffae4708fc39e9e92 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 7 Apr 2015 23:22:08 +0200 Subject: [PATCH 03/25] attachment titlepic for neuigkeit --- app/models/neuigkeit.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/neuigkeit.rb b/app/models/neuigkeit.rb index 5ad5e9b..71c21de 100755 --- a/app/models/neuigkeit.rb +++ b/app/models/neuigkeit.rb @@ -46,7 +46,11 @@ class Neuigkeit < ActiveRecord::Base if self.has_meeting? return self.meeting.meetingtyp.picture else - return self.picture + unless self.attachments.where(flag_titlepic: true).first.nil? + return self.attachments.where(flag_titlepic: true).first.datei + else + return self.picture + end end end end From 04b6bcac8a48f7ea125255844b0ee52ccd0d66c5 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 7 Apr 2015 23:22:31 +0200 Subject: [PATCH 04/25] attachments for studium --- app/models/studium.rb | 2 +- app/views/studien/_infoansicht.html.erb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/studium.rb b/app/models/studium.rb index a701f6a..2355ae6 100755 --- a/app/models/studium.rb +++ b/app/models/studium.rb @@ -33,7 +33,7 @@ class Studium < ActiveRecord::Base has_many :moduls, :through=>:modulgruppen has_many :lvas, :through=>:moduls has_many :semester, :dependent => :destroy - + has_many :attachments, :as=>:parent validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$/} validates :typ, :inclusion => {:in => ["Bachelor","Master"] } validates :name, :uniqueness => true, :presence=>true diff --git a/app/views/studien/_infoansicht.html.erb b/app/views/studien/_infoansicht.html.erb index 13dcb65..d8e6dba 100644 --- a/app/views/studien/_infoansicht.html.erb +++ b/app/views/studien/_infoansicht.html.erb @@ -3,6 +3,8 @@

<%= link_to "Qualifikationsprofil", studium_path( @studium, :ansicht=>"qualifikationsprofil")%>

+ <%= render_attachments_for(@studium) %> + <%= raw(@studium.desc) %>
@@ -15,7 +17,6 @@ <% end %> - From 080150f11b0b6f55ff2dfd7f7f8ce842bd9e19cc Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 7 Apr 2015 23:23:14 +0200 Subject: [PATCH 05/25] attachments has_many for document, neuigkeit, thema --- app/controllers/documents_controller.rb | 1 + app/models/document.rb | 1 + app/models/neuigkeit.rb | 3 +++ app/models/thema.rb | 2 +- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/documents_controller.rb b/app/controllers/documents_controller.rb index 4b9086a..dc335fc 100644 --- a/app/controllers/documents_controller.rb +++ b/app/controllers/documents_controller.rb @@ -21,6 +21,7 @@ class DocumentsController < ApplicationController @parent=@document.parent respond_to do |format| format.js + format.html end end diff --git a/app/models/document.rb b/app/models/document.rb index 7fff30a..f98535c 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -9,6 +9,7 @@ class Document < ActiveRecord::Base validate :parent, :presence=>true has_paper_trail TYPS = { 1=>"fet_docs", 10=>"protocol", 11=> "agenda"} + has_many :attachments, :as=>:parent def long_name if self.parent.class=="Meeting" ""+self.parent.text+ ""+ self.name diff --git a/app/models/neuigkeit.rb b/app/models/neuigkeit.rb index 71c21de..bdb1e7d 100755 --- a/app/models/neuigkeit.rb +++ b/app/models/neuigkeit.rb @@ -20,6 +20,9 @@ class Neuigkeit < ActiveRecord::Base has_many :calentries, as: :object has_many :nlinks has_one :meeting + has_many :attachments, :as=>:parent + + validates :rubrik, :presence=>true validates :author, :presence=>true diff --git a/app/models/thema.rb b/app/models/thema.rb index c1503f3..9b77a1e 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -22,7 +22,7 @@ class Thema < ActiveRecord::Base # Each topic has multiple questions, that are also referenced in the FAQ. has_many :fragen # Attachments can be all data formats - has_many :attachments + has_many :attachments, :as=>:parent # attached pics can be used as title pictures has_many :titlepics, :as=>:parent, :class_name=>'Attachment', :conditions=>{:flag_titlepic=>true} # each topic has to belong to one group From 5cd9ca9750c3c54ab5ecd9dd4a866ca0a0503c82 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 7 Apr 2015 23:23:28 +0200 Subject: [PATCH 06/25] meeting new view --- app/views/meetings/_meeting.html.erb | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/app/views/meetings/_meeting.html.erb b/app/views/meetings/_meeting.html.erb index 804c46b..24e22a6 100644 --- a/app/views/meetings/_meeting.html.erb +++ b/app/views/meetings/_meeting.html.erb @@ -1,13 +1,25 @@
<%= image_tag meeting.meetingtyp.picture.thumb.url unless meeting.meetingtyp.picture.thumb.url.nil? %><%= link_to meeting.text.html_safe, meeting %> -<%= link_to "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 "edit", edit_meeting_path(meeting), remote: true %> -<%= link_to 'Delete', meeting, method: :delete, data: { confirm: 'Are you sure?' } , remote: true if can? :delete, meeting %> +<%= link_to fa_icon("newspaper-o")+ "Ankündigung", rubrik_neuigkeit_path(meeting.neuigkeit.rubrik, meeting.neuigkeit) unless meeting.neuigkeit.nil? %> +<%= link_to fa_icon("bullhorn")+"ankündigen", announce_meeting_path(meeting), remote: true if meeting.neuigkeit.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? %> -<%= link_to "Protokoll" , create_protocol_meeting_path(meeting),:remote=>true if meeting.protocol.nil? %> +<% if can?(:create_agenda_meeting, meeting) %> +<%= 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) %> + +<% end %> + + <%= render meeting.agenda unless meeting.agenda.nil? %> <%= render meeting.protocol unless meeting.protocol.nil? %>
From 88b81be49d0c9b9029ef5777018b41f91a83044b Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 7 Apr 2015 23:23:37 +0200 Subject: [PATCH 07/25] new view for beispiel --- app/views/beispiele/_beispiel.html.erb | 39 ++++++++++++++------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/app/views/beispiele/_beispiel.html.erb b/app/views/beispiele/_beispiel.html.erb index 88ab024..8f9f51e 100644 --- a/app/views/beispiele/_beispiel.html.erb +++ b/app/views/beispiele/_beispiel.html.erb @@ -1,18 +1,19 @@
-
- +
<%=link_to ffi1_icon("note20")+" " + beispiel.name + " " + I18n.l(beispiel.datum), beispiel.beispieldatei.url, title: beispiel.desc %> - - <%= I18n.t("file.size") + ": " + (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB
- - <%= - 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 - else - "liked by " + beispiel.get_likes.size.to_s - end - %> +
+
+ <%= (beispiel.beispieldatei.size/1024.0).round(2).to_s %>KiB +
+
+ <%= + 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 + else + "liked by " + beispiel.get_likes.size.to_s + end + %> <%= if can?(:dislike, beispiel) @@ -23,15 +24,17 @@ %> - <%= 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 ff_icon("icon-pencil")+"edit", edit_beispiel_path(beispiel) if can? :edit, 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 %>
-
-
+
+ <% unless beispiel.desc.nil? || beispiel.desc.empty? %> +
+
+ <%= beispiel.desc %>
- - + <% end %>
From 3a1736c3c58e4e3a642b5be9a6e603d44e071c2f Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 7 Apr 2015 23:34:14 +0200 Subject: [PATCH 08/25] lva show fix --- app/views/lvas/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb index 82c6a46..ed6e0d9 100755 --- a/app/views/lvas/show.html.erb +++ b/app/views/lvas/show.html.erb @@ -19,7 +19,7 @@

<%= @lva.full_name %>

- +
-
-
-
-