Module: Nquery::ComponentsHelper

Defined in:
app/helpers/nquery/components_helper.rb

Instance Method Summary collapse

Instance Method Details

#nq_card(title: nil, **options, &block) ⇒ Object



17
18
19
# File 'app/helpers/nquery/components_helper.rb', line 17

def nq_card(title: nil, **options, &block)
  CardComponent.new(title: title, **options).render_in(self, &block)
end

#nq_card_table(columns:, **options, &block) ⇒ Object



21
22
23
# File 'app/helpers/nquery/components_helper.rb', line 21

def nq_card_table(columns:, **options, &block)
  CardTableComponent.new(columns: columns, **options).render_in(self, &block)
end

#nq_flash_card(message, type: :notice, **options) ⇒ Object



13
14
15
# File 'app/helpers/nquery/components_helper.rb', line 13

def nq_flash_card(message, type: :notice, **options)
  render_nquery_component(FlashCardComponent.new(message: message, type: type, **options))
end

#nq_flash_cards(flash: self.flash) ⇒ Object



9
10
11
# File 'app/helpers/nquery/components_helper.rb', line 9

def nq_flash_cards(flash: self.flash)
  render_nquery_component(FlashCardsComponent.new(flash: flash))
end

#nq_infinite_scroll(url:, **options, &block) ⇒ Object



25
26
27
# File 'app/helpers/nquery/components_helper.rb', line 25

def nq_infinite_scroll(url:, **options, &block)
  InfiniteScrollComponent.new(url: url, **options).render_in(self, &block)
end

#render_nquery_component(component, &block) ⇒ Object



5
6
7
# File 'app/helpers/nquery/components_helper.rb', line 5

def render_nquery_component(component, &block)
  component.render_in(self, &block)
end