This commit is contained in:
HausdorffHimself
2013-09-12 00:58:52 +02:00
13 changed files with 74 additions and 24 deletions

View File

@@ -99,3 +99,6 @@ box-shadow:none;
#contentdiv{ #contentdiv{
background: #FFFFFF background: #FFFFFF
} }
#contentdiv .container-fluid
{ padding:0;
}

View File

@@ -1,3 +1,7 @@
// Place all the styles related to the fetprofiles controller here. // Place all the styles related to the fetprofiles controller here.
// They will automatically be included in application.css. // They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/ // You can use Sass (SCSS) here: http://sass-lang.com/
ul.fetprofile_list li a {
display:block
}

View File

@@ -9,3 +9,6 @@ background: white;
padding:10px; padding:10px;
} }
div .neuigkeit_block:hover {
box-shadow: 1px 1px 2px 2px lightgray;
}

View File

@@ -16,3 +16,9 @@ border-radius:2px;
border-color: blue; border-color: blue;
margin: 5px; margin: 5px;
} }
a.studium {
display:block
}
a.studium:hover {
box-shadow: 1px 1px 2px 2px lightgray;
}

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

@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# == Schema Information # == Schema Information
# #
# Table name: calentries # Table name: calentries
@@ -17,15 +18,14 @@ class Calentry < ActiveRecord::Base
validates :start, :presence => true validates :start, :presence => true
validates :typ, :presence => true validates :typ, :presence => true
before_save :get_public before_save :get_public
belongs_to :object, polymorphic: true belongs_to :object, polymorphic: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
validate do |entry| validate do |entry|
if entry.ende.nil? if entry.ende.nil?
errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein") errors.add(:ende, "Es muss ein Endzeitpunkt vorhanden sein")
end end
end end
resourcify resourcify
def get_public def get_public
self.public = (self.try(:object).nil?)? (self.calendars.public.count>0) : object.try(:public) self.public = (self.try(:object).nil?)? (self.calendars.public.count>0) : object.try(:public)
@@ -38,7 +38,11 @@ class Calentry < ActiveRecord::Base
start.to_date start.to_date
end end
def name def name
summary unless self.object.nil?
self.object.name
else
summary
end
end end
scope :public, -> { where(:public => :true) } scope :public, -> { where(:public => :true) }
scope :upcoming, -> { where("start >= ?" , Time.now).where("start <= ?", 8.days.from_now) } scope :upcoming, -> { where("start >= ?" , Time.now).where("start <= ?", 8.days.from_now) }

View File

@@ -12,14 +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"} # Kategorien, im Wesentlichen wichtig für Listung oder nicht Listung
GESCHLECHT={0=>"saechlich", 1 => "maennlich", 2 => "weiblich"} GESCHLECHT={0=>"saechlich", 1 => "maennlich", 2 => "weiblich"} # Geschlecht des Gremiums zur richtige Deklination
ART2FALL={0=>"des", 1=>"des",2=>"der"} ART2FALL={0=>"des", 1=>"des",2=>"der"} # Artikel 2.Fall abhängig vom Geschlecht
attr_accessible :desc, :name, :typ, :geschlecht,:thema_id attr_accessible :desc, :name, :typ, :geschlecht,:thema_id
has_many :memberships has_many :memberships # Mitgliedschaften bei dem Gremium
belongs_to :thema belongs_to :thema # Gehört zu einem Thema
scope :tabs, -> { where(:typ => [1,2]) } scope :tabs, -> { where(:typ => [1,3]).order(:typ).order(:name) } # Gremien die in Tabs angezeigt werden (Alle Anderen nur in der Liste
# Gremium im 2. Fall für die Konstruktion "Mitglied des ... / der ... "
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":"")
end end

View File

@@ -1,7 +1,7 @@
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li <%= (request.fullpath == fetprofiles_path(filter: "active")|| request.fullpath == fetprofiles_path) ? 'class="active"'.html_safe : ''%> > <li <%= (request.fullpath == fetprofiles_path(filter: "active")|| request.fullpath == fetprofiles_path) ? 'class="active"'.html_safe : ''%> >
<%= link_to "Aktive Mitglieder" , fetprofiles_path( filter: "active") %> </li> <%= link_to "Aktive Mitglieder" , fetprofiles_path( filter: "active") %> </li>
<li><%= link_to "Alle Gremien und Gruppen", gremien_path %></li>
<% for g in @gremientabs %> <% for g in @gremientabs %>
<li <%= (!@gremium.nil? && g == @gremium) ? 'class="active"'.html_safe : '' %> title="<%= g.name %>"> <li <%= (!@gremium.nil? && g == @gremium) ? 'class="active"'.html_safe : '' %> title="<%= g.name %>">
<%= link_to g.name, g %> <%= link_to g.name, g %>

View File

@@ -5,19 +5,21 @@
<%= I18n.t 'fetprofiles.active' if params[:filter].nil? || params[:filter]== "active" <%= I18n.t 'fetprofiles.active' if params[:filter].nil? || params[:filter]== "active"
%> %>
</h1> </h1>
<ul class="unstyled"> <ul class="unstyled fetprofile_list">
<% @fetprofiles.each do |fetprofile| %> <% @fetprofiles.each do |fetprofile| %>
<li> <li>
<%= link_to fetprofile do %> <%= link_to fetprofile do %>
<div class="media">
<span class="pull-left"> <span class="pull-left">
<%= image_tag fetprofile.picture.portrait.url %> <%= image_tag fetprofile.picture.portrait.url %>
</span> </span>
<div class=""> <div class="media-body">
<h2><%= fetprofile.name %></h2> <h2><%= fetprofile.name %></h2>
<p><%= fetprofile.fetmail %></p> <p><%= fetprofile.fetmail %></p>
<p><%= fetprofile.desc %></p> <p><%= fetprofile.desc %></p>
</div>
</div> </div>
<% end %> <% end %>
</li> </li>

View File

@@ -0,0 +1,13 @@
<%= render 'fetprofiles/tabs' %>
<h1>Alle Gremien</h1>
<ul class="unstyled fetprofile_list">
<% @gremien.each do |g| %>
<li>
<%= link_to g do %>
<h2><%= g.name %></h2>
<p><%= g.desc %></p>
<% end %>
</li>
<% end %>
</ul>

View File

@@ -1,6 +1,14 @@
<div class="studium"> <%= link_to studium_path(studium, :ansicht=>'semesteransicht') ,{:class=>"studium"} do %>
<h2><%= link_to studium.name + " " + studium.zahl.to_s, studium_path(studium, :ansicht=>'semesteransicht')%></h2> <p><b><%= studium.typ%> </b></p>
<p><b><%=I18n.t("studien.desc")%>:</b><br>
<%= !(studium.desc.to_s == "") ? studium.desc.html_safe : I18n.t("keine.beschreibung")%></p>
</div> <h2>
<%= studium.name + " " + studium.zahl.to_s %>
</h2>
<p>
<b><%= studium.typ%> </b>
</p>
<p><b><%=I18n.t("studien.desc")%>:</b><br>
<%= !(studium.desc.to_s == "") ? studium.desc.html_safe : I18n.t("keine.beschreibung")%>
</p>
<% end %>

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