Class: Renalware::PD::AdequacyResultsComponent

Inherits:
ApplicationComponent show all
Includes:
Pagy::Backend, Pagy::Frontend, BooleanHelper, ToggleHelper
Defined in:
app/components/renalware/pd/adequacy_results_component.rb

Constant Summary collapse

TITLE =
"Adequacy Results"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ToggleHelper

#css_toggle_link_to, #row_toggler, #rows_toggler, #table_toggler, #td_toggle_row, #th_toggle_all_rows, #toggler

Methods included from BooleanHelper

#yes_no, #yes_no_if_set

Methods inherited from ApplicationComponent

#policy, #renalware

Instance Attribute Details

#paginationObject (readonly)

Returns the value of attribute pagination.



13
14
15
# File 'app/components/renalware/pd/adequacy_results_component.rb', line 13

def pagination
  @pagination
end

Instance Method Details

#resultsObject



17
18
19
20
21
22
# File 'app/components/renalware/pd/adequacy_results_component.rb', line 17

def results
  @results ||= begin
    @pagination, @results = pagy(scope, items: 6) # , link_extra: "data-remote='true'")
    @results
  end
end

#titleObject



24
25
26
27
28
29
30
# File 'app/components/renalware/pd/adequacy_results_component.rb', line 24

def title
  if pagination.items < pagination.count
    "#{TITLE} (#{pagination.items} of #{pagination.count})"
  else
    "#{TITLE} (#{pagination.items})"
  end
end