Sha256: 2f85c799f6004375996d8596a2593bcf9e56b198fb43b88eaa520fc4963669e8

Contents?: true

Size: 999 Bytes

Versions: 20

Compression:

Stored size: 999 Bytes

Contents

module Snaptable 
  module Helpers
    module ButtonsHelper

      def add_button
        link_to t("table.buttons.add"), request.path + "/new", class: "add"
      end

      def show_button
        link_to t("table.buttons.show"), "#", class: "show"
      end

      def edit_button
        link_to t("table.buttons.edit"), "#", class: "edit"
      end

      def delete_button
        link_to t("table.buttons.delete"), "#", method: :delete, class: "delete", data: { confirm: "Etes-vous sûr de vouloir supprimer cette entrée ?" } 
      end

      def add_button?
        !Snaptable.use_permission || rights?(:create, params[:controller])
      end

      def edit_button?
        !Snaptable.use_permission || rights?(:update, params[:controller])
      end

      def show_button?
        !Snaptable.use_permission || rights?(:read, params[:controller])
      end

      def delete_button?
        !Snaptable.use_permission || rights?(:destroy, params[:controller])
      end

    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
snaptable-4.0.2 lib/snaptable/helpers/buttons_helper.rb
snaptable-4.0.1 lib/snaptable/helpers/buttons_helper.rb
snaptable-4.0.0 lib/snaptable/helpers/buttons_helper.rb
snaptable-3.0.0 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.2.4 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.2.3 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.2.2 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.2.1 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.2.0 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.1.0 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.0.5 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.0.4 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.0.2 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.0.1 lib/snaptable/helpers/buttons_helper.rb
snaptable-2.0 lib/snaptable/helpers/buttons_helper.rb
snaptable-1.2.0 lib/snaptable/helpers/buttons_helper.rb
snaptable-1.1.3 lib/snaptable/helpers/buttons_helper.rb
snaptable-1.1.2 lib/snaptable/helpers/buttons_helper.rb
snaptable-1.1.1 lib/snaptable/helpers/buttons_helper.rb
snaptable-1.1.0 lib/snaptable/helpers/buttons_helper.rb