Merge pull request #4 from c-villain/fix-blocked-page

fix blocked
This commit is contained in:
Alexander Kraev 2025-07-22 12:16:29 +03:00 committed by GitHub
commit b47f968414
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,9 +1,14 @@
{{ define "page/blocked_domains" }} {{ template "page/head_start" .}}
<template> {{ template "page/head_end" .}}
<div>
{{ template "page/body_start" .}}
<a-layout id="app" v-cloak :class="themeSwitcher.currentTheme">
<a-sidebar></a-sidebar>
<a-layout id="content-layout">
<a-layout-content>
<a-card :title="i18n('menu.blocked_domains')"> <a-card :title="i18n('menu.blocked_domains')">
<a-button type="primary" @click="showAddModal = true" style="margin-bottom: 16px;"> <a-button type="primary" @click="showAddModal = true" style="margin-bottom: 16px;">
{{ i18n "add" }} [[ i18n('add') ]]
</a-button> </a-button>
<a-table-sortable <a-table-sortable
:data-source="domains" :data-source="domains"
@ -12,8 +17,8 @@
style="margin-bottom: 16px;" style="margin-bottom: 16px;"
> >
<a-table-column title="#" :customRender="(_, __, i) => i + 1" width="50" /> <a-table-column title="#" :customRender="(_, __, i) => i + 1" width="50" />
<a-table-column title="{{ i18n "domain" }}" dataIndex="domain" key="domain" /> <a-table-column title="[[ i18n('domain') ]]" dataIndex="domain" key="domain" />
<a-table-column title="{{ i18n "comment" }}" dataIndex="comment" key="comment" /> <a-table-column title="[[ i18n('comment') ]]" dataIndex="comment" key="comment" />
<a-table-column <a-table-column
:title="i18n('action')" :title="i18n('action')"
key="action" key="action"
@ -42,10 +47,16 @@
</a-form> </a-form>
</a-modal> </a-modal>
</a-card> </a-card>
</div> </a-layout-content>
</template> </a-layout>
</a-layout>
{{ template "page/body_scripts" .}}
{{ template "component/aSidebar" .}}
{{ template "component/aThemeSwitch" .}}
<script> <script>
new Vue({ const app = new Vue({
delimiters: ['[[', ']]'],
el: '#app', el: '#app',
data() { data() {
return { return {
@ -58,19 +69,7 @@ new Vue({
}, },
methods: { methods: {
i18n(key) { i18n(key) {
// Простейший i18n, можно заменить на глобальный return I18nManager ? I18nManager.t(key) : key;
const dict = {
'menu.blocked_domains': 'Запрещённые сайты',
'add': 'Добавить',
'domain': 'Домен',
'comment': 'Комментарий',
'action': 'Действия',
'add_domain': 'Добавить домен',
'edit_domain': 'Редактировать домен',
'edit': 'Редактировать',
'delete': 'Удалить',
};
return dict[key] || key;
}, },
fetchDomains() { fetchDomains() {
axios.get('blocked-domains/').then(res => { axios.get('blocked-domains/').then(res => {
@ -112,8 +111,8 @@ new Vue({
}, },
actionRender(record) { actionRender(record) {
return ( return (
`<a @click="editDomainShow(${record.id})">${this.i18n('edit')}</a> | `<a @click=\"editDomainShow(${record.id})\">${this.i18n('edit')}</a> | ` +
<a @click="deleteDomain(${record.id})">${this.i18n('delete')}</a>` `<a @click=\"deleteDomain(${record.id})\">${this.i18n('delete')}</a>`
); );
}, },
editDomainShow(id) { editDomainShow(id) {
@ -127,6 +126,6 @@ new Vue({
mounted() { mounted() {
this.fetchDomains(); this.fetchDomains();
}, },
}); });
</script> </script>
{{ end }} {{ template "page/body_end" .}}