Skip to content

Commit 14ad9cc

Browse files
committed
Minor fix.
1 parent da1ee25 commit 14ad9cc

File tree

9 files changed

+64
-60
lines changed

9 files changed

+64
-60
lines changed

dist/vuejs-dialog.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vuejs-dialog.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<title>VueJs Plugin usage example</title>
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<link href="css/app.main.css?67d55d39a25e194e69f7" rel="stylesheet"></head>
7+
<link href="css/app.main.css?00525d5dedc44076e29a" rel="stylesheet"></head>
88
<body>
99

1010
<div id="app"></div>
@@ -21,5 +21,5 @@
2121
ga('send', 'pageview');
2222

2323
</script>
24-
<script type="text/javascript" src="js/app.main.js?67d55d39a25e194e69f7"></script></body>
24+
<script type="text/javascript" src="js/app.main.js?00525d5dedc44076e29a"></script></body>
2525
</html>

docs/js/app.main.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/vuejs-dialog.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/docs/components/app.vue

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>
2+
<div style="padding-bottom: 25px">
33
<header>
44
<div class="header-cont centered">
55
<h1 class="title">Vuejs Dialog Plugin</h1>
@@ -50,14 +50,14 @@
5050
</h4>
5151

5252
<h4>
53-
<a href="http://example.com" v-confirm="`This will take you to &quot;http://example.com&quot;. Proceed with caution`">Go to example.com</a>
53+
<a href="http://example.com" v-confirm="'This will take you to &quot;http://example.com&quot;. Proceed with caution'">Go to example.com</a>
5454
</h4>
5555

5656
<h4>
5757
<button v-confirm="{
58-
message: 'This dialog was also triggered using a v-confirm directive. It has both OK and CANCEL callback',
59-
ok: clickOkHandler,
60-
cancel: clickCancelHandler}"
58+
message: 'This dialog was also triggered using a v-confirm directive. It has both OK and CANCEL callback',
59+
ok: clickOkHandler,
60+
cancel: clickCancelHandler}"
6161
>
6262
Give it an object v-confirm="messageAndCallback"
6363
</button>
@@ -79,8 +79,8 @@
7979
<h2>Confirmation types</h2>
8080
<hr/>
8181

82-
<p>All dialogs used above are BASIC confirmation dialogs. There are more strict dialogs available.</p>
83-
<p> SOFT and HARD confirmation dialogs. Examples below:</p>
82+
<p>Sometimes, you may want to be more strict by making sure a user really wants to proceed.</p>
83+
<p>The SOFT and HARD confirmation dialogs helps with that.</p>
8484

8585
<h4>
8686
<button @click="showSoftConfirmDialog()">Soft confirm - multiple clicks required</button>
@@ -173,7 +173,7 @@
173173
this.$dialog.alert(trans('messages.html'), {html: true, animation: 'fade'})
174174
},
175175
176-
showLoadingDialog(item = 'foo'){
176+
showLoadingDialog(){
177177
this.$dialog.confirm(trans('messages.loading'), {
178178
html: true,
179179
okText: 'Proceed',

src/plugin/components/ok-btn.vue

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
return (this.options.type === CONFIRM_TYPES.HARD)
3232
},
3333
is_disabled(){
34-
console.log((this.$parent.okBtnDisabled))
3534
return (this.$parent.okBtnDisabled)
3635
},
3736
clicks_remaining(){

src/plugin/js/directives.js

+44-44
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Directives
22

3-
import {noop, clickNode} from './utilities'
3+
import {noop, clickNode, cloneObj} from './utilities'
44
import {CONFIRM_TYPES} from './constants'
55

66

@@ -16,48 +16,6 @@ let Directives = function (Vue) {
1616
})
1717
}
1818

19-
Directives.prototype.defineConfirm = function () {
20-
const _this = this
21-
const DirectiveDefinition = {}
22-
23-
const clickHandler = function (event, el, binding) {
24-
event.preventDefault()
25-
event.stopImmediatePropagation()
26-
27-
let options = _this.getOptions(binding)
28-
let confirmMessage = _this.getConfirmMessage(binding)
29-
let thenCallback = _this.getThenCallback(binding, el)
30-
let catchCallback = _this.getCatchCallback(binding)
31-
32-
_this.Vue.dialog
33-
.confirm(confirmMessage, options)
34-
.then(thenCallback)
35-
.catch(catchCallback)
36-
}
37-
38-
DirectiveDefinition.bind = (el, binding) => {
39-
if (el.VuejsDialog === undefined) {
40-
el.VuejsDialog = {}
41-
}
42-
43-
el.VuejsDialog.clickHandler = function (event) {
44-
clickHandler(event, el, binding)
45-
}
46-
47-
el.addEventListener('click', el.VuejsDialog.clickHandler, true)
48-
}
49-
50-
DirectiveDefinition.unbind = (el) => {
51-
el.removeEventListener('click', el.VuejsDialog.clickHandler, true)
52-
}
53-
54-
return DirectiveDefinition
55-
}
56-
57-
Directives.prototype.defineAlert = function () {
58-
// Still Considering it uses case.
59-
}
60-
6119
Directives.prototype.getConfirmMessage = function(binding) {
6220
if (binding.value && binding.value.message) {
6321
return binding.value.message
@@ -66,7 +24,7 @@ Directives.prototype.getConfirmMessage = function(binding) {
6624
}
6725

6826
Directives.prototype.getOptions = function(binding) {
69-
let options = typeof binding.value === 'object' ? binding.value : {}
27+
let options = typeof binding.value === 'object' ? cloneObj(binding.value) : {}
7028

7129
delete options['ok']
7230
delete options['cancel']
@@ -100,4 +58,46 @@ Directives.prototype.getCatchCallback = function(binding) {
10058
return noop
10159
}
10260

61+
62+
63+
Directives.prototype.defineConfirm = function () {
64+
const _this = this
65+
const DirectiveDefinition = {}
66+
67+
const clickHandler = function (event, el, binding) {
68+
event.preventDefault()
69+
event.stopImmediatePropagation()
70+
71+
let options = _this.getOptions(binding)
72+
let confirmMessage = _this.getConfirmMessage(binding)
73+
74+
_this.Vue.dialog
75+
.confirm(confirmMessage, options)
76+
.then(_this.getThenCallback(binding, el))
77+
.catch(_this.getCatchCallback(binding))
78+
}
79+
80+
DirectiveDefinition.bind = (el, binding) => {
81+
if (el.VuejsDialog === undefined) {
82+
el.VuejsDialog = {}
83+
}
84+
85+
el.VuejsDialog.clickHandler = function (event) {
86+
clickHandler(event, el, binding)
87+
}
88+
89+
el.addEventListener('click', el.VuejsDialog.clickHandler, true)
90+
}
91+
92+
DirectiveDefinition.unbind = (el) => {
93+
el.removeEventListener('click', el.VuejsDialog.clickHandler, true)
94+
}
95+
96+
return DirectiveDefinition
97+
}
98+
99+
Directives.prototype.defineAlert = function () {
100+
// Still Considering it uses case.
101+
}
102+
103103
export default Directives
+6-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
.dg-container {
22
.dg-highlight-1 {
3-
color: darkorange;
3+
color: #FF8C00;
44
font-weight: bold;
55
border-bottom: 1px solid #2ba5ff
66
}
7+
.dg-highlight-2 {
8+
color: #2ba5ff;
9+
font-weight: bold;
10+
border-bottom: 1px solid #FF8C00
11+
}
712
}

0 commit comments

Comments
 (0)