abilities und beispiel delete

This commit is contained in:
2014-07-16 00:24:34 +05:30
parent 3291ca364b
commit 6c92fd8607
7 changed files with 57 additions and 56 deletions

View File

@@ -7,7 +7,7 @@ class FetprofilesController < ApplicationController
@fetprofiles = Fetprofile.active.order(:vorname,:nachname)
@fetprofiles = Fetprofile.order(:vorname,:nachname) if params[:filter]== "all"
@fetprofiles = Fetprofile.where(:active=>false).order(:vorname,:nachname) if params[:filter]== "notactive"
@fetprofiles = Fetprofile.where(:active=>false).order(:nachname,:vorname) if params[:filter]== "notactive"
@gremientabs = Gremium.tabs
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('profile.new_profile'),:path => new_fetprofile_path(@fetprofile) } if can? :new, @fetprofile

View File

@@ -27,10 +27,20 @@ class HomeController < ApplicationController
render 'links_notimplemented'
end
def search
unless params['query'].nil? || params['query'].empty?
@neuigkeiten=Neuigkeit.search(params['query'])
if can?(:showintern, Neuigkeit)
@neuigkeiten=Neuigkeit.search(params['query'])
else
@neuigkeiten =Neuigkeit.search(params['query']).public
end
@fetprofiles = Fetprofile.search(params['query'])
@themen=Thema.search(params['query'])
if can?(:showintern, Neuigkeit)
@themen=Thema.search(params['query'])
else
@themen=Thema.search(params['query']).public
end
else
@neuigkeiten=[]
@fetprofiles=[]

View File

@@ -2,13 +2,15 @@ class RubrikenController < ApplicationController
before_filter {@toolbar_elements=[]}
load_and_authorize_resource
def index
if can?(:shownonpublic, Rubrik)
if can?(:showintern, Rubrik)
@rubriken = Rubrik.all
@neuigkeiten = Neuigkeit.recent
else
@rubriken = Rubrik.where(:public=>true)
@neuigkeiten = Neuigkeit.public.recent
end
@neuigkeiten = @rubriken.collect(&:neuigkeiten).map(&:recent).flatten
@calentries= @rubriken.collect(&:calentries).flatten
@calentries= @rubriken.collect(&:calentries).flatten
end
def intern