diff options
| author | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-04-06 12:40:33 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-06 12:40:33 +0300 |
| commit | bea19a263db88fef44b4356082b199fbfcc39a25 (patch) | |
| tree | a111e9328c6273ad9721118238c40cf3004f72a9 /web/html/modals/prompt_modal.html | |
| parent | 878e0d02cd01a045f4f32464124c59e24f98aedd (diff) | |
Code refactoring (#2865)
* refactor: use vue inline styles in entire application
* refactor: setting row in dashboard page
* refactor: use blob for download file in text modal
* refactor: move all html templates in `web/html` folder
* refactor: `DeviceUtils` -> `MediaQueryMixin`
The transition to mixins has been made, as they can update themselves.
* chore: pretty right buttons in `outbounds` tab in xray settings
* refactor: add translations for system status
* refactor: adjust gutter spacing in setting list item
* refactor: use native `a-input-password` for password field
* chore: return old system status
with new translations
* chore: add missing translation
Diffstat (limited to 'web/html/modals/prompt_modal.html')
| -rw-r--r-- | web/html/modals/prompt_modal.html | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/web/html/modals/prompt_modal.html b/web/html/modals/prompt_modal.html new file mode 100644 index 00000000..5073650f --- /dev/null +++ b/web/html/modals/prompt_modal.html @@ -0,0 +1,71 @@ +{{define "modals/promptModal"}} +<a-modal id="prompt-modal" v-model="promptModal.visible" :title="promptModal.title" + :closable="true" @ok="promptModal.ok" :mask-closable="false" + :confirm-loading="promptModal.confirmLoading" + :ok-text="promptModal.okText" cancel-text='{{ i18n "cancel" }}' :class="themeSwitcher.currentTheme"> + <a-input id="prompt-modal-input" :type="promptModal.type" + v-model="promptModal.value" + :autosize="{minRows: 10, maxRows: 20}" + @keydown.enter.native="promptModal.keyEnter" + @keydown.ctrl.83="promptModal.ctrlS"></a-input> +</a-modal> + +<script> + + const promptModal = { + title: '', + type: '', + value: '', + okText: '{{ i18n "sure"}}', + visible: false, + confirmLoading: false, + keyEnter(e) { + if (this.type !== 'textarea') { + e.preventDefault(); + this.ok(); + } + }, + ctrlS(e) { + if (this.type === 'textarea') { + e.preventDefault(); + promptModal.confirm(promptModal.value); + } + }, + ok() { + promptModal.confirm(promptModal.value); + }, + confirm() {}, + open({ + title = '', + type = 'text', + value = '', + okText = '{{ i18n "sure"}}', + confirm = () => {}, + }) { + this.title = title; + this.type = type; + this.value = value; + this.okText = okText; + this.confirm = confirm; + this.visible = true; + promptModalApp.$nextTick(() => { + document.querySelector('#prompt-modal-input').focus(); + }); + }, + close() { + this.visible = false; + }, + loading(loading=true) { + this.confirmLoading = loading; + }, + }; + + const promptModalApp = new Vue({ + el: '#prompt-modal', + data: { + promptModal: promptModal, + }, + }); + +</script> +{{end}}
\ No newline at end of file |
