fetprofiles controller

This commit is contained in:
Andreas Stephanides
2013-09-24 10:00:57 +02:00
parent f7aa1b3240
commit 896540429f

View File

@@ -1,6 +1,10 @@
class FetprofilesController < ApplicationController
# GET /fetprofiles
# GET /fetprofiles.json
before_filter {@toolbar_elements=[]}
load_and_authorize_resource
def index
@fetprofiles = Fetprofile.active.order(:vorname,:nachname)
@@ -16,7 +20,14 @@ class FetprofilesController < ApplicationController
# GET /fetprofiles/1.json
def show
@fetprofile = Fetprofile.find(params[:id])
if params["verwalten"]
@toolbar_elements << {:hicon=>'icon-plus', :text=> I18n.t('fetprofile.newmembership'),:path => new_fetprofile_membership_path(@fetprofile) , :confirm=>"Sure?" } if can? :new, Membership
@toolbar_elements << {:hicon=>'icon-pencil', :text=> I18n.t('common.edit'),:path => edit_fetprofile_path(@fetprofile),:confirm=>"Sure?" } if can? :edit, @fetprofile
@toolbar_elements << {:hicon=>'icon-minus', :text => I18n.t('common.delete'), :method=>:delete, :confirm=>"Sure"}
else
@toolbar_elements << {:text=>I18n.t('common.verwalten'),:path=>fetprofile_path(@fetprofile,{:verwalten=>true}),:icon=>:pencil} if can? :verwalten, @fetprofile
end
respond_to do |format|
format.html # show.html.erb
format.json { render json: @fetprofile }