gremien + routes update

This commit is contained in:
Andreas Stephanides
2013-09-01 10:45:31 +02:00
parent 4dbe3f90b4
commit a3ca1f1f10
3 changed files with 9 additions and 4 deletions

View File

@@ -1,9 +1,11 @@
class GremienController < ApplicationController
# GET /gremien
# GET /gremien.json
before_filter {@toolbar_elements=[]}
def verwalten
@gremien = Gremium.all
@gremientabs=Gremium.all
@gremientabs=Gremium.all
@toolbar_elements << {:text=>I18n.t('common.new'),:path=>new_gremium_path() ,:icon=>:plus} if can? :new, Gremium
respond_to do |format|
format.html # index.html.erb
format.json { render json: @gremien }
@@ -14,7 +16,7 @@ class GremienController < ApplicationController
# GET /gremien/1.json
def show
@gremium = Gremium.find(params[:id])
@gremientabs=Gremium.order(:typ)
@gremientabs=Gremium.order(:typ)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @gremium }

View File

@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# == Schema Information
#
# Table name: gremien
@@ -11,12 +12,13 @@
#
class Gremium < ActiveRecord::Base
TYPEN={1=>"offiziell"}
GESCHLECHT={0=>"s&aumlchlich", 1 => "m&aumlnnlich", 2 => "weiblich"}
TYPEN={1=>"offiziell", 2=>"offiziell-temporär", 3 => "inoffiziell","inoffiziell-tempo"}
GESCHLECHT={0=>"saechlich", 1 => "maennlich", 2 => "weiblich"}
ART2FALL={0=>"des", 1=>"des",2=>"der"}
attr_accessible :desc, :name, :typ, :geschlecht,:thema_id
has_many :memberships
belongs_to :thema
scope :tabs, { .where(:typ=> 1,:typ=>2)}
def fall2
Gremium::ART2FALL[self.geschlecht.to_i].to_s+" "+ self.name.to_s+ ((self.geschlecht.to_i==1||self.geschlecht.to_i==0)? "s":"")
end

View File

@@ -66,6 +66,7 @@
member do
get 'verwalten'
put 'addmoderator'
get 'removemoderator'
end
resources :neuigkeiten, :except => [:index] do
member do