gremien kategorien wie berufungsgruppen

This commit is contained in:
Andreas Stephanides
2013-12-18 09:42:11 +01:00
parent 578b716275
commit ec17e4f04f
6 changed files with 42 additions and 9 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -2,7 +2,7 @@
<li <%= (request.fullpath == fetprofiles_path(filter: "active")|| request.fullpath == fetprofiles_path) ? 'class="active"'.html_safe : ''%> >
<%= link_to I18n.t('profile.active_members') , fetprofiles_path( filter: "active") %>
</li>
<li>
<li <%= request.fullpath == gremien_path ? 'class="active"'.html_safe : '' %> >
<%= link_to I18n.t('profile.all_groups'), gremien_path %>
</li>
<% for g in @gremientabs %>
@@ -10,15 +10,31 @@
<%= link_to g.name, g %>
</li>
<% end %>
<% Gremium::FILTER.each do |fid,filtername| %>
<li <%= (request.fullpath == gremien_path(filter: fid)) ? 'class="active"'.html_safe : ''%> >
<%= link_to filtername , gremien_path( filter: fid) %>
</li>
<% end %>
<li <%= (request.fullpath == fetprofiles_path(filter: "notactive")|| request.fullpath == fetprofiles_path) ? 'class="active"'.html_safe : ''%> >
<%= link_to I18n.t('profile.notactive_members') , fetprofiles_path( filter: "notactive") %>
</li>
<li <%= (request.fullpath == fetprofiles_path(filter: "all")) ? 'class="active"'.html_safe : ''%> >
<%= link_to I18n.t('profile.all_members') , fetprofiles_path( filter: "all") %>
</li>
<% if can?(:verwalten,Gremium) %>
<% if request.fullpath == verwalten_gremien_path %>
<li class="active pull-right">
<% else %>
<% else %>
<li class="pull-right">
<% end %>
<% end %>
<%= link_to I18n.t('common.verwalten'), verwalten_gremien_path %>
</li>
<% end %>

View File

@@ -1,7 +1,12 @@
<%= render 'fetprofiles/tabs' %>
<h1>Alle Gremien</h1>
<% unless params[:filter].nil? %>
<p><%= Gremium::TEXT[params[:filter]] %></p>
<% end %>
<ul class="unstyled fetprofile_list">
<% @gremien.each do |g| %>
<li>
<%= link_to g do %>

View File

@@ -4,4 +4,10 @@ de:
all_members: "Alle Mitglieder"
all_groups: "Alle Gremien und Gruppen"
active_members: "Aktive Mitglieder"
notactive_members: "Pension"
new_profile: "Neues Profil anlegen"
gremium:
filter:
berufung:
title: "Berufungskommission"
text: "B.."