Sha256: f33a63ac8597a8680d624eaaa4b26e454806b74c9c74372a47411a683c53a7a4

Contents?: true

Size: 1.02 KB

Versions: 28

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module BootdiskLinksHelper
  # Core Foreman helpers can't look up a URL against a mounted engine
  def display_bootdisk_link_if_authorized(name, options = {}, html_options = {})
    if bootdisk_authorized_for(options)
      link_to(name, bootdisk_url(options), html_options)
    else
      ''
    end
  end

  def bootdisk_url(options)
    ForemanBootdisk::Engine.routes.url_for(options.merge(only_path: true, script_name: foreman_bootdisk_path))
  end

  def bootdisk_authorized_for(options)
    User.current.allowed_to?(options)
  end

  def divider
    tag(:li, class: 'divider')
  end

  def bootdisk_help_link
    display_bootdisk_link_if_authorized(
      _('Boot disk Help'),
    {
        controller: 'foreman_bootdisk/disks',
        action: 'help'
      },
      class: 'la'
    )
  end

  def bootdisk_title_action_buttons(actions)
    title_actions(
      button_group(
        select_action_button(
          _('Boot disk'), { class: 'btn btn-group' },
          actions
        )
      )
    )
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
foreman_bootdisk-22.0.2 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-22.0.1 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-22.0.0 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.0.6 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.2.3 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.2.2 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.0.5 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.2.1 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.2.0 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.1.0 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-19.0.9 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.0.4 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.0.3 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-19.0.8 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.0.2 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-19.0.7 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.0.1 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-21.0.0 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-19.0.6 app/helpers/bootdisk_links_helper.rb
foreman_bootdisk-19.0.4.1 app/helpers/bootdisk_links_helper.rb