Class: Spotlight::SaveSearchComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/spotlight/save_search_component.rb

Overview

Displays the “Save this search” button and modal

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(button_classes: 'btn btn-secondary') ⇒ SaveSearchComponent

Returns a new instance of SaveSearchComponent.



6
7
8
9
# File 'app/components/spotlight/save_search_component.rb', line 6

def initialize(button_classes: 'btn btn-secondary')
  @button_classes = button_classes
  super
end

Instance Attribute Details

#button_classesObject (readonly)

Returns the value of attribute button_classes.



11
12
13
# File 'app/components/spotlight/save_search_component.rb', line 11

def button_classes
  @button_classes
end

Instance Method Details

#buttonObject



16
17
18
19
# File 'app/components/spotlight/save_search_component.rb', line 16

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

#form_pathObject



21
22
23
# File 'app/components/spotlight/save_search_component.rb', line 21

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