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
ea0ef9f6
Unverified
Commit
ea0ef9f6
authored
Sep 18, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Registering the TranslationHelper mixin globally to access it from anywhere
parent
532531d4
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
135 additions
and
137 deletions
+135
-137
DeleteComponent.vue
Modules/Core/Assets/js/components/DeleteComponent.vue
+0
-3
PageForm.vue
Modules/Page/Assets/js/components/PageForm.vue
+1
-2
PageTable.vue
Modules/Page/Assets/js/components/PageTable.vue
+0
-2
PageTableServerSide.vue
Modules/Page/Assets/js/components/PageTableServerSide.vue
+1
-2
app.js
public/js/app.js
+127
-128
app.js
resources/assets/js/app.js
+2
-0
mixins.js
resources/assets/js/mixins.js
+4
-0
No files found.
Modules/Core/Assets/js/components/DeleteComponent.vue
View file @
ea0ef9f6
...
...
@@ -3,10 +3,7 @@
</
template
>
<
script
>
import
TranslationHelper
from
'
../../../../Core/Assets/js/mixins/TranslationHelper
'
export
default
{
mixins
:
[
TranslationHelper
],
props
:
{
rows
:
{
default
:
null
},
scope
:
{
default
:
null
},
...
...
Modules/Page/Assets/js/components/PageForm.vue
View file @
ea0ef9f6
...
...
@@ -150,12 +150,11 @@
<
script
>
import
axios
from
'
axios
'
import
Slugify
from
'
../../../../Core/Assets/js/mixins/Slugify
'
import
TranslationHelper
from
'
../../../../Core/Assets/js/mixins/TranslationHelper
'
import
ShortcutHelper
from
'
../../../../Core/Assets/js/mixins/ShortcutHelper
'
import
Form
from
'
form-backend-validation
'
export
default
{
mixins
:
[
Slugify
,
TranslationHelper
,
ShortcutHelper
],
mixins
:
[
Slugify
,
ShortcutHelper
],
props
:
{
locales
:
{
default
:
null
}
,
pageTitle
:
{
default
:
null
,
String
}
,
...
...
Modules/Page/Assets/js/components/PageTable.vue
View file @
ea0ef9f6
...
...
@@ -30,12 +30,10 @@
<
script
>
import
axios
from
'
axios
'
import
TranslationHelper
from
'
../../../../Core/Assets/js/mixins/TranslationHelper
'
let
data
;
export
default
{
mixins
:
[
TranslationHelper
],
data
()
{
return
{
data
,
...
...
Modules/Page/Assets/js/components/PageTableServerSide.vue
View file @
ea0ef9f6
...
...
@@ -98,13 +98,12 @@
<
script
>
import
axios
from
'
axios
'
import
_
from
"
lodash
"
;
import
TranslationHelper
from
'
../../../../Core/Assets/js/mixins/TranslationHelper
'
import
ShortcutHelper
from
'
../../../../Core/Assets/js/mixins/ShortcutHelper
'
let
data
;
export
default
{
mixins
:
[
TranslationHelper
,
ShortcutHelper
],
mixins
:
[
ShortcutHelper
],
data
()
{
return
{
data
,
...
...
public/js/app.js
View file @
ea0ef9f6
...
...
@@ -31219,6 +31219,7 @@ _vue2.default.use(_vueDataTables2.default, { locale: _en2.default });
_vue2.default.use(_vueI18n2.default);
_vue2.default.use(_vueRouter2.default);
_vue2.default.use(__webpack_require__(119), { prevent: ['input', 'textarea'] });
__webpack_require__(144);
_vue2.default.component('ckeditor', __webpack_require__(120));
_vue2.default.component('DeleteButton', __webpack_require__(128));
...
...
@@ -71415,12 +71416,9 @@ var _axios = __webpack_require__(8);
var _axios2 = _interopRequireDefault(_axios);
var _TranslationHelper = __webpack_require__(10);
var _TranslationHelper2 = _interopRequireDefault(_TranslationHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _data = void 0; //
//
//
//
...
...
@@ -71450,12 +71448,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
//
//
//
//
var _data = void 0;
exports.default = {
mixins: [_TranslationHelper2.default],
data: function data() {
var _this = this;
...
...
@@ -72689,16 +72683,13 @@ var _lodash = __webpack_require__(34);
var _lodash2 = _interopRequireDefault(_lodash);
var _TranslationHelper = __webpack_require__(10);
var _TranslationHelper2 = _interopRequireDefault(_TranslationHelper);
var _ShortcutHelper = __webpack_require__(35);
var _ShortcutHelper2 = _interopRequireDefault(_ShortcutHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _data = void 0; //
//
//
//
...
...
@@ -72795,12 +72786,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
//
//
//
//
var _data = void 0;
exports.default = {
mixins: [_
TranslationHelper2.default, _
ShortcutHelper2.default],
mixins: [_ShortcutHelper2.default],
data: function data() {
return {
data: _data,
...
...
@@ -73223,10 +73211,6 @@ var _Slugify = __webpack_require__(113);
var _Slugify2 = _interopRequireDefault(_Slugify);
var _TranslationHelper = __webpack_require__(10);
var _TranslationHelper2 = _interopRequireDefault(_TranslationHelper);
var _ShortcutHelper = __webpack_require__(35);
var _ShortcutHelper2 = _interopRequireDefault(_ShortcutHelper);
...
...
@@ -73237,103 +73221,7 @@ var _formBackendValidation2 = _interopRequireDefault(_formBackendValidation);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
mixins: [_Slugify2.default, _TranslationHelper2.default, _ShortcutHelper2.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: {},
activeTab: window.AsgardCMS.currentLocale || 'en'
};
},
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();
}
}
}; //
//
//
//
//
...
...
@@ -73483,6 +73371,104 @@ exports.default = {
//
//
exports.default = {
mixins: [_Slugify2.default, _ShortcutHelper2.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: {},
activeTab: window.AsgardCMS.currentLocale || 'en'
};
},
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();
}
}
};
/***/ }),
/* 113 */
/***/ (function(module, exports, __webpack_require__) {
...
...
@@ -74892,15 +74878,12 @@ module.exports = Component.exports
Object.defineProperty(exports, "__esModule", {
value: true
});
var _TranslationHelper = __webpack_require__(10);
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 }
...
...
@@ -74949,10 +74932,7 @@ exports.default = {
this.deleteMessage = this.trans('core.modal.confirmation-message');
this.deleteTitle = this.trans('core.modal.title');
}
}; //
//
//
//
};
/***/ }),
/* 130 */
...
...
@@ -75217,5 +75197,24 @@ function toComment(sourceMap) {
}
/***/ }),
/* 144 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _vue = __webpack_require__(3);
var _vue2 = _interopRequireDefault(_vue);
var _TranslationHelper = __webpack_require__(10);
var _TranslationHelper2 = _interopRequireDefault(_TranslationHelper);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_vue2.default.mixin(_TranslationHelper2.default);
/***/ })
/******/ ]);
\ No newline at end of file
resources/assets/js/app.js
View file @
ea0ef9f6
...
...
@@ -12,6 +12,8 @@ Vue.use(DataTables, { locale });
Vue
.
use
(
VueI18n
);
Vue
.
use
(
VueRouter
);
Vue
.
use
(
require
(
'
vue-shortkey
'
),
{
prevent
:
[
'
input
'
,
'
textarea
'
]
});
require
(
'
./mixins
'
);
Vue
.
component
(
'
ckeditor
'
,
require
(
'
../../../Modules/Core/Assets/js/components/CkEditor.vue
'
));
Vue
.
component
(
'
DeleteButton
'
,
require
(
'
../../../Modules/Core/Assets/js/components/DeleteComponent.vue
'
));
...
...
resources/assets/js/mixins.js
0 → 100644
View file @
ea0ef9f6
import
Vue
from
'
vue
'
import
TranslationHelper
from
'
../../../Modules/Core/Assets/js/mixins/TranslationHelper
'
Vue
.
mixin
(
TranslationHelper
);
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