forked from bofh/fetsite
Merge branch 'master' of https://github.com/fetsite/fetsite
Conflicts: app/views/layouts/menu.html.erb config/routes.rb
This commit is contained in:
5
app/models/calendar.rb
Normal file
5
app/models/calendar.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class Calendar < ActiveRecord::Base
|
||||
attr_accessible :name, :public, :picture
|
||||
has_and_belongs_to_many :calentries
|
||||
mount_uploader :picture, PictureUploader
|
||||
end
|
||||
20
app/models/calentry.rb
Normal file
20
app/models/calentry.rb
Normal file
@@ -0,0 +1,20 @@
|
||||
class Calentry < ActiveRecord::Base
|
||||
attr_accessible :ende, :start, :summary, :typ,:calendar_ids
|
||||
has_and_belongs_to_many :calendars
|
||||
validates :start, :presence => true
|
||||
validates :typ, :presence => true
|
||||
validate do |entry|
|
||||
if entry.ende.nil?
|
||||
errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein")
|
||||
end
|
||||
end
|
||||
def start_time
|
||||
start
|
||||
end
|
||||
def start1
|
||||
start.to_date
|
||||
end
|
||||
def name
|
||||
summary
|
||||
end
|
||||
end
|
||||
@@ -16,8 +16,9 @@
|
||||
#
|
||||
|
||||
class Lva < ActiveRecord::Base
|
||||
ERLAUBTE_TYPEN = ['VO', 'UE', 'VU', 'LU', 'SE', 'andere'];
|
||||
has_paper_trail # Versionsverfolgung
|
||||
attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids
|
||||
attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids, :pruefungsinformation, :lernaufwand, :typ
|
||||
has_and_belongs_to_many :modul # Gehört zu einem Modul
|
||||
has_and_belongs_to_many :semester
|
||||
#Gehört zu einem Semester( derzeit nicht implementiert)
|
||||
@@ -27,8 +28,8 @@ class Lva < ActiveRecord::Base
|
||||
|
||||
validates :lvanr,:format=>{ :with => /^[0-9][0-9][0-9]\.[0-9][0-9][0-9]$/}, :presence=>true, :uniqueness=>true # , :uniqueness=>true # LVA-Nummer muss das Format 000.000 besitzen (uniqueness?) oder 000 für nicht
|
||||
validates_presence_of :ects # ECTS vorhanden?
|
||||
validates :name, :presence=>true
|
||||
validates :name, :uniqueness=>true# Name Eingetragen?
|
||||
validates :name, :presence=>true, :uniqueness=>true# Name Eingetragen?
|
||||
validates :typ, :presence=>true, :inclusion=> ERLAUBTE_TYPEN
|
||||
validates_presence_of :stunden # Stunden Eingetragen?
|
||||
validates_presence_of :modul # Zugehöriges Modul eingetragen? (zumindest eines)
|
||||
def add_semesters
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#
|
||||
|
||||
class Modulgruppe < ActiveRecord::Base
|
||||
attr_accessible :name, :phase, :typ,:desc, :studium_id
|
||||
attr_accessible :name, :phase, :typ,:desc, :studium_id, :modul_ids
|
||||
belongs_to :studium, :foreign_key => "studium_id"
|
||||
has_and_belongs_to_many :moduls
|
||||
|
||||
|
||||
@@ -12,14 +12,17 @@
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
class Studium < ActiveRecord::Base
|
||||
attr_accessible :desc, :name, :typ, :zahl
|
||||
attr_accessible :desc, :name,:abkuerzung, :typ, :zahl, :semester
|
||||
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe", :dependent => :destroy
|
||||
has_many :semester, :dependent => :destroy
|
||||
|
||||
validates :abkuerzung, :length=>{:maximum=>5}, :format=>{:with=>/^[a-zA-z]{0,5}$/}
|
||||
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }
|
||||
validates :name, :uniqueness => true, :presence=>true
|
||||
validates :zahl, :presence=>true, :format=>{:with=>/^0(33|66)[0-9]{3}$/}, :uniqueness => true
|
||||
translates :desc,:shortdesc, :versioning =>true,:fallbacks_for_empty_translations => true
|
||||
def title_context
|
||||
return self.abkuerzung.to_s.strip.empty? ? self.name : self.abkuerzung
|
||||
end
|
||||
|
||||
def batch_add_semester
|
||||
# Semester automatisch zu Studien hinzufügen
|
||||
|
||||
Reference in New Issue
Block a user