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
91d1b699
Unverified
Commit
91d1b699
authored
Oct 03, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CS: eslint
parent
0cbafba0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
57 deletions
+59
-57
app.js
resources/assets/js/app.js
+48
-46
bootstrap.js
resources/assets/js/bootstrap.js
+9
-9
mixins.js
resources/assets/js/mixins.js
+2
-2
No files found.
resources/assets/js/app.js
View file @
91d1b699
require
(
'
./bootstrap
'
);
import
Vue
from
'
vue
'
import
VueI18n
from
'
vue-i18n
'
import
VueRouter
from
'
vue-router
'
import
ElementUI
from
'
element-ui
'
import
DataTables
from
'
vue-data-tables
'
import
VueEvents
from
'
vue-events
'
import
locale
from
'
element-ui/lib/locale/lang/en
'
import
VueSimplemde
from
'
vue-simplemde
'
import
Vue
from
'
vue
'
;
import
VueI18n
from
'
vue-i18n
'
;
import
VueRouter
from
'
vue-router
'
;
import
ElementUI
from
'
element-ui
'
;
import
DataTables
from
'
vue-data-tables
'
;
import
VueEvents
from
'
vue-events
'
;
import
locale
from
'
element-ui/lib/locale/lang/en
'
;
import
VueSimplemde
from
'
vue-simplemde
'
;
Vue
.
use
(
ElementUI
,
{
locale
});
Vue
.
use
(
DataTables
,
{
locale
});
Vue
.
use
(
VueI18n
);
Vue
.
use
(
VueRouter
);
Vue
.
use
(
require
(
'
vue-shortkey
'
),
{
prevent
:
[
'
input
'
,
'
textarea
'
]
});
Vue
.
use
(
VueEvents
);
Vue
.
use
(
VueSimplemde
);
require
(
'
./mixins
'
);
...
...
@@ -24,62 +25,63 @@ Vue.component('DeleteButton', require('../../../Modules/Core/Assets/js/component
Vue
.
component
(
'
TagsInput
'
,
require
(
'
../../../Modules/Tag/Assets/js/components/TagInput.vue
'
));
Vue
.
component
(
'
SingleMedia
'
,
require
(
'
../../../Modules/Media/Assets/js/components/SingleMedia.vue
'
));
Vue
.
component
(
'
MediaManager
'
,
require
(
'
../../../Modules/Media/Assets/js/components/MediaManager.vue
'
));
import
PageRoutes
from
'
../../../Modules/Page/Assets/js/PageRoutes
'
;
import
MediaRoutes
from
'
../../../Modules/Media/Assets/js/MediaRoutes
'
;
const
currentLocale
=
window
.
AsgardCMS
.
currentLocale
;
const
currentLocale
=
window
.
AsgardCMS
.
currentLocale
;
const
adminPrefix
=
window
.
AsgardCMS
.
adminPrefix
;
const
router
=
new
VueRouter
({
mode
:
'
history
'
,
base
:
makeBaseUrl
(),
routes
:
[
...
PageRoutes
,
...
MediaRoutes
,
],
mode
:
'
history
'
,
base
:
makeBaseUrl
(),
routes
:
[
...
PageRoutes
,
...
MediaRoutes
,
],
});
function
makeBaseUrl
()
{
if
(
window
.
AsgardCMS
.
hideDefaultLocaleInURL
==
1
)
{
return
adminPrefix
;
}
return
`
${
currentLocale
}
/
${
adminPrefix
}
`
;
if
(
window
.
AsgardCMS
.
hideDefaultLocaleInURL
==
1
)
{
return
adminPrefix
;
}
return
`
${
currentLocale
}
/
${
adminPrefix
}
`
;
}
le
t
messages
=
{
[
currentLocale
]:
window
.
AsgardCMS
.
translations
,
cons
t
messages
=
{
[
currentLocale
]:
window
.
AsgardCMS
.
translations
,
};
const
i18n
=
new
VueI18n
({
locale
:
currentLocale
,
messages
,
locale
:
currentLocale
,
messages
,
});
const
app
=
new
Vue
({
el
:
'
#app
'
,
router
,
i18n
,
el
:
'
#app
'
,
router
,
i18n
,
});
window
.
axios
.
interceptors
.
response
.
use
(
null
,
function
(
error
)
{
if
(
error
.
response
===
undefined
)
{
console
.
log
(
error
);
return
;
}
if
(
error
.
response
.
status
===
403
)
{
app
.
$notify
.
error
({
title
:
app
.
$t
(
'
core.unauthorized
'
),
message
:
app
.
$t
(
'
core.unauthorized-access
'
),
});
window
.
location
=
route
(
'
dashboard.index
'
);
}
if
(
error
.
response
.
status
===
401
)
{
app
.
$notify
.
error
({
title
:
app
.
$t
(
'
core.unauthenticated
'
),
message
:
app
.
$t
(
'
core.unauthenticated-message
'
),
});
window
.
location
=
route
(
'
login
'
);
}
return
Promise
.
reject
(
error
);
window
.
axios
.
interceptors
.
response
.
use
(
null
,
(
error
)
=>
{
if
(
error
.
response
===
undefined
)
{
console
.
log
(
error
);
return
;
}
if
(
error
.
response
.
status
===
403
)
{
app
.
$notify
.
error
({
title
:
app
.
$t
(
'
core.unauthorized
'
),
message
:
app
.
$t
(
'
core.unauthorized-access
'
),
});
window
.
location
=
route
(
'
dashboard.index
'
);
}
if
(
error
.
response
.
status
===
401
)
{
app
.
$notify
.
error
({
title
:
app
.
$t
(
'
core.unauthenticated
'
),
message
:
app
.
$t
(
'
core.unauthenticated-message
'
),
});
window
.
location
=
route
(
'
login
'
);
}
return
Promise
.
reject
(
error
);
});
resources/assets/js/bootstrap.js
View file @
91d1b699
...
...
@@ -29,28 +29,28 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
* a simple convenience so we don't have to attach every token manually.
*/
le
t
token
=
document
.
head
.
querySelector
(
'
meta[name="csrf-token"]
'
);
cons
t
token
=
document
.
head
.
querySelector
(
'
meta[name="csrf-token"]
'
);
if
(
token
)
{
window
.
axios
.
defaults
.
headers
.
common
[
'
X-CSRF-TOKEN
'
]
=
token
.
content
;
window
.
axios
.
defaults
.
headers
.
common
[
'
X-CSRF-TOKEN
'
]
=
token
.
content
;
}
else
{
console
.
error
(
'
CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token
'
);
console
.
error
(
'
CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token
'
);
}
le
t
userApiToken
=
document
.
head
.
querySelector
(
'
meta[name="user-api-token"]
'
);
cons
t
userApiToken
=
document
.
head
.
querySelector
(
'
meta[name="user-api-token"]
'
);
if
(
userApiToken
)
{
window
.
axios
.
defaults
.
headers
.
common
[
'
Authorization
'
]
=
'
Bearer
'
+
userApiToken
.
content
;
window
.
axios
.
defaults
.
headers
.
common
.
Authorization
=
`Bearer
${
userApiToken
.
content
}
`
;
}
else
{
console
.
error
(
'
User API token not found in a meta tag.
'
);
console
.
error
(
'
User API token not found in a meta tag.
'
);
}
le
t
currentLocale
=
document
.
head
.
querySelector
(
'
meta[name="current-locale"]
'
);
cons
t
currentLocale
=
document
.
head
.
querySelector
(
'
meta[name="current-locale"]
'
);
if
(
currentLocale
)
{
window
.
AsgardCMS
.
currentLocale
=
currentLocale
.
content
;
window
.
AsgardCMS
.
currentLocale
=
currentLocale
.
content
;
}
else
{
console
.
error
(
'
Current locale token not found in a meta tag.
'
);
console
.
error
(
'
Current locale token not found in a meta tag.
'
);
}
...
...
resources/assets/js/mixins.js
View file @
91d1b699
import
Vue
from
'
vue
'
import
TranslationHelper
from
'
../../../Modules/Core/Assets/js/mixins/TranslationHelper
'
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