Class: Matestack::Ui::Bootstrap::Components::Avatar
Instance Method Summary
collapse
Methods included from Registry
#bs_accordion, #bs_alert, #bs_avatar, #bs_badge, #bs_breadcrumb, #bs_btn, #bs_btn_group, #bs_card, #bs_carousel, #bs_close, #bs_col, #bs_collapse, #bs_container, #bs_dropdown, #bs_figure, #bs_form_checkbox, #bs_form_input, #bs_form_radio, #bs_form_select, #bs_form_submit, #bs_form_switch, #bs_icon, #bs_list_group, #bs_modal, #bs_navbar, #bs_page_heading, #bs_pagination, #bs_popover, #bs_progress, #bs_row, #bs_scrollspy, #bs_section_card, #bs_sidebar, #bs_smart_collection, #bs_spinner, #bs_tab_nav, #bs_tab_nav_content, #bs_toast, #bs_tooltip
Instance Method Details
#height ⇒ Object
19
20
21
|
# File 'lib/matestack/ui/bootstrap/components/avatar.rb', line 19
def height
context.size || 40
end
|
#response ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/matestack/ui/bootstrap/components/avatar.rb', line 5
def response
if context.text.present? && context.img_path.nil?
div class: "rounded-circle bg-#{context.bg_variant || 'primary'} text-#{context.text_variant || 'white'} text-center p-2 #{context.bs_class}",
style: "height: #{height}px; width: #{width}px; display: inline-block;" do
plain context.text
end
else
div class: "rounded-circle text-#{context.text_variant || 'white'} text-center p-2 #{context.bs_class}",
style: "height: #{height}px; width: #{width}px; display: inline-block; background-image: url(#{context.img_path}); background-size: contain;" do
plain context.text
end
end
end
|
#width ⇒ Object
23
24
25
|
# File 'lib/matestack/ui/bootstrap/components/avatar.rb', line 23
def width
context.size || 40
end
|