Sha256: 0bb9d70566b5d4a9e572a352b3dd8e8fd66871967340ddde8d6c1a1fc6683bec

Contents?: true

Size: 1.03 KB

Versions: 43

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Tramway::Admin::ActionsHelper
  def destroy_is_available?(association_object, _main_object)
    ::Tramway::Admin.action_is_available?(
      association_object,
      project: (@application_engine || @application.name),
      model_name: association_object.model.class.name,
      role: current_admin.role,
      action: :destroy
    )
  end

  def update_is_available?(association_object, _main_object)
    ::Tramway::Admin.action_is_available?(
      association_object,
      project: (@application_engine || @application.name),
      model_name: association_object.model.class.name,
      role: current_admin.role,
      action: :update
    )
  end

  # delete_button is in smart-buttons gem

  def edit_button(url:, button_options:)
    link_to(url, **button_options) { yield }
  end

  def habtm_destroy_is_available?(association_object, main_object)
    ::Tramway::Admin.forms&.include?("#{main_object.model.class.to_s.underscore.pluralize}/remove_#{association_object.model.class.to_s.underscore}")
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
tramway-admin-4.0.0.1 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-4.0 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-3.0.1.1 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-3.0.1 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-3.0 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.3.3 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.3.2 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.3.1 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.3 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.2 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.1.2 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.1.1 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.1 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.0.2 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1.0.1 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.1 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.0.0.4 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.0.0.3 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.0.0.2 app/helpers/tramway/admin/actions_helper.rb
tramway-admin-2.0.0.1 app/helpers/tramway/admin/actions_helper.rb