diff --git a/app/models/ability.rb b/app/models/ability.rb index 3257ef6..de4778b 100755 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -46,6 +46,7 @@ class Ability cannot :delete, Fetprofile cannot :delete, Studium cannot :delete, Modul + cannot :delete ,Gremium end # Rechteverwaltung fuer Neuigkeiten diff --git a/app/models/gremium.rb b/app/models/gremium.rb index 3fd6acf..aef3387 100644 --- a/app/models/gremium.rb +++ b/app/models/gremium.rb @@ -20,8 +20,8 @@ class Gremium < ActiveRecord::Base TEXT={11=>I18n.t("gremium.filter.berufung.text"),12=>I18n.t("gremium.filter.habil.text")} attr_accessible :desc, :name, :typ, :geschlecht,:thema_id, :memberships_attributes - has_many :memberships # Mitgliedschaften bei dem Gremium - has_many :nlinks, as: :link + has_many :memberships, dependent: :destroy # Mitgliedschaften bei dem Gremium + has_many :nlinks, as: :link, dependent: :destroy scope :search, ->(query) {where("gremien.name like ? or gremien.desc like ?", "%#{query}%", "%#{query}%")} belongs_to :thema # Gehört zu einem Thema diff --git a/app/models/thema.rb b/app/models/thema.rb index 9dbc511..3f73b38 100644 --- a/app/models/thema.rb +++ b/app/models/thema.rb @@ -30,7 +30,7 @@ include Rails.application.routes.url_helpers unless translation.try(:updated_at).nil? translation.updated_at < 2.month.ago else - true + false end end def is_wiki? diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb index be7212e..9327b67 100644 --- a/app/uploaders/attachment_uploader.rb +++ b/app/uploaders/attachment_uploader.rb @@ -19,15 +19,39 @@ end def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end + def cover + manipulate! do |frame, index| + index== 0 ? frame.convert(:jpg) : nil + + end + end + version :thumb do + process :cover + process :resize_to_fill => [64, 64] - version :thumb do - process :resize_to_fill => [64, 64] - end - version :thumb_small do - process :resize_to_fill => [32, 32] - end + def full_filename(for_file) + super.chomp(File.extname(super)) + '.jpg' + end + end + version :cover do + process :cover + process :resize_to_fit => [64,64] + process :convert => :jpg + def full_filename(for_file) + super.chomp(File.extname(super)) + '.jpg' + end + end + version :thumb_small do + process :resize_to_fill => [32, 32] + end version :thumb_big do - process :resize_to_fill => [200,200] + process :cover + process :resize_to_fill => [200, 200] + process :convert => :jpg + def full_filename(for_file) + super.chomp(File.extname(super)) + '.jpg' + end + end version :resized do process :resize_to_fit => [1024,1024] diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index e00f27d..22b340c 100755 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -3,7 +3,7 @@ - + Fetsite