themen ueberarbeitet attachments verwalten

This commit is contained in:
2014-06-09 23:14:05 +05:30
parent babbfb7d73
commit 6451c0f175
22 changed files with 245 additions and 38 deletions

View File

@@ -12,9 +12,22 @@
class Attachment < ActiveRecord::Base
has_paper_trail
attr_accessible :name, :datei
attr_accessible :name, :datei, :datei_cache
belongs_to :thema
mount_uploader :datei, AttachmentUploader
validates :thema, :presence => true
validates :name, :presence => true
def to_jq_upload
{
"id" => read_attribute(:id),
"title" => read_attribute(:title),
"description" => read_attribute(:desc),
"name" => read_attribute(:title),
"size" => datei.size,
"url" => datei.url,
"thumbnail_url" => datei.thumb.url,
"delete_type" => "DELETE"
}
end
end

View File

@@ -14,8 +14,8 @@
class Gremium < ActiveRecord::Base
TYPEN={1=>"offiziell", 2=>"offiziell-temporär", 3 => "inoffiziell",4=>"inoffiziell-tempo", 11=> "berufungskommission",12=> "habilitationskommission" } # Kategorien, im Wesentlichen wichtig für Listung oder nicht Listung
GESCHLECHT={0=>"saechlich", 1 => "maennlich", 2 => "weiblich"} # Geschlecht des Gremiums zur richtige Deklination
ART2FALL={0=>"des", 1=>"des",2=>"der"} # Artikel 2.Fall abhängig vom Geschlecht
ART4FALL={0=>"das", 1=>"den",2=>"die"} # Artikel 2.Fall abhängig vom Geschlecht
ART2FALL={0=>"des", 1=>"des",2=>"der"} # Artikel 2.Fall abhängig vom Geschlecht
ART4FALL={0=>"das", 1=>"den",2=>"die"} # Artikel 2.Fall abhängig vom Geschlecht
FILTER={11=>I18n.t("gremium.filter.berufung.title"),12=>I18n.t("gremium.filter.habil.title")}
TEXT={11=>I18n.t("gremium.filter.berufung.text"),12=>I18n.t("gremium.filter.habil.text")}

View File

@@ -23,7 +23,7 @@ class Thema < ActiveRecord::Base
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
def is_wiki?
wikiname.empty? || wikiname.nil?
wikiname.nil? || wikiname.empty?
end
def text_first_words
md = /<p>(?<text>[^\<\>]*)/.match Sanitize.clean(self.text,:elements=>['p'])