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