diff --git a/app/controllers/studien_controller.rb b/app/controllers/studien_controller.rb
index 603131e..fb0ae58 100755
--- a/app/controllers/studien_controller.rb
+++ b/app/controllers/studien_controller.rb
@@ -1,34 +1,32 @@
class StudienController < ApplicationController
-before_filter {@toolbar_elements =[]}
+ before_filter {@toolbar_elements =[]}
-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 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])
- @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<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<modulgruppen, :phase => ph}.merge(opts)
@@ -41,13 +39,14 @@ def show
@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)}
+ if params[:ansicht] == 'semesteransicht'
+ @text = 'Zu Modulansicht wechseln'
+ @flip = 'modulgruppenansicht'
+ render 'semesteransicht'
+ else
+ @text = 'Zu Semesteransicht wechseln'
+ @flip = 'semesteransicht'
end
-
end
def new
@@ -85,31 +84,13 @@ def show
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
end
+ def default_url_options
+ {ansicht: params[:ansicht]}.merge(super)
+ end
end
diff --git a/app/views/lvas/show.html.erb b/app/views/lvas/show.html.erb
index 5d17c1d..204c3e4 100755
--- a/app/views/lvas/show.html.erb
+++ b/app/views/lvas/show.html.erb
@@ -18,7 +18,7 @@
<% end %>
-
+
<%= render 'layouts/pretty_toolbar' %>
diff --git a/app/views/moduls/show.html.erb b/app/views/moduls/show.html.erb
index 2bf73e9..7e297e7 100755
--- a/app/views/moduls/show.html.erb
+++ b/app/views/moduls/show.html.erb
@@ -1,5 +1,4 @@
<%= render 'layouts/topbar'%>
-<%= render 'layouts/topbar', :topbar=>@tb%>
<%= notice %>
<%= render @modul %> diff --git a/app/views/studien/_studium.html.erb b/app/views/studien/_studium.html.erb index 791402a..68333a6 100644 --- a/app/views/studien/_studium.html.erb +++ b/app/views/studien/_studium.html.erb @@ -1,7 +1,6 @@<%= studium.typ%>
+<%= studium.typ%>
Beschreibung:
<%= !(studium.desc.to_s == "") ? studium.desc.html_safe : I18n.t("keine.beschreibung")%>
<%= notice %>
-