More Eslint configuration and customisations

parent 14c219f2
module.exports = { module.exports = {
"extends": [ extends: [
"airbnb-base", 'airbnb-base',
'plugin:vue/recommended' 'plugin:vue/recommended',
] ],
rules: {
indent: [2, 4],
'no-undef': 'off',
'max-len': 'off',
'no-console': 'off',
},
overrides: [
{
files: ['*.vue', '**/*.vue'],
rules: {
indent: 'off',
},
},
],
}; };
...@@ -152,19 +152,18 @@ ...@@ -152,19 +152,18 @@
</template> </template>
<script> <script>
import axios from 'axios' import axios from 'axios';
import Slugify from '../../../../Core/Assets/js/mixins/Slugify' import Form from 'form-backend-validation';
import ShortcutHelper from '../../../../Core/Assets/js/mixins/ShortcutHelper' import Slugify from '../../../../Core/Assets/js/mixins/Slugify';
import ActiveEditor from '../../../../Core/Assets/js/mixins/ActiveEditor' import ShortcutHelper from '../../../../Core/Assets/js/mixins/ShortcutHelper';
import SingleFileSelector from '../../../../Media/Assets/js/mixins/SingleFileSelector' import ActiveEditor from '../../../../Core/Assets/js/mixins/ActiveEditor';
import SingleFileSelector from '../../../../Media/Assets/js/mixins/SingleFileSelector';
import Form from 'form-backend-validation'
export default { export default {
mixins: [Slugify, ShortcutHelper, ActiveEditor, SingleFileSelector], mixins: [Slugify, ShortcutHelper, ActiveEditor, SingleFileSelector],
props: { props: {
locales: {default: null}, locales: { default: null },
pageTitle: {default: null, String}, pageTitle: { default: null, String },
}, },
data() { data() {
return { return {
...@@ -181,49 +180,49 @@ ...@@ -181,49 +180,49 @@
og_type: '', og_type: '',
}]) }])
.fromPairs() .fromPairs()
.merge({template: 'default', is_home: 0, medias_single: []}) .merge({ template: 'default', is_home: 0, medias_single: [] })
.value(), .value(),
templates: { templates: {
'index': 'index', index: 'index',
'home': 'home', home: 'home',
'default': 'default', default: 'default',
}, },
form: new Form(), form: new Form(),
loading: false, loading: false,
tags: {}, tags: {},
activeTab: window.AsgardCMS.currentLocale || 'en', activeTab: window.AsgardCMS.currentLocale || 'en',
} };
}, },
methods: { methods: {
onSubmit() { onSubmit() {
this.form = new Form(_.merge(this.page, {tags: this.tags})); this.form = new Form(_.merge(this.page, { tags: this.tags }));
this.loading = true; this.loading = true;
this.form.post(this.getRoute()) this.form.post(this.getRoute())
.then(response => { .then((response) => {
this.loading = false; this.loading = false;
this.$message({ this.$message({
type: 'success', type: 'success',
message: response.message message: response.message,
}); });
this.$router.push({name: 'admin.page.page.index'}); this.$router.push({ name: 'admin.page.page.index' });
}) })
.catch(error => { .catch((error) => {
console.log(error); console.log(error);
this.loading = false; this.loading = false;
this.$notify.error({ this.$notify.error({
title: 'Error', title: 'Error',
message: 'There are some errors in the form.' message: 'There are some errors in the form.',
}); });
}); });
}, },
onCancel() { onCancel() {
this.$router.push({name: 'admin.page.page.index'}); this.$router.push({ name: 'admin.page.page.index' });
}, },
fetchTemplates() { fetchTemplates() {
axios.get(route('api.page.page-templates.index')) axios.get(route('api.page.page-templates.index'))
.then(response => { .then((response) => {
this.templates = response.data; this.templates = response.data;
}); });
}, },
...@@ -232,19 +231,17 @@ ...@@ -232,19 +231,17 @@
}, },
fetchPage() { fetchPage() {
this.loading = true; this.loading = true;
axios.post(route('api.page.page.find', {page: this.$route.params.pageId})) axios.post(route('api.page.page.find', { page: this.$route.params.pageId }))
.then(response => { .then((response) => {
this.loading = false; this.loading = false;
this.page = response.data.data; this.page = response.data.data;
this.tags = response.data.data.tags; this.tags = response.data.data.tags;
$('.publicUrl').attr('href', this.page.urls.public_url).show(); $('.publicUrl').attr('href', this.page.urls.public_url).show();
}) });
.catch(error => {
})
}, },
getRoute() { getRoute() {
if (this.$route.params.pageId !== undefined) { if (this.$route.params.pageId !== undefined) {
return route('api.page.page.update', {page: this.$route.params.pageId}); return route('api.page.page.update', { page: this.$route.params.pageId });
} }
return route('api.page.page.store'); return route('api.page.page.store');
}, },
...@@ -258,6 +255,6 @@ ...@@ -258,6 +255,6 @@
}, },
destroyed() { destroyed() {
$('.publicUrl').hide(); $('.publicUrl').hide();
} },
} };
</script> </script>
<template>
</template>
<script>
export default {
data() {
return {
};
},
methods: {},
mounted() {
},
};
</script>
...@@ -11,11 +11,11 @@ import VueSimplemde from 'vue-simplemde'; ...@@ -11,11 +11,11 @@ import VueSimplemde from 'vue-simplemde';
import PageRoutes from '../../../Modules/Page/Assets/js/PageRoutes'; import PageRoutes from '../../../Modules/Page/Assets/js/PageRoutes';
import MediaRoutes from '../../../Modules/Media/Assets/js/MediaRoutes'; import MediaRoutes from '../../../Modules/Media/Assets/js/MediaRoutes';
Vue.use(ElementUI, {locale}); Vue.use(ElementUI, { locale });
Vue.use(DataTables, {locale}); Vue.use(DataTables, { locale });
Vue.use(VueI18n); Vue.use(VueI18n);
Vue.use(VueRouter); Vue.use(VueRouter);
Vue.use(require('vue-shortkey'), {prevent: ['input', 'textarea']}); Vue.use(require('vue-shortkey'), { prevent: ['input', 'textarea'] });
Vue.use(VueEvents); Vue.use(VueEvents);
Vue.use(VueSimplemde); Vue.use(VueSimplemde);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment