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:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -15,8 +15,8 @@
|
|||||||
/log/*.log
|
/log/*.log
|
||||||
/tmp
|
/tmp
|
||||||
/config/initializers/devise.rb
|
/config/initializers/devise.rb
|
||||||
|
/app/doc/*
|
||||||
/console
|
console
|
||||||
/server
|
/server
|
||||||
/public/uploads/
|
/public/uploads/
|
||||||
*~
|
|
||||||
|
|||||||
4
Gemfile
4
Gemfile
@@ -71,3 +71,7 @@ gem 'haml'
|
|||||||
gem 'awesome_nested_set'
|
gem 'awesome_nested_set'
|
||||||
gem 'annotate', ">=2.5.0"
|
gem 'annotate', ">=2.5.0"
|
||||||
gem 'carrierwave'
|
gem 'carrierwave'
|
||||||
|
group :development, :test do
|
||||||
|
gem 'factory_girl_rails'
|
||||||
|
gem 'rspec-rails'
|
||||||
|
end
|
||||||
|
|||||||
19
Gemfile.lock
19
Gemfile.lock
@@ -56,9 +56,15 @@ GEM
|
|||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (~> 3.1)
|
railties (~> 3.1)
|
||||||
warden (~> 1.2.1)
|
warden (~> 1.2.1)
|
||||||
|
diff-lcs (1.2.4)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (1.4.0)
|
execjs (1.4.0)
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
|
factory_girl (4.2.0)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
|
factory_girl_rails (4.2.1)
|
||||||
|
factory_girl (~> 4.2.0)
|
||||||
|
railties (>= 3.0.0)
|
||||||
formtastic (2.2.1)
|
formtastic (2.2.1)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
formtastic-bootstrap (2.0.0)
|
formtastic-bootstrap (2.0.0)
|
||||||
@@ -123,6 +129,17 @@ GEM
|
|||||||
json (~> 1.4)
|
json (~> 1.4)
|
||||||
ref (1.0.2)
|
ref (1.0.2)
|
||||||
rolify (3.2.0)
|
rolify (3.2.0)
|
||||||
|
rspec-core (2.14.4)
|
||||||
|
rspec-expectations (2.14.0)
|
||||||
|
diff-lcs (>= 1.1.3, < 2.0)
|
||||||
|
rspec-mocks (2.14.1)
|
||||||
|
rspec-rails (2.14.0)
|
||||||
|
actionpack (>= 3.0)
|
||||||
|
activesupport (>= 3.0)
|
||||||
|
railties (>= 3.0)
|
||||||
|
rspec-core (~> 2.14.0)
|
||||||
|
rspec-expectations (~> 2.14.0)
|
||||||
|
rspec-mocks (~> 2.14.0)
|
||||||
sass (3.2.5)
|
sass (3.2.5)
|
||||||
sass-rails (3.2.6)
|
sass-rails (3.2.6)
|
||||||
railties (~> 3.2.0)
|
railties (~> 3.2.0)
|
||||||
@@ -165,6 +182,7 @@ DEPENDENCIES
|
|||||||
coffee-rails (~> 3.2.1)
|
coffee-rails (~> 3.2.1)
|
||||||
devise (~> 2.2.3)
|
devise (~> 2.2.3)
|
||||||
execjs (~> 1.4.0)
|
execjs (~> 1.4.0)
|
||||||
|
factory_girl_rails
|
||||||
formtastic (~> 2.2.1)
|
formtastic (~> 2.2.1)
|
||||||
formtastic-bootstrap
|
formtastic-bootstrap
|
||||||
git
|
git
|
||||||
@@ -175,6 +193,7 @@ DEPENDENCIES
|
|||||||
paperclip (~> 3.4.0)
|
paperclip (~> 3.4.0)
|
||||||
rails (= 3.2.9)
|
rails (= 3.2.9)
|
||||||
rolify
|
rolify
|
||||||
|
rspec-rails
|
||||||
sass-rails (~> 3.2.3)
|
sass-rails (~> 3.2.3)
|
||||||
sqlite3
|
sqlite3
|
||||||
therubyracer
|
therubyracer
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class BeispieleController < ApplicationController
|
|||||||
# GET /beispiele
|
# GET /beispiele
|
||||||
# GET /beispiele.json
|
# GET /beispiele.json
|
||||||
def index
|
def index
|
||||||
|
@lva = params([:lva])
|
||||||
@beispiele = Beispiel.all
|
@beispiele = Beispiel.all
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
@@ -13,6 +14,7 @@ class BeispieleController < ApplicationController
|
|||||||
# GET /beispiele/1
|
# GET /beispiele/1
|
||||||
# GET /beispiele/1.json
|
# GET /beispiele/1.json
|
||||||
def show
|
def show
|
||||||
|
@lva = lva unless lva.nil?
|
||||||
@beispiel = Beispiel.find(params[:id])
|
@beispiel = Beispiel.find(params[:id])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|||||||
@@ -3,22 +3,35 @@ class LvasController < ApplicationController
|
|||||||
before_filter {@toolbar_elements =[]}
|
before_filter {@toolbar_elements =[]}
|
||||||
def index
|
def index
|
||||||
@lvas = Lva.all
|
@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
|
end
|
||||||
|
|
||||||
# GET /lvas/1
|
# GET /lvas/1
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@lva = Lva.find_by_id(params[:id])
|
@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
|
end
|
||||||
|
|
||||||
# GET /lvas/new
|
# GET /lvas/new
|
||||||
# GET /lvas/new.json
|
# GET /lvas/new.json
|
||||||
def new
|
def new
|
||||||
@lva = Lva.new
|
@lva = Lva.new
|
||||||
modul=Modul.find(params[:modul_id])
|
modul=Modul.find_by_id(params[:modul_id])
|
||||||
@lva.modul<<modul
|
@lva.modul<<modul unless modul.nil? #
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -34,6 +47,7 @@ class LvasController < ApplicationController
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @lva.save
|
if @lva.save
|
||||||
|
@lva.add_semesters
|
||||||
format.html { redirect_to @lva, notice: 'Lva was successfully created.' }
|
format.html { redirect_to @lva, notice: 'Lva was successfully created.' }
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -50,6 +64,7 @@ class LvasController < ApplicationController
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @lva.update_attributes(params[:lva])
|
if @lva.update_attributes(params[:lva])
|
||||||
|
@lva.add_semesters
|
||||||
format.html { redirect_to @lva, notice: 'Lva was successfully updated.' }
|
format.html { redirect_to @lva, notice: 'Lva was successfully updated.' }
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ class ModulgruppenController < ApplicationController
|
|||||||
def new
|
def new
|
||||||
@modulgruppe = Modulgruppe.new
|
@modulgruppe = Modulgruppe.new
|
||||||
if !params[:studium_id].nil?
|
if !params[:studium_id].nil?
|
||||||
@studium=Studium.find(params[:studium_id])
|
@modulgruppe.studium_id=(params[:studium_id])
|
||||||
else
|
else
|
||||||
@studium=Studium.first
|
@modulgruppe.studium_id=studium_id=Studium.first.id
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # new.html.erb
|
format.html # new.html.erb
|
||||||
@@ -50,14 +50,16 @@ class ModulgruppenController < ApplicationController
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
@modulgruppe = Modulgruppe.new(params[:modulgruppe])
|
@modulgruppe = Modulgruppe.new(params[:modulgruppe])
|
||||||
|
|
||||||
if !params[:studium_id].nil?
|
if !params[:studium_id].nil?
|
||||||
@studium=Studium.find_by_id(params[:studium_id])
|
@studium=Studium.find_by_id(params[:studium_id])
|
||||||
else
|
else
|
||||||
@studium=Studium.find_by_id(params[:modulgruppe][:studium_id])
|
@studium=Studium.find_by_id(params[:modulgruppe][:studium_id])
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
||||||
if @modulgruppe.save
|
if @modulgruppe.save
|
||||||
format.html { redirect_to @modulgruppe, notice: 'Modulgruppe was successfully created.' }
|
format.html { redirect_to @studium, notice: 'Modulgruppe was successfully created.' }
|
||||||
|
|
||||||
else
|
else
|
||||||
format.html { render action: "new" }
|
format.html { render action: "new" }
|
||||||
|
|||||||
@@ -7,18 +7,41 @@ class ModulsController < ApplicationController
|
|||||||
if !params[:studium_id].nil?
|
if !params[:studium_id].nil?
|
||||||
@studium=Studium.find_by_id(params[:studium_id])
|
@studium=Studium.find_by_id(params[:studium_id])
|
||||||
end
|
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|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
format.json { render json: @moduls }
|
format.json { render json: @moduls }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /moduls/1
|
# GET /moduls/1
|
||||||
# GET /moduls/1.json
|
# GET /moduls/1.json
|
||||||
def show
|
def show
|
||||||
@modul = Modul.find(params[:id])
|
@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'}}
|
||||||
|
|
||||||
|
|
||||||
|
@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|
|
respond_to do |format|
|
||||||
format.html # show.html.erb
|
format.html # show.html.erb
|
||||||
format.json { render json: @modul }
|
format.json { render json: @modul }
|
||||||
@@ -31,7 +54,7 @@ class ModulsController < ApplicationController
|
|||||||
@modul = Modul.new
|
@modul = Modul.new
|
||||||
modulgruppe=Modulgruppe.find_by_id(params[:modulgruppen_id])
|
modulgruppe=Modulgruppe.find_by_id(params[:modulgruppen_id])
|
||||||
if !modulgruppe.nil?
|
if !modulgruppe.nil?
|
||||||
@modul.modulgruppen<<modulgruppe
|
@modul.modulgruppen<<modulgruppe #
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # new.html.erb
|
format.html # new.html.erb
|
||||||
@@ -55,6 +78,9 @@ class ModulsController < ApplicationController
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @modul.save
|
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.html { redirect_to modulgruppe_path(@modul.modulgruppen.first), notice: 'Modul was successfully created.' }
|
||||||
format.json { render json: @modul, status: :created, location: @modul }
|
format.json { render json: @modul, status: :created, location: @modul }
|
||||||
else
|
else
|
||||||
@@ -72,6 +98,9 @@ class ModulsController < ApplicationController
|
|||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @modul.update_attributes(params[:modul])
|
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.html { redirect_to url_for(@modul), notice: 'Modul was successfully updated.' }
|
||||||
format.json { head :no_content }
|
format.json { head :no_content }
|
||||||
else
|
else
|
||||||
@@ -87,6 +116,9 @@ class ModulsController < ApplicationController
|
|||||||
|
|
||||||
@modul = Modul.find(params[:id])
|
@modul = Modul.find(params[:id])
|
||||||
modulgruppe=@modul.modulgruppen.first
|
modulgruppe=@modul.modulgruppen.first
|
||||||
|
for i in @modul.lvas
|
||||||
|
i.add_semesters
|
||||||
|
end
|
||||||
@modul.destroy
|
@modul.destroy
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class SemestersController < ApplicationController
|
|||||||
def create
|
def create
|
||||||
@semester = Semester.new(params[:semester])
|
@semester = Semester.new(params[:semester])
|
||||||
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @semester.save
|
if @semester.save
|
||||||
format.html { redirect_to @semester, notice: 'Semester was successfully created.' }
|
format.html { redirect_to @semester, notice: 'Semester was successfully created.' }
|
||||||
@@ -45,7 +46,7 @@ class SemestersController < ApplicationController
|
|||||||
def destroy
|
def destroy
|
||||||
@semester = Semester.find(params[:id])
|
@semester = Semester.find(params[:id])
|
||||||
@semester.destroy
|
@semester.destroy
|
||||||
redirect_to semester_url
|
redirect_to semester_url
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,16 +1,21 @@
|
|||||||
class StudienController < ApplicationController
|
class StudienController < ApplicationController
|
||||||
before_filter {@toolbar_elements =[]}
|
before_filter {@toolbar_elements =[]}
|
||||||
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@studien = Studium.all
|
@studien = Studium.all
|
||||||
@toolbar_elements<<{:icon =>:plus, :text=> I18n.t('studien.new') ,:path=>new_studium_path }
|
@topbar_elements=[{:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"),:path=>studien_path}]
|
||||||
@toolbar_elements<<{:text=> I18n.t('modulgruppe.show.link') ,:path=>modulgruppen_path }
|
@topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("modul.list"),:path=>moduls_path}
|
||||||
@toolbar_elements<<{:text=> I18n.t('modul.show.link') ,:path=>moduls_path }
|
@topbar_elements<<{:hicon=>'icon-list', :text=>I18n.t("lva.list"),:path=>lvas_path}
|
||||||
end
|
@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
|
def show
|
||||||
@studium= Studium.find(params[:id])
|
@studium= Studium.find(params[:id])
|
||||||
|
@text = 'Zu Semesteransicht wechseln'
|
||||||
|
@path = studium_semesteransicht_path(@studium)
|
||||||
|
|
||||||
@studienphasen=[]
|
@studienphasen=[]
|
||||||
[1, 2 ,3].each do |ph|
|
[1, 2 ,3].each do |ph|
|
||||||
modulgruppen_phase=@studium.modulgruppen.where(:phase=>ph)
|
modulgruppen_phase=@studium.modulgruppen.where(:phase=>ph)
|
||||||
@@ -23,15 +28,27 @@ class StudienController < ApplicationController
|
|||||||
end
|
end
|
||||||
modulgruppen =[]
|
modulgruppen =[]
|
||||||
modulgruppen_phase.each_slice(opts[:slice]) do |s|
|
modulgruppen_phase.each_slice(opts[:slice]) do |s|
|
||||||
modulgruppen<<s
|
modulgruppen<<s #
|
||||||
|
|
||||||
end
|
end
|
||||||
@studienphasen << {:modulgruppen=>modulgruppen, :phase => ph}.merge(opts)
|
@studienphasen << {:modulgruppen=>modulgruppen, :phase => ph}.merge(opts)
|
||||||
end
|
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=[{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) },
|
||||||
@toolbar_elements<<{:text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>"Sure?" }
|
{: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
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@studium = Studium.new
|
@studium = Studium.new
|
||||||
@@ -45,8 +62,10 @@ class StudienController < ApplicationController
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
@studium = Studium.new(params[:studium])
|
@studium = Studium.new(params[:studium])
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @studium.save
|
if @studium.save
|
||||||
|
@studium.batch_add_semester
|
||||||
format.html { redirect_to url_for(@studium), notice: 'Studium was successfully created.' }
|
format.html { redirect_to url_for(@studium), notice: 'Studium was successfully created.' }
|
||||||
else
|
else
|
||||||
format.html { render action: "new" }
|
format.html { render action: "new" }
|
||||||
@@ -66,6 +85,27 @@ class StudienController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
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
|
def destroy
|
||||||
@studium = Studium.find(params[:id])
|
@studium = Studium.find(params[:id])
|
||||||
|
|||||||
@@ -19,4 +19,9 @@ class Beispiel < ActiveRecord::Base
|
|||||||
attr_accessible :desc, :name, :lva_id, :beispieldatei, :beispieldatei_cache
|
attr_accessible :desc, :name, :lva_id, :beispieldatei, :beispieldatei_cache
|
||||||
belongs_to :lva
|
belongs_to :lva
|
||||||
mount_uploader :beispieldatei, BeispieldateiUploader
|
mount_uploader :beispieldatei, BeispieldateiUploader
|
||||||
|
validates :beispieldatei, :presence => true
|
||||||
|
validates :name, :presence => true
|
||||||
|
validates :lva_id, :presence => true
|
||||||
|
validates :lva, :presence => true
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,25 +17,38 @@
|
|||||||
|
|
||||||
class Lva < ActiveRecord::Base
|
class Lva < ActiveRecord::Base
|
||||||
has_paper_trail # Versionsverfolgung
|
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 :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"
|
has_many :beispiele , :class_name => "Beispiel"
|
||||||
|
|
||||||
translates :desc, :fallbacks_for_empty_translations => true
|
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 :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 :stunden # Stunden Eingetragen?
|
||||||
validates_presence_of :modul # Zugehöriges Modul eingetragen? (zumindest eines)
|
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
|
||||||
|
|
||||||
##
|
if hits.empty? # wurde gar kein eintrag gefunden ?
|
||||||
# Lade Daten aus TISS und füge diese in die Datenbank ein.
|
self.semester << mg.studium.semester.where(:nummer => 0) # auf nummer null eintragen
|
||||||
def load_tissdata
|
end
|
||||||
|
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"
|
url= "https://tiss.tuwien.ac.at/api/course/"+ self.lvanr.to_s+"-2012W"
|
||||||
begin
|
begin
|
||||||
@hash=Hash.from_xml(open(url).read)["tuvienna"]
|
@hash=Hash.from_xml(open(url).read)["tuvienna"]
|
||||||
@@ -49,7 +62,7 @@ def load_tissdata
|
|||||||
end
|
end
|
||||||
rescue OpenURI::HTTPError => e
|
rescue OpenURI::HTTPError => e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class Modul < ActiveRecord::Base
|
|||||||
has_and_belongs_to_many :lvas
|
has_and_belongs_to_many :lvas
|
||||||
has_and_belongs_to_many :modulgruppen
|
has_and_belongs_to_many :modulgruppen
|
||||||
|
|
||||||
|
|
||||||
validates :modulgruppen, :presence=>true # Ein Modul muss zu einer Modulgruppe gehören
|
validates :modulgruppen, :presence=>true # Ein Modul muss zu einer Modulgruppe gehören
|
||||||
validates :name, :presence=>true # Ein Modul muss einen Namen haben
|
validates :name, :presence=>true # Ein Modul muss einen Namen haben
|
||||||
translates :desc,:depend,:name, :versioning =>true, :fallbacks_for_empty_translations => true
|
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_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 :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 :phase, :inclusion => {:in => [1, 2, 3, 4]}
|
||||||
validates :typ, :inclusion => {:in => ["Pflicht","Vertiefungspflicht","Wahl"] }
|
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
|
end
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: semesters
|
# Table name: semesters
|
||||||
@@ -12,6 +13,9 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
class Semester < ActiveRecord::Base
|
class Semester < ActiveRecord::Base
|
||||||
|
attr_accessible :name, :nummer, :ssws, :lva_ids
|
||||||
has_and_belongs_to_many :lvas
|
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
|
end
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
# == Schema Information
|
# == Schema Information
|
||||||
#
|
#
|
||||||
# Table name: studien
|
# Table name: studien
|
||||||
@@ -10,14 +11,36 @@
|
|||||||
# typ :string(255)
|
# typ :string(255)
|
||||||
# created_at :datetime not null
|
# created_at :datetime not null
|
||||||
# updated_at :datetime not null
|
# updated_at :datetime not null
|
||||||
#
|
|
||||||
|
|
||||||
class Studium < ActiveRecord::Base
|
class Studium < ActiveRecord::Base
|
||||||
attr_accessible :desc, :name, :typ, :zahl
|
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 :typ, :inclusion => {:in => ["Bachelor","Master"] }
|
||||||
validates :name, :uniqueness => true, :presence=>true
|
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
|
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
|
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.input :desc %>
|
||||||
<%= f.file_field :beispieldatei %>
|
<%= f.file_field :beispieldatei %>
|
||||||
<%= f.hidden_field :beispieldatei_cache %>
|
<%= f.hidden_field :beispieldatei_cache %>
|
||||||
<%= f.input :lva, :as=>:radio, :collection => Lva.all%>
|
<%= f.input :lva, :as=>:select, :collection => Lva.all%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= f.actions do %>
|
<%= f.actions do %>
|
||||||
|
|||||||
@@ -1,25 +1,10 @@
|
|||||||
<h1>Listing beispiele</h1>
|
<h1><%= I18n.t("beispiele.list")</h1>
|
||||||
|
<ul>
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Desc</th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% @beispiele.each do |beispiel| %>
|
<% @beispiele.each do |beispiel| %>
|
||||||
<tr>
|
<li>
|
||||||
<td><%= beispiel.name %></td>
|
<%= render :partial=> "beispiele/beispiel_list", :object => beispiel, :as=>:beispiel%>
|
||||||
<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>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</li>
|
||||||
|
</ul>
|
||||||
<br />
|
|
||||||
|
|
||||||
<%= link_to 'New Beispiel', new_beispiel_path %>
|
<%= 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| %>
|
<%= semantic_form_for @lva do |f| %>
|
||||||
<%= f.inputs do %>
|
<%= f.inputs do %>
|
||||||
|
<%= f.input :semester, :collection=>Semester.all.sort_by{|n| [:name]}%>
|
||||||
<%= f.input :modul %>
|
<%= f.input :modul %>
|
||||||
<%= f.input :name %>
|
<%= f.input :name %>
|
||||||
<%= f.input :ects %>
|
<%= 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>
|
<%= render :partial=>'layouts/topbar', :object=>@tb %>
|
||||||
|
<h1><%= I18n.t("lva.list")%></h1>
|
||||||
<table>
|
<ul>
|
||||||
<tr>
|
<% @lvas.each do |l| %>
|
||||||
<th>Name</th>
|
<li><%= render :partial => 'lvas/lva_semester', :locals=> {:lva => l} %>
|
||||||
<th>Desc</th>
|
<%end%>
|
||||||
<th>Ects</th>
|
</ul>
|
||||||
<th>Lvanr</th>
|
<%= render 'layouts/pretty_toolbar' %>
|
||||||
<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 %>
|
|
||||||
|
|||||||
@@ -1,30 +1,36 @@
|
|||||||
<% @lva.modul.each do |modul| %>
|
<%= render 'layouts/topbar'%>
|
||||||
<% 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 id="notice"><%= notice %></p>
|
||||||
<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>
|
|
||||||
|
<p><h4>Beschreibung</h4>
|
||||||
<%= @lva.desc %>
|
<%= @lva.desc %>
|
||||||
|
|
||||||
<%= link_to "Beispiel neu" , new_beispiel_path(:lva_id=>@lva.id) %>
|
<%= link_to "Beispiel neu" , new_beispiel_path(:lva_id=>@lva.id) %>
|
||||||
</p>
|
</p>
|
||||||
|
<h4>Beispiele</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<% @lva.beispiele.each do |b|%>
|
<% @lva.beispiele.each do |b|%>
|
||||||
|
|
||||||
<li><%= render b%></li>
|
<li><%= render b%></li>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</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>
|
<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| %>
|
<% @modulgruppen.sort_by{|n| n[:name]}.each do |modulgruppe| %>
|
||||||
<tr>
|
<%= render modulgruppe%>
|
||||||
<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>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<% if !@studium.nil? %>
|
<% if !@studium.nil? %>
|
||||||
<%= link_to 'New Modulgruppe', new_studium_modulgruppe_path(@studium) %>
|
<%= link_to 'New Modulgruppe', new_studium_modulgruppe_path(@studium) %>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
<%= semantic_form_for @modul do |f| %>
|
<%= semantic_form_for @modul do |f| %>
|
||||||
<%= f.inputs do %>
|
<%= 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 :name ,:hint=>true%>
|
||||||
<%= f.input :desc, :as=>:tinymce_text %>
|
<%= f.input :desc, :as=>:tinymce_text %>
|
||||||
<%= f.input :depend %>
|
<%= 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" >
|
<%= render :partial=>'moduls/lang', :collection=>@moduls, :as=>:modul%>
|
||||||
<tr>
|
|
||||||
<th>Modulgruppe (Studium)</th>
|
|
||||||
<th>Name</th>
|
|
||||||
<th>Desc</th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
<th></th>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<% @moduls.sort_by{|n| n[:name]}.each do |modul| %>
|
<br>
|
||||||
<tr>
|
<%= render 'layouts/pretty_toolbar'%>
|
||||||
<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%>
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
|
<%= render 'layouts/topbar'%>
|
||||||
<% @modul.modulgruppen.each do |g| %>
|
<%= render 'layouts/topbar', :topbar=>@tb%>
|
||||||
<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>
|
|
||||||
|
|
||||||
<p id="notice"><%= notice %></p>
|
<p id="notice"><%= notice %></p>
|
||||||
<%= render @modul %>
|
<%= render @modul %>
|
||||||
|
|
||||||
|
<%= render 'layouts/pretty_toolbar' %>
|
||||||
<%= link_to 'Add LVA', new_lva_path(:modul_id =>@modul.id) %>
|
<% # link_to 'Add LVA', %>
|
||||||
<%= link_to '<i class="icon-pencil"></i>'.html_safe+ I18n.t("common.edit") , edit_modul_path(@modul) %>
|
<% # 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" } %>
|
<% # link_to "Loeschen", [@modul],:method=>:delete ,:data => {:confirm =>"Are you sure" } %>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<%= f.inputs do %>
|
<%= f.inputs do %>
|
||||||
<%= f.input :name %>
|
<%= f.input :name %>
|
||||||
<%= f.input :nummer %>
|
<%= f.input :nummer %>
|
||||||
<%= f.input :ws %>
|
<%= f.input :ssws %>
|
||||||
<%= f.input :ss %>
|
<%= f.input :lvas %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= f.actions do %>
|
<%= f.actions do %>
|
||||||
|
|||||||
@@ -15,8 +15,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= semester.name %></td>
|
<td><%= semester.name %></td>
|
||||||
<td><%= semester.nummer %></td>
|
<td><%= semester.nummer %></td>
|
||||||
<td><%= semester.ws %></td>
|
<td><%= semester.ssws %></td>
|
||||||
<td><%= semester.ss %></td>
|
<td><% %></td>
|
||||||
<td><%= link_to 'Show', semester %></td>
|
<td><%= link_to 'Show', semester %></td>
|
||||||
<td><%= link_to 'Edit', edit_semester_path(semester) %></td>
|
<td><%= link_to 'Edit', edit_semester_path(semester) %></td>
|
||||||
<td><%= link_to 'Destroy', semester, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
<td><%= link_to 'Destroy', semester, method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
|||||||
@@ -1,25 +1,20 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Name:</b>
|
<b>Name:</b> <%= @semester.name %>
|
||||||
<%= @semester.name %>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Nummer:</b>
|
<b>Nummer:</b> <%= @semester.nummer %>
|
||||||
<%= @semester.nummer %>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Ws:</b>
|
<b>WS/SS?:</b> <%= @semester.ssws %>
|
||||||
<%= @semester.ws %>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>Ss:</b>
|
<%= render :partial =>'lvas/lva_semester', :collection=>@semester.lvas, :as=>:lva%>
|
||||||
<%= @semester.ss %>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_semester_path(@semester) %> |
|
<%= link_to 'Edit', edit_semester_path(@semester) %> |
|
||||||
<%= link_to 'Back', semesters_path %>
|
<%= 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,4 +1,4 @@
|
|||||||
<h1>Editing studium</h1>
|
<h1><%= I18n.t("studien.edit")%></h1>
|
||||||
|
|
||||||
<%= render 'form' %>
|
<%= render 'form' %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
|
<%= render 'layouts/topbar' %>
|
||||||
<h1><%= I18n.t("studien.list") %></h1>
|
<h1><%= I18n.t("studien.list") %></h1>
|
||||||
|
|
||||||
|
|
||||||
<% @studien.sort_by{|z| z[:zahl]}.each do |studium| %>
|
<% @studien.sort_by{|z| z[:zahl]}.each do |studium| %>
|
||||||
|
<ul>
|
||||||
|
<li><%= render studium%></li>
|
||||||
<h2><%= link_to studium.zahl + " "+ studium.typ+" " + studium.name, studium_path(studium) %></h2>
|
</ul>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<br />
|
<br>
|
||||||
<% link_to I18n.t("studien.new"), new_studium_path %>
|
<%= render :partial=>'layouts/pretty_toolbar'%>
|
||||||
<% link_to I18n.t("modulgruppe.show"), modulgruppen_path %>
|
<% #toolbar_html(@toolbar_elements) %>
|
||||||
<%= 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} %>
|
||||||
24
app/views/studien/show.html.erb
Executable file → Normal file
24
app/views/studien/show.html.erb
Executable file → Normal file
@@ -1,11 +1,10 @@
|
|||||||
|
<%= render 'layouts/topbar'%>
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<p id="notice"><%= notice %></p>
|
<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>
|
<h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1>
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
<%= raw(@studium.desc) %>
|
<%= raw(@studium.desc) %>
|
||||||
<% @studienphasen.each do |sp| %>
|
<% @studienphasen.each do |sp| %>
|
||||||
<% sp[:modulgruppen].each do |row| %>
|
<% sp[:modulgruppen].each do |row| %>
|
||||||
@@ -18,16 +17,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= render :partial=>'layouts/pretty_toolbar', :object=>@toolbar_modulgruppen %>
|
||||||
|
</div>
|
||||||
<div class="row-fluid">
|
<%= render 'layouts/pretty_toolbar' %>
|
||||||
<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>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<%= toolbar_html(@toolbar_elements) %>
|
|
||||||
|
|||||||
@@ -10,20 +10,26 @@ de:
|
|||||||
list: "Studien der Fakultät Elektrotechnik"
|
list: "Studien der Fakultät Elektrotechnik"
|
||||||
anzeigen: "Studium anzeigen"
|
anzeigen: "Studium anzeigen"
|
||||||
new: "Neues Studium"
|
new: "Neues Studium"
|
||||||
newmodulgroup: "Neue Modulgruppe"
|
|
||||||
allestudien: "Alle Studien"
|
allestudien: "Alle Studien"
|
||||||
|
loeschen: "Dieses Studium löschen"
|
||||||
|
edit: "Studium bearbeiten"
|
||||||
modul:
|
modul:
|
||||||
edit:
|
edit: "Modul bearbeiten"
|
||||||
title: "Bearbeite Modul"
|
list: "Alle Module"
|
||||||
show:
|
add: "Neues Modul"
|
||||||
title: "Auflistung aller Module"
|
keine:
|
||||||
link: "Alle Module auflisten"
|
beschreibung: "Keine Beschreibung vorhanden"
|
||||||
|
lva:
|
||||||
|
add: "Lva hinzufügen"
|
||||||
|
list: "Alle Lvas"
|
||||||
|
semester:
|
||||||
|
ohne: "Ohne Semesterzuordnung"
|
||||||
modulgruppe:
|
modulgruppe:
|
||||||
typ: "Typ"
|
typ: "Typ"
|
||||||
addmodul: "Neues Modul hinzufügen"
|
addmodul: "Neues Modul hinzufügen"
|
||||||
studium: "Studium"
|
studium: "Studium"
|
||||||
new: "Neue Modulgruppe"
|
new: "Neue Modulgruppe"
|
||||||
|
list: "Alle Modulgruppen auflisten"
|
||||||
show:
|
show:
|
||||||
title: "Auflistung aller Modulgruppen"
|
title: "Auflistung aller Modulgruppen"
|
||||||
link: "Modulgruppen auflisten"
|
link: "Modulgruppen auflisten"
|
||||||
@@ -85,4 +91,17 @@ de:
|
|||||||
blank: "Geben Sie die Stunden der LVA an"
|
blank: "Geben Sie die Stunden der LVA an"
|
||||||
lvanr:
|
lvanr:
|
||||||
invalid: "Geben Sie eine LVA-Nummer in richtigem Format an. Wenn die LVA noch keine Nummer hat, so geben sie 000 an."
|
invalid: "Geben Sie eine LVA-Nummer in richtigem Format an. Wenn die LVA noch keine Nummer hat, so geben sie 000 an."
|
||||||
|
studium:
|
||||||
|
attributes:
|
||||||
|
zahl:
|
||||||
|
blank: "Geben Sie die Studienkennzahl an"
|
||||||
|
invalid: "Die eingegebene Form stimmt nicht (beginnend mit 033 oder 066, dann 3 Stellen)"
|
||||||
|
taken: "Die Kennzahl wird bereits verwendet"
|
||||||
|
name:
|
||||||
|
blank: "Geben Sie den Namen des Studiums ein"
|
||||||
|
taken: "Der Name ist bereits vergeben"
|
||||||
|
typ:
|
||||||
|
inclusion: 'Wählen Sie "Bachelor" oder "Master" aus'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
Fetsite::Application.routes.draw do
|
Fetsite::Application.routes.draw do
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
devise_for :users
|
devise_for :users
|
||||||
resources :home, :only=>[:index]
|
resources :home, :only=>[:index]
|
||||||
#get 'home',:controller=>home,:action=>:index,:as=>"home_index"
|
#get 'home',:controller=>home,:action=>:index,:as=>"home_index"
|
||||||
@@ -11,24 +8,26 @@ Fetsite::Application.routes.draw do
|
|||||||
get 'config',:controller=>:config,:action=>:index , :as => 'config'
|
get 'config',:controller=>:config,:action=>:index , :as => 'config'
|
||||||
get 'config/get_git_update',:controller=>:config,:action=>:get_git_update, :as=>'config_getgitupdate'
|
get 'config/get_git_update',:controller=>:config,:action=>:get_git_update, :as=>'config_getgitupdate'
|
||||||
get 'config/get_git_update',:controller=>:config,:action=>:get_git_update
|
get 'config/get_git_update',:controller=>:config,:action=>:get_git_update
|
||||||
|
end
|
||||||
|
|
||||||
|
devise_for :users
|
||||||
|
|
||||||
end
|
resources :pages, :except => [:index] do
|
||||||
|
|
||||||
devise_for :users
|
|
||||||
|
|
||||||
resources :pages, :except => [:index] do
|
|
||||||
member do
|
member do
|
||||||
post 'preview'
|
post 'preview'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
get 'pages', :to =>'pages#show'
|
get 'pages', :to =>'pages#show'
|
||||||
scope '(:locale)' do
|
scope '(:locale)' do
|
||||||
|
|
||||||
resources :studien, :only=>[:show,:new,:edit,:update,:destroy]
|
resources :studien, :only=>[:show,:new,:edit,:update,:destroy]
|
||||||
resources :modulgruppen,:only =>[:create,:index]
|
resources :modulgruppen,:only =>[:create,:index]
|
||||||
|
|
||||||
resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true do
|
resources :studien,:except=>[:show,:new,:edit,:update,:destroy], :shallow=>true do
|
||||||
resources :modulgruppen, :path => "(:locale)/modulgruppen"
|
resources :modulgruppen, :path => "(:locale)/modulgruppen"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
get 'studien/:id/semesteransicht', :controller=>:studien, :action=>:semesteransicht, :as=>'studium_semesteransicht'
|
||||||
resources :semesters
|
resources :semesters
|
||||||
resources :moduls
|
resources :moduls
|
||||||
resources :lvas
|
resources :lvas
|
||||||
|
|||||||
14
db/migrate/20130729085446_create_lva_semester_join_table.rb
Normal file
14
db/migrate/20130729085446_create_lva_semester_join_table.rb
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
class CreateLvaSemesterJoinTable < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
create_table :lvas_semesters, :id=>false do |t|
|
||||||
|
t.integer :lva_id
|
||||||
|
t.integer :semester_id
|
||||||
|
end
|
||||||
|
add_index :lvas_semesters, [:lva_id, :semester_id]
|
||||||
|
add_index :lvas_semesters, :semester_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
drop_table :lvas_semesters
|
||||||
|
end
|
||||||
|
end
|
||||||
17
db/schema.rb
17
db/schema.rb
@@ -11,17 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20130214233723) do
|
ActiveRecord::Schema.define(:version => 20130729085446) do
|
||||||
|
|
||||||
create_table "beispiel_translations", :force => true do |t|
|
|
||||||
t.string "locale"
|
|
||||||
t.text "desc"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
t.integer "beispiele_id"
|
|
||||||
end
|
|
||||||
|
|
||||||
add_index "beispiel_translations", ["locale"], :name => "index_beispiel_translations_on_locale"
|
|
||||||
|
|
||||||
create_table "beispiele", :force => true do |t|
|
create_table "beispiele", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
@@ -60,6 +50,11 @@ ActiveRecord::Schema.define(:version => 20130214233723) do
|
|||||||
t.integer "modul_id"
|
t.integer "modul_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "lvas_semesters", :force => true do |t|
|
||||||
|
t.integer "lva_id"
|
||||||
|
t.integer "semester_id"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "modul_translations", :force => true do |t|
|
create_table "modul_translations", :force => true do |t|
|
||||||
t.integer "modul_id"
|
t.integer "modul_id"
|
||||||
t.string "locale"
|
t.string "locale"
|
||||||
|
|||||||
6
spec/factories/beispiele.rb
Normal file
6
spec/factories/beispiele.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :beispiel do
|
||||||
|
end
|
||||||
|
end
|
||||||
6
spec/factories/lvas.rb
Normal file
6
spec/factories/lvas.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :lva do
|
||||||
|
end
|
||||||
|
end
|
||||||
15
spec/factories/modulgruppen.rb
Normal file
15
spec/factories/modulgruppen.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :modulgruppe do
|
||||||
|
typ "Pflicht"
|
||||||
|
phase 1
|
||||||
|
name "Pflichtmodule 1"
|
||||||
|
desc "ASDFASDF"
|
||||||
|
factory :other_modulgruppe do
|
||||||
|
name "PFlichtmodule 2"
|
||||||
|
desc "sdafaswdfsfr"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
6
spec/factories/moduls.rb
Normal file
6
spec/factories/moduls.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :modul do
|
||||||
|
end
|
||||||
|
end
|
||||||
19
spec/factories/studien.rb
Normal file
19
spec/factories/studien.rb
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||||
|
|
||||||
|
|
||||||
|
FactoryGirl.define do
|
||||||
|
factory :studium do
|
||||||
|
zahl "066506"
|
||||||
|
name "Automatisierung"
|
||||||
|
desc "TEST DESC"
|
||||||
|
typ "Master"
|
||||||
|
|
||||||
|
factory :other_studium do
|
||||||
|
name "Telecommunication"
|
||||||
|
desc "frueher Telekommungikation"
|
||||||
|
zahl "066507"
|
||||||
|
typ "Master"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
1
spec/factories/studium_factory.rb
Normal file
1
spec/factories/studium_factory.rb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
5
spec/models/beispiel_spec.rb
Normal file
5
spec/models/beispiel_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Beispiel do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
5
spec/models/lva_spec.rb
Normal file
5
spec/models/lva_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Lva do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
5
spec/models/modul_spec.rb
Normal file
5
spec/models/modul_spec.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Modul do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
||||||
46
spec/models/modulgruppe_spec.rb
Normal file
46
spec/models/modulgruppe_spec.rb
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Modulgruppe do
|
||||||
|
it "should not be valid without studium" do
|
||||||
|
mg=FactoryGirl.build(:modulgruppe)
|
||||||
|
mg.should_not be_valid
|
||||||
|
mg.should have(1).errors_on(:studium_id)
|
||||||
|
end
|
||||||
|
it "should be valid with studium" do
|
||||||
|
s=FactoryGirl.create(:studium)
|
||||||
|
mg=FactoryGirl.build(:modulgruppe)
|
||||||
|
mg.studium=s
|
||||||
|
mg.should be_valid
|
||||||
|
end
|
||||||
|
it "should not be valid without name" do
|
||||||
|
s=FactoryGirl.create(:studium)
|
||||||
|
mg=FactoryGirl.build(:modulgruppe)
|
||||||
|
mg.studium=s
|
||||||
|
mg.name=nil
|
||||||
|
mg.should_not be_valid
|
||||||
|
mg.should have_at_least(1).errors_on(:name)
|
||||||
|
end
|
||||||
|
xit "should not be valid with dubble name" do
|
||||||
|
s=FactoryGirl.create(:studium)
|
||||||
|
mg=FactoryGirl.build(:modulgruppe, name: "Gruppe 1", desc: "132")
|
||||||
|
mg.studium=s
|
||||||
|
mg.save
|
||||||
|
mg=FactoryGirl.build(:modulgruppe, name: "Gruppe 2", desc: "133")
|
||||||
|
mg.studium=s
|
||||||
|
mg.should_not be_valid
|
||||||
|
mg.should have_at_least(1).errors_on(:name)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should be valid with same name on different studien" do
|
||||||
|
s=FactoryGirl.create(:studium)
|
||||||
|
s2=FactoryGirl.create(:other_studium)
|
||||||
|
mg=FactoryGirl.build(:modulgruppe, name: "Gruppe")
|
||||||
|
mg.studium=s
|
||||||
|
mg.save
|
||||||
|
mg=FactoryGirl.build(:other_modulgruppe, name: "Gruppe")
|
||||||
|
mg.studium=s2
|
||||||
|
mg.should be_valid
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
27
spec/models/studium_spec.rb
Normal file
27
spec/models/studium_spec.rb
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Studium do
|
||||||
|
[:name, :zahl].each do |attr|
|
||||||
|
it "should not be valid without #{attr}" do
|
||||||
|
s = FactoryGirl.build(:studium, attr=>nil)
|
||||||
|
s.should_not be_valid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
it "should create studium with valid data" do
|
||||||
|
s=FactoryGirl.build(:studium)
|
||||||
|
lambda {
|
||||||
|
s.save!}.should change {Studium.count()}.by(1)
|
||||||
|
end
|
||||||
|
it "should not accept double entrys" do
|
||||||
|
FactoryGirl.create(:studium)
|
||||||
|
s=FactoryGirl.build(:studium)
|
||||||
|
s.should_not be_valid
|
||||||
|
s.should have_at_least(1).error_on(:name)
|
||||||
|
s.should have_at_least(1).error_on(:zahl)
|
||||||
|
end
|
||||||
|
it "should expect zahl to be 000.000" do
|
||||||
|
s=FactoryGirl.build(:studium, :zahl=>"000000")
|
||||||
|
s.should_not be_valid
|
||||||
|
s.should have_at_least(1).error_on(:zahl)
|
||||||
|
end
|
||||||
|
end
|
||||||
38
spec/spec_helper.rb
Normal file
38
spec/spec_helper.rb
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
|
ENV["RAILS_ENV"] ||= 'test'
|
||||||
|
require File.expand_path("../../config/environment", __FILE__)
|
||||||
|
require 'rspec/rails'
|
||||||
|
require 'rspec/autorun'
|
||||||
|
|
||||||
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
||||||
|
# in spec/support/ and its subdirectories.
|
||||||
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
||||||
|
|
||||||
|
RSpec.configure do |config|
|
||||||
|
# ## Mock Framework
|
||||||
|
#
|
||||||
|
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
||||||
|
#
|
||||||
|
# config.mock_with :mocha
|
||||||
|
# config.mock_with :flexmock
|
||||||
|
# config.mock_with :rr
|
||||||
|
|
||||||
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||||
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
|
# examples within a transaction, remove the following line or assign false
|
||||||
|
# instead of true.
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
|
||||||
|
# If true, the base class of anonymous controllers will be inferred
|
||||||
|
# automatically. This will be the default behavior in future versions of
|
||||||
|
# rspec-rails.
|
||||||
|
config.infer_base_class_for_anonymous_controllers = false
|
||||||
|
|
||||||
|
# Run specs in random order to surface order dependencies. If you find an
|
||||||
|
# order dependency and want to debug it, you can fix the order by providing
|
||||||
|
# the seed, which is printed after each run.
|
||||||
|
# --seed 1234
|
||||||
|
config.order = "random"
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user