forked from bofh/fetsite
Merge branch 'master' of https://github.com/fetsite/fetsite
This commit is contained in:
257
Gemfile.lock
257
Gemfile.lock
@@ -1,257 +0,0 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actionmailer (3.2.9)
|
||||
actionpack (= 3.2.9)
|
||||
mail (~> 2.4.4)
|
||||
actionpack (3.2.9)
|
||||
activemodel (= 3.2.9)
|
||||
activesupport (= 3.2.9)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.4)
|
||||
rack (~> 1.4.0)
|
||||
rack-cache (~> 1.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.2.1)
|
||||
activemodel (3.2.9)
|
||||
activesupport (= 3.2.9)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.9)
|
||||
activemodel (= 3.2.9)
|
||||
activesupport (= 3.2.9)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.9)
|
||||
activemodel (= 3.2.9)
|
||||
activesupport (= 3.2.9)
|
||||
activesupport (3.2.9)
|
||||
i18n (~> 0.6)
|
||||
multi_json (~> 1.0)
|
||||
annotate (2.5.0)
|
||||
rake
|
||||
arel (3.0.2)
|
||||
awesome_nested_set (2.1.6)
|
||||
activerecord (>= 3.0.0)
|
||||
bcrypt-ruby (3.0.1)
|
||||
bcrypt-ruby (3.0.1-x86-mingw32)
|
||||
bootstrap-addons-rails (0.1.2)
|
||||
rails
|
||||
bootstrap-sass (2.3.2.1)
|
||||
sass (~> 3.2)
|
||||
builder (3.0.4)
|
||||
cancan (1.6.9)
|
||||
carrierwave (0.9.0)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
json (>= 1.7)
|
||||
cocaine (0.4.2)
|
||||
coffee-rails (3.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (~> 3.2.0)
|
||||
coffee-script (2.2.0)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.4.0)
|
||||
devise (2.2.3)
|
||||
bcrypt-ruby (~> 3.0)
|
||||
orm_adapter (~> 0.1)
|
||||
railties (~> 3.1)
|
||||
warden (~> 1.2.1)
|
||||
diff-lcs (1.2.4)
|
||||
erubis (2.7.0)
|
||||
execjs (1.4.0)
|
||||
multi_json (~> 1.0)
|
||||
factory_girl (4.2.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.2.1)
|
||||
factory_girl (~> 4.2.0)
|
||||
railties (>= 3.0.0)
|
||||
faraday (0.8.8)
|
||||
multipart-post (~> 1.2.0)
|
||||
formtastic (2.2.1)
|
||||
actionpack (>= 3.0)
|
||||
formtastic-bootstrap (2.1.3)
|
||||
formtastic (~> 2.2)
|
||||
git (1.2.5)
|
||||
globalize3 (0.3.0)
|
||||
activemodel (>= 3.0.0)
|
||||
activerecord (>= 3.0.0)
|
||||
paper_trail (~> 2)
|
||||
haml (4.0.0)
|
||||
tilt
|
||||
hashie (2.0.5)
|
||||
hike (1.2.1)
|
||||
httpauth (0.2.0)
|
||||
i18n (0.6.1)
|
||||
journey (1.0.4)
|
||||
jquery-fileupload-rails (0.4.1)
|
||||
actionpack (>= 3.1)
|
||||
railties (>= 3.1)
|
||||
jquery-rails (2.2.1)
|
||||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (1.7.7)
|
||||
jwt (0.1.8)
|
||||
multi_json (>= 1.5)
|
||||
libv8 (3.11.8.13)
|
||||
mail (2.4.4)
|
||||
i18n (>= 0.4.0)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.21)
|
||||
mini_portile (0.5.2)
|
||||
multi_json (1.5.1)
|
||||
multipart-post (1.2.0)
|
||||
mysql2 (0.3.13)
|
||||
net-ldap (0.2.2)
|
||||
nokogiri (1.5.6)
|
||||
nokogiri (1.6.0)
|
||||
mini_portile (~> 0.5.0)
|
||||
nokogiri (1.6.0-x86-mingw32)
|
||||
mini_portile (~> 0.5.0)
|
||||
oauth2 (0.8.1)
|
||||
faraday (~> 0.8)
|
||||
httpauth (~> 0.1)
|
||||
jwt (~> 0.1.4)
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.2)
|
||||
omniauth (1.1.4)
|
||||
hashie (>= 1.2, < 3)
|
||||
rack
|
||||
omniauth-facebook (1.4.1)
|
||||
omniauth-oauth2 (~> 1.1.0)
|
||||
omniauth-ldap (1.0.3)
|
||||
net-ldap (~> 0.2.2)
|
||||
omniauth (~> 1.0)
|
||||
pyu-ruby-sasl (~> 0.0.3.1)
|
||||
rubyntlm (~> 0.1.1)
|
||||
omniauth-oauth2 (1.1.1)
|
||||
oauth2 (~> 0.8.0)
|
||||
omniauth (~> 1.0)
|
||||
orm_adapter (0.4.0)
|
||||
paper_trail (2.7.0)
|
||||
activerecord (~> 3.0)
|
||||
railties (~> 3.0)
|
||||
paperclip (3.4.0)
|
||||
activemodel (>= 3.0.0)
|
||||
activerecord (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
cocaine (~> 0.4.0)
|
||||
mime-types
|
||||
polyglot (0.3.3)
|
||||
pyu-ruby-sasl (0.0.3.3)
|
||||
rack (1.4.5)
|
||||
rack-cache (1.2)
|
||||
rack (>= 0.4)
|
||||
rack-ssl (1.3.3)
|
||||
rack
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.9)
|
||||
actionmailer (= 3.2.9)
|
||||
actionpack (= 3.2.9)
|
||||
activerecord (= 3.2.9)
|
||||
activeresource (= 3.2.9)
|
||||
activesupport (= 3.2.9)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.9)
|
||||
railties (3.2.9)
|
||||
actionpack (= 3.2.9)
|
||||
activesupport (= 3.2.9)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.0.3)
|
||||
rdoc (3.12.1)
|
||||
json (~> 1.4)
|
||||
ref (1.0.2)
|
||||
rmagick (2.13.2)
|
||||
rolify (3.2.0)
|
||||
rspec-core (2.14.4)
|
||||
rspec-expectations (2.14.0)
|
||||
diff-lcs (>= 1.1.3, < 2.0)
|
||||
rspec-mocks (2.14.1)
|
||||
rspec-rails (2.14.0)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
railties (>= 3.0)
|
||||
rspec-core (~> 2.14.0)
|
||||
rspec-expectations (~> 2.14.0)
|
||||
rspec-mocks (~> 2.14.0)
|
||||
rubyntlm (0.1.1)
|
||||
sanitize (2.0.6)
|
||||
nokogiri (>= 1.4.4)
|
||||
sass (3.2.5)
|
||||
sass-rails (3.2.6)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
tilt (~> 1.3)
|
||||
seed_dump (0.5.3)
|
||||
simple_calendar (0.1.9)
|
||||
rails (>= 3.0)
|
||||
sprockets (2.2.2)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
sqlite3 (1.3.7)
|
||||
sqlite3 (1.3.7-x86-mingw32)
|
||||
therubyracer (0.11.3)
|
||||
libv8 (~> 3.11.8.12)
|
||||
ref
|
||||
thor (0.17.0)
|
||||
tilt (1.3.3)
|
||||
tinymce-rails (3.5.8)
|
||||
railties (>= 3.1.1)
|
||||
treetop (1.4.12)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.35)
|
||||
uglifier (1.3.0)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (~> 1.0, >= 1.0.2)
|
||||
warden (1.2.1)
|
||||
rack (>= 1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
x86-mingw32
|
||||
|
||||
DEPENDENCIES
|
||||
annotate (>= 2.5.0)
|
||||
awesome_nested_set
|
||||
bootstrap-addons-rails
|
||||
bootstrap-sass (~> 2.3.2.1)
|
||||
cancan
|
||||
carrierwave (~> 0.9.0)
|
||||
coffee-rails (~> 3.2.1)
|
||||
devise (~> 2.2.3)
|
||||
execjs (~> 1.4.0)
|
||||
factory_girl_rails
|
||||
formtastic (~> 2.2.1)
|
||||
formtastic-bootstrap (~> 2.1.3)
|
||||
git
|
||||
globalize3 (~> 0.3.0)
|
||||
haml
|
||||
jquery-fileupload-rails
|
||||
jquery-rails
|
||||
mysql2
|
||||
omniauth
|
||||
omniauth-facebook
|
||||
omniauth-ldap
|
||||
paper_trail (>= 2.7.0)
|
||||
paperclip (~> 3.4.0)
|
||||
rails (= 3.2.9)
|
||||
rmagick
|
||||
rolify
|
||||
rspec-rails
|
||||
sanitize
|
||||
sass-rails (~> 3.2)
|
||||
seed_dump (~> 0.5.3)
|
||||
simple_calendar (~> 0.1.9)
|
||||
sqlite3
|
||||
therubyracer
|
||||
tinymce-rails (>= 3.5.8)
|
||||
uglifier (>= 1.0.3)
|
||||
@@ -2,14 +2,14 @@ class CalentriesController < ApplicationController
|
||||
# GET /calentries
|
||||
# GET /calentries.json
|
||||
load_and_authorize_resource
|
||||
def index
|
||||
@calentries = Calentry.all
|
||||
# def index
|
||||
# @calentries = Calentry.all
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @calentries }
|
||||
end
|
||||
end
|
||||
# respond_to do |format|
|
||||
# format.html # index.html.erb
|
||||
# format.json { render json: @calentries }
|
||||
# end
|
||||
# end
|
||||
|
||||
# GET /calentries/1
|
||||
# GET /calentries/1.json
|
||||
@@ -25,35 +25,36 @@ class CalentriesController < ApplicationController
|
||||
|
||||
# GET /calentries/new
|
||||
# GET /calentries/new.json
|
||||
def new
|
||||
@calentry = Calentry.new
|
||||
# def new
|
||||
# @calentry = Calentry.new
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @calentry }
|
||||
end
|
||||
end
|
||||
# respond_to do |format|
|
||||
# format.html # new.html.erb
|
||||
# format.json { render json: @calentry }
|
||||
# end
|
||||
# end
|
||||
|
||||
# GET /calentries/1/edit
|
||||
def edit
|
||||
@calentry = Calentry.find(params[:id])
|
||||
end
|
||||
#def edit
|
||||
# @calentry = Calentry.find(params[:id])
|
||||
|
||||
# end
|
||||
|
||||
# POST /calentries
|
||||
# POST /calentries.json
|
||||
def create
|
||||
@calentry = Calentry.new(params[:calentry])
|
||||
# def create
|
||||
# @calentry = Calentry.new(params[:calentry])
|
||||
|
||||
respond_to do |format|
|
||||
if @calentry.save
|
||||
format.html { redirect_to @calentry, notice: 'Calentry was successfully created.' }
|
||||
format.json { render json: @calentry, status: :created, location: @calentry }
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @calentry.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
# respond_to do |format|
|
||||
# if @calentry.save
|
||||
# format.html { redirect_to @calentry, notice: 'Calentry was successfully created.' }
|
||||
# format.json { render json: @calentry, status: :created, location: @calentry }
|
||||
# else
|
||||
# format.html { render action: "new" }
|
||||
# format.json { render json: @calentry.errors, status: :unprocessable_entity }
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
# PUT /calentries/1
|
||||
# PUT /calentries/1.json
|
||||
|
||||
@@ -50,6 +50,8 @@ class FetprofilesController < ApplicationController
|
||||
# GET /fetprofiles/1/edit
|
||||
def edit
|
||||
@fetprofile = Fetprofile.find(params[:id])
|
||||
@memberships=@fetprofile.memberships.order(:typ)
|
||||
@memberships<<Membership.new
|
||||
end
|
||||
|
||||
# POST /fetprofiles
|
||||
|
||||
@@ -45,6 +45,10 @@ class GremienController < ApplicationController
|
||||
# GET /gremien/1/edit
|
||||
def edit
|
||||
@gremium = Gremium.find(params[:id])
|
||||
|
||||
@memberships=@gremium.memberships.order(:fetprofile_id).active
|
||||
@memberships<<Membership.new
|
||||
|
||||
end
|
||||
|
||||
# POST /gremien
|
||||
|
||||
@@ -8,15 +8,17 @@ class NeuigkeitenController < ApplicationController
|
||||
@neuigkeit.versions.reverse[params[:version].to_i].reify.save!
|
||||
@neuigkeit=Neuigkeit.find(params[:id])
|
||||
end
|
||||
|
||||
@calentries1=@neuigkeit.calentries
|
||||
if params[:verwalten]
|
||||
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('neuigkeit.publish'),:path => publish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>"Sure?" } if can? :publish, @neuigkeit
|
||||
@toolbar_elements << {:hicon=>'icon-minus', :text=> I18n.t('neuigkeit.unpublish'),:path => unpublish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>"Sure?" } if can? :unpublish, @neuigkeit
|
||||
@toolbar_elements << {:hicon=>'icon-minus', :text=> I18n.t('neuigkeit.unpublish'),:path => unpublish_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:confirm=>"Sure?" } if can?(:unpublish, @neuigkeit) && !@neuigkeit.published?
|
||||
|
||||
@toolbar_elements << {:text=>I18n.t('common.edit'),:path=>edit_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:icon=>:pencil} if can? :edit, @neuigkeit.rubrik
|
||||
@versions= @neuigkeit.versions.select([:created_at]).reverse
|
||||
@toolbar_elements <<{:path=>rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:method=>:versions,:versions=>@versions}
|
||||
@toolbar_elements << {:text=>I18n.t('common.edit'),:path=>edit_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:icon=>:pencil} if can? :edit, @neuigkeit.rubrik
|
||||
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :method=> :delete,:confirm=>"Sure?" } if can? :delete, @neuigkeit
|
||||
@toolbar_elements << {:path=> add_calentry_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :text=>"Add Calentry", :icon=>:plus}
|
||||
|
||||
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=> I18n.t('common.delete'),:path => rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :method=> :delete,:confirm=>'Sure?' } if can? :delete, @neuigkeit
|
||||
# @toolbar_elements << {:path=> add_calentry_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit), :text=>"Add Calentry", :icon=>:plus}
|
||||
|
||||
else
|
||||
@toolbar_elements << {:text=>I18n.t('common.verwalten'),:path=>rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit,{:verwalten=>true}),:icon=>:pencil} if can? :verwalten, @neuigkeit
|
||||
@@ -66,6 +68,9 @@ class NeuigkeitenController < ApplicationController
|
||||
def edit
|
||||
@neuigkeit = Neuigkeit.find(params[:id])
|
||||
@toolbar_elements << {:text=>I18n.t('common.show'),:path=>rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit)} if can? :show, @neuigkeit
|
||||
@calentries= @neuigkeit.calentries
|
||||
@calentries<< Calentry.new
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
|
||||
@@ -9,6 +9,17 @@ class RubrikenController < ApplicationController
|
||||
def show
|
||||
@rubrik = Rubrik.find(params[:id])
|
||||
@moderatoren=User.with_role(:newsmoderator,@rubrik)
|
||||
if can?(:showunpublished, Neuigkeit)
|
||||
@neuigkeiten = @rubrik.neuigkeiten
|
||||
else
|
||||
@neuigkeiten = @rubrik.neuigkeiten.published
|
||||
end
|
||||
@toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'),:path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik
|
||||
|
||||
@toolbar_elements << {:text=>I18n.t('common.verwalten'),:path=>verwalten_rubrik_path(@rubrik),:icon=>:pencil} if can? :verwalten, @rubrik
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@@ -78,6 +89,9 @@ class RubrikenController < ApplicationController
|
||||
@neuigkeiten_unpublished = @rubrik.neuigkeiten.unpublished
|
||||
@neuigkeiten_published=@rubrik.neuigkeiten.published
|
||||
@moderatoren=User.with_role(:newsmoderator,@rubrik)
|
||||
@toolbar_elements << {:text=>I18n.t('neuigkeit.new.title'),:path=> new_rubrik_neuigkeit_path(@rubrik),:hicon=>'icon-plus-sign'} if can? :verwalten, @rubrik
|
||||
|
||||
|
||||
end
|
||||
|
||||
# Alle Rubriken verwalten und Sachen einstellen..
|
||||
|
||||
@@ -71,6 +71,7 @@ class Ability
|
||||
if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser")
|
||||
can :manage, Rubrik
|
||||
can :manage, Neuigkeit
|
||||
can :showunpublished, Neuigkeit
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class Calendar < ActiveRecord::Base
|
||||
has_many :calentries
|
||||
mount_uploader :picture, PictureUploader
|
||||
belongs_to :rubrik
|
||||
validates :rubrik, :presence=>true
|
||||
# validates :rubrik, :presence=>true
|
||||
|
||||
resourcify
|
||||
scope :public_cals, -> { where(:public => :true) }
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
#
|
||||
|
||||
class Calentry < ActiveRecord::Base
|
||||
attr_accessible :ende, :start, :summary, :typ,:calendar_ids, :calendar
|
||||
attr_accessible :ende, :start, :summary, :typ,:calendar_ids, :calendar, :dauer
|
||||
belongs_to :calendar
|
||||
belongs_to :neuigkeit
|
||||
#belongs_to :neuigkeit
|
||||
validates :start, :presence => true
|
||||
validates :object, :presence => true
|
||||
validates :typ, :presence => true
|
||||
before_save :get_public
|
||||
belongs_to :object, polymorphic: true # Objekt zu dem der Calentry gehört (derzeit ein Newsartikel)
|
||||
@@ -38,6 +39,17 @@ validate do |entry|
|
||||
def start1
|
||||
start.to_date
|
||||
end
|
||||
def dauer
|
||||
if self.ende.nil? && self.start.nil?
|
||||
0
|
||||
else
|
||||
self.ende = self.start unless self.start.nil?
|
||||
(self.ende-self.start)/3600
|
||||
end
|
||||
end
|
||||
def dauer=(dauer)
|
||||
self.ende=self.start+dauer.to_i.hours
|
||||
end
|
||||
def name
|
||||
unless self.object.nil?
|
||||
self.object.name
|
||||
|
||||
@@ -20,10 +20,15 @@ class Fetprofile < ActiveRecord::Base
|
||||
has_many :gremien, :through=> :membership
|
||||
mount_uploader :picture, PictureUploader
|
||||
has_paper_trail
|
||||
validates :desc, :presence=>true
|
||||
validates :nachname, length:{minimum: 3},:presence=>true
|
||||
validates :vorname, length:{minimum: 3},:presence=>true
|
||||
validates :short, length:{minimum: 3},:presence=>true
|
||||
|
||||
def name
|
||||
[vorname, nachname, "(",short,")"].join(" ")
|
||||
end
|
||||
accepts_nested_attributes_for :memberships
|
||||
accepts_nested_attributes_for :memberships, :reject_if=>lambda{|a| a[:typ].blank?|| a[:start].blank? ||a[:fetprofile_id].blank?}
|
||||
scope :active, -> { where(:active=>true).order(:vorname) }
|
||||
def fetmail
|
||||
(fetmailalias.nil? || fetmailalias.empty?) ? short.to_s + "@fet.at" : fetmailalias.to_s + "@fet.at"
|
||||
|
||||
@@ -15,11 +15,12 @@ class Gremium < ActiveRecord::Base
|
||||
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 des Gremiums zur richtige Deklination
|
||||
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, :memberships_attributes
|
||||
has_many :memberships # Mitgliedschaften bei dem Gremium
|
||||
belongs_to :thema # Gehört zu einem Thema
|
||||
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 ... "
|
||||
accepts_nested_attributes_for :memberships, :reject_if=>lambda{|a| a[:typ].blank?|| a[:start].blank? ||a[:fetprofile_id].blank?}
|
||||
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
|
||||
|
||||
@@ -18,5 +18,7 @@ class Membership < ActiveRecord::Base
|
||||
belongs_to :fetprofile
|
||||
belongs_to :gremium
|
||||
scope :active, -> {where("stop >= ? OR stop IS NULL", Time.now.to_date)}
|
||||
|
||||
validates :typ, :presence=>true
|
||||
validates :fetprofile, :presence=>true
|
||||
validates :start, :presence=>true
|
||||
end
|
||||
|
||||
@@ -14,33 +14,48 @@
|
||||
|
||||
class Neuigkeit < ActiveRecord::Base
|
||||
|
||||
attr_accessible :datum, :text, :title, :rubrik_id, :author_id,:picture, :calentry_attributes
|
||||
attr_accessible :datum, :text, :title, :rubrik_id, :author_id,:picture, :calentries_attributes
|
||||
belongs_to :author, :class_name =>'User'
|
||||
belongs_to :rubrik, :class_name =>'Rubrik', :foreign_key => "rubrik_id"
|
||||
validates :rubrik, :presence=>true
|
||||
validates :author, :presence=>true
|
||||
translates :title,:text, :versioning=>true, :fallbacks_for_empty_translations => true
|
||||
has_one :calentry
|
||||
has_many :calentries, inverse_of: :object
|
||||
mount_uploader :picture, PictureUploader
|
||||
scope :published, -> {where("datum <= ? AND datum IS NOT NULL", Time.now.to_date).order(:datum).reverse_order}
|
||||
scope :recent, -> { published.where("updated_at >= ? ",Time.now - 7.days)}
|
||||
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
|
||||
scope :public, ->{includes(:rubrik).where("rubriken.public"=>:true)}
|
||||
accepts_nested_attributes_for :calentry
|
||||
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
||||
before_save :sanitize
|
||||
def datum_nilsave
|
||||
self.datum.nil? ? Time.now + 42.years : self.datum
|
||||
end
|
||||
def public
|
||||
self.rubrik.public && self.datum_nilsave >=Time.now.to_date
|
||||
end
|
||||
def published?
|
||||
self.datum_nilsave>=Time.now.to_date
|
||||
end
|
||||
|
||||
def publish
|
||||
self.datum = Date.today
|
||||
end
|
||||
def reverse_publish
|
||||
self.datum = nil
|
||||
end
|
||||
def name
|
||||
self.title
|
||||
end
|
||||
def text_first_words
|
||||
md = /<p>(?<text>[\w\s,\.!\?]*)/.match self.text
|
||||
md[:text].split(" ")[0..100].join(" ")+ " ..."
|
||||
end
|
||||
private
|
||||
def sanitize
|
||||
self.calentries.each do |calentry|
|
||||
calentry.calendar= self.rubrik.calendar
|
||||
calentry.typ=1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -11,11 +11,12 @@
|
||||
#
|
||||
|
||||
class Rubrik < ActiveRecord::Base
|
||||
attr_accessible :desc, :name, :prio, :calendar
|
||||
attr_accessible :desc, :name, :prio, :calendar, :public
|
||||
has_many :neuigkeiten, :class_name => "Neuigkeit"
|
||||
has_many :calentries, :through => :neuigkeiten, :as=>:object
|
||||
resourcify
|
||||
has_one :calendar
|
||||
validates :calender , :presence=>true
|
||||
def moderator
|
||||
u=User.with_role(:newsmoderator).first
|
||||
if !u.nil?
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<span class="pull-left" >
|
||||
<img class="media-object img-circle" src="<%= calendar.picture.thumb.url %>"/>
|
||||
</span>
|
||||
y<div class="media-body">
|
||||
<div class="media-body">
|
||||
<h4><%= calendar.name %></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<%= calendar @calendar.calentries do |entry| %>
|
||||
<div><%= link_to entry.name.to_s, entry %></div>
|
||||
<div><%= link_to entry.name.to_s, polymorphic_path(entry.object) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
|
||||
9
app/views/calentries/_calentry.html.erb
Normal file
9
app/views/calentries/_calentry.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="contentbox">
|
||||
<%= image_tag("/icon_kalender_small.png") %>
|
||||
<% if calentry.start.to_date == calentry.ende.to_date
|
||||
format=:timeonly
|
||||
else
|
||||
format =:default
|
||||
end%>
|
||||
<%= link_to I18n.l(calentry.start) +" bis "+ I18n.l(calentry.ende,:format=>format), calendar_path(calentry.calendar) %>
|
||||
</div>
|
||||
9
app/views/calentries/_nested_fields.html.erb
Normal file
9
app/views/calentries/_nested_fields.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<div class="row-fluid">
|
||||
<div class="span1"></div><div class="span1">
|
||||
<%= image_tag("/icon_kalender_small.png") %>
|
||||
</div>
|
||||
<div class="span4">
|
||||
<%= f.input :start, :as => :datepicker %></div><div class="span4">
|
||||
<%= f.input :dauer , :as => :string, :append=>"h" %></div><div class="span1">
|
||||
<% f.input :typ %></div> <div class="span1"><%= f.check_box :_destroy %> <%= I18n.t 'common.delete' %></div>
|
||||
</div>
|
||||
@@ -22,15 +22,19 @@
|
||||
<%= f.hidden_field :picture_cache %>
|
||||
<label>
|
||||
<%= f.check_box :remove_picture %>
|
||||
Bild Entfernen
|
||||
<%= I18n.t('profile.remove_picture') %>
|
||||
</label>
|
||||
</div>
|
||||
<div class="span4"> <%= f.input :fetmailalias %></div>
|
||||
</div>
|
||||
|
||||
<%= f.inputs :for => :memberships do |membership,i| %>
|
||||
<% @memberships.each do |m| %>
|
||||
|
||||
<%= f.semantic_fields_for :memberships, m do |membership| %>
|
||||
|
||||
<div class="row-fluid">
|
||||
<div class="span1"></div>
|
||||
|
||||
<div class="span3"><%= membership.input :start, :as=>:datepicker, :prepend=>"von",:label=>false%></div>
|
||||
<div class="span3"><%= membership.input :stop, :as=>:datepicker,:label=>false, :prepend =>"bis" %></div>
|
||||
<div class="span2"><%= membership.input :typ ,:as=>:select, :collection=>Membership::TYPEN.invert, :label=>false %></div>
|
||||
@@ -39,7 +43,7 @@
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %> <% end %>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<%= f.actions do %>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<ul class="nav nav-tabs">
|
||||
<li <%= (request.fullpath == fetprofiles_path(filter: "active")|| request.fullpath == fetprofiles_path) ? 'class="active"'.html_safe : ''%> >
|
||||
<%= link_to "Aktive Mitglieder" , fetprofiles_path( filter: "active") %>
|
||||
<%= link_to I18n.t('profile.active_members') , fetprofiles_path( filter: "active") %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "Alle Gremien und Gruppen", gremien_path %>
|
||||
<%= link_to I18n.t('profile.all_groups'), gremien_path %>
|
||||
</li>
|
||||
<% for g in @gremientabs %>
|
||||
<li <%= (!@gremium.nil? && g == @gremium) ? 'class="active"'.html_safe : '' %> title="<%= g.name %>">
|
||||
@@ -11,7 +11,7 @@
|
||||
</li>
|
||||
<% end %>
|
||||
<li <%= (request.fullpath == fetprofiles_path(filter: "all")) ? 'class="active"'.html_safe : ''%> >
|
||||
<%= link_to "Alle Mitglieder" , fetprofiles_path( filter: "all") %>
|
||||
<%= link_to I18n.t('profile.all_members') , fetprofiles_path( filter: "all") %>
|
||||
</li>
|
||||
<% if can?(:verwalten,Gremium) %>
|
||||
<% if request.fullpath == verwalten_gremien_path %>
|
||||
@@ -19,7 +19,7 @@
|
||||
<% else %>
|
||||
<li class="pull-right">
|
||||
<% end %>
|
||||
<%= link_to "Verwaltung", verwalten_gremien_path %>
|
||||
<%= link_to I18n.t('common.verwalten'), verwalten_gremien_path %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
<%= render 'fetprofiles/tabs' %>
|
||||
|
||||
<h1>
|
||||
<%= I18n.t 'fetprofiles.all' if params[:filter] == "all" %>
|
||||
<%= I18n.t 'fetprofiles.active' if params[:filter].nil? || params[:filter]== "active"
|
||||
<%= I18n.t 'profile.all_members' if params[:filter] == "all" %>
|
||||
<%= I18n.t 'profile.active_members' if params[:filter].nil? || params[:filter]== "active"
|
||||
%>
|
||||
</h1>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<h1>New fetprofile</h1>
|
||||
<h1><%= I18n.t('profile.new_profile')%></h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', fetprofiles_path %>
|
||||
<%= link_to I18n.t('common.back'), fetprofiles_path %>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
<% @fetprofile.memberships.each do |m| %>
|
||||
<li>
|
||||
<%= render m %>
|
||||
<%= link_to 'edit', edit_fetprofile_membership_path(@fetprofile,m) if params["verwalten"] && can?(:delete, m)%>
|
||||
<%= link_to 'delete', [@fetprofile, m], method: :delete, data: {confirm: 'Sure to delete?'} if params["verwalten"] && can?(:delete, m ) %>
|
||||
<%= link_to I18n.t('common.edit'), edit_fetprofile_membership_path(@fetprofile,m) if params["verwalten"] && can?(:edit, m)%>
|
||||
<%= link_to I18n.t('common.delete'), [@fetprofile, m], method: :delete, data: {confirm: I18n.t('common.sure_del')} if params["verwalten"] && can?(:delete, m ) %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
@@ -5,6 +5,36 @@
|
||||
<%= f.input :typ, :as => :select, :collection => Gremium::TYPEN.invert %>
|
||||
<%= f.input :geschlecht, :as => :select, :collection => Gremium::GESCHLECHT.invert %>
|
||||
<%= f.input :thema, :as=> :select, :collection => Thema.all %>
|
||||
|
||||
|
||||
<% f.inputs :for => :memberships, :objects=>@memberships do |membership,i| %>
|
||||
<div class="row-fluid">
|
||||
<div class="span1"></div>
|
||||
<div class="span3"><%= membership.input :start, :as=>:datepicker, :prepend=>"von",:label=>false%></div>
|
||||
<div class="span3"><%= membership.input :stop, :as=>:datepicker,:label=>false, :prepend =>"bis" %></div>
|
||||
<div class="span2"><%= membership.input :typ ,:as=>:select, :collection=>Membership::TYPEN.invert, :label=>false %></div>
|
||||
<div class="span3"><%= membership.input :fetprofile, :as=>:select, :label=>false %></div>
|
||||
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% @memberships.each do |m| %>
|
||||
|
||||
<%= f.semantic_fields_for :memberships, m do |memberships_attributes| %>
|
||||
<div class="row-fluid">
|
||||
<div class="span1"></div>
|
||||
<div class="span3"><%= memberships_attributes.input :start, :as=>:datepicker, :prepend=>"von",:label=>false%></div>
|
||||
<div class="span3"><%= memberships_attributes.input :stop, :as=>:datepicker,:label=>false, :prepend =>"bis" %></div>
|
||||
<div class="span2"><%= memberships_attributes.input :typ ,:as=>:select, :collection=>Membership::TYPEN.invert, :label=>false %></div>
|
||||
<div class="span3"><%= memberships_attributes.input :fetprofile, :as=>:select, :label=>false %></div>
|
||||
|
||||
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= f.actions do %>
|
||||
|
||||
@@ -1,23 +1,38 @@
|
||||
<%= tinymce_assets %>
|
||||
<div class="container-fluid">
|
||||
<%= semantic_form_for [@neuigkeit.rubrik,@neuigkeit] do |f| %>
|
||||
<%= f.inputs do %>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<%= f.input :title, :placeholder=> "Titel" %>
|
||||
<%= f.input :text, :as=> :tinymce_text %>
|
||||
<% f.input :datum, :as=> :datepicker %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<div class="span6">
|
||||
<% f.input :datum, :as=> :datepicker %>
|
||||
<%= f.input :rubrik, :as=> :radio, :collection=>Rubrik.all %>
|
||||
<%= f.input :author, :as=> :radio %>
|
||||
<%= f.input :picture, :as=> :file %>
|
||||
<% unless @neuigkeit.calentry.nil? %>
|
||||
<%= f.inputs :for => :calentry do |calentry| %>
|
||||
<%= calentry.input :start, :as => :datepicker %>
|
||||
<%= calentry.input :ende , :as => :datepicker %>
|
||||
<%= calentry.input :typ %>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<%= f.input :author, :as=> :select %>
|
||||
</div> </div>
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<%= f.input :picture, :as=> :file %>
|
||||
</div> </div>
|
||||
|
||||
|
||||
|
||||
|
||||
<%= f.semantic_fields_for :calentries , @calentries do |calentry| %>
|
||||
<%= render 'calentries/nested_fields', :f => calentry %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<%= f.actions do %>
|
||||
<%= f.action :submit, :as => :input %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<script>$('.datepicker').datepicker()</script>
|
||||
<%= tinymce %>
|
||||
|
||||
@@ -19,5 +19,7 @@
|
||||
<p></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% @calentries1.each do |ce|%>
|
||||
<%= render ce unless ce.nil? %>
|
||||
<% end %>
|
||||
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
<%= f.input :name %>
|
||||
<%= f.input :desc %>
|
||||
<%= f.input :prio %>
|
||||
<%= f.input :public %>
|
||||
|
||||
|
||||
<% end %>
|
||||
|
||||
<%= f.actions do %>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</i>
|
||||
|
||||
|
||||
<% @rubrik.neuigkeiten.each_slice(1) do |row| %>
|
||||
<% @neuigkeiten.each_slice(1) do |row| %>
|
||||
<ul class="unstyled" style="max-width:70em">
|
||||
<% row.each do |neuigkeit| %>
|
||||
<li>
|
||||
@@ -25,10 +25,9 @@
|
||||
<% end %>
|
||||
|
||||
|
||||
<br>
|
||||
|
||||
<%= link_to 'Verwalten', verwalten_rubrik_path(@rubrik) %> |
|
||||
<%= link_to '<i class="icon-plus-sign"></i>'.html_safe+"Neuer Artikel", new_rubrik_neuigkeit_path(@rubrik) %>
|
||||
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>
|
||||
|
||||
|
||||
<%= toolbar_html(@toolbar_elements)%>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<% if params[:info]==true %>
|
||||
<% if params[:info].true? %>
|
||||
<%= raw(@studium.desc) %>
|
||||
<% else %>
|
||||
<%= @studium.desc_first_words %> <%= link_to I18n.t('studium.info'), studium_path(@studium, :ansicht=>params[:ansicht], :info=>true) %>
|
||||
|
||||
@@ -194,4 +194,5 @@ de:
|
||||
default: ! '%d.%m.%Y, %H:%M Uhr'
|
||||
long: ! '%A, %d. %B %Y, %H:%M Uhr'
|
||||
short: ! '%d.%m.%Y, %H:%M Uhr'
|
||||
timeonly: ! '%H:%M Uhr'
|
||||
pm: nachmittags
|
||||
|
||||
@@ -5,10 +5,12 @@ de:
|
||||
hello: "Hallo Welt"
|
||||
common:
|
||||
edit: "Bearbeiten"
|
||||
back: "Zurück"
|
||||
actions: "Aktionen"
|
||||
delete: "Löschen"
|
||||
verwalten: "Verwalten"
|
||||
back: "Zurück"
|
||||
sure_del: "Sicher endgültig löschen?"
|
||||
home:
|
||||
mtitle: "Menu"
|
||||
willkommen: "Willkommen bei der Fachschaft Elektrotechnik"
|
||||
|
||||
7
config/locales/fetprofile.de.yml
Normal file
7
config/locales/fetprofile.de.yml
Normal file
@@ -0,0 +1,7 @@
|
||||
de:
|
||||
profile:
|
||||
remove_picture: "Bild entfernen"
|
||||
all_members: "Alle Mitglieder"
|
||||
all_groups: "Alle Gremien und Gruppen"
|
||||
active_members: "Aktive Mitglieder"
|
||||
new_profile: "Neues Profil anlegen"
|
||||
@@ -2,8 +2,10 @@
|
||||
de:
|
||||
neuigkeit:
|
||||
publish: "Neuigkeit veröffentlichen"
|
||||
republish: "Neuigkeit erneut veröffentlichen"
|
||||
unpublish: "Veröffentlichung rückgängig"
|
||||
new:
|
||||
title: "Neue Neuigkeit"
|
||||
title: "Neuer Artikel"
|
||||
rubriken:
|
||||
alle: "Alle Rubriken"
|
||||
rubrik:
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#resources :neuigkeiten, :except => [:index] do
|
||||
|
||||
#end
|
||||
resources :neuigkeiten, :only =>[:show]
|
||||
resources :rubriken do
|
||||
collection do
|
||||
get 'verwalten' , :action => :alle_verwalten
|
||||
|
||||
BIN
public/icon_kalender_small.png
Normal file
BIN
public/icon_kalender_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Reference in New Issue
Block a user