Module: OrganizationsHelper
- Defined in:
- app/helpers/organizations_helper.rb
Instance Method Summary collapse
-
#progress_bar_attributes(local_vars) ⇒ Hash
Aria and style attributes for drawing a progress bar.
-
#progress_bar_percentage(local_vars) ⇒ String
Formatted progress percentage of value vs max.
- #progress_label(title, value) ⇒ Object
-
#representation_count(count) ⇒ String
Formatted number of representations, with correct pluralization.
-
#resource_count(count) ⇒ String
Formatted number of images, with correct pluralization.
Instance Method Details
#progress_bar_attributes(local_vars) ⇒ Hash
Returns aria and style attributes for drawing a progress bar
17 18 19 20 21 22 23 |
# File 'app/helpers/organizations_helper.rb', line 17 def (local_vars) { :"aria-valuemax" => progress_max(local_vars), :"aria-valuemin" => progress_min(local_vars), :"aria-valuenow" => progress_val(local_vars), :role => "progressbar", :style => "width: #{(local_vars)}%" } end |
#progress_bar_percentage(local_vars) ⇒ String
Returns formatted progress percentage of value vs max
27 28 29 30 31 32 33 34 |
# File 'app/helpers/organizations_helper.rb', line 27 def (local_vars) max = progress_max(local_vars) return "" if max.zero? value = progress_val(local_vars) percentage = 100 * (value / max.to_f) number_to_percentage(percentage, precision: 0) end |
#progress_label(title, value) ⇒ Object
38 39 40 |
# File 'app/helpers/organizations_helper.rb', line 38 def progress_label(title, value) "#{number_with_delimiter(value)} #{title}" end |
#representation_count(count) ⇒ String
Returns formatted number of representations, with correct pluralization
10 11 12 |
# File 'app/helpers/organizations_helper.rb', line 10 def representation_count(count) "#{number_with_delimiter(count)} #{'representation'.pluralize(count)}" end |
#resource_count(count) ⇒ String
Returns formatted number of images, with correct pluralization
4 5 6 |
# File 'app/helpers/organizations_helper.rb', line 4 def resource_count(count) "#{number_with_delimiter(count)} #{'resource'.pluralize(count)}" end |