Skip to content

Commit 1fdd1d6

Browse files
committed
Ability to customize verification help text to another text/language.
1 parent 4a2c9f6 commit 1fdd1d6

File tree

7 files changed

+27
-21
lines changed

7 files changed

+27
-21
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ let options = {
139139
animation: 'zoom', // Available: "zoom", "bounce", "fade"
140140
type: 'basic', // coming soon: 'soft', 'hard'
141141
verification: 'continue', // for hard confirm, user will be prompted to type this to enable the proceed button
142+
verificationHelp: 'Type "[+:verification]" below to confirm', // Verification help text. [+:verification] will be matched with 'options.verification' (i.e 'Type "continue" below to confirm')
142143
clicksCount: 3, // for soft confirm, user will be asked to click on "proceed" btn 3 times before actually proceeding
143144
};
144145

dist/vuejs-dialog.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vuejs-dialog.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/js/vuejs-dialog.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/plugin/components/dialog-window.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
<div v-else="" class="dg-content">{{ options.message }}</div>
1515

1616
<form v-if="isHardConfirm || isPrompt" class="dg-form" @submit.prevent="submitDialogForm">
17-
<label for="dg-input-label" style="font-size: 13px">
18-
Type "{{ options.verification }}" below to confirm
19-
</label>
20-
<input type="text" placeholder="Verification text"
17+
<label for="dg-input-label" style="font-size: 13px">{{ hardConfirmHelpText }}</label>
18+
<input type="text" :placeholder="options.verification"
2119
v-model="input"
2220
id="dg-input-label"
2321
style="width: 100%;margin-top: 10px;
@@ -128,6 +126,12 @@
128126
},
129127
rightBtnText(){
130128
return this.options.reverse ? this.options.cancelText : this.options.okText
129+
},
130+
hardConfirmHelpText() {
131+
return this.options.verificationHelp
132+
.replace(/\[\+:(\w+)]/, (match, $1) => {
133+
return this.options[$1] || match
134+
})
131135
}
132136
},
133137
methods: {

src/plugin/js/constants.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,18 @@ export const ANIMATION_TYPES = {
1818
}
1919

2020
export const DEFAULT_OPTIONS = {
21-
html : false,
22-
loader : false,
23-
reverse : false,
24-
headline : "Please confirm",
25-
okText : "Continue",
26-
cancelText : "Close",
27-
type : CONFIRM_TYPES.BASIC,
28-
window : DIALOG_TYPES.CONFIRM,
29-
message : "Proceed with the request?",
30-
helpText : "Click the proceed button to continue",
31-
clicksCount : 3,
32-
animation : 'zoom',
33-
verification : 'continue'
21+
html : false,
22+
loader : false,
23+
reverse : false,
24+
headline : "Please confirm",
25+
okText : "Continue",
26+
cancelText : "Close",
27+
type : CONFIRM_TYPES.BASIC,
28+
window : DIALOG_TYPES.CONFIRM,
29+
message : "Proceed with the request?",
30+
helpText : "Click the proceed button to continue",
31+
clicksCount : 3,
32+
animation : 'zoom',
33+
verification : 'continue',
34+
verificationHelp : 'Type "[+:verification]" below to confirm'
3435
}

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if (isProduction) {
3232
minimize: true
3333
}),
3434
new WebpackShellPlugin({
35-
onBuildExit: ['node src\\docs\\js\\copy-to-docs.js']
35+
onBuildEnd: ['node src\\docs\\js\\copy-to-docs.js']
3636
})
3737
])
3838
}

0 commit comments

Comments
 (0)