This commit is contained in:
Andreas Stephanides
2013-03-18 23:07:41 +01:00
parent 922acf869a
commit a712fc70f4
5 changed files with 14 additions and 7 deletions

View File

@@ -10,7 +10,6 @@ class StudienController < ApplicationController
@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)
if modulgruppen_phase.count==1 if modulgruppen_phase.count==1
opts={:width=>12, :slice=>1} opts={:width=>12, :slice=>1}
elsif modulgruppen_phase.count <= 4 elsif modulgruppen_phase.count <= 4
@@ -21,6 +20,7 @@ class StudienController < ApplicationController
modulgruppen =[] modulgruppen =[]
modulgruppen_phase.each_slice(opts[:slice]) do |s| modulgruppen<<s end modulgruppen_phase.each_slice(opts[:slice]) do |s| modulgruppen<<s end
@studienphasen << {:modulgruppen=>modulgruppen, :phase => ph}.merge(opts) @studienphasen << {:modulgruppen=>modulgruppen, :phase => ph}.merge(opts)
toolbar_elements=[ link_to('<i class="icon-plus"'.html_safe + I18n.t('studien.new') , new_modul_path)]
end end
end end

View File

@@ -1,7 +1,9 @@
<h1>Listing moduls</h1> <h1>Alle Module der Elektrotechnik</h1>
<table> <table class="table" >
<tr> <tr>
<th>Studium</th>
<th>Modulgruppe</th>
<th>Name</th> <th>Name</th>
<th>Desc</th> <th>Desc</th>
<th></th> <th></th>
@@ -11,6 +13,10 @@
<% @moduls.each do |modul| %> <% @moduls.each do |modul| %>
<tr> <tr>
<td><%= %></td>
<td><%= if !modul.modulgruppen.first.nil?
modul.modulgruppen.first[:name]
end %> </td>
<td><%= modul.name %></td> <td><%= modul.name %></td>
<td><%= modul.desc %></td> <td><%= modul.desc %></td>
<td><%= link_to 'Show', modul_path(modul) %></td> <td><%= link_to 'Show', modul_path(modul) %></td>

View File

@@ -25,6 +25,7 @@
<%= 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-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 '<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?' } %> <%= link_to 'Destroy', @studium, method: :delete, data: { confirm: 'Are you sure?' } %>
<%= toolbar_html(toolbar_elements) %>
</span> </span>
</div> </div>

View File

@@ -7,7 +7,7 @@
# Formtastic::FormBuilder.default_text_area_height = 5 # Formtastic::FormBuilder.default_text_area_height = 5
# Set the default text area width when input is a text. Default is nil. # Set the default text area width when input is a text. Default is nil.
Formtastic::FormBuilder.default_text_area_width = 50 Formtastic::FormBuilder.default_text_area_width = 100
# Should all fields be considered "required" by default? # Should all fields be considered "required" by default?
# Defaults to true. # Defaults to true.