From b42e490f7f1115faf39db3510301f413e217e6d6 Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 27 Aug 2013 18:34:02 +0200 Subject: [PATCH 1/5] FIX: downcase in JS --- app/assets/javascripts/application.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 67930f6..c94246e 100755 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -23,13 +23,13 @@ //= require jquery-fileupload function insertAttachment(url,name) { - var ext = url.split('.').pop(); - var img_ext = [ "jpg", "png", "bmp" , "jpeg" ]; - - if ( img_ext.indexOf(ext) > -1) { - tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + ""); - } - else { - tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "" + name +""); - } + var ext = url.split('.').pop().toLowerCase(); + var img_ext = [ "jpg", "png", "bmp" , "jpeg" ]; + + if ( img_ext.indexOf(ext) > -1) { + tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + ""); + } + else { + tinymce.activeEditor.setContent(tinymce.activeEditor.getContent({format : 'raw'}) + "" + name +""); + } } From 348c81b856f04a4b1fd566ef0898b4b98354c8cf Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 27 Aug 2013 18:34:55 +0200 Subject: [PATCH 2/5] NEW: Uploader --- app/models/attachment.rb | 2 +- app/uploaders/attachment_uploader.rb | 56 ++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 app/uploaders/attachment_uploader.rb diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 06f2929..1efccd6 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -14,7 +14,7 @@ class Attachment < ActiveRecord::Base has_paper_trail attr_accessible :name, :datei belongs_to :thema - mount_uploader :datei, BeispieldateiUploader + mount_uploader :datei, AttachmentUploader validates :thema, :presence => true validates :name, :presence => true end diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb new file mode 100644 index 0000000..cba26e4 --- /dev/null +++ b/app/uploaders/attachment_uploader.rb @@ -0,0 +1,56 @@ +# encoding: utf-8 + +class AttachmentUploader < CarrierWave::Uploader::Base + + # Include RMagick or MiniMagick support: + include CarrierWave::RMagick + # include CarrierWave::RMagick + # include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + storage :file + # storage :fog + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + version :thumb do + process :resize_to_fill => [64, 64] + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url + # # For Rails 3.1+ asset pipeline compatibility: + # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) + # + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process :scale => [50, 50] + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + # def extension_white_list + # %w(jpg jpeg gif png) + # end + + # Override the filename of the uploaded files: + # Avoid using model.id or version_name here, see uploader/store.rb for details. + # def filename + # "something.jpg" if original_filename + # end + +end From 338f3a0a06ea1bd99fc25828b123c0c2aa706e21 Mon Sep 17 00:00:00 2001 From: HausdorffHimself Date: Tue, 27 Aug 2013 18:35:50 +0200 Subject: [PATCH 3/5] CHANGE: Attachment-Einbindung in TinyMCE mit Thumbnails und eigenem Partial-View --- app/assets/images/pdf-logo.jpg | Bin 0 -> 1629 bytes app/views/attachments/_show_image_list.erb | 12 ++++++++++ app/views/themen/_form.html.erb | 14 +++++++---- app/views/themen/_select.html.erb | 26 +++++++++++++++++++++ app/views/themen/edit.html.erb | 3 +-- app/views/themen/show.html.erb | 10 +------- 6 files changed, 49 insertions(+), 16 deletions(-) create mode 100644 app/assets/images/pdf-logo.jpg create mode 100644 app/views/attachments/_show_image_list.erb create mode 100644 app/views/themen/_select.html.erb diff --git a/app/assets/images/pdf-logo.jpg b/app/assets/images/pdf-logo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..729b9a7053bfd2d46e42c15f8b9318aae56d2115 GIT binary patch literal 1629 zcmb7BKDG?8|~hI2}~tT}F_5>cymoc`$bI)9$e^XL2Xyr0)2`%Cr$toCyEbO$gP3~XH) zAo~WKHv5xZxBL1#K#}2Q(ee8up(B>-Eg<6rM%2Mb$kWRM^712lKu2t>OiZEh{SmZ; z*uxM#ffgHeI7vx11~vml1qGynydn~bM4=RwRMgQb%E~I*ST$93ypG;acpV%LGFWc} z5lo3VoUyHmsf8tpMA9>|-(+XyxZav%^{)hmLZMWYRkYA(Eh~MTzSaMZtP5ZifeUbf z!w5hQ1A}8=GCsfoASVZ3`SwQ;3i3#p99$8sP>0n(4hENl%fnHM@b8Tkf{@1mtb)EJ zQjOqBQ>O?uhz3^HbVhCy$&DI%npxJJme;tls{;f76$3Z|z~mIIBSrK zuL|as6UwivJ}e|pPfDNE+O^F@Esrk!M9*lEfx8?hMP9n?ZEs4|T)p7ipjuKU-_a#$ zT6HRk^IJj*CVGq#lDZB3xtnoNG^JUm311?73DWTyjhhwf=16=qDRKOq;25!P&Z@fc z`G+1l4sN#nPw!d!t+LfK(~Ymc)+~CDXdLaRtM`Tqr=dV4uc7_JCK9V-Q>hh?ZoZ#g z$WORZ>!TT9Ez)G$;lF9xZ=_w_bDk~(^-g9!?=Bs%cs^0!Z!c|*FD!70WtI|>)7zIE zrQ_!fBzbw0wW>|s@`eenc9>B?go)4CXz3kAZlm`#T|EqOv=LDwf||T@Jl&d3x<<;7IkTI~(B2YJ z-177lE0Hl>J^DIy_Se+Ss%mEfPi2t34)KOd&Y}g!qTdcCnm^w8K41~8Y^VaC_|nTo{zuzHiw7`qPGJE**L`1T!@UX&uW)hX z;jLX`wGSf6dx#9{%opZP!N-m3+O|Jpjt|kY%Y*19>_A3Mk`5NeeKY7q#mh)n?R!;2H3y*;Z)as=afN6uU@Dj#Q)v+6uP%T)^RPLCTp8F` zno(MPpk6s1{d$b4-S5yjGUH-DQ4d|~G;OH&s);t{L_fMLjz_up=xx z$T~gNKNu>ix#2ON6^ORDaFjrK5b8TYc{nVYD!o*?OzxdG>bc&z=j2OGy}r^ljcI?J zt3u!H?>~^;Ap_W4q7OK<}hN6p&l0iJK7;wy^+ ziS>mwP6;P6Rg(#nFUtlC^N7ze8`daO$)A9cbqQYPYUDUS8Zr+8x{2mDM9`lxf|Qxwu%M}`f4c)X`0s3 zQ{fD!kgueXP@YF}cF}}-1gYpsJ0dL=$I-^SyG~ACJKB0|9BcP+owT)=P9z=Y^yPI3 ql0O~&^kIO 0 %> + +<% else %> + No Images Uploaded Yet. +<% end %> diff --git a/app/views/themen/_form.html.erb b/app/views/themen/_form.html.erb index 7185578..b967041 100644 --- a/app/views/themen/_form.html.erb +++ b/app/views/themen/_form.html.erb @@ -9,6 +9,13 @@

Attachments:

+<%= render :partial => "themen/select", :object => @thema,:locals =>{ :editor => :true} %> + +<%= f.actions do %> +<%= f.action :submit, :as => :input %> +<% end %> + + - diff --git a/app/views/themen/_select.html.erb b/app/views/themen/_select.html.erb new file mode 100644 index 0000000..4964693 --- /dev/null +++ b/app/views/themen/_select.html.erb @@ -0,0 +1,26 @@ +
+ <% select.attachments.each_slice(6) do |row| %> +
+ <% row.each do |attachment| + data_ext = attachment.datei.file.extension.downcase %> +
+ <%= link_to attachment.name, edit_thema_attachment_path(@thema,attachment) %>
+ <% if (!["jpg","png","jpeg"].find_index(data_ext).nil?) %> + <%= image_tag attachment.datei.thumb.url %> + <% else %> + <%= image_tag "pdf-logo.jpg" %> + <% end %> + <% if(editor) %> +
+ <% else %> +
<%= link_to 'Destroy',[@thema,attachment], method: :delete, data: { confirm: 'Are you sure?' } %> + <% end %> +
+ <% end %> +
+
+ <% end %> +
+
+<%= link_to 'Neues Attachment', new_thema_attachment_path(@thema) %> +
diff --git a/app/views/themen/edit.html.erb b/app/views/themen/edit.html.erb index 9230c28..5376cfb 100644 --- a/app/views/themen/edit.html.erb +++ b/app/views/themen/edit.html.erb @@ -2,5 +2,4 @@ <%= render 'form' %> -<%= link_to 'Show', @thema %> | -<%= link_to 'Back', themen_path %> +
<%= link_to 'Back', @thema %> diff --git a/app/views/themen/show.html.erb b/app/views/themen/show.html.erb index 6fe1cd7..aaf3fa6 100644 --- a/app/views/themen/show.html.erb +++ b/app/views/themen/show.html.erb @@ -24,12 +24,4 @@

Attachments:

-<% @thema.attachments.each do |attachment| %> -
    -
  • - <%= link_to attachment.name, edit_thema_attachment_path(@thema,attachment) %> | <%= link_to 'Destroy',[@thema,attachment], method: :delete, data: { confirm: 'Are you sure?' } %> -
  • -
-<% end %> -<%= link_to 'Neues Attachment', new_thema_attachment_path(@thema) %> -
+<%= render :partial => "themen/select", :object => @thema, :locals => { :editor => :false }%> From 45908e6013d8b410f26e33260ad3f940ee6d9747 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 27 Aug 2013 20:43:16 +0200 Subject: [PATCH 4/5] =?UTF-8?q?links=20=C3=BCberarbeitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/application.css.scss | 3 +- app/views/fetprofiles/index.html.erb | 7 +-- app/views/galleries/index.html.erb | 42 ++++++++-------- app/views/gremien/show.html.erb | 55 ++++++++++++++------- app/views/neuigkeiten/_neuigkeit.html.erb | 6 +-- 5 files changed, 69 insertions(+), 44 deletions(-) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 194f5be..a2c8f7f 100755 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -12,6 +12,7 @@ *= require_tree . *= require jquery.fileupload-ui * require 'bootstrap' + */ $linkColor: #03006E; @@ -55,4 +56,4 @@ border-style: solid; border-width: 1px 0px 0px 0px; border-color: grey; min-width: 100%; -} \ No newline at end of file +} diff --git a/app/views/fetprofiles/index.html.erb b/app/views/fetprofiles/index.html.erb index 1bfac8c..f6889e8 100644 --- a/app/views/fetprofiles/index.html.erb +++ b/app/views/fetprofiles/index.html.erb @@ -17,16 +17,17 @@ <% @fetprofiles.each do |fetprofile| %>
+ <%= link_to fetprofile do %>
<%= image_tag fetprofile.picture.portrait.url %>
-

<%= link_to fetprofile.name, fetprofile %>

+

<%= fetprofile.name %>

<%= fetprofile.fetmail %>

<%= fetprofile.desc %>

-

<%= fetprofile.active %>

-
+ +
<% end %> <% end %>
diff --git a/app/views/galleries/index.html.erb b/app/views/galleries/index.html.erb index 562128c..5512beb 100644 --- a/app/views/galleries/index.html.erb +++ b/app/views/galleries/index.html.erb @@ -1,26 +1,28 @@

Listing galleries

- - - - - - - - - -<% @galleries.each do |gallery| %> - - - - - - - - -<% end %> -
NameDescDatum
<%= gallery.name %><%= gallery.desc %><%= gallery.datum %><%= link_to 'Show', gallery %><%= link_to 'Edit', edit_gallery_path(gallery) %><%= link_to 'Destroy', gallery, method: :delete, data: { confirm: 'Are you sure?' } %>
+ <%= %> +
+
+
+ <% @galleries.each do |gallery| %> + <%= link_to gallery do %> +
+
+ <%= image_tag gallery.fotos.first.datei.big_thumb.url %> +
+
+

<%= gallery.datum %> - <%= gallery.name %>

+

<%= gallery.desc %> +

+
+
+ <% end %> + <%= link_to 'Edit', edit_gallery_path(gallery) %> + <% end %> +
+
+
diff --git a/app/views/gremien/show.html.erb b/app/views/gremien/show.html.erb index 3638fe7..039dd86 100644 --- a/app/views/gremien/show.html.erb +++ b/app/views/gremien/show.html.erb @@ -1,20 +1,41 @@ -

<%= notice %>

-<%= render 'fetprofiles/tabs' %> -

- <%= @gremium.name %> -

-

-<%= @gremium.desc %> -

- -<% @gremium.memberships.order(:typ).active.each do |m| %> - <%= image_tag m.fetprofile.picture.portrait %> - <%= m.fetprofile.name + " ist" + render(m) %> -<% end %> -

- <%= Gremium::TYPEN[@gremium.typ.to_i].to_s %> -

+
+
+
+ <%= render 'fetprofiles/tabs' %> +

<%= notice %>

+
+
+
+
+

+ <%= @gremium.name %> +

+ <% Gremium::TYPEN[@gremium.typ.to_i].to_s %> +

+ <%= @gremium.desc %> +

+
+
-<%= link_to 'Edit', edit_gremium_path(@gremium) %> | + <% @gremium.memberships.order(:typ).active.each_slice(4) do |r| %> +
<% r.each do |m| %> + <%= link_to m.fetprofile do %> +
+ <%= image_tag m.fetprofile.picture.portrait %> +

+ <%= m.fetprofile.name %>
<%= render(m) %> +

+
+ <% end %> + <% end %> +
+ <% end %> + + + <%= link_to 'Edit', edit_gremium_path(@gremium) %> | +
+
+ + diff --git a/app/views/neuigkeiten/_neuigkeit.html.erb b/app/views/neuigkeiten/_neuigkeit.html.erb index 57efadc..d42e2f5 100755 --- a/app/views/neuigkeiten/_neuigkeit.html.erb +++ b/app/views/neuigkeiten/_neuigkeit.html.erb @@ -1,15 +1,15 @@ - +<%= link_to neuigkeit do %>


<%= image_tag neuigkeit.picture.thumb.url unless neuigkeit.picture.url.nil? %>

<%= neuigkeit.rubrik.name %> <%= "am "+ I18n.l(neuigkeit.try(:datum).try(:to_date)) unless neuigkeit.try(:datum).try(:to_date).nil? %>
-

<%= link_to neuigkeit.title,neuigkeit_path(neuigkeit) %>

+

<%= neuigkeit.title%>

<%= raw(neuigkeit.text_first_words) unless neuigkeit.text.nil?%> - <%= link_to "more" , neuigkeit_path(neuigkeit) %>

+<% end %> From a38eec97a56442db4d740f8555d4a16d49b12d74 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Tue, 27 Aug 2013 20:43:16 +0200 Subject: [PATCH 5/5] =?UTF-8?q?links=20=C3=BCberarbeitet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/assets/stylesheets/application.css.scss | 3 +- app/views/fetprofiles/index.html.erb | 7 +-- app/views/galleries/index.html.erb | 42 ++++++++-------- app/views/gremien/show.html.erb | 55 ++++++++++++++------- app/views/neuigkeiten/_neuigkeit.html.erb | 6 +-- 5 files changed, 69 insertions(+), 44 deletions(-) diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index 194f5be..a2c8f7f 100755 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -12,6 +12,7 @@ *= require_tree . *= require jquery.fileupload-ui * require 'bootstrap' + */ $linkColor: #03006E; @@ -55,4 +56,4 @@ border-style: solid; border-width: 1px 0px 0px 0px; border-color: grey; min-width: 100%; -} \ No newline at end of file +} diff --git a/app/views/fetprofiles/index.html.erb b/app/views/fetprofiles/index.html.erb index 1bfac8c..f6889e8 100644 --- a/app/views/fetprofiles/index.html.erb +++ b/app/views/fetprofiles/index.html.erb @@ -17,16 +17,17 @@ <% @fetprofiles.each do |fetprofile| %>
+ <%= link_to fetprofile do %>
<%= image_tag fetprofile.picture.portrait.url %>
-

<%= link_to fetprofile.name, fetprofile %>

+

<%= fetprofile.name %>

<%= fetprofile.fetmail %>

<%= fetprofile.desc %>

-

<%= fetprofile.active %>

-
+ +
<% end %> <% end %>
diff --git a/app/views/galleries/index.html.erb b/app/views/galleries/index.html.erb index 562128c..5512beb 100644 --- a/app/views/galleries/index.html.erb +++ b/app/views/galleries/index.html.erb @@ -1,26 +1,28 @@

Listing galleries

- - - - - - - - - -<% @galleries.each do |gallery| %> - - - - - - - - -<% end %> -
NameDescDatum
<%= gallery.name %><%= gallery.desc %><%= gallery.datum %><%= link_to 'Show', gallery %><%= link_to 'Edit', edit_gallery_path(gallery) %><%= link_to 'Destroy', gallery, method: :delete, data: { confirm: 'Are you sure?' } %>
+ <%= %> +
+
+
+ <% @galleries.each do |gallery| %> + <%= link_to gallery do %> +
+
+ <%= image_tag gallery.fotos.first.datei.big_thumb.url %> +
+
+

<%= gallery.datum %> - <%= gallery.name %>

+

<%= gallery.desc %> +

+
+
+ <% end %> + <%= link_to 'Edit', edit_gallery_path(gallery) %> + <% end %> +
+
+
diff --git a/app/views/gremien/show.html.erb b/app/views/gremien/show.html.erb index 3638fe7..039dd86 100644 --- a/app/views/gremien/show.html.erb +++ b/app/views/gremien/show.html.erb @@ -1,20 +1,41 @@ -

<%= notice %>

-<%= render 'fetprofiles/tabs' %> -

- <%= @gremium.name %> -

-

-<%= @gremium.desc %> -

- -<% @gremium.memberships.order(:typ).active.each do |m| %> - <%= image_tag m.fetprofile.picture.portrait %> - <%= m.fetprofile.name + " ist" + render(m) %> -<% end %> -

- <%= Gremium::TYPEN[@gremium.typ.to_i].to_s %> -

+
+
+
+ <%= render 'fetprofiles/tabs' %> +

<%= notice %>

+
+
+
+
+

+ <%= @gremium.name %> +

+ <% Gremium::TYPEN[@gremium.typ.to_i].to_s %> +

+ <%= @gremium.desc %> +

+
+
-<%= link_to 'Edit', edit_gremium_path(@gremium) %> | + <% @gremium.memberships.order(:typ).active.each_slice(4) do |r| %> +
<% r.each do |m| %> + <%= link_to m.fetprofile do %> +
+ <%= image_tag m.fetprofile.picture.portrait %> +

+ <%= m.fetprofile.name %>
<%= render(m) %> +

+
+ <% end %> + <% end %> +
+ <% end %> + + + <%= link_to 'Edit', edit_gremium_path(@gremium) %> | +
+
+ + diff --git a/app/views/neuigkeiten/_neuigkeit.html.erb b/app/views/neuigkeiten/_neuigkeit.html.erb index 57efadc..d42e2f5 100755 --- a/app/views/neuigkeiten/_neuigkeit.html.erb +++ b/app/views/neuigkeiten/_neuigkeit.html.erb @@ -1,15 +1,15 @@ - +<%= link_to neuigkeit do %>


<%= image_tag neuigkeit.picture.thumb.url unless neuigkeit.picture.url.nil? %>

<%= neuigkeit.rubrik.name %> <%= "am "+ I18n.l(neuigkeit.try(:datum).try(:to_date)) unless neuigkeit.try(:datum).try(:to_date).nil? %>
-

<%= link_to neuigkeit.title,neuigkeit_path(neuigkeit) %>

+

<%= neuigkeit.title%>

<%= raw(neuigkeit.text_first_words) unless neuigkeit.text.nil?%> - <%= link_to "more" , neuigkeit_path(neuigkeit) %>

+<% end %>