neuigkeiten rechte

This commit is contained in:
Andreas Stephanides
2014-02-07 22:15:30 +01:00
parent 48fc0455c7
commit 50bceaf017
4 changed files with 17 additions and 4 deletions

View File

@@ -67,7 +67,10 @@ class Ability
if user.has_role?("newsadmin") || user.has_role?("fetadmin")
can :addmoderator, Rubrik
end
can [:show, :index], [Rubrik,Neuigkeit]
can [:show,:index], Rubrik, :public=>true
can :show, Neuigkeit, :rubrik=>{:public=>true}
if user.has_role?("newsadmin") || user.has_role?( "fetadmin") || user.has_role?( "fetuser")
can :manage, Rubrik
can :manage, Neuigkeit

View File

@@ -50,7 +50,13 @@ self.title
end
def text_first_words
md = /<p>(?<text>[\w\s,\.!\?]*)/.match self.text
md[:text].split(" ")[0..100].join(" ")+ " ..." unless md[:text].split(" ").empty?
words=md[:text].split(" ") unless md.nil?
if words.nil? || words.empty?
"...."
else
words[0..100].join(" ")+ " ..." unless words.nil?
end
end
def has_calentries?
!self.calentries.nil? && !self.calentries.empty?

View File

@@ -1,6 +1,7 @@
<%= render 'rubriken/tabs' %>
<div class="content-column content-wrap">
<p id="notice"><%= notice %></p>
<div class="contentbox">
<span>
<%= @neuigkeit.rubrik.name %>
</span>
@@ -22,7 +23,10 @@
<p></p>
</div>
</div>
<% @calentries1.each do |ce|%>
<%= render ce unless ce.nil? %>
<% end %>
<%= render 'layouts/pretty_toolbar', :object=> @toolbar_elements %>
</div>
</div>

View File

@@ -14,7 +14,7 @@
<ul class="unstyled linkbox-list" style="max-width:70em">
<% @neuigkeiten.each do |n| %>
<li><%= render n %> </li>
<li><%= render n if can?(:show, n) %> </li>
<% end %>
</ul>
</div>