matestack-ui-bootstrap 1.5.1 → 3.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +17 -5
- data/README.md +36 -60
- data/lib/matestack/ui/bootstrap/base_component.rb +11 -0
- data/lib/matestack/ui/bootstrap/base_vue_js_component.rb +11 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/accordion.rb +18 -16
- data/lib/matestack/ui/bootstrap/components/alert.js +58 -0
- data/lib/matestack/ui/bootstrap/components/alert.rb +43 -0
- data/lib/matestack/ui/bootstrap/components/avatar.rb +27 -0
- data/lib/matestack/ui/bootstrap/components/badge.rb +32 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/breadcrumb.rb +12 -10
- data/lib/matestack/ui/bootstrap/components/button.rb +71 -0
- data/lib/matestack/ui/bootstrap/components/button_group.rb +36 -0
- data/lib/matestack/ui/bootstrap/components/card.rb +105 -0
- data/lib/matestack/ui/bootstrap/components/carousel.js +84 -0
- data/lib/matestack/ui/bootstrap/components/carousel.rb +103 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/close.rb +10 -9
- data/lib/matestack/ui/bootstrap/components/collapse.js +89 -0
- data/lib/matestack/ui/bootstrap/components/collapse.rb +54 -0
- data/lib/matestack/ui/bootstrap/components/dropdown.js +19 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/dropdown.rb +29 -25
- data/lib/matestack/ui/bootstrap/components/icon.rb +21 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/list_group.rb +32 -29
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/modal.js +32 -28
- data/lib/matestack/ui/bootstrap/components/modal.rb +121 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/navbar.rb +39 -30
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/page_heading.rb +7 -5
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/pagination.rb +11 -9
- data/lib/matestack/ui/bootstrap/components/popover.js +30 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/popover.rb +25 -21
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/progress.rb +19 -19
- data/lib/matestack/ui/bootstrap/components/scrollspy.rb +50 -0
- data/lib/matestack/ui/bootstrap/components/section_card.rb +33 -0
- data/lib/matestack/ui/bootstrap/components/spinner.rb +35 -0
- data/lib/matestack/ui/bootstrap/components/tab_nav.rb +79 -0
- data/lib/matestack/ui/bootstrap/components/tab_nav_content.rb +35 -0
- data/lib/matestack/ui/bootstrap/components/toast.js +89 -0
- data/lib/matestack/ui/bootstrap/components/toast.rb +113 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/tooltip.js +9 -6
- data/{app/concepts → lib}/matestack/ui/bootstrap/components/tooltip.rb +20 -18
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/figure.rb +4 -2
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/collection.rb +22 -16
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/collection.scss +0 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/content.rb +38 -21
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/filter.rb +6 -2
- data/{app/concepts → lib}/matestack/ui/bootstrap/content/smart_collection/paginate.rb +16 -11
- data/lib/matestack/ui/bootstrap/form/checkbox.rb +88 -0
- data/lib/matestack/ui/bootstrap/form/input.rb +116 -0
- data/lib/matestack/ui/bootstrap/form/radio.rb +55 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/form/select.rb +18 -10
- data/lib/matestack/ui/bootstrap/form/submit.rb +20 -0
- data/lib/matestack/ui/bootstrap/form/switch.rb +30 -0
- data/lib/matestack/ui/bootstrap/form/textarea.rb +47 -0
- data/lib/matestack/ui/bootstrap/index.js +40 -0
- data/lib/matestack/ui/bootstrap/initialize.rb +3 -0
- data/lib/matestack/ui/bootstrap/layout/column.rb +49 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/layout/container.rb +12 -9
- data/lib/matestack/ui/bootstrap/layout/row.rb +25 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.js +10 -6
- data/lib/matestack/ui/bootstrap/layout/sidebar.rb +43 -0
- data/{app/concepts → lib}/matestack/ui/bootstrap/layout/sidebar.scss +0 -0
- data/{app/concepts/matestack/ui/bootstrap/apps → lib/matestack/ui/bootstrap/layouts}/admin_template.rb +18 -13
- data/lib/matestack/ui/bootstrap/registry.rb +173 -0
- data/{app/javascript/matestack-ui-bootstrap → lib/matestack/ui/bootstrap}/stylesheets/matestack-ui-bootstrap.scss +0 -0
- data/lib/matestack/ui/bootstrap/version.rb +1 -1
- data/lib/matestack/ui/bootstrap.rb +99 -17
- metadata +85 -80
- data/app/assets/images/avatar-placeholder.png +0 -0
- data/app/assets/images/icons/bootstrap-icons.svg +0 -1
- data/app/concepts/matestack/ui/bootstrap/components/alert.js +0 -53
- data/app/concepts/matestack/ui/bootstrap/components/alert.rb +0 -34
- data/app/concepts/matestack/ui/bootstrap/components/avatar.rb +0 -27
- data/app/concepts/matestack/ui/bootstrap/components/badge.rb +0 -30
- data/app/concepts/matestack/ui/bootstrap/components/button.rb +0 -69
- data/app/concepts/matestack/ui/bootstrap/components/button_group.rb +0 -36
- data/app/concepts/matestack/ui/bootstrap/components/card.rb +0 -100
- data/app/concepts/matestack/ui/bootstrap/components/carousel.js +0 -79
- data/app/concepts/matestack/ui/bootstrap/components/carousel.rb +0 -86
- data/app/concepts/matestack/ui/bootstrap/components/collapse.js +0 -84
- data/app/concepts/matestack/ui/bootstrap/components/collapse.rb +0 -43
- data/app/concepts/matestack/ui/bootstrap/components/dropdown.js +0 -14
- data/app/concepts/matestack/ui/bootstrap/components/icon.rb +0 -19
- data/app/concepts/matestack/ui/bootstrap/components/modal.rb +0 -106
- data/app/concepts/matestack/ui/bootstrap/components/popover.js +0 -26
- data/app/concepts/matestack/ui/bootstrap/components/scrollspy.rb +0 -48
- data/app/concepts/matestack/ui/bootstrap/components/section_card.rb +0 -31
- data/app/concepts/matestack/ui/bootstrap/components/spinner.rb +0 -31
- data/app/concepts/matestack/ui/bootstrap/components/tab_nav.rb +0 -83
- data/app/concepts/matestack/ui/bootstrap/components/tab_nav_content.rb +0 -32
- data/app/concepts/matestack/ui/bootstrap/components/toast.js +0 -85
- data/app/concepts/matestack/ui/bootstrap/components/toast.rb +0 -99
- data/app/concepts/matestack/ui/bootstrap/form/checkbox.rb +0 -99
- data/app/concepts/matestack/ui/bootstrap/form/input.rb +0 -112
- data/app/concepts/matestack/ui/bootstrap/form/radio.rb +0 -57
- data/app/concepts/matestack/ui/bootstrap/form/submit.rb +0 -21
- data/app/concepts/matestack/ui/bootstrap/form/switch.rb +0 -99
- data/app/concepts/matestack/ui/bootstrap/layout/column.rb +0 -47
- data/app/concepts/matestack/ui/bootstrap/layout/row.rb +0 -15
- data/app/concepts/matestack/ui/bootstrap/layout/sidebar.rb +0 -45
- data/app/concepts/matestack/ui/bootstrap/pages/devise/sign_in.rb +0 -40
- data/app/concepts/matestack/ui/bootstrap/registry.rb +0 -61
- data/app/helpers/matestack/ui/bootstrap/application_helper.rb +0 -17
- data/app/javascript/matestack-ui-bootstrap/index.js +0 -24
- data/app/javascript/packs/matestack-ui-bootstrap.js +0 -2
- data/app/matestack/bootstrap/form/submit.rb +0 -20
- data/config/routes.rb +0 -2
- data/config/webpack/development.js +0 -5
- data/config/webpack/environment.js +0 -29
- data/config/webpack/production.js +0 -33
- data/config/webpack/test.js +0 -5
- data/config/webpacker.yml +0 -96
- data/lib/matestack/ui/bootstrap/engine.rb +0 -26
@@ -1,53 +0,0 @@
|
|
1
|
-
import * as bootstrap from 'bootstrap'
|
2
|
-
|
3
|
-
MatestackUiCore.Vue.component('matestack-ui-bootstrap-alert', {
|
4
|
-
mixins: [MatestackUiCore.componentMixin],
|
5
|
-
|
6
|
-
data() {
|
7
|
-
return {
|
8
|
-
alertInstance: undefined,
|
9
|
-
};
|
10
|
-
},
|
11
|
-
|
12
|
-
methods: {
|
13
|
-
close: function (){
|
14
|
-
this.alertInstance.close()
|
15
|
-
},
|
16
|
-
dispose: function (){
|
17
|
-
this.alertInstance.dispose()
|
18
|
-
// this.alertInstance = new bootstrap.Alert(self.$el)
|
19
|
-
}
|
20
|
-
},
|
21
|
-
|
22
|
-
mounted: function() {
|
23
|
-
const self = this
|
24
|
-
var alert = self.$el
|
25
|
-
self.alertInstance = new bootstrap.Alert(alert)
|
26
|
-
},
|
27
|
-
|
28
|
-
created: function() {
|
29
|
-
const self = this
|
30
|
-
// close_on event registration
|
31
|
-
if(self.componentConfig["close_on"] != undefined){
|
32
|
-
var close_events = self.componentConfig["close_on"].split(",")
|
33
|
-
close_events.forEach(close_event => MatestackUiCore.matestackEventHub.$on(close_event.trim(), self.close));
|
34
|
-
}
|
35
|
-
// dispose_on event registration
|
36
|
-
if(self.componentConfig["dispose_on"] != undefined){
|
37
|
-
var dispose_events = self.componentConfig["dispose_on"].split(",")
|
38
|
-
dispose_events.forEach(dispose_event => MatestackUiCore.matestackEventHub.$on(dispose_event.trim(), self.dispose));
|
39
|
-
}
|
40
|
-
},
|
41
|
-
|
42
|
-
beforeDestroy: function() {
|
43
|
-
const self = this
|
44
|
-
if(self.componentConfig["close_on"] != undefined){
|
45
|
-
var closen_events = self.componentConfig["close_on"].split(",")
|
46
|
-
closen_events.forEach(close_event => MatestackUiCore.matestackEventHub.$off(close_event.trim(), self.close));
|
47
|
-
}
|
48
|
-
if(self.componentConfig["dispose_on"] != undefined){
|
49
|
-
var dispose_events = self.componentConfig["dispose_on"].split(",")
|
50
|
-
dispose_events.forEach(dispose_event => MatestackUiCore.matestackEventHub.$off(dispose_event.trim(), self.dispose));
|
51
|
-
}
|
52
|
-
},
|
53
|
-
});
|
@@ -1,34 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::Alert < Matestack::Ui::VueJsComponent
|
2
|
-
vue_js_component_name "matestack-ui-bootstrap-alert"
|
3
|
-
|
4
|
-
optional :title, :text, :variant, :dismissible, :animate, :title_size, class: { as: :bs_class }
|
5
|
-
optional :close_on, :dispose_on # event names on which occourences we close or dispose the modal
|
6
|
-
|
7
|
-
def response
|
8
|
-
div alert_attributes do
|
9
|
-
heading size: (title_size || 4), class: 'alert-heading', text: title if title
|
10
|
-
plain text if text
|
11
|
-
yield_components
|
12
|
-
bs_close dismiss: "alert" if dismissible
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
|
18
|
-
def alert_classes
|
19
|
-
classes = ['alert']
|
20
|
-
classes << "alert-#{variant || "primary"}"
|
21
|
-
classes << "alert-dismissible" if dismissible
|
22
|
-
classes << "fade show" if animate
|
23
|
-
classes << bs_class
|
24
|
-
classes.join(' ')
|
25
|
-
end
|
26
|
-
|
27
|
-
def alert_attributes
|
28
|
-
html_attributes.merge(
|
29
|
-
class: alert_classes,
|
30
|
-
attributes: { role: :alert }
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::Avatar < Matestack::Ui::Component
|
2
|
-
|
3
|
-
optional :text, :bg_variant, :text_variant, :img_path, :size, class: { as: :bs_class }
|
4
|
-
|
5
|
-
def response
|
6
|
-
if text.present? && img_path.nil?
|
7
|
-
div class: "rounded-circle bg-#{bg_variant || 'primary'} text-#{text_variant || 'white'} text-center p-2 #{bs_class}",
|
8
|
-
attributes: { style: "height: #{height}px; width: #{width}px; display: inline-block;"} do
|
9
|
-
plain text
|
10
|
-
end
|
11
|
-
else
|
12
|
-
div class: "rounded-circle text-#{text_variant || 'white'} text-center p-2 #{bs_class}",
|
13
|
-
attributes: { style: "height: #{height}px; width: #{width}px; display: inline-block; background-image: url(#{img_path}); background-size: contain;"} do
|
14
|
-
plain text
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def height
|
20
|
-
size || 40
|
21
|
-
end
|
22
|
-
|
23
|
-
def width
|
24
|
-
size || 40
|
25
|
-
end
|
26
|
-
|
27
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::Badge < Matestack::Ui::Component
|
2
|
-
|
3
|
-
optional class: { as: :bs_class }
|
4
|
-
optional :text, :variant, :rounded, :visually_hidden
|
5
|
-
|
6
|
-
def response
|
7
|
-
span badge_attributes do
|
8
|
-
plain text if text
|
9
|
-
yield_components
|
10
|
-
end
|
11
|
-
span class: "visually-hidden", text: visually_hidden if visually_hidden.present?
|
12
|
-
end
|
13
|
-
|
14
|
-
protected
|
15
|
-
|
16
|
-
def badge_attributes
|
17
|
-
html_attributes.merge(
|
18
|
-
class: badge_classes
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
def badge_classes
|
23
|
-
[].tap do |classes|
|
24
|
-
classes << 'badge'
|
25
|
-
classes << (variant.present? ? "bg-#{variant}" : "bg-secondary")
|
26
|
-
classes << "rounded-pill" if rounded
|
27
|
-
classes << bs_class
|
28
|
-
end.join(' ').strip
|
29
|
-
end
|
30
|
-
end
|
@@ -1,69 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::Button < Matestack::Ui::Component
|
2
|
-
|
3
|
-
optional :text, :type, :variant, :size, :outline
|
4
|
-
optional attributes: { as: :bs_attrs }, class: { as: :bs_class }
|
5
|
-
optional transition: { as: :bs_btn_transition }
|
6
|
-
optional action: { as: :bs_btn_action }
|
7
|
-
optional onclick: { as: :bs_btn_onclick }
|
8
|
-
optional link: { as: :bs_btn_link }
|
9
|
-
|
10
|
-
def response
|
11
|
-
if bs_btn_transition.present? && bs_btn_transition.is_a?(Hash)
|
12
|
-
transition button_attributes.merge(bs_btn_transition.merge({attributes: { role: "button"} })) do
|
13
|
-
inner_response
|
14
|
-
end
|
15
|
-
elsif bs_btn_action.present? && bs_btn_action.is_a?(Hash)
|
16
|
-
action button_attributes.merge(bs_btn_action.merge({attributes: { role: "button"} })) do
|
17
|
-
inner_response
|
18
|
-
end
|
19
|
-
elsif bs_btn_onclick.present? && bs_btn_onclick.is_a?(Hash)
|
20
|
-
onclick button_attributes.merge(bs_btn_onclick.merge({attributes: { role: "button"} })) do
|
21
|
-
inner_response
|
22
|
-
end
|
23
|
-
elsif bs_btn_link.present? && bs_btn_link.is_a?(Hash)
|
24
|
-
link button_attributes.merge(bs_btn_link.merge({attributes: { role: "button"} })) do
|
25
|
-
inner_response
|
26
|
-
end
|
27
|
-
else
|
28
|
-
button_response
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def button_response
|
33
|
-
button button_attributes do
|
34
|
-
inner_response
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def inner_response
|
39
|
-
plain text if text
|
40
|
-
yield_components
|
41
|
-
end
|
42
|
-
|
43
|
-
protected
|
44
|
-
|
45
|
-
def button_attributes
|
46
|
-
html_attributes.merge(
|
47
|
-
type: type || 'button',
|
48
|
-
class: button_classes,
|
49
|
-
attributes: bs_attrs
|
50
|
-
)
|
51
|
-
end
|
52
|
-
|
53
|
-
def button_classes
|
54
|
-
[].tap do |classes|
|
55
|
-
classes << 'btn'
|
56
|
-
# btn variants outlined or solid background
|
57
|
-
if outline
|
58
|
-
classes << "btn-outline-#{variant.to_s.gsub('_', '-') || 'primary'}"
|
59
|
-
else
|
60
|
-
classes << (variant ? "btn-#{variant.to_s.gsub('_', '-')}" : 'btn-primary')
|
61
|
-
end
|
62
|
-
# btn size
|
63
|
-
classes << "btn-#{size}" if size
|
64
|
-
# custom classes
|
65
|
-
classes << bs_class
|
66
|
-
end.join(' ').strip
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::ButtonGroup < Matestack::Ui::Component
|
2
|
-
|
3
|
-
optional class: { as: :bs_class }
|
4
|
-
optional label: { as: :bs_label }
|
5
|
-
optional :toolbar, :size, :vertical
|
6
|
-
|
7
|
-
def response
|
8
|
-
div buttongroup_attributes do
|
9
|
-
yield_components
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
protected
|
14
|
-
|
15
|
-
def buttongroup_attributes
|
16
|
-
attributes = {}.tap do |hash|
|
17
|
-
hash[:class] = buttongroup_classes
|
18
|
-
hash[:attributes] = {
|
19
|
-
role: "#{toolbar ? :toolbar : :group}",
|
20
|
-
'aria-label': bs_label
|
21
|
-
}
|
22
|
-
end
|
23
|
-
html_attributes.merge(
|
24
|
-
attributes
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
def buttongroup_classes
|
29
|
-
[].tap do |classes|
|
30
|
-
classes << ("btn-#{toolbar ? :toolbar : :group}#{'-vertical' if vertical}")
|
31
|
-
classes << "btn-group-#{size}" if size.present?
|
32
|
-
classes << bs_class
|
33
|
-
end.join(' ').strip
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
@@ -1,100 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::Card < Matestack::Ui::Component
|
2
|
-
|
3
|
-
optional class: { as: :bs_class }
|
4
|
-
|
5
|
-
# header attributes, expects a hash or string
|
6
|
-
# possible keys `:class, :text`
|
7
|
-
optional :header
|
8
|
-
# footer attributes, expects a hash or string
|
9
|
-
# possible keys `:class, :text`
|
10
|
-
optional :footer
|
11
|
-
|
12
|
-
optional :title, :body, :subtitle # body attributes
|
13
|
-
optional :img_path, :img_pos, :alt_text # image attributes
|
14
|
-
|
15
|
-
optional :content_wrapper_class # class for content wrapper -> useful for content padding without affecting top image
|
16
|
-
|
17
|
-
optional :slots # passed in slots for card header or footer
|
18
|
-
|
19
|
-
def response
|
20
|
-
div card_attributes do
|
21
|
-
if header || slots && slots[:header]
|
22
|
-
header_partial
|
23
|
-
end
|
24
|
-
|
25
|
-
img_partial :top unless img_pos == :bottom
|
26
|
-
div class: content_wrapper_class do
|
27
|
-
body_partial if title || body || slots && slots[:body]
|
28
|
-
|
29
|
-
# custom body components
|
30
|
-
# needed a div otherwise it will be displayed below footer
|
31
|
-
div class: "p-3 pt-1" do yield_components end
|
32
|
-
|
33
|
-
img_partial :bottom if img_pos == :bottom
|
34
|
-
|
35
|
-
footer_partial if footer || slots && slots[:footer]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
protected
|
41
|
-
|
42
|
-
def header_partial
|
43
|
-
header = self.header.is_a?(Hash) ? self.header : { text: self.header }
|
44
|
-
div class: "card-header #{header[:class]}" do
|
45
|
-
plain header[:text] if header[:text].present?
|
46
|
-
slot slots[:header] if slots && slots[:header]
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def body_partial
|
51
|
-
div class: "card-body" do
|
52
|
-
# title
|
53
|
-
card_title(title, "card-title")
|
54
|
-
# subtitle
|
55
|
-
card_title(subtitle, 6, "card-subtitle text-muted")
|
56
|
-
# body
|
57
|
-
if body.is_a? Hash
|
58
|
-
paragraph class: "card-text #{body[:class]}", text: body[:text]
|
59
|
-
elsif body
|
60
|
-
paragraph class: "card-text", text: body
|
61
|
-
end
|
62
|
-
slot slots[:body] if slots && slots[:body]
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def footer_partial
|
67
|
-
footer = self.footer.is_a?(Hash) ? self.footer : { text: self.footer }
|
68
|
-
div class: "card-footer #{footer[:class]}" do
|
69
|
-
plain footer[:text] if footer[:text].present?
|
70
|
-
slot slots[:footer] if slots && slots[:footer]
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def img_partial pos
|
75
|
-
img class: "card-img-#{pos}", path: img_path, alt: alt_text if img_path.present?
|
76
|
-
end
|
77
|
-
|
78
|
-
def card_attributes
|
79
|
-
html_attributes.except(:title).merge(
|
80
|
-
class: card_classes
|
81
|
-
)
|
82
|
-
end
|
83
|
-
|
84
|
-
def card_classes
|
85
|
-
[].tap do |classes|
|
86
|
-
classes << 'card'
|
87
|
-
classes << bs_class
|
88
|
-
end.join(' ').strip
|
89
|
-
end
|
90
|
-
|
91
|
-
def card_title(options, default_size = 5, title_class)
|
92
|
-
if options.is_a? Hash
|
93
|
-
heading size: (options[:size] || default_size), class: "#{options[:class]} #{title_class}",
|
94
|
-
text: options[:text]
|
95
|
-
elsif options
|
96
|
-
heading size: default_size, class: title_class, text: options
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
import * as bootstrap from 'bootstrap'
|
2
|
-
|
3
|
-
MatestackUiCore.Vue.component('matestack-ui-bootstrap-carousel', {
|
4
|
-
mixins: [MatestackUiCore.componentMixin],
|
5
|
-
data() {
|
6
|
-
return {
|
7
|
-
carouselInstance: undefined
|
8
|
-
};
|
9
|
-
},
|
10
|
-
|
11
|
-
methods: {
|
12
|
-
cycle: function(){
|
13
|
-
const self = this;
|
14
|
-
self.carouselInstance.cycle()
|
15
|
-
},
|
16
|
-
pause: function(){
|
17
|
-
const self = this;
|
18
|
-
self.carouselInstance.pause()
|
19
|
-
},
|
20
|
-
prev: function(){
|
21
|
-
const self = this;
|
22
|
-
self.carouselInstance.prev()
|
23
|
-
},
|
24
|
-
next: function(){
|
25
|
-
const self = this;
|
26
|
-
self.carouselInstance.next()
|
27
|
-
}
|
28
|
-
},
|
29
|
-
|
30
|
-
mounted: function() {
|
31
|
-
const self = this;
|
32
|
-
var myCarousel = self.$el;
|
33
|
-
self.carouselInstance = new bootstrap.Carousel(myCarousel, {
|
34
|
-
interval: (self.componentConfig['interval'] || 5000)
|
35
|
-
})
|
36
|
-
},
|
37
|
-
|
38
|
-
created: function() {
|
39
|
-
const self = this
|
40
|
-
if(self.componentConfig["cycle_on"] != undefined){
|
41
|
-
var cycle_events = self.componentConfig["cycle_on"].split(",")
|
42
|
-
cycle_events.forEach(cycle_event => MatestackUiCore.matestackEventHub.$on(cycle_event.trim(), self.cycle));
|
43
|
-
}
|
44
|
-
if(self.componentConfig["pause_on"] != undefined){
|
45
|
-
var pause_events = self.componentConfig["pause_on"].split(",")
|
46
|
-
pause_events.forEach(pause_event => MatestackUiCore.matestackEventHub.$on(pause_event.trim(), self.pause));
|
47
|
-
}
|
48
|
-
if(self.componentConfig["prev_on"] != undefined){
|
49
|
-
var prev_events = self.componentConfig["prev_on"].split(",")
|
50
|
-
prev_events.forEach(prev_event => MatestackUiCore.matestackEventHub.$on(prev_event.trim(), self.prev));
|
51
|
-
}
|
52
|
-
if(self.componentConfig["next_on"] != undefined){
|
53
|
-
var next_events = self.componentConfig["next_on"].split(",")
|
54
|
-
next_events.forEach(next_event => MatestackUiCore.matestackEventHub.$on(next_event.trim(), self.next));
|
55
|
-
}
|
56
|
-
},
|
57
|
-
|
58
|
-
beforeDestroy: function() {
|
59
|
-
const self = this
|
60
|
-
if(self.componentConfig["cycle_on"] != undefined){
|
61
|
-
var cycle_events = self.componentConfig["cycle_on"].split(",")
|
62
|
-
cycle_events.forEach(cycle_event => MatestackUiCore.matestackEventHub.$off(cycle_event.trim(), self.cycle));
|
63
|
-
}
|
64
|
-
|
65
|
-
if(self.componentConfig["pause_on"] != undefined){
|
66
|
-
var pause_events = self.componentConfig["pause_on"].split(",")
|
67
|
-
pause_events.forEach(pause_event => MatestackUiCore.matestackEventHub.$off(pause_event.trim(), self.pause));
|
68
|
-
}
|
69
|
-
|
70
|
-
if(self.componentConfig["prev_on"] != undefined){
|
71
|
-
var prev_events = self.componentConfig["prev_on"].split(",")
|
72
|
-
prev_events.forEach(prev_event => MatestackUiCore.matestackEventHub.$off(prev_event.trim(), self.prev));
|
73
|
-
}
|
74
|
-
if(self.componentConfig["next_on"] != undefined){
|
75
|
-
var next_events = self.componentConfig["next_on"].split(",")
|
76
|
-
next_events.forEach(next_event => MatestackUiCore.matestackEventHub.$off(next_event.trim(), self.next));
|
77
|
-
}
|
78
|
-
},
|
79
|
-
});
|
@@ -1,86 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::Carousel < Matestack::Ui::VueJsComponent
|
2
|
-
vue_js_component_name "matestack-ui-bootstrap-carousel"
|
3
|
-
|
4
|
-
optional :start, :controls, :indicators, :fade, :interval, :variant
|
5
|
-
optional :items, class: { as: :bs_class }
|
6
|
-
# possible keys for items: path, title, text, interval
|
7
|
-
# event trigger
|
8
|
-
optional :cycle_on, :pause_on, :prev_on, :next_on
|
9
|
-
|
10
|
-
def setup
|
11
|
-
@component_config["carousel-id"] = carousel_id
|
12
|
-
end
|
13
|
-
|
14
|
-
def response
|
15
|
-
div carousel_attributes do
|
16
|
-
# carousel indicator
|
17
|
-
indicator_partial if indicators.present?
|
18
|
-
# carousel content
|
19
|
-
div class: "carousel-inner" do
|
20
|
-
yield_components
|
21
|
-
carousel_partial if items
|
22
|
-
end
|
23
|
-
controls_partial if controls
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
protected
|
28
|
-
|
29
|
-
def indicator_partial
|
30
|
-
ol class: "carousel-indicators" do
|
31
|
-
items.size.times do |index|
|
32
|
-
li data: { "bs-target": "##{carousel_id}", 'bs-slide-to': index },
|
33
|
-
class: "#{'active' if index == (start || 0) }"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def carousel_partial
|
39
|
-
items.each_with_index do |item, index|
|
40
|
-
div class: "carousel-item #{'active' if index == (start || 0) } #{item[:class]}".strip,
|
41
|
-
data: { "bs-interval": item[:interval] } do
|
42
|
-
img class: "d-block w-100", path: item[:path]
|
43
|
-
if item[:title] || item[:text]
|
44
|
-
div class: "carousel-caption d-none d-md-block #{item[:title_class]}" do
|
45
|
-
heading size: 5, text: item[:title]
|
46
|
-
paragraph text: item[:text]
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def controls_partial
|
54
|
-
link class: "carousel-control-prev", data: { "bs-target": "##{carousel_id}", "bs-slide": :prev }, attributes: { 'role': "button" } do
|
55
|
-
span class: "carousel-control-prev-icon", attributes: { 'aria-hidden': "true" }
|
56
|
-
span class: "visually-hidden", text: "Previous"
|
57
|
-
end
|
58
|
-
link class: "carousel-control-next", data: { "bs-target": "##{carousel_id}", "bs-slide": :next }, attributes: { 'role': "button" } do
|
59
|
-
span class: "carousel-control-next-icon", attributes: { 'aria-hidden': "true" }
|
60
|
-
span class: "visually-hidden", text: "Next"
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def carousel_attributes
|
65
|
-
html_attributes.merge(
|
66
|
-
id: carousel_id,
|
67
|
-
class: carousel_classes,
|
68
|
-
data: { "bs-ride": 'carousel', "bs-interval": (interval || 5000) }
|
69
|
-
)
|
70
|
-
end
|
71
|
-
|
72
|
-
def carousel_classes
|
73
|
-
[].tap do |classes|
|
74
|
-
classes << 'carousel slide'
|
75
|
-
classes << 'carousel-fade' if fade
|
76
|
-
classes << 'carousel-dark' if variant == :dark
|
77
|
-
#custom classes
|
78
|
-
classes << bs_class
|
79
|
-
end.join(' ').strip
|
80
|
-
end
|
81
|
-
|
82
|
-
def carousel_id
|
83
|
-
@carousel_id ||= "matestack-carousel-#{SecureRandom.hex}"
|
84
|
-
end
|
85
|
-
|
86
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
import * as bootstrap from 'bootstrap'
|
2
|
-
|
3
|
-
MatestackUiCore.Vue.component('matestack-ui-bootstrap-collapse', {
|
4
|
-
mixins: [MatestackUiCore.componentMixin],
|
5
|
-
data() {
|
6
|
-
return {
|
7
|
-
collapseInstance: undefined
|
8
|
-
};
|
9
|
-
},
|
10
|
-
|
11
|
-
methods: {
|
12
|
-
toggle: function (){
|
13
|
-
const self = this;
|
14
|
-
self.collapseInstance.toggle();
|
15
|
-
},
|
16
|
-
show: function(){
|
17
|
-
const self = this;
|
18
|
-
self.collapseInstance.show();
|
19
|
-
},
|
20
|
-
hide: function(){
|
21
|
-
const self = this;
|
22
|
-
self.collapseInstance.hide();
|
23
|
-
},
|
24
|
-
dispose: function(){
|
25
|
-
const self = this;
|
26
|
-
self.collapseInstance.hide();
|
27
|
-
self.collapseInstance.dispose();
|
28
|
-
// ToDo: Error occurs after dispose when click on the button again
|
29
|
-
}
|
30
|
-
},
|
31
|
-
|
32
|
-
mounted: function() {
|
33
|
-
const self = this;
|
34
|
-
var myCollapse = self.$el;
|
35
|
-
self.collapseInstance = new bootstrap.Collapse(myCollapse, {
|
36
|
-
toggle: false
|
37
|
-
})
|
38
|
-
},
|
39
|
-
|
40
|
-
created: function() {
|
41
|
-
const self = this
|
42
|
-
|
43
|
-
// toggle_on event registration
|
44
|
-
if(self.componentConfig["toggle_on"] != undefined){
|
45
|
-
var toggle_events = self.componentConfig["toggle_on"].split(",")
|
46
|
-
toggle_events.forEach(toggle_event => MatestackUiCore.matestackEventHub.$on(toggle_event.trim(), self.toggle));
|
47
|
-
}
|
48
|
-
// show_on event registration
|
49
|
-
if(self.componentConfig["show_on"] != undefined){
|
50
|
-
var show_events = self.componentConfig["show_on"].split(",")
|
51
|
-
show_events.forEach(show_event => MatestackUiCore.matestackEventHub.$on(show_event.trim(), self.show));
|
52
|
-
}
|
53
|
-
// hide_on event registration
|
54
|
-
if(self.componentConfig["hide_on"] != undefined){
|
55
|
-
var hide_events = self.componentConfig["hide_on"].split(",")
|
56
|
-
hide_events.forEach(hide_event => MatestackUiCore.matestackEventHub.$on(hide_event.trim(), self.hide));
|
57
|
-
}
|
58
|
-
// dispose_on event registration
|
59
|
-
if(self.componentConfig["dispose_on"] != undefined){
|
60
|
-
var dispose_events = self.componentConfig["dispose_on"].split(",")
|
61
|
-
dispose_events.forEach(dispose_event => MatestackUiCore.matestackEventHub.$on(dispose_event.trim(), self.dispose));
|
62
|
-
}
|
63
|
-
},
|
64
|
-
|
65
|
-
beforeDestroy: function(){
|
66
|
-
const self = this
|
67
|
-
if(self.componentConfig["toggle_on"] != undefined){
|
68
|
-
var show_events = self.componentConfig["toggle_on"].split(",")
|
69
|
-
show_events.forEach(show_event => MatestackUiCore.matestackEventHub.$off(show_event.trim(), self.show));
|
70
|
-
}
|
71
|
-
if(self.componentConfig["show_on"] != undefined){
|
72
|
-
var show_events = self.componentConfig["show_on"].split(",")
|
73
|
-
show_events.forEach(show_event => MatestackUiCore.matestackEventHub.$off(show_event.trim(), self.show));
|
74
|
-
}
|
75
|
-
if(self.componentConfig["hide_on"] != undefined){
|
76
|
-
var hide_events = self.componentConfig["hide_on"].split(",")
|
77
|
-
hide_events.forEach(hide_event => MatestackUiCore.matestackEventHub.$off(hide_event.trim(), self.hide));
|
78
|
-
}
|
79
|
-
if(self.componentConfig["dispose_on"] != undefined){
|
80
|
-
var dispose_events = self.componentConfig["dispose_on"].split(",")
|
81
|
-
dispose_events.forEach(dispose_event => MatestackUiCore.matestackEventHub.$off(dispose_event.trim(), self.dispose));
|
82
|
-
}
|
83
|
-
}
|
84
|
-
});
|
@@ -1,43 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::Collapse < Matestack::Ui::VueJsComponent
|
2
|
-
vue_js_component_name "matestack-ui-bootstrap-collapse"
|
3
|
-
|
4
|
-
optional :multi, :labelledby, :parent, class: { as: :bs_class }
|
5
|
-
optional :card # possible keys: class, text
|
6
|
-
# event trigger
|
7
|
-
optional :toggle_on, :show_on, :hide_on, :dispose_on
|
8
|
-
|
9
|
-
def response
|
10
|
-
div collapse_attributes do
|
11
|
-
card_partial if card
|
12
|
-
yield_components
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
|
18
|
-
def card_partial
|
19
|
-
tmp_card = card.is_a?(Hash) ? self.card : { text: self.card }
|
20
|
-
div class: "card card-body #{tmp_card[:class]}".strip do
|
21
|
-
plain tmp_card[:text]
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def collapse_attributes
|
26
|
-
html_attributes.merge(
|
27
|
-
class: collapse_classes,
|
28
|
-
data: { "bs-parent": parent },
|
29
|
-
attributes: { 'aria-labelledby': "#{labelledby}" }
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
def collapse_classes
|
34
|
-
[].tap do |classes|
|
35
|
-
classes << 'collapse'
|
36
|
-
# mulit target
|
37
|
-
classes << 'multi-collapse' if multi
|
38
|
-
#custom classes
|
39
|
-
classes << bs_class
|
40
|
-
end.join(' ').strip
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
import * as bootstrap from 'bootstrap'
|
2
|
-
|
3
|
-
MatestackUiCore.Vue.component('matestack-ui-bootstrap-dropdown', {
|
4
|
-
mixins: [MatestackUiCore.componentMixin],
|
5
|
-
data() {
|
6
|
-
return {
|
7
|
-
dropdownInstance: undefined
|
8
|
-
};
|
9
|
-
},
|
10
|
-
mounted() {
|
11
|
-
// var mydropdown = document.getElementById(this.componentConfig["dropdown-id"])
|
12
|
-
// this.dropdownInstance = new bootstrap.Dropdown(mydropdown)
|
13
|
-
}
|
14
|
-
});
|
@@ -1,19 +0,0 @@
|
|
1
|
-
class Matestack::Ui::Bootstrap::Components::Icon < Matestack::Ui::Component
|
2
|
-
|
3
|
-
requires :name
|
4
|
-
optional :size
|
5
|
-
optional class: { as: :bs_class }
|
6
|
-
|
7
|
-
def response
|
8
|
-
plain " <svg class='bi #{bs_class}' width='#{get_size}' height='#{get_size}' fill='currentColor'>
|
9
|
-
<use xlink:href='#{image_url("icons/bootstrap-icons.svg")}##{name}'/>
|
10
|
-
</svg>".html_safe
|
11
|
-
end
|
12
|
-
|
13
|
-
def get_size
|
14
|
-
size || 20
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|