Sha256: dd1fe5c2e90b221ce869b2aaebb555fad79c6c3040654b095636790c405df734

Contents?: true

Size: 783 Bytes

Versions: 2

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

module Spotlight
  # Displays the "Save this search" button and modal
  class SaveSearchComponent < ViewComponent::Base
    def initialize(button_classes: 'btn btn-secondary')
      @button_classes = button_classes
      super
    end

    attr_reader :button_classes

    delegate :search_state, :current_exhibit, to: :helpers
    delegate :searches, to: :current_exhibit

    def button
      button_tag t(:'spotlight.saved_search.label'), id: 'save-this-search', class: button_classes,
                                                     data: { toggle: 'modal', 'bs-toggle': 'modal', target: '#save-modal', 'bs-target': '#save-modal' }
    end

    def form_path
      [helpers.spotlight, current_exhibit, Spotlight::Search.new]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
blacklight-spotlight-4.6.1 app/components/spotlight/save_search_component.rb
blacklight-spotlight-4.6.0 app/components/spotlight/save_search_component.rb