create collections for translation, langauge, mails

This commit is contained in:
2020-11-19 14:57:00 +01:00
parent c8f282394d
commit 646fdef67a
28 changed files with 264 additions and 542 deletions
@@ -51,12 +51,14 @@
if (!errors)
{
instance.$refs.error.clear();
instance.$refs.error.clearErrors();
}
else
{
instance.$refs.error.set(errors);
instance.$refs.error.setErrors(errors);
}
setTimeout(() => instance.state = 'default', 1500);
},
success: true
});
+1 -1
View File
@@ -3,7 +3,7 @@
<div class="ui-table" :class="{'is-inline': inline }">
<header class="ui-table-row ui-table-head">
<div v-for="column in columns" :key="column.path" class="ui-table-cell" :table-field="column.path" :style="column.flex" :class="column.options.class">
{{ column.label | localize }}
<span v-localize:html="column.label"></span>
<button :disabled="!column.canSort" @click="sort(column)" type="button" class="ui-table-sort" :class="query.orderBy == column.path ? 'sort-' + (query.orderIsDescending ? 'desc' : 'asc') : null">
<i class="arrow arrow-down"></i>
</button>
+1 -1
View File
@@ -8,7 +8,7 @@ const prefix = '@country.fields.';
list.templateLabel = x => prefix + x;
list.link = zero.alias.settings.countries + '-edit';
list.onFetch(filter => CountriesApi.getAll(filter));
list.onFetch(filter => CountriesApi.getByQuery(filter));
list.column('flag', { width: 62, canSort: false, hideLabel: true }).custom((value, model) => `<i class="flag flag-${model.code.toLowerCase()}"></i>`, true, 'flag');
list.column('name').name();
+1 -1
View File
@@ -8,7 +8,7 @@ const prefix = '@language.fields.';
list.templateLabel = x => prefix + x;
list.link = zero.alias.settings.languages + '-edit';
list.onFetch(filter => LanguagesApi.getAll(filter));
list.onFetch(filter => LanguagesApi.getByQuery(filter));
list.column('name').name();
list.column('code').text();
+1 -1
View File
@@ -7,7 +7,7 @@ const list = new List('mailTemplates');
list.templateLabel = x => '@mailTemplate.fields.' + x;
list.link = zero.alias.settings.mails + '-edit';
list.onFetch(filter => MailTemplatesApi.getAll(filter));
list.onFetch(filter => MailTemplatesApi.getByQuery(filter));
list.column('name').name();
list.column('subject').text();
@@ -8,7 +8,7 @@ const prefix = '@translation.fields.';
list.templateLabel = x => prefix + x;
list.link = zero.alias.settings.translations + '-edit';
list.onFetch(filter => TranslationsApi.getAll(filter));
list.onFetch(filter => TranslationsApi.getByQuery(filter));
list.column('key').name();
list.column('value').text();
+6
View File
@@ -20,6 +20,12 @@ export default {
return Axios.get('languages/getAll').then(res => Promise.resolve(res.data));
},
// get all languages
getByQuery(query)
{
return Axios.get('languages/getByQuery', { params: query }).then(res => Promise.resolve(res.data));
},
// get all available cultures
getAllCultures()
{
@@ -14,6 +14,11 @@ export default {
return Axios.get(base + 'getEmpty').then(res => Promise.resolve(res.data));
},
getByQuery(query)
{
return Axios.get(base + 'getByQuery', { params: query }).then(res => Promise.resolve(res.data));
},
getAll(query)
{
return Axios.get(base + 'getAll', query ? { params: { query } } : undefined).then(res => Promise.resolve(res.data));
@@ -14,6 +14,12 @@ export default {
return Axios.get('translations/getEmpty').then(res => Promise.resolve(res.data));
},
// get all translations
getByQuery(query)
{
return Axios.get('translations/getByQuery', { params: query }).then(res => Promise.resolve(res.data));
},
// get all translations
getAll(query)
{
+1 -1
View File
@@ -156,7 +156,7 @@ class ListColumn
this.#type = 'boolean';
this.#asHtml = true;
this.#funcOptions = { colored: false, ...options };
this.#func = (value, opts) => '<span class="ui-table-field-bool' + (value === true ? ' is-checked' : '') + (opts.colored ? ' is-colored' : '') + '"></span>';
this.#func = (value, opts) => '<span class="ui-table-field-bool' + (!!value ? ' is-checked' : '') + (opts.colored ? ' is-colored' : '') + '"></span>';
return this;
}
+12 -2
View File
@@ -73,8 +73,18 @@ class List
*/
column(path, options)
{
const column = new ListColumn(path, options);
this.columns.push(column);
let column = this.columns.find(x => x.path === path);
if (!column)
{
column = new ListColumn(path, options);
this.columns.push(column);
}
else
{
column.options = { ...column.options, ...(options || {}) };
}
return column;
}