Topbar layouts
This commit is contained in:
@@ -4,6 +4,9 @@ class LvasController < ApplicationController
|
||||
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
|
||||
|
||||
@@ -8,12 +8,16 @@ class ModulsController < ApplicationController
|
||||
@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
|
||||
@@ -24,11 +28,24 @@ class ModulsController < ApplicationController
|
||||
@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}]
|
||||
|
||||
@topbar_elements <<{:newline=>true}
|
||||
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
|
||||
@topbar_elements <<{:text=> i.name + ' ('+i.studium.name + ')', :path=>studium_modulgruppen_path(i)}
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @modul }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# GET /moduls/new
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
class StudienController < ApplicationController
|
||||
before_filter {@toolbar_elements =[]}
|
||||
before_filter {@toolbar_elements =[]}
|
||||
|
||||
|
||||
def index
|
||||
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
|
||||
end
|
||||
|
||||
def show
|
||||
def show
|
||||
@studium= Studium.find(params[:id])
|
||||
@text = 'Zu Semesteransicht wechseln'
|
||||
@path = studium_semesteransicht_path(@studium)
|
||||
@@ -26,14 +29,25 @@ class StudienController < ApplicationController
|
||||
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) }]
|
||||
@toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)}
|
||||
@toolbar_elements<<{: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)}]
|
||||
@toolbar_modulgruppen << {:hicon=>'icon-list', :text => I18n.t('modulgruppe.list'), :path=>modulgruppen_path}
|
||||
|
||||
@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
|
||||
@@ -79,9 +93,18 @@ class StudienController < ApplicationController
|
||||
end
|
||||
@text = 'Zu Modulgruppenansicht wechseln'
|
||||
@path = studium_path(@studium)
|
||||
@toolbar_elements=[{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) }]
|
||||
@toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)}
|
||||
@toolbar_elements<<{:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>"Sure?" }
|
||||
@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
|
||||
|
||||
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], tb[:path] %><span class="divider">/</span></li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</ul>
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render 'layouts/link_all' %>
|
||||
<%= render :partial=>'layouts/topbar', :object=>@tb %>
|
||||
<h1><%= I18n.t("lva.list")%></h1>
|
||||
<ul>
|
||||
<% @lvas.each do |l| %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render 'layouts/link_all' %>
|
||||
<%= render 'layouts/topbar' %>
|
||||
<h1><%= I18n.t("modul.list") %></h1>
|
||||
|
||||
<%= render :partial=>'moduls/lang', :collection=>@moduls, :as=>:modul%>
|
||||
|
||||
@@ -1,24 +1,4 @@
|
||||
|
||||
<ul class="breadcrumb">
|
||||
<% @modul.modulgruppen.each do |g| %>
|
||||
<% if !g.nil? %>
|
||||
<li>
|
||||
<% if !g.studium.nil? %>
|
||||
<%= link_to g.studium.name , studium_path(g.studium) %>
|
||||
|
||||
<% else %>
|
||||
<li>Studium fehlt!
|
||||
<% end %>
|
||||
<span class="divider">/</span></li>
|
||||
<li><%= link_to g.name , modulgruppe_path(g)%>
|
||||
<% else %>
|
||||
<li>Modulgruppe Fehlt
|
||||
<%end %>
|
||||
<span class="divider">/</span> </li>
|
||||
<br>
|
||||
<%end%>
|
||||
|
||||
</ul>
|
||||
<%= render 'layouts/topbar'%>
|
||||
|
||||
<p id="notice"><%= notice %></p>
|
||||
<%= render @modul %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render 'layouts/link_all' %>
|
||||
<%= render 'layouts/topbar' %>
|
||||
<h1><%= I18n.t("studien.list") %></h1>
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render :partial=>'studien/navigation'%>
|
||||
<%= render :partial=>'layouts/topbar'%>
|
||||
|
||||
<h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1>
|
||||
<%= raw(@studium.desc) %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<%= render :partial=>'studien/navigation'%>
|
||||
<%= render 'layouts/topbar'%>
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<p id="notice"><%= notice %></p>
|
||||
|
||||
Reference in New Issue
Block a user