fixed studien Ansicht und Modulgruppen

This commit is contained in:
Andreas Stephanides
2013-02-12 23:51:43 +01:00
parent 4745590c63
commit cf33706320
5 changed files with 39 additions and 33 deletions

View File

@@ -6,11 +6,24 @@ class StudienController < ApplicationController
end end
def show def show
@studium= Studium.find(params[:id]) @studium= Studium.find(params[:id])
end @studienphasen=[]
[1, 2 ,3].each do |ph|
modulgruppen_phase=@studium.modulgruppen.where(:phase=>ph)
# GET /studia/new if modulgruppen_phase.count==1
# GET /studia/new.json 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
end
def new def new
@studium = Studium.new @studium = Studium.new
end end

View File

@@ -18,10 +18,10 @@
</div> </div>
<span class="label">Aktionen</span> <span class="label"><%= I18n.t("common.actions")%></span>
<div class="btn-group"> <div class="btn-group">
<%= link_to 'Add Modul', new_modul_path(:modulgruppen_id =>@modulgruppe.id),:class =>"btn" %> <%= link_to I18n.t("modulgruppe.addmodul"), new_modul_path(:modulgruppen_id =>@modulgruppe.id),:class =>"btn" %>
<%= link_to 'Studium', studium_path(@modulgruppe.studium),:class =>"btn" %> <%= link_to I18n.t("modulgruppe.studium"), studium_path(@modulgruppe.studium),:class =>"btn" %>
<%= link_to 'Edit', edit_modulgruppe_path(@modulgruppe),:class =>"btn" %> <%= link_to I18n.t("common.edit"), edit_modulgruppe_path(@modulgruppe),:class =>"btn" %>
<%= link_to 'Back', modulgruppen_path,:class =>"btn" %>
</div> </div>

View File

@@ -1,28 +1,13 @@
<div class="container-fluid">
<p id="notice"><%= notice %></p> <p id="notice"><%= notice %></p>
<h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1> <h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1>
<%= raw(@studium.desc) %> <%= raw(@studium.desc) %>
<% [1, 2 ,3].each do |ph| %>
<% ph_mod = @studium.modulgruppen.where(:phase=>ph) <% @studienphasen.each do |sp| %>
if ph_mod.count==1 <% sp[:modulgruppen].each do |row| %>
width=12
slice=1
elsif ph_mod.count <= 4
width=6
slice=2
else
width=4
slice=3
end
%>
<% ph_mod.each_slice(slice) do |row| %>
<div class="row-fluid"> <div class="row-fluid">
<% row.each do |modulgruppe| %> <% row.each do |modulgruppe| %>
<div class="span<%= width%> min-width:13em;"> <div class="span<%= sp[:width]%> min-width:13em;">
<%= render modulgruppe %> <%= render modulgruppe %>
</div> </div>
<% end %> <% end %>
@@ -31,8 +16,9 @@
<% end %> <% end %>
</div> </div>
<div class="row-fluid"> <div class="row-fluid">
<div class="span12"> <span class="span12">
<%= link_to 'New Modulgruppe', new_studium_modulgruppe_path(@studium) %> | <%= link_to 'New Modulgruppe', new_studium_modulgruppe_path(@studium),:class=>"btn" %> |
<%= link_to 'Edit', edit_studium_path(@studium) %> | <%= link_to I18n.t("common.edit"), edit_studium_path(@studium) ,:class=>"btn"%> |
<%= link_to '<i class="icon-list"></i> Alle Studien'.html_safe, studien_path,:class=>"btn",:raw=>true %> <%= link_to '<i class="icon-list"></i> Alle Studien'.html_safe, studien_path,:class=>"btn",:raw=>true %>
</span>
</div></div> </div></div>

View File

@@ -0,0 +1 @@
I18n.default_locale = :de

View File

@@ -2,15 +2,22 @@
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
de: de:
hello: "Hallo Welt" hello: "Hallo Welt"
common:
edit: "Bearbeiten"
actions: "Aktionen"
studien: studien:
list: "Studien der Fakultät Elektrotechnik" list: "Studien der Fakultät Elektrotechnik"
new: "Neues Studium" new: "Neues Studium"
modul: modul:
edit: edit:
title: "Bearbeite Modul" title: "Bearbeite Modul"
modulgruppe: modulgruppe:
typ: "Typ" typ: "Typ"
addmodul: "Neues Modul hinzufügen"
studium: "Studium"
home: home:
mtitle: "Menu" mtitle: "Menu"
hallobeiderfet: "Du bist auf er Seite der Fachschaft Elektrotechnik der TU Wien" hallobeiderfet: "Du bist auf er Seite der Fachschaft Elektrotechnik der TU Wien"
@@ -18,7 +25,6 @@ de:
studien: "Studien" studien: "Studien"
news: "News" news: "News"
info: "Information" info: "Information"
rubrik: rubrik:
moderatoradded: "Neuen Moderator hinzugefügt!" moderatoradded: "Neuen Moderator hinzugefügt!"
moderatoraddnorights: "Keine Berechtigung neue Moderatoren hinzuzufügen!" moderatoraddnorights: "Keine Berechtigung neue Moderatoren hinzuzufügen!"