forked from bofh/fetsite
GitHub Account angelegt
This commit is contained in:
18
app/controllers/application_controller.rb
Normal file
18
app/controllers/application_controller.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
before_filter :set_i18n_locale_from_params
|
||||
protected
|
||||
def set_i18n_locale_from_params
|
||||
if params[:locale]
|
||||
if I18n.available_locales.include?(params[:locale].to_sym)
|
||||
I18n.locale=params[:locale].to_sym
|
||||
else
|
||||
flash.now[:notice]= "#{params[:locale]} translation not available"
|
||||
logger.error flash.now[:notice]
|
||||
end
|
||||
end
|
||||
end
|
||||
def default_url_options
|
||||
{locale: I18n.locale}
|
||||
end
|
||||
end
|
||||
6
app/controllers/home_controller.rb
Normal file
6
app/controllers/home_controller.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class HomeController < ApplicationController
|
||||
def index
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
84
app/controllers/lvas_controller.rb
Normal file
84
app/controllers/lvas_controller.rb
Normal file
@@ -0,0 +1,84 @@
|
||||
class LvasController < ApplicationController
|
||||
# GET /lvas
|
||||
# GET /lvas.json
|
||||
def index
|
||||
@lvas = Lva.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @lvas }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /lvas/1
|
||||
# GET /lvas/1.json
|
||||
def show
|
||||
@lva = Lva.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @lva }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /lvas/new
|
||||
# GET /lvas/new.json
|
||||
def new
|
||||
@lva = Lva.new
|
||||
modul=Modul.find(params[:modul_id])
|
||||
@lva.modul<<modul
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @lva }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /lvas/1/edit
|
||||
def edit
|
||||
@lva = Lva.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /lvas
|
||||
# POST /lvas.json
|
||||
def create
|
||||
@lva = Lva.new(params[:lva])
|
||||
|
||||
respond_to do |format|
|
||||
if @lva.save
|
||||
format.html { redirect_to @lva, notice: 'Lva was successfully created.' }
|
||||
format.json { render json: @lva, status: :created, location: @lva }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @lva.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /lvas/1
|
||||
# PUT /lvas/1.json
|
||||
def update
|
||||
@lva = Lva.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @lva.update_attributes(params[:lva])
|
||||
format.html { redirect_to @lva, notice: 'Lva was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @lva.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /lvas/1
|
||||
# DELETE /lvas/1.json
|
||||
def destroy
|
||||
@lva = Lva.find(params[:id])
|
||||
@lva.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to lvas_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
89
app/controllers/modulgruppen_controller.rb
Normal file
89
app/controllers/modulgruppen_controller.rb
Normal file
@@ -0,0 +1,89 @@
|
||||
class ModulgruppenController < ApplicationController
|
||||
# GET /modulgruppen
|
||||
# GET /modulgruppen.json
|
||||
|
||||
load_and_authorize_resource
|
||||
def index
|
||||
@modulgruppen = Modulgruppe.all
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# GET /modulgruppen/1
|
||||
# GET /modulgruppen/1.json
|
||||
def show
|
||||
@modulgruppe = Modulgruppe.find(params[:id])
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# GET /modulgruppen/new
|
||||
# GET /modulgruppen/new.json
|
||||
def new
|
||||
@modulgruppe = Modulgruppe.new
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# GET /modulgruppen/1/edit
|
||||
def edit
|
||||
@modulgruppe = Modulgruppe.find(params[:id])
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
end
|
||||
end
|
||||
|
||||
# POST /modulgruppen
|
||||
# POST /modulgruppen.json
|
||||
def create
|
||||
@modulgruppe = Modulgruppe.new(params[:modulgruppe])
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
else
|
||||
@studium=Studium.find(params[:modulgruppe][:studium_id])
|
||||
end
|
||||
respond_to do |format|
|
||||
if @modulgruppe.save
|
||||
format.html { redirect_to @modulgruppe, notice: 'Modulgruppe was successfully created.' }
|
||||
format.json { render json: @modulgruppe, status: :created, location: @modulgruppe }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @modulgruppe.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /modulgruppen/1
|
||||
# PUT /modulgruppen/1.json
|
||||
def update
|
||||
@modulgruppe = Modulgruppe.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @modulgruppe.update_attributes(params[:modulgruppe])
|
||||
format.html { redirect_to @modulgruppe, notice: 'Modulgruppe was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @modulgruppe.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /modulgruppen/1
|
||||
# DELETE /modulgruppen/1.json
|
||||
def destroy
|
||||
@modulgruppe = Modulgruppe.find(params[:id])
|
||||
@modulgruppe.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to modulgruppen_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
91
app/controllers/moduls_controller.rb
Normal file
91
app/controllers/moduls_controller.rb
Normal file
@@ -0,0 +1,91 @@
|
||||
class ModulsController < ApplicationController
|
||||
# GET /moduls
|
||||
# GET /moduls.json
|
||||
def index
|
||||
@moduls = Modul.all
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @moduls }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /moduls/1
|
||||
# GET /moduls/1.json
|
||||
def show
|
||||
@modul = Modul.find(params[:id])
|
||||
|
||||
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(params[:modulgruppen_id])
|
||||
@modul.modulgruppen<<modulgruppe
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @modul }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /moduls/1/edit
|
||||
def edit
|
||||
@modul = Modul.find(params[:id])
|
||||
if !params[:studium_id].nil?
|
||||
@studium=Studium.find(params[:studium_id])
|
||||
end
|
||||
end
|
||||
|
||||
# POST /moduls
|
||||
# POST /moduls.json
|
||||
def create
|
||||
@modul = Modul.new(params[:modul])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @modul.save
|
||||
format.html { redirect_to modulgruppe_path(@modul.modulgruppen.first), notice: 'Modul was successfully created.' }
|
||||
format.json { render json: @modul, status: :created, location: @modul }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @modul.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# PUT /moduls/1
|
||||
# PUT /moduls/1.json
|
||||
def update
|
||||
@modul = Modul.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @modul.update_attributes(params[:modul])
|
||||
format.html { redirect_to @modul, notice: 'Modul was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @modul.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /moduls/1
|
||||
# DELETE /moduls/1.json
|
||||
def destroy
|
||||
@modul = Modul.find(params[:id])
|
||||
@modul.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to moduls_path() }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
83
app/controllers/neuigkeiten_controller.rb
Normal file
83
app/controllers/neuigkeiten_controller.rb
Normal file
@@ -0,0 +1,83 @@
|
||||
class NeuigkeitenController < ApplicationController
|
||||
# GET /neuigkeiten
|
||||
# GET /neuigkeiten.json
|
||||
def index
|
||||
@neuigkeiten = Neuigkeit.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @neuigkeiten }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /neuigkeiten/1
|
||||
# GET /neuigkeiten/1.json
|
||||
def show
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @neuigkeit }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /neuigkeiten/new
|
||||
# GET /neuigkeiten/new.json
|
||||
def new
|
||||
@neuigkeit = Neuigkeit.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @neuigkeit }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /neuigkeiten/1/edit
|
||||
def edit
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /neuigkeiten
|
||||
# POST /neuigkeiten.json
|
||||
def create
|
||||
@neuigkeit = Neuigkeit.new(params[:neuigkeit])
|
||||
|
||||
respond_to do |format|
|
||||
if @neuigkeit.save
|
||||
format.html { redirect_to @neuigkeit, notice: 'Neuigkeit was successfully created.' }
|
||||
format.json { render json: @neuigkeit, status: :created, location: @neuigkeit }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @neuigkeit.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /neuigkeiten/1
|
||||
# PUT /neuigkeiten/1.json
|
||||
def update
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @neuigkeit.update_attributes(params[:neuigkeit])
|
||||
format.html { redirect_to @neuigkeit, notice: 'Neuigkeit was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @neuigkeit.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /neuigkeiten/1
|
||||
# DELETE /neuigkeiten/1.json
|
||||
def destroy
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
@neuigkeit.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to neuigkeiten_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
93
app/controllers/rubriken_controller.rb
Normal file
93
app/controllers/rubriken_controller.rb
Normal file
@@ -0,0 +1,93 @@
|
||||
class RubrikenController < ApplicationController
|
||||
# GET /rubriken
|
||||
# GET /rubriken.json
|
||||
def index
|
||||
@rubriken = Rubrik.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @rubriken }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /rubriken/1
|
||||
# GET /rubriken/1.json
|
||||
def show
|
||||
@rubrik = Rubrik.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @rubrik }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /rubriken/new
|
||||
# GET /rubriken/new.json
|
||||
def new
|
||||
@rubrik = Rubrik.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @rubrik }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /rubriken/1/edit
|
||||
def edit
|
||||
@rubrik = Rubrik.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /rubriken
|
||||
# POST /rubriken.json
|
||||
def create
|
||||
@rubrik = Rubrik.new(params[:rubrik])
|
||||
|
||||
respond_to do |format|
|
||||
if @rubrik.save
|
||||
format.html { redirect_to @rubrik, notice: 'Rubrik was successfully created.' }
|
||||
format.json { render json: @rubrik, status: :created, location: @rubrik }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @rubrik.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /rubriken/1
|
||||
# PUT /rubriken/1.json
|
||||
|
||||
def addmoderator
|
||||
@rubrik = Rubrik.find(params[:id])
|
||||
if current_user.has_role?(:newsadmin,@rubrik) || current_user.has_role?(:newsadmin)
|
||||
User.find(params[:userid]).add_role(:newsmoderator, @rubrik)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to @rubrik }
|
||||
end
|
||||
end
|
||||
def update
|
||||
@rubrik = Rubrik.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @rubrik.update_attributes(params[:rubrik])
|
||||
format.html { redirect_to @rubrik, notice: 'Rubrik was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @rubrik.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /rubriken/1
|
||||
# DELETE /rubriken/1.json
|
||||
def destroy
|
||||
@rubrik = Rubrik.find(params[:id])
|
||||
@rubrik.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to rubriken_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
83
app/controllers/semesters_controller.rb
Normal file
83
app/controllers/semesters_controller.rb
Normal file
@@ -0,0 +1,83 @@
|
||||
class SemestersController < ApplicationController
|
||||
# GET /semesters
|
||||
# GET /semesters.json
|
||||
def index
|
||||
@semesters = Semester.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @semesters }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /semesters/1
|
||||
# GET /semesters/1.json
|
||||
def show
|
||||
@semester = Semester.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @semester }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /semesters/new
|
||||
# GET /semesters/new.json
|
||||
def new
|
||||
@semester = Semester.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @semester }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /semesters/1/edit
|
||||
def edit
|
||||
@semester = Semester.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /semesters
|
||||
# POST /semesters.json
|
||||
def create
|
||||
@semester = Semester.new(params[:semester])
|
||||
|
||||
respond_to do |format|
|
||||
if @semester.save
|
||||
format.html { redirect_to @semester, notice: 'Semester was successfully created.' }
|
||||
format.json { render json: @semester, status: :created, location: @semester }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @semester.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /semesters/1
|
||||
# PUT /semesters/1.json
|
||||
def update
|
||||
@semester = Semester.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @semester.update_attributes(params[:semester])
|
||||
format.html { redirect_to @semester, notice: 'Semester was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @semester.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /semesters/1
|
||||
# DELETE /semesters/1.json
|
||||
def destroy
|
||||
@semester = Semester.find(params[:id])
|
||||
@semester.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to semesters_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
83
app/controllers/studien_controller.rb
Normal file
83
app/controllers/studien_controller.rb
Normal file
@@ -0,0 +1,83 @@
|
||||
class StudienController < ApplicationController
|
||||
# GET /studia
|
||||
# GET /studia.json
|
||||
def index
|
||||
@studien = Studium.all
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @studien }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /studia/1
|
||||
# GET /studia/1.json
|
||||
def show
|
||||
|
||||
@studium= Studium.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @studium }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /studia/new
|
||||
# GET /studia/new.json
|
||||
def new
|
||||
@studium = Studium.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @studium }
|
||||
end
|
||||
end
|
||||
|
||||
# GET /studia/1/edit
|
||||
def edit
|
||||
@studium = Studium.find(params[:id])
|
||||
end
|
||||
|
||||
# POST /studia
|
||||
# POST /studia.json
|
||||
def create
|
||||
@studium = Studium.new(params[:studium])
|
||||
|
||||
respond_to do |format|
|
||||
if @studium.save
|
||||
format.html { redirect_to @studium, notice: 'Studium was successfully created.' }
|
||||
format.json { render json: @studium, status: :created, location: @studium }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @studium.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PUT /studia/1
|
||||
# PUT /studia/1.json
|
||||
def update
|
||||
@studium = Studium.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @studium.update_attributes(params[:studium])
|
||||
format.html { redirect_to @studium, notice: 'Studium was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @studium.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /studia/1
|
||||
# DELETE /studia/1.json
|
||||
def destroy
|
||||
@studium = Studium.find(params[:id])
|
||||
@studium.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to studien_url }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
end
|
||||
6
app/controllers/users_controller.rb
Normal file
6
app/controllers/users_controller.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class UsersController < ApplicationController
|
||||
def index
|
||||
@users = User.all
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user