From ec17e4f04fb2d28844fb32bb9724fae6ca70ec0a Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Wed, 18 Dec 2013 09:42:11 +0100 Subject: [PATCH] gremien kategorien wie berufungsgruppen --- app/controllers/fetprofiles_controller.rb | 4 ++-- app/controllers/gremien_controller.rb | 8 +++++++- app/models/gremium.rb | 4 ++-- app/views/fetprofiles/_tabs.html.erb | 22 +++++++++++++++++++--- app/views/gremien/index.html.erb | 5 +++++ config/locales/fetprofile.de.yml | 8 +++++++- 6 files changed, 42 insertions(+), 9 deletions(-) diff --git a/app/controllers/fetprofiles_controller.rb b/app/controllers/fetprofiles_controller.rb index 344d50c..2f8a654 100644 --- a/app/controllers/fetprofiles_controller.rb +++ b/app/controllers/fetprofiles_controller.rb @@ -3,12 +3,12 @@ class FetprofilesController < ApplicationController # GET /fetprofiles.json before_filter {@toolbar_elements=[]} load_and_authorize_resource - - def index @fetprofiles = Fetprofile.active.order(:vorname,:nachname) @fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all" + @fetprofiles = Fetprofile.where(:active=>false).order(:vorname,:nachname) if params[:filter]== "notactive" + @gremientabs = Gremium.tabs respond_to do |format| format.html # index.html.erb diff --git a/app/controllers/gremien_controller.rb b/app/controllers/gremien_controller.rb index 83385f0..432cecc 100644 --- a/app/controllers/gremien_controller.rb +++ b/app/controllers/gremien_controller.rb @@ -14,7 +14,13 @@ class GremienController < ApplicationController end def index - @gremien = Gremium.order(:typ).order(:name) + if params[:filter].nil? + @gremien = Gremium.where("CAST(typ AS INT) < 10").order(:typ).order(:name) + else + @gremien = Gremium.order(:typ).order(:name).where("CAST(typ AS INT) == ?",params[:filter]) + end + + @gremientabs=Gremium.tabs end diff --git a/app/models/gremium.rb b/app/models/gremium.rb index 54080eb..ebc571d 100644 --- a/app/models/gremium.rb +++ b/app/models/gremium.rb @@ -15,8 +15,8 @@ class Gremium < ActiveRecord::Base TYPEN={1=>"offiziell", 2=>"offiziell-temporär", 3 => "inoffiziell",4=>"inoffiziell-tempo", 11=> "berufungskommission"} # Kategorien, im Wesentlichen wichtig für Listung oder nicht Listung GESCHLECHT={0=>"saechlich", 1 => "maennlich", 2 => "weiblich"} # Geschlecht des Gremiums zur richtige Deklination ART2FALL={0=>"des", 1=>"des",2=>"der"} # Artikel 2.Fall abhängig vom Geschlecht - FILTER={11=>I18n.t("gremium.filter.berufung")} - TEXT={11=>I18n.t("gremium.filter.berufungT")} + FILTER={11=>I18n.t("gremium.filter.berufung.title")} + TEXT={11=>I18n.t("gremium.filter.berufung.text")} attr_accessible :desc, :name, :typ, :geschlecht,:thema_id, :memberships_attributes has_many :memberships # Mitgliedschaften bei dem Gremium diff --git a/app/views/fetprofiles/_tabs.html.erb b/app/views/fetprofiles/_tabs.html.erb index a17254b..42e83e8 100644 --- a/app/views/fetprofiles/_tabs.html.erb +++ b/app/views/fetprofiles/_tabs.html.erb @@ -2,7 +2,7 @@
  • > <%= link_to I18n.t('profile.active_members') , fetprofiles_path( filter: "active") %>
  • -
  • +
  • > <%= link_to I18n.t('profile.all_groups'), gremien_path %>
  • <% for g in @gremientabs %> @@ -10,15 +10,31 @@ <%= link_to g.name, g %> <% end %> + + <% Gremium::FILTER.each do |fid,filtername| %> +
  • > + <%= link_to filtername , gremien_path( filter: fid) %> +
  • + <% end %> + + +
  • > + <%= link_to I18n.t('profile.notactive_members') , fetprofiles_path( filter: "notactive") %> +
  • +
  • > <%= link_to I18n.t('profile.all_members') , fetprofiles_path( filter: "all") %>
  • + + + + <% if can?(:verwalten,Gremium) %> <% if request.fullpath == verwalten_gremien_path %>
  • - <% else %> + <% else %>
  • - <% end %> + <% end %> <%= link_to I18n.t('common.verwalten'), verwalten_gremien_path %>
  • <% end %> diff --git a/app/views/gremien/index.html.erb b/app/views/gremien/index.html.erb index 5390cb7..a1b70e3 100644 --- a/app/views/gremien/index.html.erb +++ b/app/views/gremien/index.html.erb @@ -1,7 +1,12 @@ <%= render 'fetprofiles/tabs' %>

    Alle Gremien

    +<% unless params[:filter].nil? %> +

    <%= Gremium::TEXT[params[:filter]] %>

    +<% end %> +