forked from bofh/fetsite
Merge branch 'master' of https://github.com/andreassteph/fetsite
Beispiel.lva bei neues Beispiel resolved Conflicts: app/controllers/beispiele_controller.rb
This commit is contained in:
@@ -2,6 +2,7 @@ class BeispieleController < ApplicationController
|
||||
# GET /beispiele
|
||||
# GET /beispiele.json
|
||||
def index
|
||||
@lva = params([:lva])
|
||||
@beispiele = Beispiel.all
|
||||
|
||||
respond_to do |format|
|
||||
@@ -13,6 +14,7 @@ class BeispieleController < ApplicationController
|
||||
# GET /beispiele/1
|
||||
# GET /beispiele/1.json
|
||||
def show
|
||||
@lva = lva unless lva.nil?
|
||||
@beispiel = Beispiel.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
@@ -26,7 +28,7 @@ class BeispieleController < ApplicationController
|
||||
def new
|
||||
@beispiel = Beispiel.new
|
||||
@beispiel.lva = Lva.find(params[:lva_id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @beispiel }
|
||||
|
||||
@@ -3,23 +3,36 @@ class LvasController < ApplicationController
|
||||
before_filter {@toolbar_elements =[]}
|
||||
def index
|
||||
@lvas = Lva.all
|
||||
|
||||
@toolbar_elements=[{:hicon=>'icon-plus-sign',:text =>I18n.t('lva.add'),:path => new_lva_path}]
|
||||
@tb=[{:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"),:path=>studien_path},
|
||||
{:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path},
|
||||
{:hicon=>'icon-list', :text=>I18n.t("lva.list"),:path=>lvas_path}]
|
||||
end
|
||||
|
||||
# GET /lvas/1
|
||||
|
||||
def show
|
||||
@lva = Lva.find_by_id(params[:id])
|
||||
@toolbar_elements<<{:icon=>:pencil,:text =>I18n.t('common.edit'),:path => edit_lva_path(@lva)}
|
||||
|
||||
@toolbar_elements<<{:hicon=>'icon-plus-sign', :icon=>:plus, :text => "Neues Beispiel", :path=> new_beispiel_path(:lva_id =>@lva.id)}
|
||||
@toolbar_elements<<{:hicon=>'icon-pencil', :icon=>:pencil,:text =>I18n.t('common.edit'),:path => edit_lva_path(@lva)}
|
||||
@topbar_elements =[{:hicon=>'icon-list', :text=>I18n.t("lva.list"), :path=>lvas_path}]
|
||||
for m in @lva.modul
|
||||
@topbar_elements << {:newline=>true}
|
||||
@topbar_elements << {:text=> '<b>' + m.name + '</b>', :path=>modul_path(m)}
|
||||
for mg in m.modulgruppen
|
||||
@topbar_elements << {:text => mg.studium.name + ' (' + mg.name + ')', :path=>studium_path(mg.studium)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /lvas/new
|
||||
# GET /lvas/new.json
|
||||
def new
|
||||
@lva = Lva.new
|
||||
modul=Modul.find(params[:modul_id])
|
||||
@lva.modul<<modul
|
||||
|
||||
modul=Modul.find_by_id(params[:modul_id])
|
||||
@lva.modul<<modul unless modul.nil? #
|
||||
|
||||
end
|
||||
|
||||
# GET /lvas/1/edit
|
||||
@@ -31,14 +44,15 @@ class LvasController < ApplicationController
|
||||
# POST /lvas.json
|
||||
def create
|
||||
@lva = Lva.new(params[:lva])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @lva.save
|
||||
@lva.add_semesters
|
||||
format.html { redirect_to @lva, notice: 'Lva was successfully created.' }
|
||||
|
||||
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -47,9 +61,10 @@ class LvasController < ApplicationController
|
||||
# PUT /lvas/1.json
|
||||
def update
|
||||
@lva = Lva.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @lva.update_attributes(params[:lva])
|
||||
@lva.add_semesters
|
||||
format.html { redirect_to @lva, notice: 'Lva was successfully updated.' }
|
||||
|
||||
else
|
||||
|
||||
@@ -27,9 +27,9 @@ class ModulgruppenController < ApplicationController
|
||||
def new
|
||||
@modulgruppe = Modulgruppe.new
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
@modulgruppe.studium_id=(params[:studium_id])
|
||||
else
|
||||
@studium=Studium.first
|
||||
@modulgruppe.studium_id=studium_id=Studium.first.id
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
@@ -50,14 +50,16 @@ class ModulgruppenController < ApplicationController
|
||||
|
||||
def create
|
||||
@modulgruppe = Modulgruppe.new(params[:modulgruppe])
|
||||
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find_by_id(params[:studium_id])
|
||||
else
|
||||
@studium=Studium.find_by_id(params[:modulgruppe][:studium_id])
|
||||
end
|
||||
respond_to do |format|
|
||||
|
||||
if @modulgruppe.save
|
||||
format.html { redirect_to @modulgruppe, notice: 'Modulgruppe was successfully created.' }
|
||||
format.html { redirect_to @studium, notice: 'Modulgruppe was successfully created.' }
|
||||
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
|
||||
@@ -2,24 +2,47 @@ class ModulsController < ApplicationController
|
||||
# GET /moduls
|
||||
# GET /moduls.json
|
||||
def index
|
||||
@moduls = Modul.all
|
||||
if @moduls
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find_by_id(params[:studium_id])
|
||||
end
|
||||
@moduls = Modul.all
|
||||
if @moduls
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find_by_id(params[:studium_id])
|
||||
end
|
||||
@toolbar_elements = [{:hicon=>'icon-plus-sign', :text=>I18n.t("modul.add"), :path=>new_modul_path}]
|
||||
@topbar_elements=[{:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"),:path=>studien_path}]
|
||||
@topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path}
|
||||
@topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("lva.list"),:path=>lvas_path}
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @moduls }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# GET /moduls/1
|
||||
# GET /moduls/1.json
|
||||
def show
|
||||
@modul = Modul.find(params[:id])
|
||||
@toolbar_elements = [{:hicon=>'icon-plus-sign', :text=>I18n.t("lva.add"), :path=>new_lva_path(:modul_id =>@modul.id)}]
|
||||
@toolbar_elements << {:hicon=>'icon-pencil', :text=>I18n.t("modul.edit"), :path=>edit_modul_path(@modul)}
|
||||
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t("common.delete"),:path=>@modul , :method=>:delete , :data=>{:confirm =>'Are you sure'}}
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
@topbar_elements = [{:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path}]
|
||||
@tb=[]
|
||||
for i in @modul.modulgruppen
|
||||
|
||||
if !i.studium.nil?
|
||||
name =i.studium.name
|
||||
id = i.studium.id
|
||||
else
|
||||
s.name = 'Kein Studium vorhanden'
|
||||
s.id = nil
|
||||
end
|
||||
@tb <<{:text=> i.name + ' ('+i.studium.name + ')', :path=>modulgruppe_path(i)}
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @modul }
|
||||
end
|
||||
@@ -31,7 +54,7 @@ class ModulsController < ApplicationController
|
||||
@modul = Modul.new
|
||||
modulgruppe=Modulgruppe.find_by_id(params[:modulgruppen_id])
|
||||
if !modulgruppe.nil?
|
||||
@modul.modulgruppen<<modulgruppe
|
||||
@modul.modulgruppen<<modulgruppe #
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
@@ -42,27 +65,30 @@ class ModulsController < ApplicationController
|
||||
# GET /moduls/1/edit
|
||||
def edit
|
||||
@modul = Modul.find(params[:id])
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
end
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
end
|
||||
end
|
||||
|
||||
# POST /moduls
|
||||
# POST /moduls.json
|
||||
def create
|
||||
@modul = Modul.new(params[:modul])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @modul.save
|
||||
|
||||
respond_to do |format|
|
||||
if @modul.save
|
||||
for i in @modul.lvas
|
||||
i.add_semesters
|
||||
end
|
||||
format.html { redirect_to modulgruppe_path(@modul.modulgruppen.first), notice: 'Modul was successfully created.' }
|
||||
format.json { render json: @modul, status: :created, location: @modul }
|
||||
else
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @modul.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# PUT /moduls/1
|
||||
@@ -72,6 +98,9 @@ class ModulsController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
if @modul.update_attributes(params[:modul])
|
||||
for i in @modul.lvas
|
||||
i.add_semesters
|
||||
end
|
||||
format.html { redirect_to url_for(@modul), notice: 'Modul was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@@ -87,6 +116,9 @@ class ModulsController < ApplicationController
|
||||
|
||||
@modul = Modul.find(params[:id])
|
||||
modulgruppe=@modul.modulgruppen.first
|
||||
for i in @modul.lvas
|
||||
i.add_semesters
|
||||
end
|
||||
@modul.destroy
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ class SemestersController < ApplicationController
|
||||
@semesters = Semester.all
|
||||
end
|
||||
|
||||
|
||||
|
||||
def show
|
||||
@semester = Semester.find(params[:id])
|
||||
|
||||
@@ -20,6 +20,7 @@ class SemestersController < ApplicationController
|
||||
|
||||
def create
|
||||
@semester = Semester.new(params[:semester])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @semester.save
|
||||
@@ -45,7 +46,7 @@ class SemestersController < ApplicationController
|
||||
def destroy
|
||||
@semester = Semester.find(params[:id])
|
||||
@semester.destroy
|
||||
redirect_to semester_url
|
||||
redirect_to semester_url
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,52 +1,71 @@
|
||||
class StudienController < ApplicationController
|
||||
before_filter {@toolbar_elements =[]}
|
||||
before_filter {@toolbar_elements =[]}
|
||||
|
||||
|
||||
def index
|
||||
@studien = Studium.all
|
||||
@toolbar_elements<<{:icon =>:plus, :text=> I18n.t('studien.new') ,:path=>new_studium_path }
|
||||
@toolbar_elements<<{:text=> I18n.t('modulgruppe.show.link') ,:path=>modulgruppen_path }
|
||||
@toolbar_elements<<{:text=> I18n.t('modul.show.link') ,:path=>moduls_path }
|
||||
end
|
||||
def index
|
||||
@studien = Studium.all
|
||||
@topbar_elements=[{:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"),:path=>studien_path}]
|
||||
@topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path}
|
||||
@topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("lva.list"),:path=>lvas_path}
|
||||
@toolbar_elements<<{:icon =>:plus, :hicon=>'icon-plus-sign', :text=> I18n.t('studien.new') ,:path=>new_studium_path }
|
||||
# @toolbar_elements<<{:text=> I18n.t('modulgruppe.show.link') ,:path=>modulgruppen_path }
|
||||
end
|
||||
|
||||
def show
|
||||
@studium= Studium.find(params[:id])
|
||||
@studienphasen=[]
|
||||
[1, 2 ,3].each do |ph|
|
||||
modulgruppen_phase=@studium.modulgruppen.where(:phase=>ph)
|
||||
if modulgruppen_phase.count==1
|
||||
opts={:width=>12, :slice=>1}
|
||||
elsif modulgruppen_phase.count <= 4
|
||||
opts={:width=>6, :slice=>2}
|
||||
else
|
||||
opts={:width=>4, :slice=>3}
|
||||
end
|
||||
modulgruppen =[]
|
||||
modulgruppen_phase.each_slice(opts[:slice]) do |s|
|
||||
modulgruppen<<s
|
||||
end
|
||||
@studienphasen << {:modulgruppen=>modulgruppen, :phase => ph}.merge(opts)
|
||||
end
|
||||
@toolbar_elements=[{:icon =>:plus ,:text=> I18n.t('studien.new') , :path => new_studium_modulgruppe_path(@studium) }]
|
||||
@toolbar_elements<<{:icon=>:pencil,:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)}
|
||||
@toolbar_elements<<{:text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>"Sure?" }
|
||||
end
|
||||
def show
|
||||
@studium= Studium.find(params[:id])
|
||||
@text = 'Zu Semesteransicht wechseln'
|
||||
@path = studium_semesteransicht_path(@studium)
|
||||
|
||||
@studienphasen=[]
|
||||
[1, 2 ,3].each do |ph|
|
||||
modulgruppen_phase=@studium.modulgruppen.where(:phase=>ph)
|
||||
if modulgruppen_phase.count==1
|
||||
opts={:width=>12, :slice=>1}
|
||||
elsif modulgruppen_phase.count <= 4
|
||||
opts={:width=>6, :slice=>2}
|
||||
else
|
||||
opts={:width=>4, :slice=>3}
|
||||
end
|
||||
modulgruppen =[]
|
||||
modulgruppen_phase.each_slice(opts[:slice]) do |s|
|
||||
modulgruppen<<s #
|
||||
|
||||
end
|
||||
@studienphasen << {:modulgruppen=>modulgruppen, :phase => ph}.merge(opts)
|
||||
end
|
||||
|
||||
@toolbar_elements=[{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) },
|
||||
{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)},
|
||||
{:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>"Sure?" }]
|
||||
|
||||
@toolbar_modulgruppen =[ {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)},
|
||||
{:hicon=>'icon-list', :text => I18n.t('modulgruppe.list'), :path=>modulgruppen_path}]
|
||||
|
||||
@topbar_elements = [ {:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"), :path=>studien_path},
|
||||
{:text=>'Zur Semesteransicht wechseln', :path=>studium_semesteransicht_path(@studium)},
|
||||
{:newline=>true}]
|
||||
for i in Studium.all
|
||||
@topbar_elements << {:text=>i.name, :path=>studium_path(i)}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
@studium = Studium.new
|
||||
end
|
||||
|
||||
def edit
|
||||
@studium = Studium.find(params[:id])
|
||||
@toolbar_elements=[{:text => I18n.t('studien.anzeigen') , :path => url_for(@studium) }]
|
||||
@toolbar_elements<<{:text =>I18n.t('studien.allestudien'),:path=>studien_path(@studium)}
|
||||
@toolbar_elements=[{:text => I18n.t('studien.anzeigen') , :path => url_for(@studium) }]
|
||||
@toolbar_elements<<{:text =>I18n.t('studien.allestudien'),:path=>studien_path(@studium)}
|
||||
end
|
||||
|
||||
def create
|
||||
@studium = Studium.new(params[:studium])
|
||||
|
||||
respond_to do |format|
|
||||
if @studium.save
|
||||
@studium.batch_add_semester
|
||||
format.html { redirect_to url_for(@studium), notice: 'Studium was successfully created.' }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
@@ -57,19 +76,40 @@ class StudienController < ApplicationController
|
||||
|
||||
def update
|
||||
@studium = Studium.find(params[:id])
|
||||
|
||||
if @studium.update_attributes(params[:studium])
|
||||
redirect_to url_for(@studium), notice: 'Studium was successfully updated.'
|
||||
else
|
||||
render action: "edit"
|
||||
|
||||
end
|
||||
|
||||
if @studium.update_attributes(params[:studium])
|
||||
redirect_to url_for(@studium), notice: 'Studium was successfully updated.'
|
||||
else
|
||||
render action: "edit"
|
||||
|
||||
end
|
||||
end
|
||||
def semesteransicht
|
||||
@sem = 'true'
|
||||
@studium = Studium.find(params[:id])
|
||||
if @studium.nil?
|
||||
@studium = Studium.first
|
||||
end
|
||||
@text = 'Zu Modulgruppenansicht wechseln'
|
||||
@path = studium_path(@studium)
|
||||
@topbar_elements = [ {:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"), :path=>studien_path},
|
||||
{:text=>'Zur Modulgruppenansicht wechseln', :path=>studium_path(@studium)},
|
||||
{:newline=>true}]
|
||||
for i in Studium.all
|
||||
@topbar_elements << {:text=>i.name, :path=>studium_semesteransicht_path(i)}
|
||||
end
|
||||
|
||||
|
||||
|
||||
@toolbar_elements = [ {:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) },
|
||||
{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)},
|
||||
{:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>"Sure?" }]
|
||||
end
|
||||
|
||||
def destroy
|
||||
@studium = Studium.find(params[:id])
|
||||
@studium.destroy
|
||||
redirect_to studien_url
|
||||
@studium = Studium.find(params[:id])
|
||||
@studium.destroy
|
||||
redirect_to studien_url
|
||||
end
|
||||
end
|
||||
|
||||
@@ -19,4 +19,9 @@ class Beispiel < ActiveRecord::Base
|
||||
attr_accessible :desc, :name, :lva_id, :beispieldatei, :beispieldatei_cache
|
||||
belongs_to :lva
|
||||
mount_uploader :beispieldatei, BeispieldateiUploader
|
||||
validates :beispieldatei, :presence => true
|
||||
validates :name, :presence => true
|
||||
validates :lva_id, :presence => true
|
||||
validates :lva, :presence => true
|
||||
|
||||
end
|
||||
|
||||
@@ -17,39 +17,52 @@
|
||||
|
||||
class Lva < ActiveRecord::Base
|
||||
has_paper_trail # Versionsverfolgung
|
||||
attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids
|
||||
|
||||
attr_accessible :desc, :ects, :lvanr, :name, :stunden, :modul_ids, :semester_ids
|
||||
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)
|
||||
has_and_belongs_to_many :semester
|
||||
#Gehört zu einem Semester( derzeit nicht implementiert)
|
||||
has_many :beispiele , :class_name => "Beispiel"
|
||||
|
||||
translates :desc, :fallbacks_for_empty_translations => true
|
||||
|
||||
validates :lvanr,:format=>{ :with => /^[0-9][0-9][0-9]\.[0-9][0-9][0-9]$/} # , :uniqueness=>true # LVA-Nummer muss das Format 000.000 besitzen (uniqueness?) oder 000 für nicht existent
|
||||
|
||||
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_presence_of :name # Name Eingetragen?
|
||||
validates :name, :presence=>true
|
||||
validates :name, :uniqueness=>true# Name Eingetragen?
|
||||
validates_presence_of :stunden # Stunden Eingetragen?
|
||||
validates_presence_of :modul # Zugehöriges Modul eingetragen? (zumindest eines)
|
||||
private
|
||||
def add_semesters
|
||||
# Diese Methode fügt die Instanz automatisch zu allen Studien als "Ohne Semesterempfehlung" (Semester 0) zu, bei denen die Instanz im Studium noch nicht vorkommt.
|
||||
for m in self.modul
|
||||
for mg in m.modulgruppen # Über alle Module und alle Modulgruppen iterieren
|
||||
hits = mg.studium.semester.all.map{|x| x.lvas}.collect{|x| x.find_by_id(self.id)}.compact # Alle einträge in allen semestern mit gleicher LVa-ID suchen und alle nils entfernen
|
||||
|
||||
##
|
||||
# Lade Daten aus TISS und füge diese in die Datenbank ein.
|
||||
def load_tissdata
|
||||
url= "https://tiss.tuwien.ac.at/api/course/"+ self.lvanr.to_s+"-2012W"
|
||||
begin
|
||||
@hash=Hash.from_xml(open(url).read)["tuvienna"]
|
||||
@person=[]
|
||||
if @hash["course"]["lecturers"]["oid"].is_a? String
|
||||
@person = @hash["course"]["lecturers"]["oid"]
|
||||
else
|
||||
@hash["course"]["lecturers"]["oid"].each do |pid|
|
||||
@person << Hash.from_xml(open("https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/" + pid.to_s + ".xml").read)["tuvienna"]["person"]
|
||||
if hits.empty? # wurde gar kein eintrag gefunden ?
|
||||
self.semester << mg.studium.semester.where(:nummer => 0) # auf nummer null eintragen
|
||||
end
|
||||
end
|
||||
end
|
||||
rescue OpenURI::HTTPError => e
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
private
|
||||
|
||||
##
|
||||
# Lade Daten aus TISS und füge diese in die Datenbank ein.
|
||||
def load_tissdata
|
||||
url= "https://tiss.tuwien.ac.at/api/course/"+ self.lvanr.to_s+"-2012W"
|
||||
begin
|
||||
@hash=Hash.from_xml(open(url).read)["tuvienna"]
|
||||
@person=[]
|
||||
if @hash["course"]["lecturers"]["oid"].is_a? String
|
||||
@person = @hash["course"]["lecturers"]["oid"]
|
||||
else
|
||||
@hash["course"]["lecturers"]["oid"].each do |pid|
|
||||
@person << Hash.from_xml(open("https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/" + pid.to_s + ".xml").read)["tuvienna"]["person"]
|
||||
end
|
||||
end
|
||||
rescue OpenURI::HTTPError => e
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ class Modul < ActiveRecord::Base
|
||||
has_and_belongs_to_many :lvas
|
||||
has_and_belongs_to_many :modulgruppen
|
||||
|
||||
|
||||
validates :modulgruppen, :presence=>true # Ein Modul muss zu einer Modulgruppe gehören
|
||||
validates :name, :presence=>true # Ein Modul muss einen Namen haben
|
||||
translates :desc,:depend,:name, :versioning =>true, :fallbacks_for_empty_translations => true
|
||||
|
||||
@@ -21,8 +21,8 @@ class Modulgruppe < ActiveRecord::Base
|
||||
|
||||
validates :studium_id, :presence => true # Bei der Abfrage ist student_id entscheidend
|
||||
validates :studium, :presence => true # Wird gesetzt, um das richtige Feld zu melden bei Fehlern
|
||||
validates :name, :uniqueness =>{:scope => :studium}, :presence=>true # Funktioniert leider nicht
|
||||
validates :name, :uniqueness =>{:scope => :studium_id}, :presence=>true # Pro Studium darf ein Name nur einmal vorkommen
|
||||
validates :phase, :inclusion => {:in => [1, 2, 3, 4]}
|
||||
validates :typ, :inclusion => {:in => ["Pflicht","Vertiefungspflicht","Wahl"] }
|
||||
translates :name,:desc, :versioning =>true,:fallbacks_for_empty_translations => true
|
||||
translates :desc, :versioning =>true,:fallbacks_for_empty_translations => true
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: semesters
|
||||
@@ -12,6 +13,9 @@
|
||||
#
|
||||
|
||||
class Semester < ActiveRecord::Base
|
||||
attr_accessible :name, :nummer, :ssws, :lva_ids
|
||||
has_and_belongs_to_many :lvas
|
||||
attr_accessible :name, :nummer, :ss, :ws
|
||||
belongs_to :studium, :foreign_key => "studium_id"
|
||||
validates :name, :presence => true
|
||||
validates :nummer, :presence => true
|
||||
end
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: studien
|
||||
@@ -10,14 +11,36 @@
|
||||
# typ :string(255)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
|
||||
class Studium < ActiveRecord::Base
|
||||
attr_accessible :desc, :name, :typ, :zahl
|
||||
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe"
|
||||
has_many :modulgruppen, inverse_of: :studium, :class_name => "Modulgruppe", :dependent => :destroy
|
||||
has_many :semester, :dependent => :destroy
|
||||
|
||||
validates :typ, :inclusion => {:in => ["Bachelor","Master"] }
|
||||
validates :name, :uniqueness => true, :presence=>true
|
||||
validates :zahl, :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 batch_add_semester
|
||||
# Semester automatisch zu Studien hinzufügen
|
||||
if self.typ == "Bachelor"
|
||||
length = 6
|
||||
else
|
||||
length = 4
|
||||
end
|
||||
for i in 1..length
|
||||
semester =Semester.new()
|
||||
semester.name = i.to_s + '. ' + self.name
|
||||
semester.nummer = i
|
||||
semester.ssws = ((i % 2 == 0) ? "SS" : "WS")
|
||||
semester.save
|
||||
self.semester << semester
|
||||
end
|
||||
semester = Semester.new()
|
||||
semester.name = 'Ohne Zuordnung (' + self.name + ')'
|
||||
semester.nummer = 0
|
||||
semester.ssws = "WS"
|
||||
semester.save
|
||||
self.semester << semester
|
||||
end
|
||||
end
|
||||
|
||||
19
app/views/beispiele/_beispiel_list.html.erb
Normal file
19
app/views/beispiele/_beispiel_list.html.erb
Normal file
@@ -0,0 +1,19 @@
|
||||
<div class="beispiel">
|
||||
<p>
|
||||
<b>
|
||||
<%=link_to beispiel.name, beispiel.beispieldatei.url%>
|
||||
</b>
|
||||
<p>
|
||||
Beschreibung:
|
||||
<p>
|
||||
<%= beispiel.desc %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
LVA: <%=link_to beispiel.lva.name, lva_path(beispiel.lva.id)%>
|
||||
</p>
|
||||
|
||||
<%= link_to 'Show', beispiel %>
|
||||
<%= link_to 'Edit', edit_beispiel_path(beispiel) %>
|
||||
<%= link_to 'Destroy', beispiel, method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||
</div class="beispiel">
|
||||
@@ -4,7 +4,7 @@
|
||||
<%= f.input :desc %>
|
||||
<%= f.file_field :beispieldatei %>
|
||||
<%= f.hidden_field :beispieldatei_cache %>
|
||||
<%= f.input :lva, :as=>:radio, :collection => Lva.all%>
|
||||
<%= f.input :lva, :as=>:select, :collection => Lva.all%>
|
||||
<% end %>
|
||||
|
||||
<%= f.actions do %>
|
||||
|
||||
@@ -1,25 +1,10 @@
|
||||
<h1>Listing beispiele</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Desc</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<h1><%= I18n.t("beispiele.list")</h1>
|
||||
<ul>
|
||||
<% @beispiele.each do |beispiel| %>
|
||||
<tr>
|
||||
<td><%= beispiel.name %></td>
|
||||
<td><%= beispiel.desc %></td>
|
||||
<td><%= link_to 'Show', beispiel %></td>
|
||||
<td><%= link_to 'Edit', edit_beispiel_path(beispiel) %></td>
|
||||
<td><%= link_to 'Destroy', beispiel, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<li>
|
||||
<%= render :partial=> "beispiele/beispiel_list", :object => beispiel, :as=>:beispiel%>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<%= link_to 'New Beispiel', new_beispiel_path %>
|
||||
|
||||
11
app/views/layouts/_link_all.html.erb
Executable file
11
app/views/layouts/_link_all.html.erb
Executable file
@@ -0,0 +1,11 @@
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li> <%= link_to_unless_current '<i class="icon-list"></i>'.html_safe+ I18n.t("studien.allestudien"), studien_path,:raw=>true %>
|
||||
<span class="divider">/</span></li>
|
||||
|
||||
<li> <%= link_to_unless_current '<i class="icon-list"></i>'.html_safe+ I18n.t("modul.list"), moduls_path,:raw=>true %>
|
||||
<span class="divider">/</span></li>
|
||||
<li> <%= link_to_unless_current '<i class="icon-list"></i>'.html_safe+ I18n.t("lva.list"), lvas_path,:raw=>true %>
|
||||
<span class="divider">/</span></li>
|
||||
</ul>
|
||||
|
||||
7
app/views/layouts/_pretty_toolbar.html.erb
Normal file
7
app/views/layouts/_pretty_toolbar.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<% toolbar_elements = !pretty_toolbar.nil? ? pretty_toolbar : @toolbar_elements %>
|
||||
<span class="label"><%= I18n.t("common.actions")%></span>
|
||||
<div class="btn-group">
|
||||
<% toolbar_elements.each do |t| %>
|
||||
<%= link_to '<i class="'.html_safe+ t[:hicon].to_s.html_safe + '"></i>'.html_safe+t[:text], t[:path], :method=>t[:method], :confirm=>t[:confirm].to_s, :data=>t[:data], :class=>"btn" %>
|
||||
<% end %>
|
||||
</div>
|
||||
11
app/views/layouts/_topbar.html.erb
Executable file
11
app/views/layouts/_topbar.html.erb
Executable file
@@ -0,0 +1,11 @@
|
||||
<% topbar = !topbar.nil? ? topbar : @topbar_elements %>
|
||||
<ul class="breadcrumb">
|
||||
<% topbar.each do |tb| %>
|
||||
<% if tb[:newline]%>
|
||||
<br>
|
||||
<% else %>
|
||||
<li>
|
||||
<%= link_to_unless_current '<i class="'.html_safe + tb[:hicon].to_s.html_safe + '"></i>'.html_safe+ tb[:text].html_safe, tb[:path] %><span class="divider">/</span></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
@@ -1,5 +1,6 @@
|
||||
<%= semantic_form_for @lva do |f| %>
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :semester, :collection=>Semester.all.sort_by{|n| [:name]}%>
|
||||
<%= f.input :modul %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :ects %>
|
||||
|
||||
28
app/views/lvas/_lva.html.erb
Executable file
28
app/views/lvas/_lva.html.erb
Executable file
@@ -0,0 +1,28 @@
|
||||
<% @lva.modul.each do |modul| %>
|
||||
<% modul.modulgruppen.each do |g| %>
|
||||
<ul class="breadcrumb">
|
||||
<li><%= link_to g.studium.name , studium_path(g.studium)%>
|
||||
<span class="divider"></span></li>
|
||||
<li><%= link_to g.name , modulgruppe_path(g)%><span class="divider">/</span></li>
|
||||
<li><%= link_to modul.name , modul_path(modul)%></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<p id="notice"><%= notice %></p>
|
||||
<p>
|
||||
<%= @lva.lvanr %>
|
||||
<b><%= @lva.name %> <%= @lva.ects %> ECTS/ <%= @lva.stunden %> Std</b>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<%= @lva.desc %>
|
||||
</p>
|
||||
<ul>
|
||||
<% @lva.beispiele.each do |b|%>
|
||||
|
||||
<li><%= render b%></li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= toolbar_html(@toolbar_elements) %>
|
||||
10
app/views/lvas/_lva_semester.html.erb
Executable file
10
app/views/lvas/_lva_semester.html.erb
Executable file
@@ -0,0 +1,10 @@
|
||||
|
||||
<p class="lva_semester">
|
||||
<b><%= link_to lva.name, lva_path(lva)%></b><br>
|
||||
Module: /<% lva.modul.each do |m| %> <%= link_to m.name + ' / ', modul_path(m) unless m.modulgruppen.map{|x| x.studium}.index(@studium).nil? && !@studium.nil? %><% end %>
|
||||
<br>
|
||||
<%="LVa-Nr " + lva.lvanr.to_s %>
|
||||
<%= lva.ects %> ECTS / <%= lva.stunden %> Std <% " / " + lva.beispiele.count.to_s + " Beispiele"%> <br>
|
||||
<%= link_to "Edit", edit_lva_path(lva) %> | <%= link_to "Beispiel hinzufügen", new_beispiel_path(:lva_id=>lva.id) %>
|
||||
</p class="lva_semester">
|
||||
<% #toolbar_html(@toolbar_elements) %>
|
||||
@@ -1,31 +1,8 @@
|
||||
<h1>Listing lvas</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Desc</th>
|
||||
<th>Ects</th>
|
||||
<th>Lvanr</th>
|
||||
<th>Stunden</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @lvas.each do |lva| %>
|
||||
<tr>
|
||||
<td><%= lva.name %></td>
|
||||
<td><%= lva.desc %></td>
|
||||
<td><%= lva.ects %></td>
|
||||
<td><%= lva.lvanr %></td>
|
||||
<td><%= lva.stunden %></td>
|
||||
<td><%= link_to 'Show', lva %></td>
|
||||
<td><%= link_to 'Edit', edit_lva_path(lva) %></td>
|
||||
<td><%= link_to 'Destroy', lva, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
|
||||
<%= link_to 'New Lva', new_lva_path %>
|
||||
<%= render :partial=>'layouts/topbar', :object=>@tb %>
|
||||
<h1><%= I18n.t("lva.list")%></h1>
|
||||
<ul>
|
||||
<% @lvas.each do |l| %>
|
||||
<li><%= render :partial => 'lvas/lva_semester', :locals=> {:lva => l} %>
|
||||
<%end%>
|
||||
</ul>
|
||||
<%= render 'layouts/pretty_toolbar' %>
|
||||
|
||||
@@ -1,30 +1,36 @@
|
||||
<% @lva.modul.each do |modul| %>
|
||||
<% modul.modulgruppen.each do |g| %>
|
||||
<ul class="breadcrumb">
|
||||
<li><%= link_to g.studium.name , studium_path(g.studium)%>
|
||||
<span class="divider">/</span></li>
|
||||
<li><%= link_to g.name , modulgruppe_path(g)%><span class="divider">/</span></li>
|
||||
<li><%= link_to modul.name , modul_path(modul)%></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
<%= render 'layouts/topbar'%>
|
||||
<p id="notice"><%= notice %></p>
|
||||
<p>
|
||||
<%= @lva.lvanr %>
|
||||
<b><%= @lva.name %> <%= @lva.ects %> ECTS/ <%= @lva.stunden %> Std</b>
|
||||
|
||||
|
||||
<h2><%= @lva.lvanr %><%= @lva.name %> <%= @lva.ects %> ECTS/ <%= @lva.stunden %> Std</h2>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
<p><h4>Beschreibung</h4>
|
||||
<%= @lva.desc %>
|
||||
|
||||
<%= link_to "Beispiel neu" , new_beispiel_path(:lva_id=>@lva.id) %>
|
||||
</p>
|
||||
<h4>Beispiele</h4>
|
||||
<ul>
|
||||
<% @lva.beispiele.each do |b|%>
|
||||
<% @lva.beispiele.each do |b|%>
|
||||
|
||||
<li><%= render b%></li>
|
||||
<li><%= render b%></li>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= toolbar_html(@toolbar_elements) %>
|
||||
<h4>Module</h4>
|
||||
<ul>
|
||||
<% @lva.modul.each do |modul| %>
|
||||
<li><b><%= link_to modul.name , modul_path(modul)%></b>
|
||||
<ul>
|
||||
<% modul.modulgruppen.each do |g| %>
|
||||
|
||||
<li><%= link_to g.studium.name , studium_semesteransicht_path(g.studium)%> (<%=link_to g.name, modulgruppe_path(g)%>)</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
<%= render 'layouts/pretty_toolbar' %>
|
||||
|
||||
@@ -1,29 +1,9 @@
|
||||
<h1><%= I18n.t("modulgruppe.show.title")%></h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Phase</th>
|
||||
<th>Studium</th>
|
||||
<th>Name</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
<% @modulgruppen.sort_by{|n| n[:name]}.each do |modulgruppe| %>
|
||||
<tr>
|
||||
<td><%= modulgruppe.typ %></td>
|
||||
<td><%= modulgruppe.phase %></td>
|
||||
<td><%= modulgruppe.studium.name unless modulgruppe.studium.nil? %></td>
|
||||
<td><%= modulgruppe.name %></td>
|
||||
<td><%= link_to 'Show', modulgruppe %></td>
|
||||
<td><%= link_to 'Edit', edit_modulgruppe_path(modulgruppe) %></td>
|
||||
<td><%= link_to 'Destroy', modulgruppe, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<%= render modulgruppe%>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<% if !@studium.nil? %>
|
||||
<%= link_to 'New Modulgruppe', new_studium_modulgruppe_path(@studium) %>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
|
||||
<%= semantic_form_for @modul do |f| %>
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :modulgruppen,:as => :select, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}] %>
|
||||
<% # f.input :modulgruppen,:as => :select, :collection => Hash[Modulgruppe.all.map{|m| [m.studium.name + " " + m.name,m.id]}] %>
|
||||
<%= f.input :modulgruppen %>
|
||||
<%= f.input :name ,:hint=>true%>
|
||||
<%= f.input :desc, :as=>:tinymce_text %>
|
||||
<%= f.input :depend %>
|
||||
|
||||
32
app/views/moduls/_lang.html.erb
Executable file
32
app/views/moduls/_lang.html.erb
Executable file
@@ -0,0 +1,32 @@
|
||||
<div style="border: solid 1px; padding:2px"><p>
|
||||
<b><%=
|
||||
if modul.name.nil?
|
||||
name=""
|
||||
else
|
||||
name=modul.name
|
||||
end
|
||||
link_to "Modul "+name , modul_path(modul) %> </b>
|
||||
</p>
|
||||
<p>
|
||||
<%= raw(modul.desc) %>
|
||||
</p>
|
||||
LVAs:
|
||||
|
||||
<ul>
|
||||
|
||||
<% modul.lvas.each do |lv| %>
|
||||
<li>
|
||||
<%= link_to lv.name.to_s, lva_path(lv.id) %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
|
||||
Modulgruppen:
|
||||
<ul>
|
||||
<% modul.modulgruppen.each do |mg| %>
|
||||
<li> <%=mg.name%> (<%= mg.studium.name unless mg.studium.nil?%>)</li>
|
||||
<%end%>
|
||||
</ul>
|
||||
<% # @toolbar_elements << {:icon=>:pencil,:text=>I18n.t("common.edit"),:path=> edit_modul_path(modul)} %>
|
||||
</div>
|
||||
@@ -1,39 +1,8 @@
|
||||
<h1><%= I18n.t("modul.show.title") %></h1>
|
||||
<%= render 'layouts/topbar' %>
|
||||
<h1><%= I18n.t("modul.list") %></h1>
|
||||
|
||||
<table class="table" >
|
||||
<tr>
|
||||
<th>Modulgruppe (Studium)</th>
|
||||
<th>Name</th>
|
||||
<th>Desc</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<%= render :partial=>'moduls/lang', :collection=>@moduls, :as=>:modul%>
|
||||
|
||||
<% @moduls.sort_by{|n| n[:name]}.each do |modul| %>
|
||||
<tr>
|
||||
<td>
|
||||
<%modul.modulgruppen.sort_by{|n| n[:name]}.each do |m|%>
|
||||
|
||||
|
||||
<%=m.name unless m.nil? %> (<%=m.studium.name unless m.studium.nil? %>)
|
||||
<!-- Modulgruppenname falls existiert (Studium falls existiert) -->
|
||||
<br>
|
||||
<% end %>
|
||||
|
||||
</td>
|
||||
|
||||
<td><%= modul.name %></td>
|
||||
<td><%= modul.desc %></td>
|
||||
<td><%= link_to 'Show', modul_path(modul) %></td>
|
||||
<td><%= link_to 'Edit', edit_modul_path(modul) %></td>
|
||||
<td><%= link_to 'Destroy', [modul], method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
|
||||
<br />
|
||||
<% #if !@studium.nil? %>
|
||||
<%= link_to 'New Modul', new_modul_path() %>
|
||||
<% #end%>
|
||||
<br>
|
||||
<%= render 'layouts/pretty_toolbar'%>
|
||||
|
||||
|
||||
@@ -1,16 +1,9 @@
|
||||
|
||||
<% @modul.modulgruppen.each do |g| %>
|
||||
<ul class="breadcrumb">
|
||||
<li>
|
||||
<%= link_to g.studium.name , studium_path(g.studium)%> <span class="divider">/</span></li>
|
||||
<li><%= link_to g.name , modulgruppe_path(g)%></li>
|
||||
<%end%>
|
||||
</ul>
|
||||
|
||||
<%= render 'layouts/topbar'%>
|
||||
<%= render 'layouts/topbar', :topbar=>@tb%>
|
||||
<p id="notice"><%= notice %></p>
|
||||
<%= render @modul %>
|
||||
|
||||
|
||||
<%= link_to 'Add LVA', new_lva_path(:modul_id =>@modul.id) %>
|
||||
<%= link_to '<i class="icon-pencil"></i>'.html_safe+ I18n.t("common.edit") , edit_modul_path(@modul) %>
|
||||
<%= link_to "Loeschen", [@modul],:method=>:delete ,:data => {:confirm =>"Are you sure" } %>
|
||||
<%= render 'layouts/pretty_toolbar' %>
|
||||
<% # link_to 'Add LVA', %>
|
||||
<% # link_to '<i class="icon-pencil"></i>'.html_safe+ I18n.t("common.edit") , edit_modul_path(@modul) %>
|
||||
<% # link_to "Loeschen", [@modul],:method=>:delete ,:data => {:confirm =>"Are you sure" } %>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<%= f.inputs do %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :nummer %>
|
||||
<%= f.input :ws %>
|
||||
<%= f.input :ss %>
|
||||
<%= f.input :ssws %>
|
||||
<%= f.input :lvas %>
|
||||
<% end %>
|
||||
|
||||
<%= f.actions do %>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<tr>
|
||||
<td><%= semester.name %></td>
|
||||
<td><%= semester.nummer %></td>
|
||||
<td><%= semester.ws %></td>
|
||||
<td><%= semester.ss %></td>
|
||||
<td><%= semester.ssws %></td>
|
||||
<td><% %></td>
|
||||
<td><%= link_to 'Show', semester %></td>
|
||||
<td><%= link_to 'Edit', edit_semester_path(semester) %></td>
|
||||
<td><%= link_to 'Destroy', semester, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||
|
||||
@@ -1,25 +1,20 @@
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<p>
|
||||
<b>Name:</b>
|
||||
<%= @semester.name %>
|
||||
<b>Name:</b> <%= @semester.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Nummer:</b>
|
||||
<%= @semester.nummer %>
|
||||
<b>Nummer:</b> <%= @semester.nummer %>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
<b>Ws:</b>
|
||||
<%= @semester.ws %>
|
||||
<b>WS/SS?:</b> <%= @semester.ssws %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Ss:</b>
|
||||
<%= @semester.ss %>
|
||||
<%= render :partial =>'lvas/lva_semester', :collection=>@semester.lvas, :as=>:lva%>
|
||||
</p>
|
||||
|
||||
|
||||
<%= link_to 'Edit', edit_semester_path(@semester) %> |
|
||||
<%= link_to 'Back', semesters_path %>
|
||||
|
||||
20
app/views/studien/_navigation.html.erb
Executable file
20
app/views/studien/_navigation.html.erb
Executable file
@@ -0,0 +1,20 @@
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<li> <%= link_to '<i class="icon-list"></i>'.html_safe+ I18n.t("studien.allestudien"), studien_path,:raw=>true %>
|
||||
<span class="divider">/</span></li>
|
||||
<li> <%= link_to @text, @path%>
|
||||
<span class="divider">/</span></li>
|
||||
<br>
|
||||
<% Studium.all.each do |s| %>
|
||||
<li>
|
||||
<% if @sem=='true' %>
|
||||
<%= link_to_unless_current s.name, studium_semesteransicht_path(s) %>
|
||||
<% else %>
|
||||
<%= link_to_unless_current s.name, studium_path(s) %>
|
||||
<% end %>
|
||||
<span class="divider">/</span></li>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
</ul>
|
||||
|
||||
9
app/views/studien/_studium.html.erb
Normal file
9
app/views/studien/_studium.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="studium">
|
||||
<h2><%= link_to studium.name + " " + studium.zahl.to_s, studium_semesteransicht_path(studium)%></h2>
|
||||
<ul>
|
||||
<li><b><%= studium.typ%> </b></li>
|
||||
<li><b>Beschreibung:</b><br>
|
||||
<%= !(studium.desc.to_s == "") ? studium.desc.html_safe : I18n.t("keine.beschreibung")%></li>
|
||||
<li><%=link_to "Link zur Modulgruppenansicht",studium_path(studium) %> </li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<h1>Editing studium</h1>
|
||||
<h1><%= I18n.t("studien.edit")%></h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @studium %> |
|
||||
<%= link_to 'Back', studien_path %>
|
||||
<%= link_to 'Back', studien_path %>
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
<%= render 'layouts/topbar' %>
|
||||
<h1><%= I18n.t("studien.list") %></h1>
|
||||
|
||||
|
||||
<% @studien.sort_by{|z| z[:zahl]}.each do |studium| %>
|
||||
|
||||
|
||||
<h2><%= link_to studium.zahl + " "+ studium.typ+" " + studium.name, studium_path(studium) %></h2>
|
||||
|
||||
<ul>
|
||||
<li><%= render studium%></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
||||
|
||||
<br />
|
||||
<% link_to I18n.t("studien.new"), new_studium_path %>
|
||||
<% link_to I18n.t("modulgruppe.show"), modulgruppen_path %>
|
||||
<%= toolbar_html(@toolbar_elements) %>
|
||||
<br>
|
||||
<%= render :partial=>'layouts/pretty_toolbar'%>
|
||||
<% #toolbar_html(@toolbar_elements) %>
|
||||
|
||||
17
app/views/studien/semesteransicht.html.erb
Normal file
17
app/views/studien/semesteransicht.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<%= render :partial=>'layouts/topbar'%>
|
||||
|
||||
<h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1>
|
||||
<%= raw(@studium.desc) %>
|
||||
<% @studium.semester.each do |sem| %>
|
||||
<div class="row-fluid">
|
||||
<h2><%= sem.name %></h2>
|
||||
<div class="span<%= sem[:width]%> min-width:13em;">
|
||||
<ul>
|
||||
<% sem.lvas.sort_by{|n| n[:name]}.each do |l| %>
|
||||
<li><%= render :partial=>'lvas/lva_semester', :locals =>{:lva => l}%>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial=>'layouts/pretty_toolbar', :locals=>{:elements=>@toolbar_elements} %>
|
||||
50
app/views/studien/show.html.erb
Executable file → Normal file
50
app/views/studien/show.html.erb
Executable file → Normal file
@@ -1,33 +1,23 @@
|
||||
<%= render 'layouts/topbar'%>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
<%= link_to '<i class="icon-list"></i>'.html_safe+ I18n.t("studien.allestudien"), studien_path,:raw=>true %>
|
||||
|
||||
<h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1>
|
||||
</div>
|
||||
<%= raw(@studium.desc) %>
|
||||
<% @studienphasen.each do |sp| %>
|
||||
<% sp[:modulgruppen].each do |row| %>
|
||||
<div class="row-fluid">
|
||||
<% row.each do |modulgruppe| %>
|
||||
<div class="span<%= sp[:width]%> min-width:13em;">
|
||||
<%= render modulgruppe %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="row-fluid">
|
||||
<p id="notice"><%= notice %></p>
|
||||
<h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1>
|
||||
</div>
|
||||
<div>
|
||||
<%= raw(@studium.desc) %>
|
||||
<% @studienphasen.each do |sp| %>
|
||||
<% sp[:modulgruppen].each do |row| %>
|
||||
<div class="row-fluid">
|
||||
<% row.each do |modulgruppe| %>
|
||||
<div class="span<%= sp[:width]%> min-width:13em;">
|
||||
<%= render modulgruppe %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div class="row-fluid">
|
||||
<span class="span12">
|
||||
<%= link_to '<i class="icon-plus-sign"></i>'.html_safe+I18n.t("studien.newmodulgroup"), new_studium_modulgruppe_path(@studium),:class=>"btn" %> |
|
||||
<%= link_to '<i class="icon-pencil"></i>'.html_safe+I18n.t("common.edit"), edit_studium_path(@studium) ,:class=>"btn"%>
|
||||
<%= link_to 'Destroy', @studium, method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%= render :partial=>'layouts/pretty_toolbar', :object=>@toolbar_modulgruppen %>
|
||||
</div>
|
||||
<%= render 'layouts/pretty_toolbar' %>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<%= toolbar_html(@toolbar_elements) %>
|
||||
|
||||
Reference in New Issue
Block a user