Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
3a1d5485
Unverified
Commit
3a1d5485
authored
Sep 16, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using the new translation helper on all components.
Using array_dot, on translations
parent
8ffaf496
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
237 additions
and
177 deletions
+237
-177
DeleteComponent.vue
Modules/Core/Assets/js/components/DeleteComponent.vue
+8
-5
PageForm.vue
Modules/Page/Assets/js/components/PageForm.vue
+23
-22
PageTable.vue
Modules/Page/Assets/js/components/PageTable.vue
+4
-2
PageTableServerSide.vue
Modules/Page/Assets/js/components/PageTableServerSide.vue
+9
-7
master.blade.php
Themes/Adminlte/views/layouts/master.blade.php
+1
-1
app.js
public/js/app.js
+192
-140
No files found.
Modules/Core/Assets/js/components/DeleteComponent.vue
View file @
3a1d5485
...
...
@@ -3,7 +3,10 @@
</
template
>
<
script
>
import
TranslationHelper
from
'
../../../../Core/Assets/js/mixins/TranslationHelper
'
export
default
{
mixins
:
[
TranslationHelper
],
props
:
{
rows
:
{
default
:
null
},
scope
:
{
default
:
null
},
...
...
@@ -17,8 +20,8 @@
methods
:
{
deleteRow
(
event
)
{
this
.
$confirm
(
this
.
deleteMessage
,
this
.
deleteTitle
,
{
confirmButtonText
:
this
.
$t
(
'
core.button.delete
'
),
cancelButtonText
:
this
.
$t
(
'
core.button.cancel
'
),
confirmButtonText
:
this
.
trans
(
'
core.button.delete
'
),
cancelButtonText
:
this
.
trans
(
'
core.button.cancel
'
),
type
:
'
warning
'
}).
then
(()
=>
{
let
vm
=
this
;
...
...
@@ -42,14 +45,14 @@
}).
catch
(()
=>
{
this
.
$message
({
type
:
'
info
'
,
message
:
this
.
$t
(
'
core.delete-cancelled
'
)
message
:
this
.
trans
(
'
core.delete-cancelled
'
)
});
});
}
},
mounted
()
{
this
.
deleteMessage
=
this
.
$t
(
'
core.modal.confirmation-message
'
);
this
.
deleteTitle
=
this
.
$t
(
'
core.modal.title
'
);
this
.
deleteMessage
=
this
.
trans
(
'
core.modal.confirmation-message
'
);
this
.
deleteTitle
=
this
.
trans
(
'
core.modal.title
'
);
}
}
</
script
>
Modules/Page/Assets/js/components/PageForm.vue
View file @
3a1d5485
...
...
@@ -2,15 +2,15 @@
<div
class=
"div"
>
<div
class=
"content-header"
>
<h1>
{{
$t
(
`page.${pageTitle
}
`
)
}}
{{
trans
(
`page.${pageTitle
}
`
)
}}
<
/h1
>
<
el
-
breadcrumb
separator
=
"
/
"
>
<
el
-
breadcrumb
-
item
>
<
a
href
=
"
/backend
"
>
Home
<
/a
>
<
/el-breadcrumb-item
>
<
el
-
breadcrumb
-
item
:
to
=
"
{name: 'admin.page.page.index'
}
"
>
{{
$t
(
'
page.pages
'
)
}}
<
el
-
breadcrumb
-
item
:
to
=
"
{name: 'admin.page.page.index'
}
"
>
{{
trans
(
'
page.pages
'
)
}}
<
/el-breadcrumb-item
>
<
el
-
breadcrumb
-
item
:
to
=
"
{name: 'admin.page.page.create'
}
"
>
{{
$t
(
`page.${pageTitle
}
`
)
}}
<
el
-
breadcrumb
-
item
:
to
=
"
{name: 'admin.page.page.create'
}
"
>
{{
trans
(
`page.${pageTitle
}
`
)
}}
<
/el-breadcrumb-item
>
<
/el-breadcrumb
>
<
/div
>
...
...
@@ -27,14 +27,14 @@
:
key
=
"
localeArray.name
"
>
<
span
slot
=
"
label
"
:
class
=
"
{'error' : form.errors.has(locale)
}
"
>
{{
localeArray
.
name
}}
<
/span
>
<
el
-
form
-
item
:
label
=
"
$t
('page.title')
"
<
el
-
form
-
item
:
label
=
"
trans
('page.title')
"
:
class
=
"
{'el-form-item is-error': form.errors.has(locale + '.title')
}
"
>
<
el
-
input
v
-
model
=
"
page[locale].title
"
><
/el-input
>
<
div
class
=
"
el-form-item__error
"
v
-
if
=
"
form.errors.has(locale + '.title')
"
v
-
text
=
"
form.errors.first(locale + '.title')
"
><
/div
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t
('page.slug')
"
<
el
-
form
-
item
:
label
=
"
trans
('page.slug')
"
:
class
=
"
{'el-form-item is-error': form.errors.has(locale + '.slug')
}
"
>
<
el
-
input
v
-
model
=
"
page[locale].slug
"
>
<
el
-
button
slot
=
"
prepend
"
@
click
=
"
generateSlug($event, locale)
"
>
Generate
<
/el-button
>
...
...
@@ -43,7 +43,7 @@
v
-
text
=
"
form.errors.first(locale + '.slug')
"
><
/div
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t
('page.body')
"
<
el
-
form
-
item
:
label
=
"
trans
('page.body')
"
:
class
=
"
{'el-form-item is-error': form.errors.has(locale + '.body')
}
"
>
<
ckeditor
v
-
model
=
"
page[locale].body
"
:
value
=
"
page[locale].body
"
>
<
/ckeditor
>
...
...
@@ -56,17 +56,17 @@
<
h4
class
=
"
box-title
"
>
<
a
class
=
"
collapsed
"
data
-
toggle
=
"
collapse
"
data
-
parent
=
"
#accordion
"
:
href
=
"
`#collapseMeta-${locale
}
`
"
>
{{
$t
(
'
page.meta_data
'
)
}}
{{
trans
(
'
page.meta_data
'
)
}}
<
/a
>
<
/h4
>
<
/div
>
<
div
style
=
"
height: 0px;
"
:
id
=
"
`collapseMeta-${locale
}
`
"
class
=
"
panel-collapse collapse
"
>
<
div
class
=
"
box-body
"
>
<
el
-
form
-
item
:
label
=
"
$t
('page.meta_title')
"
>
<
el
-
form
-
item
:
label
=
"
trans
('page.meta_title')
"
>
<
el
-
input
v
-
model
=
"
page[locale].meta_title
"
><
/el-input
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t
('page.meta_description')
"
>
<
el
-
form
-
item
:
label
=
"
trans
('page.meta_description')
"
>
<
el
-
input
type
=
"
textarea
"
v
-
model
=
"
page[locale].meta_description
"
><
/el-input
>
<
/el-form-item
>
...
...
@@ -79,28 +79,28 @@
<
h4
class
=
"
box-title
"
>
<
a
class
=
"
collapsed
"
data
-
toggle
=
"
collapse
"
data
-
parent
=
"
#accordion
"
:
href
=
"
`#collapseFacebook-${locale
}
`
"
>
{{
$t
(
'
page.facebook_data
'
)
}}
{{
trans
(
'
page.facebook_data
'
)
}}
<
/a
>
<
/h4
>
<
/div
>
<
div
style
=
"
height: 0px;
"
:
id
=
"
`collapseFacebook-${locale
}
`
"
class
=
"
panel-collapse collapse
"
>
<
div
class
=
"
box-body
"
>
<
el
-
form
-
item
:
label
=
"
$t
('page.og_title')
"
>
<
el
-
form
-
item
:
label
=
"
trans
('page.og_title')
"
>
<
el
-
input
v
-
model
=
"
page[locale].og_title
"
><
/el-input
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t
('page.og_description')
"
>
<
el
-
form
-
item
:
label
=
"
trans
('page.og_description')
"
>
<
el
-
input
type
=
"
textarea
"
v
-
model
=
"
page[locale].og_description
"
><
/el-input
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t
('page.og_type')
"
>
<
el
-
form
-
item
:
label
=
"
trans
('page.og_type')
"
>
<
el
-
select
v
-
model
=
"
page[locale].og_type
"
:
placeholder
=
"
$t
('page.og_type')
"
>
<
el
-
option
:
label
=
"
$t
('page.facebook-types.website')
"
:
placeholder
=
"
trans
('page.og_type')
"
>
<
el
-
option
:
label
=
"
trans
('page.facebook-types.website')
"
value
=
"
website
"
><
/el-option
>
<
el
-
option
:
label
=
"
$t
('page.facebook-types.product')
"
<
el
-
option
:
label
=
"
trans
('page.facebook-types.product')
"
value
=
"
product
"
><
/el-option
>
<
el
-
option
:
label
=
"
$t
('page.facebook-types.article')
"
<
el
-
option
:
label
=
"
trans
('page.facebook-types.article')
"
value
=
"
article
"
><
/el-option
>
<
/el-select
>
<
/el-form-item
>
...
...
@@ -110,9 +110,9 @@
<
el
-
form
-
item
>
<
el
-
button
type
=
"
primary
"
@
click
=
"
onSubmit()
"
:
loading
=
"
loading
"
>
{{
$t
(
'
core.save
'
)
}}
{{
trans
(
'
core.save
'
)
}}
<
/el-button
>
<
el
-
button
@
click
=
"
onCancel()
"
>
{{
$t
(
'
core.button.cancel
'
)
}}
<
el
-
button
@
click
=
"
onCancel()
"
>
{{
trans
(
'
core.button.cancel
'
)
}}
<
/el-button
>
<
/el-form-item
>
...
...
@@ -126,9 +126,9 @@
<
div
class
=
"
box-body
"
>
<
el
-
form
-
item
label
=
""
>
<
el
-
checkbox
v
-
model
=
"
page.is_home
"
:
true
-
label
=
"
1
"
:
false
-
label
=
"
0
"
name
=
"
is_home
"
:
label
=
"
$t('page.is_
homepage')
"
><
/el-checkbox
>
:
label
=
"
trans('page.is
homepage')
"
><
/el-checkbox
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"
$t
('page.template')
"
<
el
-
form
-
item
:
label
=
"
trans
('page.template')
"
:
class
=
"
{'el-form-item is-error': form.errors.has('template')
}
"
>
<
el
-
select
v
-
model
=
"
page.template
"
filterable
>
<
el
-
option
v
-
for
=
"
(template, key) in templates
"
:
key
=
"
template
"
...
...
@@ -149,10 +149,11 @@
<
script
>
import
axios
from
'
axios
'
import
Slugify
from
'
../../../../Core/Assets/js/mixins/Slugify
'
import
TranslationHelper
from
'
../../../../Core/Assets/js/mixins/TranslationHelper
'
import
Form
from
'
form-backend-validation
'
export
default
{
mixins
:
[
Slugify
],
mixins
:
[
Slugify
,
TranslationHelper
],
props
:
{
locales
:
{
default
:
null
}
,
pageTitle
:
{
default
:
null
,
String
}
,
...
...
Modules/Page/Assets/js/components/PageTable.vue
View file @
3a1d5485
...
...
@@ -6,7 +6,7 @@
<data-tables
:data=
"data"
:actions-def=
"actionsDef"
>
<el-table-column
prop=
"id"
label=
"Id"
width=
"100"
>
</el-table-column>
<el-table-column
prop=
"title"
:label=
"
$t
('page.title')"
>
<el-table-column
prop=
"title"
:label=
"
trans
('page.title')"
>
</el-table-column>
<el-table-column
prop=
"slug"
label=
"Slug"
>
</el-table-column>
...
...
@@ -30,10 +30,12 @@
<
script
>
import
axios
from
'
axios
'
import
TranslationHelper
from
'
../../../../Core/Assets/js/mixins/TranslationHelper
'
let
data
;
export
default
{
mixins
:
[
TranslationHelper
],
data
()
{
return
{
data
,
...
...
@@ -42,7 +44,7 @@
links
:
{},
actionsDef
:
{
def
:
[{
name
:
this
.
$t
(
'
page.create-page
'
),
name
:
this
.
trans
(
'
page.create-page
'
),
icon
:
'
edit
'
,
handler
:
()
=>
{
this
.
$router
.
push
({
name
:
'
admin.page.page.create
'
})
...
...
Modules/Page/Assets/js/components/PageTableServerSide.vue
View file @
3a1d5485
...
...
@@ -2,13 +2,13 @@
<div
class=
"div"
>
<div
class=
"content-header"
>
<h1>
{{
$t
(
'
page.pages
'
)
}}
{{
trans
(
'
page.pages
'
)
}}
</h1>
<el-breadcrumb
separator=
"/"
>
<el-breadcrumb-item>
<a
href=
"/backend"
>
Home
</a>
</el-breadcrumb-item>
<el-breadcrumb-item
:to=
"
{name: 'admin.page.page.index'}">
{{
$t
(
'
page.pages
'
)
}}
</el-breadcrumb-item>
<el-breadcrumb-item
:to=
"
{name: 'admin.page.page.index'}">
{{
trans
(
'
page.pages
'
)
}}
</el-breadcrumb-item>
</el-breadcrumb>
</div>
...
...
@@ -21,7 +21,7 @@
<div
class=
"actions el-col el-col-5"
>
<router-link
:to=
"
{name: 'admin.page.page.create'}">
<el-button
type=
"primary"
><i
class=
"el-icon-edit"
></i>
{{
$t
(
'
page.create-page
'
)
}}
{{
trans
(
'
page.create-page
'
)
}}
</el-button>
</router-link>
</div>
...
...
@@ -39,13 +39,13 @@
@
sort-change=
"handleSortChange"
>
<el-table-column
prop=
"id"
label=
"Id"
width=
"100"
sortable=
"custom"
>
</el-table-column>
<el-table-column
prop=
"translations.title"
:label=
"
$t
('page.title')"
>
<el-table-column
prop=
"translations.title"
:label=
"
trans
('page.title')"
>
</el-table-column>
<el-table-column
prop=
"translations.slug"
:label=
"
$t
('page.slug')"
>
<el-table-column
prop=
"translations.slug"
:label=
"
trans
('page.slug')"
>
</el-table-column>
<el-table-column
prop=
"created_at"
:label=
"
$t('core.created_
at')"
sortable=
"custom"
>
<el-table-column
prop=
"created_at"
:label=
"
trans('core.table.created
at')"
sortable=
"custom"
>
</el-table-column>
<el-table-column
fixed=
"right"
prop=
"actions"
:label=
"
$t('cor
e.actions')"
>
<el-table-column
fixed=
"right"
prop=
"actions"
:label=
"
trans('core.tabl
e.actions')"
>
<template
scope=
"scope"
>
<a
class=
"btn btn-default btn-flat"
@
click
.
prevent=
"goToEdit(scope)"
><i
class=
"fa fa-pencil"
></i></a>
...
...
@@ -77,10 +77,12 @@
<
script
>
import
axios
from
'
axios
'
import
_
from
"
lodash
"
;
import
TranslationHelper
from
'
../../../../Core/Assets/js/mixins/TranslationHelper
'
let
data
;
export
default
{
mixins
:
[
TranslationHelper
],
data
()
{
return
{
data
,
...
...
Themes/Adminlte/views/layouts/master.blade.php
View file @
3a1d5485
...
...
@@ -75,7 +75,7 @@
@endforeach
<script>
window
.
AsgardCMS
=
{
translations
:
{
!!
json_encode
([
'
page
'
=>
trans
(
'
page::pages
'
),
'
core
'
=>
trans
(
'
core::core
'
)])
!!
}
translations
:
{
!!
json_encode
([
'
page
'
=>
array_dot
(
trans
(
'
page::pages
'
)),
'
core
'
=>
array_dot
(
trans
(
'
core::core
'
)
)])
!!
}
};
window
.
locales
=
{
!!
json_encode
(
LaravelLocalization
::
getSupportedLocales
())
!!
}
...
...
public/js/app.js
View file @
3a1d5485
...
...
@@ -70544,9 +70544,13 @@ var _axios = __webpack_require__(8);
var _axios2 = _interopRequireDefault(_axios);
var _TranslationHelper = __webpack_require__(139);
var _TranslationHelper2 = _interopRequireDefault(_TranslationHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _data = void 0;
//
//
//
//
//
...
...
@@ -70577,7 +70581,10 @@ var _data = void 0; //
//
//
var _data = void 0;
exports.default = {
mixins: [_TranslationHelper2.default],
data: function data() {
var _this = this;
...
...
@@ -70588,7 +70595,7 @@ exports.default = {
links: {},
actionsDef: {
def: [{
name: this.
$t
('page.create-page'),
name: this.
trans
('page.create-page'),
icon: 'edit',
handler: function handler() {
_this.$router.push({ name: 'admin.page.page.create' });
...
...
@@ -71702,7 +71709,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}), _vm._v(" "), _c('el-table-column', {
attrs: {
"prop": "title",
"label": _vm.
$t
('page.title')
"label": _vm.
trans
('page.title')
}
}), _vm._v(" "), _c('el-table-column', {
attrs: {
...
...
@@ -71811,8 +71818,13 @@ var _lodash = __webpack_require__(35);
var _lodash2 = _interopRequireDefault(_lodash);
var _TranslationHelper = __webpack_require__(139);
var _TranslationHelper2 = _interopRequireDefault(_TranslationHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _data = void 0; //
//
//
//
...
...
@@ -71888,11 +71900,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
//
//
//
//
var _data = void 0;
exports.default = {
mixins: [_TranslationHelper2.default],
data: function data() {
return {
data: _data,
...
...
@@ -72032,7 +72042,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "div"
}, [_c('div', {
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.
trans
('page.pages')) + "\n ")]), _vm._v(" "), _c('el-breadcrumb', {
attrs: {
"separator": "/"
}
...
...
@@ -72046,7 +72056,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
name: 'admin.page.page.index'
}
}
}, [_vm._v(_vm._s(_vm.
$t
('page.pages')))])], 1)], 1), _vm._v(" "), _c('div', {
}, [_vm._v(_vm._s(_vm.
trans
('page.pages')))])], 1)], 1), _vm._v(" "), _c('div', {
staticClass: "row"
}, [_c('div', {
staticClass: "col-xs-12"
...
...
@@ -72075,7 +72085,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
}, [_c('i', {
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.
trans
('page.create-page')) + "\n ")])], 1)], 1), _vm._v(" "), _c('div', {
staticClass: "search el-col el-col-5"
}, [_c('el-input', {
attrs: {
...
...
@@ -72121,24 +72131,24 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}), _vm._v(" "), _c('el-table-column', {
attrs: {
"prop": "translations.title",
"label": _vm.
$t
('page.title')
"label": _vm.
trans
('page.title')
}
}), _vm._v(" "), _c('el-table-column', {
attrs: {
"prop": "translations.slug",
"label": _vm.
$t
('page.slug')
"label": _vm.
trans
('page.slug')
}
}), _vm._v(" "), _c('el-table-column', {
attrs: {
"prop": "created_at",
"label": _vm.
$t('core.created_
at'),
"label": _vm.
trans('core.table.created
at'),
"sortable": "custom"
}
}), _vm._v(" "), _c('el-table-column', {
attrs: {
"fixed": "right",
"prop": "actions",
"label": _vm.
$t('cor
e.actions')
"label": _vm.
trans('core.tabl
e.actions')
},
scopedSlots: _vm._u([{
key: "default",
...
...
@@ -72251,108 +72261,17 @@ var _Slugify = __webpack_require__(118);
var _Slugify2 = _interopRequireDefault(_Slugify);
var _TranslationHelper = __webpack_require__(139);
var _TranslationHelper2 = _interopRequireDefault(_TranslationHelper);
var _formBackendValidation = __webpack_require__(119);
var _formBackendValidation2 = _interopRequireDefault(_formBackendValidation);
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();
}
}
}; //
//
//
//
//
...
...
@@ -72501,6 +72420,103 @@ exports.default = {
//
//
exports.default = {
mixins: [_Slugify2.default, _TranslationHelper2.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 */
/***/ (function(module, exports, __webpack_require__) {
...
...
@@ -72921,7 +72937,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "div"
}, [_c('div', {
staticClass: "content-header"
}, [_c('h1', [_vm._v("\n " + _vm._s(_vm.
$t
(("page." + _vm.pageTitle))) + "\n ")]), _vm._v(" "), _c('el-breadcrumb', {
}, [_c('h1', [_vm._v("\n " + _vm._s(_vm.
trans
(("page." + _vm.pageTitle))) + "\n ")]), _vm._v(" "), _c('el-breadcrumb', {
attrs: {
"separator": "/"
}
...
...
@@ -72935,13 +72951,13 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
name: 'admin.page.page.index'
}
}
}, [_vm._v(_vm._s(_vm.
$t
('page.pages')) + "\n ")]), _vm._v(" "), _c('el-breadcrumb-item', {
}, [_vm._v(_vm._s(_vm.
trans
('page.pages')) + "\n ")]), _vm._v(" "), _c('el-breadcrumb-item', {
attrs: {
"to": {
name: 'admin.page.page.create'
}
}
}, [_vm._v(_vm._s(_vm.
$t
(("page." + _vm.pageTitle))) + "\n ")])], 1)], 1), _vm._v(" "), _c('el-form', {
}, [_vm._v(_vm._s(_vm.
trans
(("page." + _vm.pageTitle))) + "\n ")])], 1)], 1), _vm._v(" "), _c('el-form', {
directives: [{
name: "loading",
rawName: "v-loading.body",
...
...
@@ -72990,7 +73006,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')
},
attrs: {
"label": _vm.
$t
('page.title')
"label": _vm.
trans
('page.title')
}
}, [_c('el-input', {
model: {
...
...
@@ -73010,7 +73026,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')
},
attrs: {
"label": _vm.
$t
('page.slug')
"label": _vm.
trans
('page.slug')
}
}, [_c('el-input', {
model: {
...
...
@@ -73037,7 +73053,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')
},
attrs: {
"label": _vm.
$t
('page.body')
"label": _vm.
trans
('page.body')
}
}, [_c('ckeditor', {
attrs: {
...
...
@@ -73068,7 +73084,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"data-parent": "#accordion",
"href": ("#collapseMeta-" + locale)
}
}, [_vm._v("\n " + _vm._s(_vm.
$t
('page.meta_data')) + "\n ")])])]), _vm._v(" "), _c('div', {
}, [_vm._v("\n " + _vm._s(_vm.
trans
('page.meta_data')) + "\n ")])])]), _vm._v(" "), _c('div', {
staticClass: "panel-collapse collapse",
staticStyle: {
"height": "0px"
...
...
@@ -73080,7 +73096,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "box-body"
}, [_c('el-form-item', {
attrs: {
"label": _vm.
$t
('page.meta_title')
"label": _vm.
trans
('page.meta_title')
}
}, [_c('el-input', {
model: {
...
...
@@ -73092,7 +73108,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
})], 1), _vm._v(" "), _c('el-form-item', {
attrs: {
"label": _vm.
$t
('page.meta_description')
"label": _vm.
trans
('page.meta_description')
}
}, [_c('el-input', {
attrs: {
...
...
@@ -73118,7 +73134,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"data-parent": "#accordion",
"href": ("#collapseFacebook-" + locale)
}
}, [_vm._v("\n " + _vm._s(_vm.
$t
('page.facebook_data')) + "\n ")])])]), _vm._v(" "), _c('div', {
}, [_vm._v("\n " + _vm._s(_vm.
trans
('page.facebook_data')) + "\n ")])])]), _vm._v(" "), _c('div', {
staticClass: "panel-collapse collapse",
staticStyle: {
"height": "0px"
...
...
@@ -73130,7 +73146,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
staticClass: "box-body"
}, [_c('el-form-item', {
attrs: {
"label": _vm.
$t
('page.og_title')
"label": _vm.
trans
('page.og_title')
}
}, [_c('el-input', {
model: {
...
...
@@ -73142,7 +73158,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
})], 1), _vm._v(" "), _c('el-form-item', {
attrs: {
"label": _vm.
$t
('page.og_description')
"label": _vm.
trans
('page.og_description')
}
}, [_c('el-input', {
attrs: {
...
...
@@ -73157,11 +73173,11 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
})], 1), _vm._v(" "), _c('el-form-item', {
attrs: {
"label": _vm.
$t
('page.og_type')
"label": _vm.
trans
('page.og_type')
}
}, [_c('el-select', {
attrs: {
"placeholder": _vm.
$t
('page.og_type')
"placeholder": _vm.
trans
('page.og_type')
},
model: {
value: (_vm.page[locale].og_type),
...
...
@@ -73172,17 +73188,17 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
}, [_c('el-option', {
attrs: {
"label": _vm.
$t
('page.facebook-types.website'),
"label": _vm.
trans
('page.facebook-types.website'),
"value": "website"
}
}), _vm._v(" "), _c('el-option', {
attrs: {
"label": _vm.
$t
('page.facebook-types.product'),
"label": _vm.
trans
('page.facebook-types.product'),
"value": "product"
}
}), _vm._v(" "), _c('el-option', {
attrs: {
"label": _vm.
$t
('page.facebook-types.article'),
"label": _vm.
trans
('page.facebook-types.article'),
"value": "article"
}
})], 1)], 1)], 1)])]), _vm._v(" "), _c('el-form-item', [_c('el-button', {
...
...
@@ -73195,13 +73211,13 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
_vm.onSubmit()
}
}
}, [_vm._v("\n " + _vm._s(_vm.
$t
('core.save')) + "\n ")]), _vm._v(" "), _c('el-button', {
}, [_vm._v("\n " + _vm._s(_vm.
trans
('core.save')) + "\n ")]), _vm._v(" "), _c('el-button', {
on: {
"click": function($event) {
_vm.onCancel()
}
}
}, [_vm._v(_vm._s(_vm.
$t
('core.button.cancel')) + "\n ")])], 1)], 1)
}, [_vm._v(_vm._s(_vm.
trans
('core.button.cancel')) + "\n ")])], 1)], 1)
}))], 1)])]), _vm._v(" "), _c('div', {
staticClass: "col-md-2"
}, [_c('div', {
...
...
@@ -73217,7 +73233,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"true-label": 1,
"false-label": 0,
"name": "is_home",
"label": _vm.
$t('page.is_
homepage')
"label": _vm.
trans('page.is
homepage')
},
model: {
value: (_vm.page.is_home),
...
...
@@ -73231,7 +73247,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
'el-form-item is-error': _vm.form.errors.has('template')
},
attrs: {
"label": _vm.
$t
('page.template')
"label": _vm.
trans
('page.template')
}
}, [_c('el-select', {
attrs: {
...
...
@@ -73875,12 +73891,15 @@ module.exports = Component.exports
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
var _TranslationHelper = __webpack_require__(139);
var _TranslationHelper2 = _interopRequireDefault(_TranslationHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_TranslationHelper2.default],
props: {
rows: { default: null },
scope: { default: null }
...
...
@@ -73897,8 +73916,8 @@ exports.default = {
var _this = this;
this.$confirm(this.deleteMessage, this.deleteTitle, {
confirmButtonText: this.
$t
('core.button.delete'),
cancelButtonText: this.
$t
('core.button.cancel'),
confirmButtonText: this.
trans
('core.button.delete'),
cancelButtonText: this.
trans
('core.button.cancel'),
type: 'warning'
}).then(function () {
var vm = _this;
...
...
@@ -73920,16 +73939,19 @@ exports.default = {
}).catch(function () {
_this.$message({
type: 'info',
message: _this.
$t
('core.delete-cancelled')
message: _this.
trans
('core.delete-cancelled')
});
});
}
},
mounted: function mounted() {
this.deleteMessage = this.
$t
('core.modal.confirmation-message');
this.deleteTitle = this.
$t
('core.modal.title');
this.deleteMessage = this.
trans
('core.modal.confirmation-message');
this.deleteTitle = this.
trans
('core.modal.title');
}
};
}; //
//
//
//
/***/ }),
/* 133 */
...
...
@@ -75493,5 +75515,35 @@ if (typeof window !== 'undefined' && window.Vue) {
/* harmony default export */ __webpack_exports__["default"] = (VueI18n);
/***/ }),
/* 138 */,
/* 139 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = {
methods: {
trans: function trans(string) {
// Makes a string: core.button.cancel | core.button.created at
// to: core["button.cancel"] | core["button.created at"]
var array = string.split('.');
if (array.length < 2) {
return this.$t(string);
}
var first = array.splice(0, 1);
var key = array.join('.');
return this.$t(first + '[\'' + key + '\']');
}
}
};
/***/ })
/******/ ]);
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment