Using the vuejs translate method

parent 415138e7
...@@ -3,9 +3,7 @@ ...@@ -3,9 +3,7 @@
</template> </template>
<script> <script>
import Translate from '../../../../Core/Assets/js/mixins/Translate'
export default { export default {
mixins: [Translate],
props: { props: {
rows: {default: null}, rows: {default: null},
scope: {default: null}, scope: {default: null},
...@@ -19,8 +17,8 @@ ...@@ -19,8 +17,8 @@
methods: { methods: {
deleteRow(event) { deleteRow(event) {
this.$confirm(this.deleteMessage, this.deleteTitle, { this.$confirm(this.deleteMessage, this.deleteTitle, {
confirmButtonText: this.translate('core', 'button.delete'), confirmButtonText: this.$t('core.button.delete'),
cancelButtonText: this.translate('core', 'button.cancel'), cancelButtonText: this.$t('core.button.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
let vm = this; let vm = this;
...@@ -44,14 +42,14 @@ ...@@ -44,14 +42,14 @@
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: this.translate('core', 'delete cancelled') message: this.$t('core.delete-cancelled')
}); });
}); });
} }
}, },
mounted() { mounted() {
this.deleteMessage = this.translate('core', 'modal.confirmation-message'); this.deleteMessage = this.$t('core.modal.confirmation-message');
this.deleteTitle = this.translate('core', 'modal.title'); this.deleteTitle = this.$t('core.modal.title');
} }
} }
</script> </script>
...@@ -2,15 +2,15 @@ ...@@ -2,15 +2,15 @@
<div class="div"> <div class="div">
<div class="content-header"> <div class="content-header">
<h1> <h1>
{{ translate('page', pageTitle) }} {{ $t(`page.${pageTitle}`) }}
</h1> </h1>
<el-breadcrumb separator="/"> <el-breadcrumb separator="/">
<el-breadcrumb-item> <el-breadcrumb-item>
<a href="/backend">Home</a> <a href="/backend">Home</a>
</el-breadcrumb-item> </el-breadcrumb-item>
<el-breadcrumb-item :to="{name: 'admin.page.page.index'}">{{ translate('page', 'pages') }} <el-breadcrumb-item :to="{name: 'admin.page.page.index'}">{{ $t('page.pages') }}
</el-breadcrumb-item> </el-breadcrumb-item>
<el-breadcrumb-item :to="{name: 'admin.page.page.create'}">{{ translate('page', pageTitle) }} <el-breadcrumb-item :to="{name: 'admin.page.page.create'}">{{ $t(`page.${pageTitle}`) }}
</el-breadcrumb-item> </el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
</div> </div>
...@@ -27,14 +27,14 @@ ...@@ -27,14 +27,14 @@
:key="localeArray.name"> :key="localeArray.name">
<span slot="label" :class="{'error' : form.errors.has(locale)}">{{ localeArray.name <span slot="label" :class="{'error' : form.errors.has(locale)}">{{ localeArray.name
}}</span> }}</span>
<el-form-item :label="translate('page', 'title')" <el-form-item :label="$t('page.title')"
:class="{'el-form-item is-error': form.errors.has(locale + '.title') }"> :class="{'el-form-item is-error': form.errors.has(locale + '.title') }">
<el-input v-model="page[locale].title"></el-input> <el-input v-model="page[locale].title"></el-input>
<div class="el-form-item__error" v-if="form.errors.has(locale + '.title')" <div class="el-form-item__error" v-if="form.errors.has(locale + '.title')"
v-text="form.errors.first(locale + '.title')"></div> v-text="form.errors.first(locale + '.title')"></div>
</el-form-item> </el-form-item>
<el-form-item :label="translate('page', 'slug')" <el-form-item :label="$t('page.slug')"
:class="{'el-form-item is-error': form.errors.has(locale + '.slug') }"> :class="{'el-form-item is-error': form.errors.has(locale + '.slug') }">
<el-input v-model="page[locale].slug"> <el-input v-model="page[locale].slug">
<el-button slot="prepend" @click="generateSlug($event, locale)">Generate</el-button> <el-button slot="prepend" @click="generateSlug($event, locale)">Generate</el-button>
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
v-text="form.errors.first(locale + '.slug')"></div> v-text="form.errors.first(locale + '.slug')"></div>
</el-form-item> </el-form-item>
<el-form-item :label="translate('page', 'body')" <el-form-item :label="$t('page.body')"
:class="{'el-form-item is-error': form.errors.has(locale + '.body') }"> :class="{'el-form-item is-error': form.errors.has(locale + '.body') }">
<ckeditor v-model="page[locale].body" :value="page[locale].body"> <ckeditor v-model="page[locale].body" :value="page[locale].body">
</ckeditor> </ckeditor>
...@@ -56,17 +56,17 @@ ...@@ -56,17 +56,17 @@
<h4 class="box-title"> <h4 class="box-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" <a class="collapsed" data-toggle="collapse" data-parent="#accordion"
:href="`#collapseMeta-${locale}`"> :href="`#collapseMeta-${locale}`">
{{ translate('page', 'meta_data') }} {{ $t('page.meta_data') }}
</a> </a>
</h4> </h4>
</div> </div>
<div style="height: 0px;" :id="`collapseMeta-${locale}`" <div style="height: 0px;" :id="`collapseMeta-${locale}`"
class="panel-collapse collapse"> class="panel-collapse collapse">
<div class="box-body"> <div class="box-body">
<el-form-item :label="translate('page', 'meta_title')"> <el-form-item :label="$t('page.meta_title')">
<el-input v-model="page[locale].meta_title"></el-input> <el-input v-model="page[locale].meta_title"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="translate('page', 'meta_description')"> <el-form-item :label="$t('page.meta_description')">
<el-input type="textarea" <el-input type="textarea"
v-model="page[locale].meta_description"></el-input> v-model="page[locale].meta_description"></el-input>
</el-form-item> </el-form-item>
...@@ -79,28 +79,28 @@ ...@@ -79,28 +79,28 @@
<h4 class="box-title"> <h4 class="box-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" <a class="collapsed" data-toggle="collapse" data-parent="#accordion"
:href="`#collapseFacebook-${locale}`"> :href="`#collapseFacebook-${locale}`">
{{ translate('page', 'facebook_data') }} {{ $t('page.facebook_data') }}
</a> </a>
</h4> </h4>
</div> </div>
<div style="height: 0px;" :id="`collapseFacebook-${locale}`" <div style="height: 0px;" :id="`collapseFacebook-${locale}`"
class="panel-collapse collapse"> class="panel-collapse collapse">
<div class="box-body"> <div class="box-body">
<el-form-item :label="translate('page', 'og_title')"> <el-form-item :label="$t('page.og_title')">
<el-input v-model="page[locale].og_title"></el-input> <el-input v-model="page[locale].og_title"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="translate('page', 'og_description')"> <el-form-item :label="$t('page.og_description')">
<el-input type="textarea" <el-input type="textarea"
v-model="page[locale].og_description"></el-input> v-model="page[locale].og_description"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="translate('page', 'og_type')"> <el-form-item :label="$t('page.og_type')">
<el-select v-model="page[locale].og_type" <el-select v-model="page[locale].og_type"
:placeholder="translate('page', 'og_type')"> :placeholder="$t('page.og_type')">
<el-option :label="translate('page', 'facebook-types.website')" <el-option :label="$t('page.facebook-types.website')"
value="website"></el-option> value="website"></el-option>
<el-option :label="translate('page', 'facebook-types.product')" <el-option :label="$t('page.facebook-types.product')"
value="product"></el-option> value="product"></el-option>
<el-option :label="translate('page', 'facebook-types.article')" <el-option :label="$t('page.facebook-types.article')"
value="article"></el-option> value="article"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -110,9 +110,9 @@ ...@@ -110,9 +110,9 @@
<el-form-item> <el-form-item>
<el-button type="primary" @click="onSubmit()" :loading="loading"> <el-button type="primary" @click="onSubmit()" :loading="loading">
{{ translate('core', 'save') }} {{ $t('core.save') }}
</el-button> </el-button>
<el-button @click="onCancel()">{{ translate('core', 'button.cancel') }} <el-button @click="onCancel()">{{ $t('core.button.cancel') }}
</el-button> </el-button>
</el-form-item> </el-form-item>
...@@ -126,9 +126,9 @@ ...@@ -126,9 +126,9 @@
<div class="box-body"> <div class="box-body">
<el-form-item label=""> <el-form-item label="">
<el-checkbox v-model="page.is_home" :true-label="1" :false-label="0" name="is_home" <el-checkbox v-model="page.is_home" :true-label="1" :false-label="0" name="is_home"
:label="translate('page', 'is homepage')"></el-checkbox> :label="$t('page.is_homepage')"></el-checkbox>
</el-form-item> </el-form-item>
<el-form-item :label="translate('page', 'template')" <el-form-item :label="$t('page.template')"
:class="{'el-form-item is-error': form.errors.has('template') }"> :class="{'el-form-item is-error': form.errors.has('template') }">
<el-select v-model="page.template" filterable> <el-select v-model="page.template" filterable>
<el-option v-for="(template, key) in templates" :key="template" <el-option v-for="(template, key) in templates" :key="template"
...@@ -148,12 +148,11 @@ ...@@ -148,12 +148,11 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
import Translate from '../../../../Core/Assets/js/mixins/Translate'
import Slugify from '../../../../Core/Assets/js/mixins/Slugify' import Slugify from '../../../../Core/Assets/js/mixins/Slugify'
import Form from 'form-backend-validation' import Form from 'form-backend-validation'
export default { export default {
mixins: [Translate, Slugify], mixins: [Slugify],
props: { props: {
locales: {default: null}, locales: {default: null},
pageTitle: {default: null, String}, pageTitle: {default: null, String},
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
<div class="div"> <div class="div">
<div class="content-header"> <div class="content-header">
<h1> <h1>
{{ translate('page', 'pages') }} {{ $t('page.pages') }}
</h1> </h1>
<el-breadcrumb separator="/"> <el-breadcrumb separator="/">
<el-breadcrumb-item> <el-breadcrumb-item>
<a href="/backend">Home</a> <a href="/backend">Home</a>
</el-breadcrumb-item> </el-breadcrumb-item>
<el-breadcrumb-item :to="{name: 'admin.page.page.index'}">{{ translate('page', 'pages') }}</el-breadcrumb-item> <el-breadcrumb-item :to="{name: 'admin.page.page.index'}">{{ $t('page.pages') }}</el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
</div> </div>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<div class="actions el-col el-col-5"> <div class="actions el-col el-col-5">
<router-link :to="{name: 'admin.page.page.create'}"> <router-link :to="{name: 'admin.page.page.create'}">
<el-button type="primary"><i class="el-icon-edit"></i> <el-button type="primary"><i class="el-icon-edit"></i>
{{ translate('page', 'create page') }} {{ $t('page.create-page') }}
</el-button> </el-button>
</router-link> </router-link>
</div> </div>
...@@ -39,18 +39,18 @@ ...@@ -39,18 +39,18 @@
@sort-change="handleSortChange"> @sort-change="handleSortChange">
<el-table-column prop="id" label="Id" width="100" sortable="custom"> <el-table-column prop="id" label="Id" width="100" sortable="custom">
</el-table-column> </el-table-column>
<el-table-column prop="translations.title" :label="translate('page', 'title')"> <el-table-column prop="translations.title" :label="$t('page.title')">
</el-table-column> </el-table-column>
<el-table-column prop="translations.slug" label="Slug"> <el-table-column prop="translations.slug" :label="$t('page.slug')">
</el-table-column> </el-table-column>
<el-table-column prop="created_at" label="Created at" sortable="custom"> <el-table-column prop="created_at" :label="$t('core.created_at')" sortable="custom">
</el-table-column> </el-table-column>
<el-table-column fixed="right" prop="actions" label="Actions"> <el-table-column fixed="right" prop="actions" :label="$t('core.actions')">
<template scope="scope"> <template scope="scope">
<a class="btn btn-default btn-flat" @click.prevent="goToEdit(scope)"><i <a class="btn btn-default btn-flat" @click.prevent="goToEdit(scope)"><i
class="fa fa-pencil"></i></a> class="fa fa-pencil"></i></a>
<delete-button :scope="scope" :rows="data" :translations="translations"> <delete-button :scope="scope" :rows="data">
</delete-button> </delete-button>
</template> </template>
</el-table-column> </el-table-column>
...@@ -76,13 +76,11 @@ ...@@ -76,13 +76,11 @@
<script> <script>
import axios from 'axios' import axios from 'axios'
import Translate from '../../../../Core/Assets/js/mixins/Translate'
import _ from "lodash"; import _ from "lodash";
let data; let data;
export default { export default {
mixins: [Translate],
data() { data() {
return { return {
data, data,
......
...@@ -11127,13 +11127,19 @@ Object.defineProperty(exports, "__esModule", { ...@@ -11127,13 +11127,19 @@ Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.default = { exports.default = {
props: { data: function data() {
translations: { default: null } return {
translations: {}
};
}, },
methods: { methods: {
translate: function translate(namespace, name) { translate: function translate(namespace, name) {
return _.get(this.translations[namespace], name); return _.get(this.translations[namespace], name);
} }
},
mounted: function mounted() {
this.translations = window.AsgardCMS.translations;
} }
}; };
...@@ -31287,8 +31293,7 @@ var router = new _vueRouter2.default({ ...@@ -31287,8 +31293,7 @@ var router = new _vueRouter2.default({
routes: [].concat(_toConsumableArray(_PageRoutes2.default)) routes: [].concat(_toConsumableArray(_PageRoutes2.default))
}); });
var messages = _defineProperty({}, currentLocale, window.translations); var messages = _defineProperty({}, currentLocale, window.AsgardCMS.translations);
console.log(messages);
var i18n = new _vueI18n2.default({ var i18n = new _vueI18n2.default({
locale: currentLocale, locale: currentLocale,
...@@ -31301,15 +31306,6 @@ var app = new _vue2.default({ ...@@ -31301,15 +31306,6 @@ var app = new _vue2.default({
i18n: i18n i18n: i18n
}); });
// window.axios.get(route('api.translation.translations.all'))
// .then(response => {
// messages = {
// [currentLocale]: response.data,
// };
// console.log(messages);
// app.$i18n.setLocaleMessage('en', messages)
// });
/***/ }), /***/ }),
/* 39 */ /* 39 */
/***/ (function(module, __webpack_exports__, __webpack_require__) { /***/ (function(module, __webpack_exports__, __webpack_require__) {
...@@ -70495,33 +70491,27 @@ var _PageForm2 = _interopRequireDefault(_PageForm); ...@@ -70495,33 +70491,27 @@ var _PageForm2 = _interopRequireDefault(_PageForm);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var translations = window.translations;
var locales = window.locales; var locales = window.locales;
exports.default = [{ exports.default = [{
path: '/page/pages', path: '/page/pages',
name: 'admin.page.page.index', name: 'admin.page.page.index',
component: _PageTableServerSide2.default, component: _PageTableServerSide2.default
props: {
translations: translations
}
}, { }, {
path: '/page/pages/create', path: '/page/pages/create',
name: 'admin.page.page.create', name: 'admin.page.page.create',
component: _PageForm2.default, component: _PageForm2.default,
props: { props: {
translations: translations,
locales: locales, locales: locales,
pageTitle: 'create page' pageTitle: 'create-page'
} }
}, { }, {
path: '/page/pages/:pageId/edit', path: '/page/pages/:pageId/edit',
name: 'admin.page.page.edit', name: 'admin.page.page.edit',
component: _PageForm2.default, component: _PageForm2.default,
props: { props: {
translations: translations,
locales: locales, locales: locales,
pageTitle: 'edit page' pageTitle: 'edit-page'
} }
}]; }];
...@@ -71850,17 +71840,12 @@ var _axios = __webpack_require__(8); ...@@ -71850,17 +71840,12 @@ var _axios = __webpack_require__(8);
var _axios2 = _interopRequireDefault(_axios); var _axios2 = _interopRequireDefault(_axios);
var _Translate = __webpack_require__(10);
var _Translate2 = _interopRequireDefault(_Translate);
var _lodash = __webpack_require__(35); var _lodash = __webpack_require__(35);
var _lodash2 = _interopRequireDefault(_lodash); var _lodash2 = _interopRequireDefault(_lodash);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _data = void 0; //
// //
// //
// //
...@@ -71936,9 +71921,11 @@ var _data = void 0; // ...@@ -71936,9 +71921,11 @@ var _data = void 0; //
// //
// //
// //
//
var _data = void 0;
exports.default = { exports.default = {
mixins: [_Translate2.default],
data: function data() { data: function data() {
return { return {
data: _data, data: _data,
...@@ -72078,7 +72065,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -72078,7 +72065,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "div" staticClass: "div"
}, [_c('div', { }, [_c('div', {
staticClass: "content-header" staticClass: "content-header"
}, [_c('h1', [_vm._v("\n " + _vm._s(_vm.$t('page["pages"]')) + "\n ")]), _vm._v(" "), _c('el-breadcrumb', { }, [_c('h1', [_vm._v("\n " + _vm._s(_vm.$t('page.pages')) + "\n ")]), _vm._v(" "), _c('el-breadcrumb', {
attrs: { attrs: {
"separator": "/" "separator": "/"
} }
...@@ -72092,7 +72079,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -72092,7 +72079,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
name: 'admin.page.page.index' name: 'admin.page.page.index'
} }
} }
}, [_vm._v(_vm._s(_vm.$t('page["pages"]')))])], 1)], 1), _vm._v(" "), _c('div', { }, [_vm._v(_vm._s(_vm.$t('page.pages')))])], 1)], 1), _vm._v(" "), _c('div', {
staticClass: "row" staticClass: "row"
}, [_c('div', { }, [_c('div', {
staticClass: "col-xs-12" staticClass: "col-xs-12"
...@@ -72121,7 +72108,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -72121,7 +72108,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
} }
}, [_c('i', { }, [_c('i', {
staticClass: "el-icon-edit" staticClass: "el-icon-edit"
}), _vm._v("\n " + _vm._s(_vm.$t('page["create page"]')) + "\n ")])], 1)], 1), _vm._v(" "), _c('div', { }), _vm._v("\n " + _vm._s(_vm.$t('page.create-page')) + "\n ")])], 1)], 1), _vm._v(" "), _c('div', {
staticClass: "search el-col el-col-5" staticClass: "search el-col el-col-5"
}, [_c('el-input', { }, [_c('el-input', {
attrs: { attrs: {
...@@ -72202,8 +72189,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -72202,8 +72189,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
})]), _vm._v(" "), _c('delete-button', { })]), _vm._v(" "), _c('delete-button', {
attrs: { attrs: {
"scope": scope, "scope": scope,
"rows": _vm.data, "rows": _vm.data
"translations": _vm.translations
} }
})] })]
} }
...@@ -72294,10 +72280,6 @@ var _axios = __webpack_require__(8); ...@@ -72294,10 +72280,6 @@ var _axios = __webpack_require__(8);
var _axios2 = _interopRequireDefault(_axios); var _axios2 = _interopRequireDefault(_axios);
var _Translate = __webpack_require__(10);
var _Translate2 = _interopRequireDefault(_Translate);
var _Slugify = __webpack_require__(118); var _Slugify = __webpack_require__(118);
var _Slugify2 = _interopRequireDefault(_Slugify); var _Slugify2 = _interopRequireDefault(_Slugify);
...@@ -72308,6 +72290,102 @@ var _formBackendValidation2 = _interopRequireDefault(_formBackendValidation); ...@@ -72308,6 +72290,102 @@ var _formBackendValidation2 = _interopRequireDefault(_formBackendValidation);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_Slugify2.default],
props: {
locales: { default: null },
pageTitle: { default: null, String: String }
},
data: function data() {
return {
page: _(this.locales).keys().map(function (locale) {
return [locale, {
title: '',
slug: '',
body: '',
meta_title: '',
meta_description: '',
og_title: '',
og_description: '',
og_type: ''
}];
}).fromPairs().merge({ template: 'default', is_home: 0 }).value(),
templates: {
'index': 'index',
'home': 'home',
'default': 'default'
},
form: new _formBackendValidation2.default(),
loading: false,
tags: {}
};
},
methods: {
onSubmit: function onSubmit() {
var _this = this;
this.form = new _formBackendValidation2.default(_.merge(this.page, { tags: this.tags }));
this.loading = true;
this.form.post(this.getRoute()).then(function (response) {
_this.loading = false;
_this.$message({
type: 'success',
message: response.message
});
_this.$router.push({ name: 'admin.page.page.index' });
}).catch(function (error) {
console.log(error);
_this.loading = false;
_this.$notify.error({
title: 'Error',
message: 'There are some errors in the form.'
});
});
},
onCancel: function onCancel() {
this.$router.push({ name: 'admin.page.page.index' });
},
fetchTemplates: function fetchTemplates() {
var _this2 = this;
_axios2.default.get(route('api.page.page-templates.index')).then(function (response) {
_this2.templates = response.data;
});
},
generateSlug: function generateSlug(event, locale) {
this.page[locale].slug = this.slugify(this.page[locale].title);
},
setTags: function setTags(tags) {
this.tags = tags;
},
fetchPage: function fetchPage() {
var _this3 = this;
this.loading = true;
_axios2.default.post(route('api.page.page.find', { page: this.$route.params.pageId })).then(function (response) {
_this3.loading = false;
_this3.page = response.data.data;
_this3.tags = response.data.data.tags;
}).catch(function (error) {});
},
getRoute: function getRoute() {
if (this.$route.params.pageId !== undefined) {
return route('api.page.page.update', { page: this.$route.params.pageId });
}
return route('api.page.page.store');
}
},
mounted: function mounted() {
this.fetchTemplates();
if (this.$route.params.pageId !== undefined) {
this.fetchPage();
}
}
}; //
// //
// //
// //
...@@ -72455,104 +72533,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de ...@@ -72455,104 +72533,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
// //
// //
// //
//
exports.default = {
mixins: [_Translate2.default, _Slugify2.default],
props: {
locales: { default: null },
pageTitle: { default: null, String: String }
},
data: function data() {
return {
page: _(this.locales).keys().map(function (locale) {
return [locale, {
title: '',
slug: '',
body: '',
meta_title: '',
meta_description: '',
og_title: '',
og_description: '',
og_type: ''
}];
}).fromPairs().merge({ template: 'default', is_home: 0 }).value(),
templates: {
'index': 'index',
'home': 'home',
'default': 'default'
},
form: new _formBackendValidation2.default(),
loading: false,
tags: {}
};
},
methods: {
onSubmit: function onSubmit() {
var _this = this;
this.form = new _formBackendValidation2.default(_.merge(this.page, { tags: this.tags }));
this.loading = true;
this.form.post(this.getRoute()).then(function (response) {
_this.loading = false;
_this.$message({
type: 'success',
message: response.message
});
_this.$router.push({ name: 'admin.page.page.index' });
}).catch(function (error) {
console.log(error);
_this.loading = false;
_this.$notify.error({
title: 'Error',
message: 'There are some errors in the form.'
});
});
},
onCancel: function onCancel() {
this.$router.push({ name: 'admin.page.page.index' });
},
fetchTemplates: function fetchTemplates() {
var _this2 = this;
_axios2.default.get(route('api.page.page-templates.index')).then(function (response) {
_this2.templates = response.data;
});
},
generateSlug: function generateSlug(event, locale) {
this.page[locale].slug = this.slugify(this.page[locale].title);
},
setTags: function setTags(tags) {
this.tags = tags;
},
fetchPage: function fetchPage() {
var _this3 = this;
this.loading = true;
_axios2.default.post(route('api.page.page.find', { page: this.$route.params.pageId })).then(function (response) {
_this3.loading = false;
_this3.page = response.data.data;
_this3.tags = response.data.data.tags;
}).catch(function (error) {});
},
getRoute: function getRoute() {
if (this.$route.params.pageId !== undefined) {
return route('api.page.page.update', { page: this.$route.params.pageId });
}
return route('api.page.page.store');
}
},
mounted: function mounted() {
this.fetchTemplates();
if (this.$route.params.pageId !== undefined) {
this.fetchPage();
}
}
};
/***/ }), /***/ }),
/* 118 */ /* 118 */
...@@ -72974,7 +72954,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -72974,7 +72954,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "div" staticClass: "div"
}, [_c('div', { }, [_c('div', {
staticClass: "content-header" staticClass: "content-header"
}, [_c('h1', [_vm._v("\n " + _vm._s(_vm.translate('page', _vm.pageTitle)) + "\n ")]), _vm._v(" "), _c('el-breadcrumb', { }, [_c('h1', [_vm._v("\n " + _vm._s(_vm.$t(("page." + _vm.pageTitle))) + "\n ")]), _vm._v(" "), _c('el-breadcrumb', {
attrs: { attrs: {
"separator": "/" "separator": "/"
} }
...@@ -72988,13 +72968,13 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -72988,13 +72968,13 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
name: 'admin.page.page.index' name: 'admin.page.page.index'
} }
} }
}, [_vm._v(_vm._s(_vm.translate('page', 'pages')) + "\n ")]), _vm._v(" "), _c('el-breadcrumb-item', { }, [_vm._v(_vm._s(_vm.$t('page.pages')) + "\n ")]), _vm._v(" "), _c('el-breadcrumb-item', {
attrs: { attrs: {
"to": { "to": {
name: 'admin.page.page.create' name: 'admin.page.page.create'
} }
} }
}, [_vm._v(_vm._s(_vm.translate('page', _vm.pageTitle)) + "\n ")])], 1)], 1), _vm._v(" "), _c('el-form', { }, [_vm._v(_vm._s(_vm.$t(("page." + _vm.pageTitle))) + "\n ")])], 1)], 1), _vm._v(" "), _c('el-form', {
directives: [{ directives: [{
name: "loading", name: "loading",
rawName: "v-loading.body", rawName: "v-loading.body",
...@@ -73043,7 +73023,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73043,7 +73023,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
'el-form-item is-error': _vm.form.errors.has(locale + '.title') 'el-form-item is-error': _vm.form.errors.has(locale + '.title')
}, },
attrs: { attrs: {
"label": _vm.translate('page', 'title') "label": _vm.$t('page.title')
} }
}, [_c('el-input', { }, [_c('el-input', {
model: { model: {
...@@ -73063,7 +73043,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73063,7 +73043,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
'el-form-item is-error': _vm.form.errors.has(locale + '.slug') 'el-form-item is-error': _vm.form.errors.has(locale + '.slug')
}, },
attrs: { attrs: {
"label": _vm.translate('page', 'slug') "label": _vm.$t('page.slug')
} }
}, [_c('el-input', { }, [_c('el-input', {
model: { model: {
...@@ -73090,7 +73070,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73090,7 +73070,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
'el-form-item is-error': _vm.form.errors.has(locale + '.body') 'el-form-item is-error': _vm.form.errors.has(locale + '.body')
}, },
attrs: { attrs: {
"label": _vm.translate('page', 'body') "label": _vm.$t('page.body')
} }
}, [_c('ckeditor', { }, [_c('ckeditor', {
attrs: { attrs: {
...@@ -73121,7 +73101,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73121,7 +73101,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"data-parent": "#accordion", "data-parent": "#accordion",
"href": ("#collapseMeta-" + locale) "href": ("#collapseMeta-" + locale)
} }
}, [_vm._v("\n " + _vm._s(_vm.translate('page', 'meta_data')) + "\n ")])])]), _vm._v(" "), _c('div', { }, [_vm._v("\n " + _vm._s(_vm.$t('page.meta_data')) + "\n ")])])]), _vm._v(" "), _c('div', {
staticClass: "panel-collapse collapse", staticClass: "panel-collapse collapse",
staticStyle: { staticStyle: {
"height": "0px" "height": "0px"
...@@ -73133,7 +73113,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73133,7 +73113,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "box-body" staticClass: "box-body"
}, [_c('el-form-item', { }, [_c('el-form-item', {
attrs: { attrs: {
"label": _vm.translate('page', 'meta_title') "label": _vm.$t('page.meta_title')
} }
}, [_c('el-input', { }, [_c('el-input', {
model: { model: {
...@@ -73145,7 +73125,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73145,7 +73125,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
} }
})], 1), _vm._v(" "), _c('el-form-item', { })], 1), _vm._v(" "), _c('el-form-item', {
attrs: { attrs: {
"label": _vm.translate('page', 'meta_description') "label": _vm.$t('page.meta_description')
} }
}, [_c('el-input', { }, [_c('el-input', {
attrs: { attrs: {
...@@ -73171,7 +73151,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73171,7 +73151,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"data-parent": "#accordion", "data-parent": "#accordion",
"href": ("#collapseFacebook-" + locale) "href": ("#collapseFacebook-" + locale)
} }
}, [_vm._v("\n " + _vm._s(_vm.translate('page', 'facebook_data')) + "\n ")])])]), _vm._v(" "), _c('div', { }, [_vm._v("\n " + _vm._s(_vm.$t('page.facebook_data')) + "\n ")])])]), _vm._v(" "), _c('div', {
staticClass: "panel-collapse collapse", staticClass: "panel-collapse collapse",
staticStyle: { staticStyle: {
"height": "0px" "height": "0px"
...@@ -73183,7 +73163,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73183,7 +73163,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "box-body" staticClass: "box-body"
}, [_c('el-form-item', { }, [_c('el-form-item', {
attrs: { attrs: {
"label": _vm.translate('page', 'og_title') "label": _vm.$t('page.og_title')
} }
}, [_c('el-input', { }, [_c('el-input', {
model: { model: {
...@@ -73195,7 +73175,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73195,7 +73175,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
} }
})], 1), _vm._v(" "), _c('el-form-item', { })], 1), _vm._v(" "), _c('el-form-item', {
attrs: { attrs: {
"label": _vm.translate('page', 'og_description') "label": _vm.$t('page.og_description')
} }
}, [_c('el-input', { }, [_c('el-input', {
attrs: { attrs: {
...@@ -73210,11 +73190,11 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73210,11 +73190,11 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
} }
})], 1), _vm._v(" "), _c('el-form-item', { })], 1), _vm._v(" "), _c('el-form-item', {
attrs: { attrs: {
"label": _vm.translate('page', 'og_type') "label": _vm.$t('page.og_type')
} }
}, [_c('el-select', { }, [_c('el-select', {
attrs: { attrs: {
"placeholder": _vm.translate('page', 'og_type') "placeholder": _vm.$t('page.og_type')
}, },
model: { model: {
value: (_vm.page[locale].og_type), value: (_vm.page[locale].og_type),
...@@ -73225,17 +73205,17 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73225,17 +73205,17 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
} }
}, [_c('el-option', { }, [_c('el-option', {
attrs: { attrs: {
"label": _vm.translate('page', 'facebook-types.website'), "label": _vm.$t('page.facebook-types.website'),
"value": "website" "value": "website"
} }
}), _vm._v(" "), _c('el-option', { }), _vm._v(" "), _c('el-option', {
attrs: { attrs: {
"label": _vm.translate('page', 'facebook-types.product'), "label": _vm.$t('page.facebook-types.product'),
"value": "product" "value": "product"
} }
}), _vm._v(" "), _c('el-option', { }), _vm._v(" "), _c('el-option', {
attrs: { attrs: {
"label": _vm.translate('page', 'facebook-types.article'), "label": _vm.$t('page.facebook-types.article'),
"value": "article" "value": "article"
} }
})], 1)], 1)], 1)])]), _vm._v(" "), _c('el-form-item', [_c('el-button', { })], 1)], 1)], 1)])]), _vm._v(" "), _c('el-form-item', [_c('el-button', {
...@@ -73248,13 +73228,13 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73248,13 +73228,13 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
_vm.onSubmit() _vm.onSubmit()
} }
} }
}, [_vm._v("\n " + _vm._s(_vm.translate('core', 'save')) + "\n ")]), _vm._v(" "), _c('el-button', { }, [_vm._v("\n " + _vm._s(_vm.$t('core.save')) + "\n ")]), _vm._v(" "), _c('el-button', {
on: { on: {
"click": function($event) { "click": function($event) {
_vm.onCancel() _vm.onCancel()
} }
} }
}, [_vm._v(_vm._s(_vm.translate('core', 'button.cancel')) + "\n ")])], 1)], 1) }, [_vm._v(_vm._s(_vm.$t('core.button.cancel')) + "\n ")])], 1)], 1)
}))], 1)])]), _vm._v(" "), _c('div', { }))], 1)])]), _vm._v(" "), _c('div', {
staticClass: "col-md-2" staticClass: "col-md-2"
}, [_c('div', { }, [_c('div', {
...@@ -73270,7 +73250,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73270,7 +73250,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"true-label": 1, "true-label": 1,
"false-label": 0, "false-label": 0,
"name": "is_home", "name": "is_home",
"label": _vm.translate('page', 'is homepage') "label": _vm.$t('page.is_homepage')
}, },
model: { model: {
value: (_vm.page.is_home), value: (_vm.page.is_home),
...@@ -73284,7 +73264,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c ...@@ -73284,7 +73264,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
'el-form-item is-error': _vm.form.errors.has('template') 'el-form-item is-error': _vm.form.errors.has('template')
}, },
attrs: { attrs: {
"label": _vm.translate('page', 'template') "label": _vm.$t('page.template')
} }
}, [_c('el-select', { }, [_c('el-select', {
attrs: { attrs: {
...@@ -73928,15 +73908,12 @@ module.exports = Component.exports ...@@ -73928,15 +73908,12 @@ module.exports = Component.exports
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
//
var _Translate = __webpack_require__(10); //
//
var _Translate2 = _interopRequireDefault(_Translate); //
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = { exports.default = {
mixins: [_Translate2.default],
props: { props: {
rows: { default: null }, rows: { default: null },
scope: { default: null } scope: { default: null }
...@@ -73953,8 +73930,8 @@ exports.default = { ...@@ -73953,8 +73930,8 @@ exports.default = {
var _this = this; var _this = this;
this.$confirm(this.deleteMessage, this.deleteTitle, { this.$confirm(this.deleteMessage, this.deleteTitle, {
confirmButtonText: this.translate('core', 'button.delete'), confirmButtonText: this.$t('core.button.delete'),
cancelButtonText: this.translate('core', 'button.cancel'), cancelButtonText: this.$t('core.button.cancel'),
type: 'warning' type: 'warning'
}).then(function () { }).then(function () {
var vm = _this; var vm = _this;
...@@ -73976,19 +73953,16 @@ exports.default = { ...@@ -73976,19 +73953,16 @@ exports.default = {
}).catch(function () { }).catch(function () {
_this.$message({ _this.$message({
type: 'info', type: 'info',
message: _this.translate('core', 'delete cancelled') message: _this.$t('core.delete-cancelled')
}); });
}); });
} }
}, },
mounted: function mounted() { mounted: function mounted() {
this.deleteMessage = this.translate('core', 'modal.confirmation-message'); this.deleteMessage = this.$t('core.modal.confirmation-message');
this.deleteTitle = this.translate('core', 'modal.title'); this.deleteTitle = this.$t('core.modal.title');
} }
}; // };
//
//
//
/***/ }), /***/ }),
/* 133 */ /* 133 */
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