# -*- coding: utf-8 -*- class ModulsController < ApplicationController # GET /moduls # GET /moduls.json before_filter :find_modul, :only=>[:show,:update_lvas,:edit_lvas,:load_tiss,:show_tiss] # @modul laden before_filter :load_toolbar_show, :only=>[:show] # Toolbar für show erstellen before_filter :load_toolbar_index, :only=>[:index] # Toolbar für index erstellen load_and_authorize_resource def index @moduls = Modul.all if @moduls if !params[:studium_id].nil? @studium=Studium.find_by_id(params[:studium_id]) end respond_to do |format| format.html # index.html.erb end end end # GET /moduls/1 # GET /moduls/1.json def show for i in @modul.modulgruppen @tb <<{:text=> i.name + ' ('+i.studium_name + ')', :path=>modulgruppe_path(i)} end respond_to do |format| format.html # show.html.erb format.json { render json: @modul } end end # GET /moduls/new # GET /moduls/new.json def new @modul = Modul.new modulgruppe=Modulgruppe.find_by_id(params[:modulgruppen_id]) if !modulgruppe.nil? @modul.modulgruppen<'icon-plus-sign', :text=>I18n.t("lva.add"), :path=>new_lva_path(:modul_id =>@modul.id)}] @toolbar_elements << {:hicon=>'icon-pencil', :text=>"Lvas bearbeiten", :path=>edit_lvas_modul_path(@modul)} @toolbar_elements << {:hicon=>'icon-plus-sign', :text=>"ADD FROM TISS", :path=>load_tiss_modul_path(:modul_id =>@modul.id)} @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}] @tb=[] end def load_toolbar_index @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} end end