Class: Emjay::Components::MjNavbarLink
- Inherits:
-
BodyComponent
- Object
- Emjay::Component
- BodyComponent
- Emjay::Components::MjNavbarLink
- Defined in:
- lib/emjay/components/body/mj_navbar_link.rb
Instance Attribute Summary
Attributes inherited from Emjay::Component
Class Method Summary collapse
- .allowed_attributes ⇒ Object
- .component_name ⇒ Object
- .default_attributes ⇒ Object
- .ending_tag? ⇒ Boolean
Instance Method Summary collapse
Methods inherited from BodyComponent
#get_box_widths, #get_child_context, #get_shorthand_attr_value, #get_shorthand_border_value, #html_attributes, #render_children, #styles
Methods inherited from Emjay::Component
#get_attribute, #get_child_context, #get_content, #initialize, raw_element?
Constructor Details
This class inherits a constructor from Emjay::Component
Class Method Details
.allowed_attributes ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/emjay/components/body/mj_navbar_link.rb', line 33 def self.allowed_attributes { "color" => "color", "font-family" => "string", "font-size" => "unit(px)", "font-style" => "string", "font-weight" => "string", "href" => "string", "name" => "string", "target" => "string", "rel" => "string", "letter-spacing" => "unitWithNegative(px,em)", "line-height" => "unit(px,%,)", "padding-bottom" => "unit(px,%)", "padding-left" => "unit(px,%)", "padding-right" => "unit(px,%)", "padding-top" => "unit(px,%)", "padding" => "unit(px,%){1,4}", "text-decoration" => "string", "text-transform" => "string" } end |
.component_name ⇒ Object
11 12 13 |
# File 'lib/emjay/components/body/mj_navbar_link.rb', line 11 def self.component_name "mj-navbar-link" end |
.default_attributes ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/emjay/components/body/mj_navbar_link.rb', line 19 def self.default_attributes { "color" => "#000000", "font-family" => "Ubuntu, Helvetica, Arial, sans-serif", "font-size" => "13px", "font-weight" => "normal", "line-height" => "22px", "padding" => "15px 10px", "target" => "_blank", "text-decoration" => "none", "text-transform" => "uppercase" } end |
.ending_tag? ⇒ Boolean
15 16 17 |
# File 'lib/emjay/components/body/mj_navbar_link.rb', line 15 def self.ending_tag? true end |
Instance Method Details
#get_styles ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/emjay/components/body/mj_navbar_link.rb', line 56 def get_styles { a: { "display" => "inline-block", "color" => get_attribute("color"), "font-family" => get_attribute("font-family"), "font-size" => get_attribute("font-size"), "font-style" => get_attribute("font-style"), "font-weight" => get_attribute("font-weight"), "letter-spacing" => get_attribute("letter-spacing"), "line-height" => get_attribute("line-height"), "text-decoration" => get_attribute("text-decoration"), "text-transform" => get_attribute("text-transform"), "padding" => get_attribute("padding"), "padding-top" => get_attribute("padding-top"), "padding-left" => get_attribute("padding-left"), "padding-right" => get_attribute("padding-right"), "padding-bottom" => get_attribute("padding-bottom") }, td: { "padding" => get_attribute("padding"), "padding-top" => get_attribute("padding-top"), "padding-left" => get_attribute("padding-left"), "padding-right" => get_attribute("padding-right"), "padding-bottom" => get_attribute("padding-bottom") } } end |
#render ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/emjay/components/body/mj_navbar_link.rb', line 85 def render td_attrs = html_attributes( style: :td, class: SuffixCssClasses.call(get_attribute("css-class"), "outlook") ) <<~HTML #{ConditionalTag.conditional_tag("<td#{td_attrs}>")} #{render_content} #{ConditionalTag.conditional_tag("</td>")} HTML end |