Sha256: 05d29a4f5aa7e21b205e8316a15faac56db23f98757f3b5152ef2e93391393b8

Contents?: true

Size: 789 Bytes

Versions: 3

Compression:

Stored size: 789 Bytes

Contents

module Snaptable 
  module Helpers
    module ButtonsHelper

      def add_button?
        Snaptable.add_button && 
        (!Snaptable.use_permission || 
        current_permission.allow_create?(params[:controller]))
      end

      def edit_button?
        Snaptable.edit_button && 
        (!Snaptable.use_permission || 
        current_permission.allow_modify?(params[:controller], "update"))
      end

      def show_button?
        Snaptable.show_button && 
        (!Snaptable.use_permission || 
        current_permission.allow_modify?(params[:controller], "read"))
      end

      def delete_button?
        Snaptable.delete_button && 
        (!Snaptable.use_permission || 
        current_permission.allow_modify?(params[:controller], "destroy"))
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
snaptable-0.9.3 lib/snaptable/helpers/buttons_helper.rb
snaptable-0.9.2 lib/snaptable/helpers/buttons_helper.rb
snaptable-0.9.1 lib/snaptable/helpers/buttons_helper.rb