Module: Maquina::ApplicationView
- Includes:
- Phlex::Rails::Helpers::Translate
- Included in:
- Maquina::AcceptInvitations::NewView, Maquina::Application::Alert, Maquina::Application::Components::ComponentBase, Maquina::Application::Edit, Maquina::Application::Form, Maquina::Application::IndexHeader, Maquina::Application::IndexModal, Maquina::Application::IndexTable, Maquina::Application::New, Maquina::Application::SessionsHeader, FirstRuns::Form, Navbar::Menu, Navbar::MenuItemLink, Navbar::MobileButton, Navbar::MobileMenu, Navbar::Notification, Navbar::Profile, Navbar::ProfileButton, Navbar::ProfileMenu, Navbar::ProfileMenuItemLink, Navbar::Search, Navbar::Title, Sessions::Form
- Defined in:
- app/views/maquina/application_view.rb
Instance Method Summary collapse
- #attribute_human_name(attribute) ⇒ Object
- #button_to(name, options = nil, html_options = nil) ⇒ Object
-
#image_tag(source, options = {}) ⇒ Object
TODO: Revisit this later.
- #link_to(body, url, html_options = {}) ⇒ Object
- #model_human_name(plural: false) ⇒ Object
-
#svg_icon(type, icon:, view_box: "0 0 24 24", stroke_width: 2, css_class: "block h-6 w-6", data: {}) ⇒ Object
type: :fill or :outline.
Instance Method Details
#attribute_human_name(attribute) ⇒ Object
42 43 44 |
# File 'app/views/maquina/application_view.rb', line 42 def attribute_human_name(attribute) resource_class.human_attribute_name(attribute) end |
#button_to(name, options = nil, html_options = nil) ⇒ Object
19 20 21 |
# File 'app/views/maquina/application_view.rb', line 19 def (name, = nil, = nil) unsafe_raw helpers.(name, , ) end |
#image_tag(source, options = {}) ⇒ Object
TODO: Revisit this later
11 12 13 |
# File 'app/views/maquina/application_view.rb', line 11 def image_tag(source, = {}) unsafe_raw helpers.image_tag(source, **) end |
#link_to(body, url, html_options = {}) ⇒ Object
15 16 17 |
# File 'app/views/maquina/application_view.rb', line 15 def link_to(body, url, = {}) unsafe_raw helpers.link_to(body, url, ) end |
#model_human_name(plural: false) ⇒ Object
38 39 40 |
# File 'app/views/maquina/application_view.rb', line 38 def model_human_name(plural: false) resource_class.model_name.human(count: plural ? 2 : 1) end |
#svg_icon(type, icon:, view_box: "0 0 24 24", stroke_width: 2, css_class: "block h-6 w-6", data: {}) ⇒ Object
type: :fill or :outline
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/views/maquina/application_view.rb', line 24 def svg_icon(type, icon:, view_box: "0 0 24 24", stroke_width: 2, css_class: "block h-6 w-6", data: {}) svg_attributes = if type == :fill {xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: view_box, "aria-hidden": "true"} else {xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: view_box, "stroke-width": stroke_width, stroke: "currentColor", "aria-hidden": "true"} end path_attributes = (type == :fill) ? {} : {"stroke-linecap": "round", "stroke-linejoin": "round"} svg(class: css_class, data: data, **svg_attributes) do |markup| markup.path(d: icon, **path_attributes) end end |