Topbar layouts

This commit is contained in:
Thomas Blazek
2013-08-04 18:04:04 +02:00
parent 05ed9da9c4
commit c72c186d62
10 changed files with 101 additions and 67 deletions

View File

@@ -4,6 +4,9 @@ class LvasController < ApplicationController
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}] @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

View File

@@ -8,12 +8,16 @@ class ModulsController < ApplicationController
@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}] @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
@@ -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-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'}} @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| respond_to do |format|
format.html # show.html.erb format.html # show.html.erb
format.json { render json: @modul } format.json { render json: @modul }
end end
end end
# GET /moduls/new # GET /moduls/new

View File

@@ -4,6 +4,9 @@ class StudienController < ApplicationController
def index def index
@studien = Studium.all @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<<{: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 } # @toolbar_elements<<{:text=> I18n.t('modulgruppe.show.link') ,:path=>modulgruppen_path }
end end
@@ -26,14 +29,25 @@ class StudienController < ApplicationController
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, :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=[{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) },
@toolbar_elements<<{:hicon=>'icon-remove-circle', :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)},
@toolbar_modulgruppen =[ {:hicon=>'icon-plus-sign', :text=> I18n.t('modulgruppe.new'), :path=>new_studium_modulgruppe_path(@studium)}] {:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>"Sure?" }]
@toolbar_modulgruppen << {:hicon=>'icon-list', :text => I18n.t('modulgruppe.list'), :path=>modulgruppen_path}
@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
@@ -79,9 +93,18 @@ class StudienController < ApplicationController
end end
@text = 'Zu Modulgruppenansicht wechseln' @text = 'Zu Modulgruppenansicht wechseln'
@path = studium_path(@studium) @path = studium_path(@studium)
@toolbar_elements=[{:icon=>:plus, :hicon =>'icon-plus-sign' ,:text=> I18n.t('studien.new') , :path => new_studium_path(@studium) }] @topbar_elements = [ {:hicon=>'icon-list', :text=>I18n.t("studien.allestudien"), :path=>studien_path},
@toolbar_elements<<{:icon=>:pencil, :hicon=>'icon-pencil',:text =>I18n.t('common.edit'),:path => edit_studium_path(@studium)} {:text=>'Zur Modulgruppenansicht wechseln', :path=>studium_path(@studium)},
@toolbar_elements<<{:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => studium_path(@studium), :method=> :delete,:confirm=>"Sure?" } {: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 end
def destroy def destroy

View 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>

View File

@@ -1,4 +1,4 @@
<%= render 'layouts/link_all' %> <%= render :partial=>'layouts/topbar', :object=>@tb %>
<h1><%= I18n.t("lva.list")%></h1> <h1><%= I18n.t("lva.list")%></h1>
<ul> <ul>
<% @lvas.each do |l| %> <% @lvas.each do |l| %>

View File

@@ -1,4 +1,4 @@
<%= render 'layouts/link_all' %> <%= render 'layouts/topbar' %>
<h1><%= I18n.t("modul.list") %></h1> <h1><%= I18n.t("modul.list") %></h1>
<%= render :partial=>'moduls/lang', :collection=>@moduls, :as=>:modul%> <%= render :partial=>'moduls/lang', :collection=>@moduls, :as=>:modul%>

View File

@@ -1,24 +1,4 @@
<%= render 'layouts/topbar'%>
<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>
<p id="notice"><%= notice %></p> <p id="notice"><%= notice %></p>
<%= render @modul %> <%= render @modul %>

View File

@@ -1,4 +1,4 @@
<%= render 'layouts/link_all' %> <%= render 'layouts/topbar' %>
<h1><%= I18n.t("studien.list") %></h1> <h1><%= I18n.t("studien.list") %></h1>

View File

@@ -1,4 +1,4 @@
<%= render :partial=>'studien/navigation'%> <%= render :partial=>'layouts/topbar'%>
<h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1> <h1><%= @studium.typ %> <%= @studium.name %> (<%= @studium.zahl %>)</h1>
<%= raw(@studium.desc) %> <%= raw(@studium.desc) %>

View File

@@ -1,4 +1,4 @@
<%= render :partial=>'studien/navigation'%> <%= 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>