rechte für actions versions neuigkeiten

This commit is contained in:
Andreas Stephanides
2014-10-19 19:49:33 +02:00
parent ad751c0837
commit 7436c5c01e
6 changed files with 14 additions and 7 deletions

View File

@@ -16,7 +16,7 @@ class NeuigkeitenController < ApplicationController
@rubriken = Rubrik.where(:public=>true)
end
if !params[:version].nil?
if !params[:version].nil? && can?(:showversions, Neuigkeit)
@neuigkeit.assign_attributes(@neuigkeit.translation.versions.reverse[params[:version].to_i].reify.attributes.select{|k,v| @neuigkeit.translated_attribute_names.include? k.to_sym })
end
@calentries1=@neuigkeit.calentries
@@ -192,12 +192,13 @@ actions << {:hicon=>'icon-facebook', :text=> I18n.t('neuigkeit.publishfetmail'),
@toolbar_elements << {:text=>I18n.t('common.edit'),:path=>edit_rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:icon=>:pencil} if can? :edit, @neuigkeit.rubrik
if can?(:showversions, Neuigkeit)
@versions= @neuigkeit.translation.versions.select([:created_at]).reverse
@toolbar_elements <<{:path=>rubrik_neuigkeit_path(@neuigkeit.rubrik,@neuigkeit),:method=>:versions,:versions=>@versions}
end
actions << {: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 << {:text => "action", :method => :dropdown, :elements=> actions}
@toolbar_elements << {:text => "action", :method => :dropdown, :elements=> actions} unless actions.empty?
end

View File

@@ -38,7 +38,7 @@ class ThemenController < ApplicationController
# #
#
# @thema.text = @thema.text.sanitize
render :show
render :edit
end
def verwalten
@thema = Thema.find(params[:id])
@@ -46,6 +46,8 @@ class ThemenController < ApplicationController
@fragen=@thema.fragen
@toolbar_elements = [{:icon=>:pencil, :hicon=>'icon-pencil', :text=>I18n.t('thema.edit'), :path=>edit_thema_path(@thema)}]
@toolbar_elements <<{ :hicon=>'icon-leaf', :text=>"Sanitize", :path=>sanitize_thema_path(@thema)}
@toolbar_elements << {:hicon=>'icon-remove-circle', :text=>I18n.t('thema.remove'), :path=>thema_path(@thema), :method=>:delete, :confirm=>I18n.t('thema.sure')}
end

View File

@@ -24,6 +24,7 @@ class Ability
can :manage, Studium
can :manage, Beispiel
can :manage, Lecturer
end
unless user.has_role?("fetadmin")
cannot :delete, Studium
@@ -88,6 +89,7 @@ class Ability
if loggedin
end
if( user.has_role?("fetuser") || user.has_role?("fetadmin"))
can :showintern, Neuigkeit
can :showintern, Rubrik
can :seeintern, User

View File

@@ -31,6 +31,7 @@ Verwendung: Aufruf mit
</ul>
<% end %>
<% else %>
<% if t[:versions].count>0 %>
<div class="btn-group">
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
<%= I18n.t("common.versions") %><span class="caret"></span>
@@ -53,6 +54,7 @@ Verwendung: Aufruf mit
<% end %>
</ul>
</div>
<% end %>
<% end %>
<% end %>
</div>

View File

@@ -5,7 +5,7 @@
<% p = nlink_list.link_type.downcase.pluralize+"/nlink" %>
<%= raw(strip_links(render :partial=>p, :object=>nlink_list.link )) %>
</div>
<%= link_to "DELETE", delete_link_rubrik_neuigkeit_path(nlink_list.neuigkeit.rubrik,nlink_list.neuigkeit.id, :nlink_id=>nlink_list.id) %>
<%= link_to "DELETE", delete_link_rubrik_neuigkeit_path(nlink_list.neuigkeit.rubrik,nlink_list.neuigkeit.id, :nlink_id=>nlink_list.id) if can? :delete, Nlink %>
</div>
<% end %>

View File

@@ -1,6 +1,6 @@
<% if can? :show, small %>
<a name="thema_<%=small.id%>" href="#<%=small.id%>">
<h2><%= small.title %> <%= link_to fa_icon("pencil"), verwalten_thema_path(small) if can? :edit, small %></h2>
<h2><%= small.title %> <%= link_to fa_icon("pencil"), verwalten_thema_path(small) if can? :edit, small %> <%= link_to fa_icon("paint-brush"), sanitize_thema_path(small) if can? :edit, small %></h2>
</a>
<% if small.is_outdated? %>
<div class="sticker sticker-red"> <%= I18n.t("thema.outdated") %> <%= link_to"Als aktuell markieren",is_updated_thema_path(small), :class=>:btn if can? :is_updated, small%></div>