Merge branch 'master' of https://github.com/fetsite/fetsite
This commit is contained in:
@@ -21,6 +21,8 @@ class Gremium < ActiveRecord::Base
|
|||||||
|
|
||||||
attr_accessible :desc, :name, :typ, :geschlecht,:thema_id, :memberships_attributes
|
attr_accessible :desc, :name, :typ, :geschlecht,:thema_id, :memberships_attributes
|
||||||
has_many :memberships # Mitgliedschaften bei dem Gremium
|
has_many :memberships # Mitgliedschaften bei dem Gremium
|
||||||
|
has_many :nlinks, as: :link
|
||||||
|
scope :search, ->(query) {where("gremien.name like ? or gremien.desc like ?", "%#{query}%", "%#{query}%")}
|
||||||
|
|
||||||
belongs_to :thema # Gehört zu einem Thema
|
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
|
scope :tabs, -> { where(:typ => [1,3]).order(:typ).order(:name) } # Gremien die in Tabs angezeigt werden (Alle Anderen nur in der Liste
|
||||||
@@ -31,6 +33,9 @@ class Gremium < ActiveRecord::Base
|
|||||||
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
|
||||||
|
def title
|
||||||
|
name
|
||||||
|
end
|
||||||
def fall4
|
def fall4
|
||||||
Gremium::ART4FALL[self.geschlecht.to_i].to_s+" "+ self.name.to_s+ ((self.geschlecht.to_i==1||self.geschlecht.to_i==0)? "":"")
|
Gremium::ART4FALL[self.geschlecht.to_i].to_s+" "+ self.name.to_s+ ((self.geschlecht.to_i==1||self.geschlecht.to_i==0)? "":"")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class Neuigkeit < ActiveRecord::Base
|
|||||||
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
|
scope :unpublished, -> {where("datum >= ? OR datum IS NULL", Date.today)}
|
||||||
scope :public, ->{includes(:rubrik).where("rubriken.public"=>:true)}
|
scope :public, ->{includes(:rubrik).where("rubriken.public"=>:true)}
|
||||||
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
|
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
|
||||||
LINKTYPES=["Thema", "Gallery", "Lva","Studium","Fetprofile"]
|
LINKTYPES=["Thema", "Gallery", "Lva","Studium","Fetprofile", "Gremium"]
|
||||||
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
accepts_nested_attributes_for :calentries, :allow_destroy=>true , :reject_if=> lambda{|a| a[:start].blank?}
|
||||||
before_validation :sanitize
|
before_validation :sanitize
|
||||||
has_many :nlinks
|
has_many :nlinks
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Nlink < ActiveRecord::Base
|
|||||||
belongs_to :link, :polymorphic=>true
|
belongs_to :link, :polymorphic=>true
|
||||||
validates :neuigkeit, :presence=>true
|
validates :neuigkeit, :presence=>true
|
||||||
validates :link, :presence=>true
|
validates :link, :presence=>true
|
||||||
validates :link_id, :uniqueness=>{:scope=>[:neuigkeit_id]}
|
validates :link_id, :uniqueness=>{:scope=>[:neuigkeit_id,:link_type]}
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1 +1,10 @@
|
|||||||
<h2><%= nlink.title %></h2>
|
<div class="media">
|
||||||
|
|
||||||
|
<span class="pull-left">
|
||||||
|
<%= image_tag nlink.picture.thumb.url %>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<div class="media-body">
|
||||||
|
<h2><%= nlink.title %></h2>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|||||||
2
app/views/gremien/_nlink.html.erb
Normal file
2
app/views/gremien/_nlink.html.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<h2><%=fa_icon("users 2x")+ nlink.name %></h2>
|
||||||
|
<p><%= raw(nlink.desc) %></p>
|
||||||
@@ -38,6 +38,15 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span12">
|
||||||
|
<ul class="unstyled">
|
||||||
|
<% @gremium.nlinks.each do |l| %>
|
||||||
|
<li><%= render l.neuigkeit %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%= link_to I18n.t('common.edit'), edit_gremium_path(@gremium) %>
|
<%= link_to I18n.t('common.edit'), edit_gremium_path(@gremium) %>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<% neuigkeiten.each do |n| %>
|
<% neuigkeiten.each do |n| %>
|
||||||
<% r = n.rubrik %>
|
<% r = n.rubrik %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= r.public%></td>
|
<td><%= fa_icon "globe" if r.public%></td>
|
||||||
<td><%= r.name %></td>
|
<td><%= r.name %></td>
|
||||||
<td>
|
<td>
|
||||||
<%= n.title %>
|
<%= n.title %>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
<h2><%= nlink.title %></h2>
|
<h2><%= fa_icon("info-circle 2x")+" "+ nlink.title %></h2>
|
||||||
<p><%= raw(nlink.text_first_words) %></p>
|
<p><%= raw(nlink.text_first_words) %></p>
|
||||||
|
|||||||
Reference in New Issue
Block a user