gremien tabs

This commit is contained in:
Andreas Stephanides
2013-09-10 22:14:29 +02:00
parent f067d5564f
commit 4b484c8d76
4 changed files with 14 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ class FetprofilesController < ApplicationController
@fetprofiles = Fetprofile.active.order(:vorname,:nachname) @fetprofiles = Fetprofile.active.order(:vorname,:nachname)
@fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all" @fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all"
@gremientabs=Gremium.order(:typ) @gremientabs=Gremium.tabs
respond_to do |format| respond_to do |format|
format.html # index.html.erb format.html # index.html.erb
format.json { render json: @fetprofiles } format.json { render json: @fetprofiles }

View File

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

View File

@@ -12,13 +12,14 @@
# #
class Gremium < ActiveRecord::Base class Gremium < ActiveRecord::Base
TYPEN={1=>"offiziell", 2=>"offiziell-temporaer", 3 => "inoffiziell",4=>"inoffiziell-tempo"} TYPEN={1=>"offiziell", 2=>"offiziell-temporär", 3 => "inoffiziell",4=>"inoffiziell-tempo"}
TAPS_TYPEN={1=>true,2=>false,3=>true,4=>false}
GESCHLECHT={0=>"saechlich", 1 => "maennlich", 2 => "weiblich"} GESCHLECHT={0=>"saechlich", 1 => "maennlich", 2 => "weiblich"}
ART2FALL={0=>"des", 1=>"des",2=>"der"} ART2FALL={0=>"des", 1=>"des",2=>"der"}
attr_accessible :desc, :name, :typ, :geschlecht,:thema_id attr_accessible :desc, :name, :typ, :geschlecht,:thema_id
has_many :memberships has_many :memberships
belongs_to :thema belongs_to :thema
scope :tabs, -> { where(:typ => [1,2]) } scope :tabs, -> { where(:typ => [1,3]).order(:typ).order(:name) }
def fall2 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":"") Gremium::ART2FALL[self.geschlecht.to_i].to_s+" "+ self.name.to_s+ ((self.geschlecht.to_i==1||self.geschlecht.to_i==0)? "s":"")

View File

@@ -35,7 +35,7 @@
resources :fotos resources :fotos
end end
resources :gremien, :except=>[:index] do resources :gremien do
collection do collection do
get 'verwalten' get 'verwalten'
end end