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
a068bea3
Unverified
Commit
a068bea3
authored
Oct 06, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More Eslint configuration and customisations
parent
14c219f2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
78 deletions
+104
-78
.eslintrc.js
.eslintrc.js
+18
-4
PageForm.vue
Modules/Page/Assets/js/components/PageForm.vue
+27
-30
RoleTable.vue
Modules/User/Assets/js/components/RoleTable.vue
+15
-0
app.js
resources/assets/js/app.js
+38
-38
bootstrap.js
resources/assets/js/bootstrap.js
+6
-6
No files found.
.eslintrc.js
View file @
a068bea3
module
.
exports
=
{
"
extends
"
:
[
"
airbnb-base
"
,
'
plugin:vue/recommended
'
]
extends
:
[
'
airbnb-base
'
,
'
plugin:vue/recommended
'
,
],
rules
:
{
indent
:
[
2
,
4
],
'
no-undef
'
:
'
off
'
,
'
max-len
'
:
'
off
'
,
'
no-console
'
:
'
off
'
,
},
overrides
:
[
{
files
:
[
'
*.vue
'
,
'
**/*.vue
'
],
rules
:
{
indent
:
'
off
'
,
},
},
],
};
Modules/Page/Assets/js/components/PageForm.vue
View file @
a068bea3
...
...
@@ -152,19 +152,18 @@
<
/template
>
<
script
>
import
axios
from
'
axios
'
import
Slugify
from
'
../../../../Core/Assets/js/mixins/Slugify
'
import
ShortcutHelper
from
'
../../../../Core/Assets/js/mixins/ShortcutHelper
'
import
ActiveEditor
from
'
../../../../Core/Assets/js/mixins/ActiveEditor
'
import
SingleFileSelector
from
'
../../../../Media/Assets/js/mixins/SingleFileSelector
'
import
Form
from
'
form-backend-validation
'
import
axios
from
'
axios
'
;
import
Form
from
'
form-backend-validation
'
;
import
Slugify
from
'
../../../../Core/Assets/js/mixins/Slugify
'
;
import
ShortcutHelper
from
'
../../../../Core/Assets/js/mixins/ShortcutHelper
'
;
import
ActiveEditor
from
'
../../../../Core/Assets/js/mixins/ActiveEditor
'
;
import
SingleFileSelector
from
'
../../../../Media/Assets/js/mixins/SingleFileSelector
'
;
export
default
{
mixins
:
[
Slugify
,
ShortcutHelper
,
ActiveEditor
,
SingleFileSelector
],
props
:
{
locales
:
{
default
:
null
}
,
pageTitle
:
{
default
:
null
,
String
}
,
locales
:
{
default
:
null
}
,
pageTitle
:
{
default
:
null
,
String
}
,
}
,
data
()
{
return
{
...
...
@@ -181,49 +180,49 @@
og_type
:
''
,
}
])
.
fromPairs
()
.
merge
({
template
:
'
default
'
,
is_home
:
0
,
medias_single
:
[]
}
)
.
merge
({
template
:
'
default
'
,
is_home
:
0
,
medias_single
:
[]
}
)
.
value
(),
templates
:
{
'
index
'
:
'
index
'
,
'
home
'
:
'
home
'
,
'
default
'
:
'
default
'
,
index
:
'
index
'
,
home
:
'
home
'
,
default
:
'
default
'
,
}
,
form
:
new
Form
(),
loading
:
false
,
tags
:
{
}
,
activeTab
:
window
.
AsgardCMS
.
currentLocale
||
'
en
'
,
}
}
;
}
,
methods
:
{
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
.
form
.
post
(
this
.
getRoute
())
.
then
(
response
=>
{
.
then
(
(
response
)
=>
{
this
.
loading
=
false
;
this
.
$message
({
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
);
this
.
loading
=
false
;
this
.
$notify
.
error
({
title
:
'
Error
'
,
message
:
'
There are some errors in the form.
'
message
:
'
There are some errors in the form.
'
,
}
);
}
);
}
,
onCancel
()
{
this
.
$router
.
push
({
name
:
'
admin.page.page.index
'
}
);
this
.
$router
.
push
({
name
:
'
admin.page.page.index
'
}
);
}
,
fetchTemplates
()
{
axios
.
get
(
route
(
'
api.page.page-templates.index
'
))
.
then
(
response
=>
{
.
then
(
(
response
)
=>
{
this
.
templates
=
response
.
data
;
}
);
}
,
...
...
@@ -232,19 +231,17 @@
}
,
fetchPage
()
{
this
.
loading
=
true
;
axios
.
post
(
route
(
'
api.page.page.find
'
,
{
page
:
this
.
$route
.
params
.
pageId
}
))
.
then
(
response
=>
{
axios
.
post
(
route
(
'
api.page.page.find
'
,
{
page
:
this
.
$route
.
params
.
pageId
}
))
.
then
(
(
response
)
=>
{
this
.
loading
=
false
;
this
.
page
=
response
.
data
.
data
;
this
.
tags
=
response
.
data
.
data
.
tags
;
$
(
'
.publicUrl
'
).
attr
(
'
href
'
,
this
.
page
.
urls
.
public_url
).
show
();
}
)
.
catch
(
error
=>
{
}
)
}
);
}
,
getRoute
()
{
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
'
);
}
,
...
...
@@ -258,6 +255,6 @@
}
,
destroyed
()
{
$
(
'
.publicUrl
'
).
hide
();
}
}
}
,
}
;
<
/script
>
Modules/User/Assets/js/components/RoleTable.vue
0 → 100644
View file @
a068bea3
<
template
>
</
template
>
<
script
>
export
default
{
data
()
{
return
{
};
},
methods
:
{},
mounted
()
{
},
};
</
script
>
resources/assets/js/app.js
View file @
a068bea3
...
...
@@ -11,11 +11,11 @@ import VueSimplemde from 'vue-simplemde';
import
PageRoutes
from
'
../../../Modules/Page/Assets/js/PageRoutes
'
;
import
MediaRoutes
from
'
../../../Modules/Media/Assets/js/MediaRoutes
'
;
Vue
.
use
(
ElementUI
,
{
locale
});
Vue
.
use
(
DataTables
,
{
locale
});
Vue
.
use
(
ElementUI
,
{
locale
});
Vue
.
use
(
DataTables
,
{
locale
});
Vue
.
use
(
VueI18n
);
Vue
.
use
(
VueRouter
);
Vue
.
use
(
require
(
'
vue-shortkey
'
),
{
prevent
:
[
'
input
'
,
'
textarea
'
]
});
Vue
.
use
(
require
(
'
vue-shortkey
'
),
{
prevent
:
[
'
input
'
,
'
textarea
'
]
});
Vue
.
use
(
VueEvents
);
Vue
.
use
(
VueSimplemde
);
...
...
@@ -34,54 +34,54 @@ const currentLocale = window.AsgardCMS.currentLocale;
const
adminPrefix
=
window
.
AsgardCMS
.
adminPrefix
;
function
makeBaseUrl
()
{
if
(
window
.
AsgardCMS
.
hideDefaultLocaleInURL
==
1
)
{
return
adminPrefix
;
}
return
`
${
currentLocale
}
/
${
adminPrefix
}
`
;
if
(
window
.
AsgardCMS
.
hideDefaultLocaleInURL
==
1
)
{
return
adminPrefix
;
}
return
`
${
currentLocale
}
/
${
adminPrefix
}
`
;
}
const
router
=
new
VueRouter
({
mode
:
'
history
'
,
base
:
makeBaseUrl
(),
routes
:
[
...
PageRoutes
,
...
MediaRoutes
,
],
mode
:
'
history
'
,
base
:
makeBaseUrl
(),
routes
:
[
...
PageRoutes
,
...
MediaRoutes
,
],
});
const
messages
=
{
[
currentLocale
]:
window
.
AsgardCMS
.
translations
,
[
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
,
(
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
);
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 @
a068bea3
...
...
@@ -32,25 +32,25 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
const
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
'
);
}
const
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.
'
);
}
const
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.
'
);
}
...
...
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