Class: UiBibz::Ui::Base
- Inherits:
-
Object
- Object
- UiBibz::Ui::Base
- Includes:
- ActionView::Helpers
- Defined in:
- lib/ui_bibz/ui/base.rb
Direct Known Subclasses
Core::Component, Core::Forms::Dropdowns::Components::DropdownDivider, Core::Navigations::NavbarForm, Core::Navigations::ToolbarForm, Ux::Tables::Actionable, Ux::Tables::Paginable, Ux::Tables::Searchable, Ux::Tables::Sortable, Ux::Tables::TablePagination, Ux::Tables::TablePaginationPerPage
Instance Attribute Summary collapse
-
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
Instance Method Summary collapse
- #generate_id(name = nil) ⇒ Object
-
#i18n_set?(key) ⇒ Boolean
To know if translation missing.
-
#inject_url(url, record) ⇒ Object
Add “id” in url to match with current record.
Instance Attribute Details
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
9 10 11 |
# File 'lib/ui_bibz/ui/base.rb', line 9 def output_buffer @output_buffer end |
Instance Method Details
#generate_id(name = nil) ⇒ Object
23 24 25 |
# File 'lib/ui_bibz/ui/base.rb', line 23 def generate_id(name = nil) "#{name || 'id'}-#{Random.rand(99_999)}" end |
#i18n_set?(key) ⇒ Boolean
To know if translation missing
12 13 14 15 16 |
# File 'lib/ui_bibz/ui/base.rb', line 12 def i18n_set?(key) I18n.t key, raise: true rescue StandardError false end |
#inject_url(url, record) ⇒ Object
Add “id” in url to match with current record
19 20 21 |
# File 'lib/ui_bibz/ui/base.rb', line 19 def inject_url(url, record) url.gsub(%r{(/id/?)}, "/#{record.id}/") end |