administrate-bootstrap-theme 0.1.0 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -11
- data/Rakefile +10 -14
- data/app/assets/config/administrate-bootstrap-theme_manifest.js +1 -0
- data/app/assets/javascripts/administrate-bootstrap-theme/theme.js +2 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/_base.scss +17 -1
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_content_body.scss +17 -3
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_form.scss +52 -16
- data/app/assets/stylesheets/administrate-bootstrap-theme/theme.scss +12 -0
- data/lib/administrate-bootstrap-theme/engine.rb +2 -0
- data/lib/administrate-bootstrap-theme/version.rb +1 -1
- data/node_modules/bootstrap/js/src/alert.js +141 -0
- data/node_modules/bootstrap/js/src/base-component.js +46 -0
- data/node_modules/bootstrap/js/src/button.js +95 -0
- data/node_modules/bootstrap/js/src/carousel.js +624 -0
- data/node_modules/bootstrap/js/src/collapse.js +410 -0
- data/node_modules/bootstrap/js/src/dom/data.js +57 -0
- data/node_modules/bootstrap/js/src/dom/event-handler.js +331 -0
- data/node_modules/bootstrap/js/src/dom/manipulator.js +80 -0
- data/node_modules/bootstrap/js/src/dom/selector-engine.js +75 -0
- data/node_modules/bootstrap/js/src/dropdown.js +543 -0
- data/node_modules/bootstrap/js/src/modal.js +582 -0
- data/node_modules/bootstrap/js/src/offcanvas.js +279 -0
- data/node_modules/bootstrap/js/src/popover.js +171 -0
- data/node_modules/bootstrap/js/src/scrollspy.js +319 -0
- data/node_modules/bootstrap/js/src/tab.js +220 -0
- data/node_modules/bootstrap/js/src/toast.js +219 -0
- data/node_modules/bootstrap/js/src/tooltip.js +802 -0
- data/node_modules/bootstrap/js/src/util/index.js +253 -0
- data/node_modules/bootstrap/js/src/util/sanitizer.js +127 -0
- data/node_modules/bootstrap/js/src/util/scrollbar.js +70 -0
- data/node_modules/bootstrap/scss/_accordion.scss +116 -0
- data/node_modules/bootstrap/scss/_alert.scss +57 -0
- data/node_modules/bootstrap/scss/_badge.scss +29 -0
- data/node_modules/bootstrap/scss/_breadcrumb.scss +28 -0
- data/node_modules/bootstrap/scss/_button-group.scss +139 -0
- data/node_modules/bootstrap/scss/_buttons.scss +111 -0
- data/node_modules/bootstrap/scss/_card.scss +215 -0
- data/node_modules/bootstrap/scss/_carousel.scss +229 -0
- data/node_modules/bootstrap/scss/_close.scss +40 -0
- data/node_modules/bootstrap/scss/_containers.scss +41 -0
- data/node_modules/bootstrap/scss/_dropdown.scss +246 -0
- data/node_modules/bootstrap/scss/_forms.scss +9 -0
- data/node_modules/bootstrap/scss/_functions.scss +205 -0
- data/node_modules/bootstrap/scss/_grid.scss +22 -0
- data/node_modules/bootstrap/scss/_helpers.scss +7 -0
- data/node_modules/bootstrap/scss/_images.scss +42 -0
- data/node_modules/bootstrap/scss/_list-group.scss +174 -0
- data/node_modules/bootstrap/scss/_mixins.scss +41 -0
- data/node_modules/bootstrap/scss/_modal.scss +237 -0
- data/node_modules/bootstrap/scss/_nav.scss +139 -0
- data/node_modules/bootstrap/scss/_navbar.scss +306 -0
- data/node_modules/bootstrap/scss/_offcanvas.scss +77 -0
- data/node_modules/bootstrap/scss/_pagination.scss +64 -0
- data/node_modules/bootstrap/scss/_popover.scss +158 -0
- data/node_modules/bootstrap/scss/_progress.scss +48 -0
- data/node_modules/bootstrap/scss/_reboot.scss +621 -0
- data/node_modules/bootstrap/scss/_root.scss +16 -0
- data/node_modules/bootstrap/scss/_spinners.scss +69 -0
- data/node_modules/bootstrap/scss/_tables.scss +150 -0
- data/node_modules/bootstrap/scss/_toasts.scss +51 -0
- data/node_modules/bootstrap/scss/_tooltip.scss +115 -0
- data/node_modules/bootstrap/scss/_transitions.scss +21 -0
- data/node_modules/bootstrap/scss/_type.scss +104 -0
- data/node_modules/bootstrap/scss/_utilities.scss +594 -0
- data/node_modules/bootstrap/scss/_variables.scss +1464 -0
- data/node_modules/bootstrap/scss/bootstrap-grid.scss +65 -0
- data/node_modules/bootstrap/scss/bootstrap-reboot.scss +15 -0
- data/node_modules/bootstrap/scss/bootstrap-utilities.scss +18 -0
- data/node_modules/bootstrap/scss/bootstrap.scss +52 -0
- data/node_modules/bootstrap/scss/forms/_floating-labels.scss +61 -0
- data/node_modules/bootstrap/scss/forms/_form-check.scss +152 -0
- data/node_modules/bootstrap/scss/forms/_form-control.scss +219 -0
- data/node_modules/bootstrap/scss/forms/_form-range.scss +91 -0
- data/node_modules/bootstrap/scss/forms/_form-select.scss +67 -0
- data/node_modules/bootstrap/scss/forms/_form-text.scss +11 -0
- data/node_modules/bootstrap/scss/forms/_input-group.scss +121 -0
- data/node_modules/bootstrap/scss/forms/_labels.scss +36 -0
- data/node_modules/bootstrap/scss/forms/_validation.scss +12 -0
- data/node_modules/bootstrap/scss/helpers/_clearfix.scss +3 -0
- data/node_modules/bootstrap/scss/helpers/_colored-links.scss +12 -0
- data/node_modules/bootstrap/scss/helpers/_position.scss +30 -0
- data/node_modules/bootstrap/scss/helpers/_ratio.scss +26 -0
- data/node_modules/bootstrap/scss/helpers/_stretched-link.scss +15 -0
- data/node_modules/bootstrap/scss/helpers/_text-truncation.scss +7 -0
- data/node_modules/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_alert.scss +11 -0
- data/node_modules/bootstrap/scss/mixins/_border-radius.scss +78 -0
- data/node_modules/bootstrap/scss/mixins/_box-shadow.scss +18 -0
- data/node_modules/bootstrap/scss/mixins/_breakpoints.scss +127 -0
- data/node_modules/bootstrap/scss/mixins/_buttons.scss +133 -0
- data/node_modules/bootstrap/scss/mixins/_caret.scss +64 -0
- data/node_modules/bootstrap/scss/mixins/_clearfix.scss +9 -0
- data/node_modules/bootstrap/scss/mixins/_container.scss +9 -0
- data/node_modules/bootstrap/scss/mixins/_deprecate.scss +10 -0
- data/node_modules/bootstrap/scss/mixins/_forms.scss +134 -0
- data/node_modules/bootstrap/scss/mixins/_gradients.scss +47 -0
- data/node_modules/bootstrap/scss/mixins/_grid.scss +120 -0
- data/node_modules/bootstrap/scss/mixins/_image.scss +16 -0
- data/node_modules/bootstrap/scss/mixins/_list-group.scss +24 -0
- data/node_modules/bootstrap/scss/mixins/_lists.scss +7 -0
- data/node_modules/bootstrap/scss/mixins/_pagination.scss +31 -0
- data/node_modules/bootstrap/scss/mixins/_reset-text.scss +17 -0
- data/node_modules/bootstrap/scss/mixins/_resize.scss +6 -0
- data/node_modules/bootstrap/scss/mixins/_table-variants.scss +21 -0
- data/node_modules/bootstrap/scss/mixins/_text-truncate.scss +8 -0
- data/node_modules/bootstrap/scss/mixins/_transition.scss +26 -0
- data/node_modules/bootstrap/scss/mixins/_utilities.scss +68 -0
- data/node_modules/bootstrap/scss/mixins/_visually-hidden.scss +29 -0
- data/node_modules/bootstrap/scss/utilities/_api.scss +47 -0
- data/node_modules/bootstrap/scss/vendor/_rfs.scss +312 -0
- metadata +106 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c179fa187eba0bd5d2a559db05a527b1cdde088000608bee63f9eed413aa8288
|
4
|
+
data.tar.gz: f0b2b078a5f189eb914dc8d0f70affc23fc91bf7b05fffa11ad6aee35ed064c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89a9486a51c81bf5a59b5866ced85fb658e6bdc1da5105f7a4876266f75d27f066e2c3aad3523c6177e2ab4b82b3d6e0aab0b6971565b238ef36dc6a5949f973
|
7
|
+
data.tar.gz: 52526a552b243d3d72a0eba83d321e23fe7a7f3af3f88e9e70a291a09d31211e4a357a8ed250ae00cda75371f9bb62fb5ed8a856ab202f31343f235e6ea82354
|
data/README.md
CHANGED
@@ -1,29 +1,35 @@
|
|
1
|
-
# Administrate Bootstrap Theme [![Gem Version](https://badge.fury.io/rb/administrate-bootstrap-theme.svg)](https://badge.fury.io/rb/administrate-bootstrap-theme)
|
1
|
+
# Administrate Bootstrap Theme [![Gem Version](https://badge.fury.io/rb/administrate-bootstrap-theme.svg)](https://badge.fury.io/rb/administrate-bootstrap-theme) ![specs](https://github.com/blocknotes/administrate-bootstrap-theme/actions/workflows/ruby.yml/badge.svg)
|
2
2
|
A Bootstrap 5 (_beta_) theme for [Administrate](https://github.com/thoughtbot/administrate).
|
3
3
|
|
4
4
|
Features:
|
5
|
-
- easy to install, just include CSS to apply the theme to a default Administrate structure;
|
5
|
+
- easy to install, just include CSS/JS to apply the theme to a default Administrate structure;
|
6
6
|
- customizable via SASS variables;
|
7
7
|
- allow to use *Bootstrap* components in the admin.
|
8
8
|
|
9
|
-
|
9
|
+
See some [screenshots](#screenshots).
|
10
10
|
|
11
11
|
## Installation
|
12
|
-
- Add to
|
13
|
-
-
|
12
|
+
- Add to *Gemfile* (of an Administrate project): `gem 'administrate-bootstrap-theme'` (and execute `bundle`)
|
13
|
+
- Add to *app/assets/config/manifest.js*:
|
14
14
|
|
15
15
|
```js
|
16
16
|
//= link administrate-bootstrap-theme/theme.css
|
17
|
-
|
18
|
-
// OFF link administrate/application.css
|
19
|
-
// OFF link administrate/application.js
|
17
|
+
//= link administrate-bootstrap-theme/theme.js
|
20
18
|
```
|
21
19
|
|
22
|
-
-
|
23
|
-
|
20
|
+
- Generate the layout views if they are missing: `rails generate administrate:views:layout` (only **_stylesheet** and **_javascript** partials are needed)
|
21
|
+
- Update *app/views/admin/application/_stylesheet.html.erb*, leaving only:
|
24
22
|
|
25
|
-
```
|
23
|
+
```erb
|
26
24
|
<%= stylesheet_link_tag 'administrate-bootstrap-theme/theme', media: 'all' %>
|
25
|
+
<%= yield :stylesheet %>
|
26
|
+
```
|
27
|
+
|
28
|
+
- Update *app/views/admin/application/_javascript.html.erb*, leaving only:
|
29
|
+
|
30
|
+
```erb
|
31
|
+
<%= javascript_include_tag 'administrate-bootstrap-theme/theme' %>
|
32
|
+
<%= yield :javascript %>
|
27
33
|
```
|
28
34
|
|
29
35
|
## Customizations
|
@@ -39,6 +45,14 @@ And replace the link tag in the *application.html.erb* with: `<%= stylesheet_lin
|
|
39
45
|
|
40
46
|
For the complete list of options take a look [here](app/assets/stylesheets/administrate-bootstrap-theme/_variables.scss).
|
41
47
|
|
48
|
+
## Screenshots
|
49
|
+
- Index page:
|
50
|
+
![screenshot_index](screenshot_index.png)
|
51
|
+
- Show page:
|
52
|
+
![screenshot_show](screenshot_show.png)
|
53
|
+
- Form page:
|
54
|
+
![screenshot_form](screenshot_form.png)
|
55
|
+
|
42
56
|
## Do you like it? Star it!
|
43
57
|
If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
|
44
58
|
|
data/Rakefile
CHANGED
@@ -1,20 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
begin
|
6
|
+
require 'rspec/core/rake_task'
|
7
7
|
|
8
|
-
|
8
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
9
|
+
# t.ruby_opts = %w[-w]
|
10
|
+
t.rspec_opts = ['--color', '--format documentation']
|
11
|
+
end
|
9
12
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Rake::TestTask.new(:test) do |t|
|
15
|
-
t.libs << 'test'
|
16
|
-
t.pattern = 'test/**/*_test.rb'
|
17
|
-
t.verbose = false
|
13
|
+
task default: :spec
|
14
|
+
rescue LoadError
|
15
|
+
puts '! LoadError: no RSpec available'
|
18
16
|
end
|
19
|
-
|
20
|
-
task default: :test
|
@@ -1,10 +1,11 @@
|
|
1
|
-
@import "
|
1
|
+
@import "bootstrap/scss/bootstrap";
|
2
2
|
|
3
3
|
@import "variables";
|
4
4
|
|
5
5
|
@import "components/navigation";
|
6
6
|
@import "components/content_header";
|
7
7
|
@import "components/content_body";
|
8
|
+
@import "components/form";
|
8
9
|
@import "components/pagination";
|
9
10
|
|
10
11
|
.app-container {
|
@@ -13,6 +14,21 @@
|
|
13
14
|
height: 100vh;
|
14
15
|
}
|
15
16
|
|
17
|
+
.flashes {
|
18
|
+
pointer-events: none;
|
19
|
+
position: fixed;
|
20
|
+
text-align: center;
|
21
|
+
width: calc(100% - #{$navigation-width});
|
22
|
+
|
23
|
+
> .flash {
|
24
|
+
@extend .alert, .d-inline-block;
|
25
|
+
|
26
|
+
&.flash-notice {
|
27
|
+
@extend .alert-info;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
16
32
|
.main-content {
|
17
33
|
@extend .d-flex, .flex-column;
|
18
34
|
|
@@ -1,13 +1,13 @@
|
|
1
1
|
.main-content__body {
|
2
|
-
@extend .container-fluid;
|
3
|
-
|
4
|
-
@import "form";
|
2
|
+
@extend .container-fluid, .mb-3;
|
5
3
|
|
6
4
|
> dl {
|
7
5
|
@extend .row;
|
8
6
|
|
9
7
|
dt {
|
10
8
|
@extend .col-2, .text-end;
|
9
|
+
|
10
|
+
min-height: 32px;
|
11
11
|
}
|
12
12
|
|
13
13
|
dd {
|
@@ -23,6 +23,20 @@
|
|
23
23
|
@extend .table;
|
24
24
|
}
|
25
25
|
|
26
|
+
.attribute--nested {
|
27
|
+
> div {
|
28
|
+
display: flex;
|
29
|
+
}
|
30
|
+
|
31
|
+
legend {
|
32
|
+
@extend .fs-5, .border-bottom;
|
33
|
+
}
|
34
|
+
|
35
|
+
.attribute-data {
|
36
|
+
@extend .ps-4;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
26
40
|
.cell-label__sort-indicator > svg {
|
27
41
|
height: 20px;
|
28
42
|
width: 20px;
|
@@ -1,25 +1,61 @@
|
|
1
|
-
|
1
|
+
.main-content__body {
|
2
|
+
legend {
|
3
|
+
@extend .fs-4, .my-2;
|
4
|
+
}
|
2
5
|
|
3
|
-
.
|
4
|
-
|
5
|
-
}
|
6
|
+
.field_with_errors {
|
7
|
+
@extend .text-danger;
|
8
|
+
}
|
6
9
|
|
7
|
-
.
|
8
|
-
|
9
|
-
}
|
10
|
+
.form-actions > input {
|
11
|
+
@extend .btn;
|
12
|
+
}
|
13
|
+
|
14
|
+
.field-unit {
|
15
|
+
@extend .row, .mb-3;
|
16
|
+
}
|
17
|
+
|
18
|
+
.field-unit__field {
|
19
|
+
@extend .col-10;
|
10
20
|
|
11
|
-
|
12
|
-
|
21
|
+
> input:not([type="checkbox"]) {
|
22
|
+
@extend .form-control;
|
23
|
+
}
|
13
24
|
|
14
|
-
|
15
|
-
|
25
|
+
> input[type="checkbox"] {
|
26
|
+
@extend .form-check-input
|
27
|
+
}
|
28
|
+
|
29
|
+
> select {
|
30
|
+
@extend .form-select;
|
31
|
+
}
|
32
|
+
|
33
|
+
> textarea {
|
34
|
+
@extend .form-control;
|
35
|
+
min-height: 150px;
|
36
|
+
}
|
16
37
|
}
|
17
|
-
}
|
18
38
|
|
19
|
-
.field-unit__label {
|
20
|
-
|
39
|
+
.field-unit__label {
|
40
|
+
@extend .col-2;
|
41
|
+
|
42
|
+
> label {
|
43
|
+
@extend .col-form-label;
|
44
|
+
border-bottom: 1px dashed #ccc;
|
45
|
+
padding-bottom: 0;
|
46
|
+
width: 100%;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
#error_explanation {
|
51
|
+
@extend .alert, .alert-danger;
|
52
|
+
|
53
|
+
> h2 {
|
54
|
+
@extend .h4, .alert-heading;
|
55
|
+
}
|
21
56
|
|
22
|
-
|
23
|
-
|
57
|
+
> ul {
|
58
|
+
@extend .mb-0;
|
59
|
+
}
|
24
60
|
}
|
25
61
|
}
|
@@ -21,11 +21,23 @@ nav.pagination {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
.main-content__body {
|
24
|
+
table {
|
25
|
+
@extend .table-striped;
|
26
|
+
}
|
27
|
+
|
28
|
+
.attribute-data > table {
|
29
|
+
@extend .table-bordered;
|
30
|
+
}
|
31
|
+
|
24
32
|
.form-actions > input {
|
25
33
|
@extend .btn-primary;
|
26
34
|
}
|
27
35
|
|
28
36
|
.js-table-row {
|
37
|
+
.action-show {
|
38
|
+
@extend .link-secondary;
|
39
|
+
}
|
40
|
+
|
29
41
|
.action-edit {
|
30
42
|
@extend .btn-secondary;
|
31
43
|
}
|
@@ -0,0 +1,141 @@
|
|
1
|
+
/**
|
2
|
+
* --------------------------------------------------------------------------
|
3
|
+
* Bootstrap (v5.0.0-beta3): alert.js
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
5
|
+
* --------------------------------------------------------------------------
|
6
|
+
*/
|
7
|
+
|
8
|
+
import {
|
9
|
+
defineJQueryPlugin,
|
10
|
+
emulateTransitionEnd,
|
11
|
+
getElementFromSelector,
|
12
|
+
getTransitionDurationFromElement
|
13
|
+
} from './util/index'
|
14
|
+
import Data from './dom/data'
|
15
|
+
import EventHandler from './dom/event-handler'
|
16
|
+
import BaseComponent from './base-component'
|
17
|
+
|
18
|
+
/**
|
19
|
+
* ------------------------------------------------------------------------
|
20
|
+
* Constants
|
21
|
+
* ------------------------------------------------------------------------
|
22
|
+
*/
|
23
|
+
|
24
|
+
const NAME = 'alert'
|
25
|
+
const DATA_KEY = 'bs.alert'
|
26
|
+
const EVENT_KEY = `.${DATA_KEY}`
|
27
|
+
const DATA_API_KEY = '.data-api'
|
28
|
+
|
29
|
+
const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]'
|
30
|
+
|
31
|
+
const EVENT_CLOSE = `close${EVENT_KEY}`
|
32
|
+
const EVENT_CLOSED = `closed${EVENT_KEY}`
|
33
|
+
const EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`
|
34
|
+
|
35
|
+
const CLASS_NAME_ALERT = 'alert'
|
36
|
+
const CLASS_NAME_FADE = 'fade'
|
37
|
+
const CLASS_NAME_SHOW = 'show'
|
38
|
+
|
39
|
+
/**
|
40
|
+
* ------------------------------------------------------------------------
|
41
|
+
* Class Definition
|
42
|
+
* ------------------------------------------------------------------------
|
43
|
+
*/
|
44
|
+
|
45
|
+
class Alert extends BaseComponent {
|
46
|
+
// Getters
|
47
|
+
|
48
|
+
static get DATA_KEY() {
|
49
|
+
return DATA_KEY
|
50
|
+
}
|
51
|
+
|
52
|
+
// Public
|
53
|
+
|
54
|
+
close(element) {
|
55
|
+
const rootElement = element ? this._getRootElement(element) : this._element
|
56
|
+
const customEvent = this._triggerCloseEvent(rootElement)
|
57
|
+
|
58
|
+
if (customEvent === null || customEvent.defaultPrevented) {
|
59
|
+
return
|
60
|
+
}
|
61
|
+
|
62
|
+
this._removeElement(rootElement)
|
63
|
+
}
|
64
|
+
|
65
|
+
// Private
|
66
|
+
|
67
|
+
_getRootElement(element) {
|
68
|
+
return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`)
|
69
|
+
}
|
70
|
+
|
71
|
+
_triggerCloseEvent(element) {
|
72
|
+
return EventHandler.trigger(element, EVENT_CLOSE)
|
73
|
+
}
|
74
|
+
|
75
|
+
_removeElement(element) {
|
76
|
+
element.classList.remove(CLASS_NAME_SHOW)
|
77
|
+
|
78
|
+
if (!element.classList.contains(CLASS_NAME_FADE)) {
|
79
|
+
this._destroyElement(element)
|
80
|
+
return
|
81
|
+
}
|
82
|
+
|
83
|
+
const transitionDuration = getTransitionDurationFromElement(element)
|
84
|
+
|
85
|
+
EventHandler.one(element, 'transitionend', () => this._destroyElement(element))
|
86
|
+
emulateTransitionEnd(element, transitionDuration)
|
87
|
+
}
|
88
|
+
|
89
|
+
_destroyElement(element) {
|
90
|
+
if (element.parentNode) {
|
91
|
+
element.parentNode.removeChild(element)
|
92
|
+
}
|
93
|
+
|
94
|
+
EventHandler.trigger(element, EVENT_CLOSED)
|
95
|
+
}
|
96
|
+
|
97
|
+
// Static
|
98
|
+
|
99
|
+
static jQueryInterface(config) {
|
100
|
+
return this.each(function () {
|
101
|
+
let data = Data.get(this, DATA_KEY)
|
102
|
+
|
103
|
+
if (!data) {
|
104
|
+
data = new Alert(this)
|
105
|
+
}
|
106
|
+
|
107
|
+
if (config === 'close') {
|
108
|
+
data[config](this)
|
109
|
+
}
|
110
|
+
})
|
111
|
+
}
|
112
|
+
|
113
|
+
static handleDismiss(alertInstance) {
|
114
|
+
return function (event) {
|
115
|
+
if (event) {
|
116
|
+
event.preventDefault()
|
117
|
+
}
|
118
|
+
|
119
|
+
alertInstance.close(this)
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* ------------------------------------------------------------------------
|
126
|
+
* Data Api implementation
|
127
|
+
* ------------------------------------------------------------------------
|
128
|
+
*/
|
129
|
+
|
130
|
+
EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()))
|
131
|
+
|
132
|
+
/**
|
133
|
+
* ------------------------------------------------------------------------
|
134
|
+
* jQuery
|
135
|
+
* ------------------------------------------------------------------------
|
136
|
+
* add .Alert to jQuery only if jQuery is present
|
137
|
+
*/
|
138
|
+
|
139
|
+
defineJQueryPlugin(NAME, Alert)
|
140
|
+
|
141
|
+
export default Alert
|