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
bfd7c30e
Unverified
Commit
bfd7c30e
authored
Oct 06, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CS: Eslint
parent
28aea032
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
338 additions
and
342 deletions
+338
-342
ActiveEditor.js
Modules/Core/Assets/js/mixins/ActiveEditor.js
+3
-3
ShortcutHelper.js
Modules/Core/Assets/js/mixins/ShortcutHelper.js
+3
-3
Slugify.js
Modules/Core/Assets/js/mixins/Slugify.js
+6
-6
StringHelpers.vue
Modules/Core/Assets/js/mixins/StringHelpers.vue
+4
-3
TranslationHelper.js
Modules/Core/Assets/js/mixins/TranslationHelper.js
+6
-6
MediaRoutes.js
Modules/Media/Assets/js/MediaRoutes.js
+4
-4
MediaForm.vue
Modules/Media/Assets/js/components/MediaForm.vue
+20
-22
MediaList.vue
Modules/Media/Assets/js/components/MediaList.vue
+38
-38
MediaManager.vue
Modules/Media/Assets/js/components/MediaManager.vue
+3
-3
NewFolder.vue
Modules/Media/Assets/js/components/NewFolder.vue
+10
-10
RenameFolder.vue
Modules/Media/Assets/js/components/RenameFolder.vue
+10
-10
SingleMedia.vue
Modules/Media/Assets/js/components/SingleMedia.vue
+20
-21
UploadButton.vue
Modules/Media/Assets/js/components/UploadButton.vue
+12
-12
UploadZone.vue
Modules/Media/Assets/js/components/UploadZone.vue
+6
-6
PageRoutes.js
Modules/Page/Assets/js/PageRoutes.js
+5
-5
PageTableServerSide.vue
Modules/Page/Assets/js/components/PageTableServerSide.vue
+24
-26
asgardcms.js
Themes/Adminlte/resources/assets/js/asgardcms.js
+14
-12
mixins.js
Themes/Adminlte/resources/assets/js/mixins.js
+1
-1
app.js
public/js/app.js
+149
-151
No files found.
Modules/Core/Assets/js/mixins/ActiveEditor.js
View file @
bfd7c30e
...
...
@@ -8,7 +8,7 @@ export default {
if
(
configuredEditor
===
'
ckeditor
'
)
{
return
'
ckeditor
'
;
}
return
'
ckeditor
'
return
'
ckeditor
'
;
},
}
}
}
,
}
;
Modules/Core/Assets/js/mixins/ShortcutHelper.js
View file @
bfd7c30e
...
...
@@ -2,6 +2,6 @@ export default {
methods
:
{
pushRoute
(
route
)
{
this
.
$router
.
push
(
route
);
}
}
}
}
,
}
,
}
;
Modules/Core/Assets/js/mixins/Slugify.js
View file @
bfd7c30e
...
...
@@ -6,9 +6,9 @@ export default {
value
=
value
.
toLowerCase
();
// remove accents, swap ñ for n, etc
var
from
=
"
ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;
"
;
var
to
=
"
aaaaaeeeeeiiiiooooouuuunc------
"
;
for
(
var
i
=
0
,
l
=
from
.
length
;
i
<
l
;
i
++
)
{
const
from
=
'
ãàáäâẽèéëêìíïîõòóöôùúüûñç·/_,:;
'
;
const
to
=
'
aaaaaeeeeeiiiiooooouuuunc------
'
;
for
(
let
i
=
0
,
l
=
from
.
length
;
i
<
l
;
i
++
)
{
value
=
value
.
replace
(
new
RegExp
(
from
.
charAt
(
i
),
'
g
'
),
to
.
charAt
(
i
));
}
...
...
@@ -17,6 +17,6 @@ export default {
.
replace
(
/-+/g
,
'
-
'
);
// collapse dashes
return
value
;
}
}
}
}
,
}
,
}
;
Modules/Core/Assets/js/mixins/StringHelpers.vue
View file @
bfd7c30e
<
template
>
<div></div>
</
template
>
<
script
>
...
...
@@ -8,8 +9,8 @@
return
string
[
0
].
toUpperCase
()
+
string
.
substr
(
1
);
},
ucwords
(
string
)
{
return
string
.
replace
(
/
\w\S
*/g
,
function
(
txt
){
return
txt
.
charAt
(
0
).
toUpperCase
()
+
txt
.
substr
(
1
).
toLowerCase
();}
);
}
return
string
.
replace
(
/
\w\S
*/g
,
txt
=>
txt
.
charAt
(
0
).
toUpperCase
()
+
txt
.
substr
(
1
).
toLowerCase
()
);
}
,
},
}
}
;
</
script
>
Modules/Core/Assets/js/mixins/TranslationHelper.js
View file @
bfd7c30e
...
...
@@ -3,14 +3,14 @@ export default {
trans
(
string
)
{
// Makes a string: core.button.cancel | core.button.created at
// to: core["button.cancel"] | core["button.created at"]
le
t
array
=
string
.
split
(
'
.
'
);
cons
t
array
=
string
.
split
(
'
.
'
);
if
(
array
.
length
<
2
)
{
return
this
.
$t
(
string
)
}
if
(
array
.
length
<
2
)
{
return
this
.
$t
(
string
)
;
}
let
first
=
array
.
splice
(
0
,
1
);
le
t
key
=
array
.
join
(
'
.
'
);
const
first
=
array
.
splice
(
0
,
1
);
cons
t
key
=
array
.
join
(
'
.
'
);
return
this
.
$t
(
`
${
first
}
['
${
key
}
']`
);
},
}
}
}
,
}
;
Modules/Media/Assets/js/MediaRoutes.js
View file @
bfd7c30e
...
...
@@ -12,7 +12,7 @@ export default [
{
path
:
''
,
component
:
MediaList
,
name
:
'
admin.media.media.index
'
name
:
'
admin.media.media.index
'
,
},
{
path
:
'
:mediaId/edit
'
,
...
...
@@ -20,8 +20,8 @@ export default [
name
:
'
admin.media.media.edit
'
,
props
:
{
locales
,
}
}
,
},
]
}
]
,
}
,
];
Modules/Media/Assets/js/components/MediaForm.vue
View file @
bfd7c30e
...
...
@@ -64,7 +64,7 @@
</div>
<div
class=
"col-md-4"
>
<img
:src=
"media.path"
alt=
""
v-if=
"media.is_image"
style=
"width: 100%;"
/>
<i
class=
"fa fa-file"
style=
"font-size: 50px;"
v-else
=
""
></i>
<i
class=
"fa fa-file"
style=
"font-size: 50px;"
v-else
></i>
</div>
</div>
</el-form>
...
...
@@ -84,12 +84,12 @@
</
template
>
<
script
>
import
Form
from
'
form-backend-validation
'
import
axios
from
'
axios
'
import
Form
from
'
form-backend-validation
'
;
import
axios
from
'
axios
'
;
export
default
{
props
:
{
locales
:
{
default
:
null
},
locales
:
{
default
:
null
},
},
data
()
{
return
{
...
...
@@ -101,62 +101,60 @@
keywords
:
''
,
}])
.
fromPairs
()
//.merge({template: 'default', is_home: 0, medias_single: []})
//
.merge({template: 'default', is_home: 0, medias_single: []})
.
value
(),
form
:
new
Form
(),
loading
:
false
,
tags
:
{},
activeTab
:
window
.
AsgardCMS
.
currentLocale
||
'
en
'
,
}
}
;
},
methods
:
{
fetchMedia
()
{
this
.
loading
=
true
;
axios
.
get
(
route
(
'
api.media.media.find
'
,
{
media
:
this
.
$route
.
params
.
mediaId
}))
.
then
(
response
=>
{
axios
.
get
(
route
(
'
api.media.media.find
'
,
{
media
:
this
.
$route
.
params
.
mediaId
}))
.
then
(
(
response
)
=>
{
this
.
loading
=
false
;
this
.
media
=
response
.
data
.
data
;
this
.
tags
=
response
.
data
.
data
.
tags
;
})
.
catch
(
error
=>
{
})
});
},
onSubmit
()
{
this
.
form
=
new
Form
(
_
.
merge
(
this
.
media
,
{
tags
:
this
.
tags
}));
this
.
form
=
new
Form
(
_
.
merge
(
this
.
media
,
{
tags
:
this
.
tags
}));
this
.
loading
=
true
;
this
.
form
.
put
(
route
(
'
api.media.media.update
'
,
{
file
:
this
.
media
.
id
}))
.
then
(
response
=>
{
this
.
form
.
put
(
route
(
'
api.media.media.update
'
,
{
file
:
this
.
media
.
id
}))
.
then
(
(
response
)
=>
{
this
.
loading
=
false
;
this
.
$message
({
type
:
'
success
'
,
message
:
response
.
message
message
:
response
.
message
,
});
this
.
$router
.
push
({
name
:
'
admin.media.media.index
'
,
query
:
{
folder_id
:
this
.
media
.
folder_id
}})
this
.
$router
.
push
({
name
:
'
admin.media.media.index
'
,
query
:
{
folder_id
:
this
.
media
.
folder_id
}
});
})
.
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
()
{
if
(
this
.
media
.
folder_id
==
0
)
{
this
.
$router
.
push
({
name
:
'
admin.media.media.index
'
,
query
:
{}
});
this
.
$router
.
push
({
name
:
'
admin.media.media.index
'
,
query
:
{}
});
return
;
}
this
.
$router
.
push
({
name
:
'
admin.media.media.index
'
,
query
:
{
folder_id
:
this
.
media
.
folder_id
}})
this
.
$router
.
push
({
name
:
'
admin.media.media.index
'
,
query
:
{
folder_id
:
this
.
media
.
folder_id
}
});
},
},
mounted
()
{
if
(
this
.
$route
.
params
.
mediaId
!==
undefined
)
{
this
.
fetchMedia
();
}
}
}
}
,
}
;
</
script
>
<
style
>
.el-select
{
...
...
Modules/Media/Assets/js/components/MediaList.vue
View file @
bfd7c30e
...
...
@@ -27,7 +27,7 @@
<el-button
type=
"primary"
:disabled=
"selectedMedia.length === 0"
>
Move
</el-button>
</el-button-group>
<el-button
type=
"danger"
:disabled=
"selectedMedia.length === 0"
@
click
.
preent=
"batchDelete"
:loading=
"filesAreDeleting"
>
@
click
.
pre
v
ent=
"batchDelete"
:loading=
"filesAreDeleting"
>
Delete
</el-button>
</div>
...
...
@@ -128,7 +128,7 @@
</template>
<
script
>
import
axios
from
'
axios
'
import
axios
from
'
axios
'
;
import
NewFolder
from
'
./NewFolder.vue
'
;
import
UploadButton
from
'
./UploadButton.vue
'
;
import
RenameFolder
from
'
./RenameFolder.vue
'
;
...
...
@@ -140,7 +140,7 @@
'
rename-folder
'
:
RenameFolder
,
},
props
:
{
singleModal
:
{
type
:
Boolean
},
singleModal
:
{
type
:
Boolean
},
eventName
:
{},
},
data
()
{
...
...
@@ -160,15 +160,15 @@
folderId
:
0
,
selectedMedia
:
{},
folderBreadcrumb
:
[
{
id
:
0
,
name
:
'
Home
'
},
{
id
:
0
,
name
:
'
Home
'
},
],
filesAreDeleting
:
false
,
canEditFolders
:
true
,
}
}
;
},
methods
:
{
queryServer
(
customProperties
)
{
le
t
properties
=
{
cons
t
properties
=
{
page
:
this
.
meta
.
current_page
,
per_page
:
this
.
meta
.
per_page
,
order_by
:
this
.
order_meta
.
order_by
,
...
...
@@ -178,7 +178,7 @@
};
axios
.
get
(
route
(
'
api.media.all-vue
'
,
_
.
merge
(
properties
,
customProperties
)))
.
then
(
response
=>
{
.
then
(
(
response
)
=>
{
this
.
tableIsLoading
=
false
;
this
.
data
=
response
.
data
.
data
;
this
.
meta
=
response
.
data
.
meta
;
...
...
@@ -191,7 +191,7 @@
fetchMediaData
()
{
this
.
tableIsLoading
=
true
;
if
(
this
.
$route
.
query
.
folder_id
!==
undefined
)
{
this
.
queryServer
({
folder_id
:
this
.
$route
.
query
.
folder_id
});
this
.
queryServer
({
folder_id
:
this
.
$route
.
query
.
folder_id
});
this
.
fetchFolderBreadcrumb
(
this
.
$route
.
query
.
folder_id
);
return
;
}
...
...
@@ -200,40 +200,40 @@
fetchFolderBreadcrumb
(
folderId
)
{
if
(
folderId
===
0
)
{
this
.
folderBreadcrumb
=
[
{
id
:
0
,
name
:
'
Home
'
},
{
id
:
0
,
name
:
'
Home
'
},
];
return
;
}
axios
.
get
(
route
(
'
api.media.folders.breadcrumb
'
,
{
folder
:
folderId
}))
.
then
(
response
=>
{
axios
.
get
(
route
(
'
api.media.folders.breadcrumb
'
,
{
folder
:
folderId
}))
.
then
(
(
response
)
=>
{
this
.
folderBreadcrumb
=
response
.
data
;
});
},
handleSizeChange
(
event
)
{
console
.
log
(
'
per page :
'
+
event
);
console
.
log
(
`per page :
${
event
}
`
);
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
per_page
:
event
});
this
.
queryServer
({
per_page
:
event
});
},
handleCurrentChange
(
event
)
{
console
.
log
(
'
current page :
'
+
event
);
console
.
log
(
`current page :
${
event
}
`
);
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
page
:
event
});
this
.
queryServer
({
page
:
event
});
},
handleSortChange
(
event
)
{
console
.
log
(
'
sorting
'
,
event
);
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
order_by
:
event
.
prop
,
order
:
event
.
order
,
});
this
.
queryServer
({
order_by
:
event
.
prop
,
order
:
event
.
order
});
},
performSearch
(
query
)
{
console
.
log
(
'
searching:
'
+
query
);
console
.
log
(
`searching:
${
query
}
`
);
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
search
:
query
});
this
.
queryServer
({
search
:
query
});
},
enterFolder
(
scope
)
{
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
folder_id
:
scope
.
row
.
id
});
this
.
queryServer
({
folder_id
:
scope
.
row
.
id
});
this
.
folderId
=
scope
.
row
.
id
;
this
.
$router
.
push
({
query
:
{
folder_id
:
scope
.
row
.
id
}});
this
.
$router
.
push
({
query
:
{
folder_id
:
scope
.
row
.
id
}
});
this
.
fetchFolderBreadcrumb
(
scope
.
row
.
id
);
},
insertMedia
(
scope
)
{
...
...
@@ -245,14 +245,14 @@
showEditFolder
(
scope
)
{
this
.
$events
.
emit
(
'
editFolderWasClicked
'
,
scope
);
},
changeRoot
(
folderId
,
index
)
{
changeRoot
(
folderId
)
{
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
folder_id
:
folderId
});
this
.
queryServer
({
folder_id
:
folderId
});
this
.
folderId
=
folderId
;
if
(
folderId
===
0
)
{
this
.
$router
.
push
({
query
:
{}});
this
.
$router
.
push
({
query
:
{}
});
}
else
{
this
.
$router
.
push
({
query
:
{
folder_id
:
folderId
}});
this
.
$router
.
push
({
query
:
{
folder_id
:
folderId
}
});
}
this
.
fetchFolderBreadcrumb
(
folderId
);
...
...
@@ -261,17 +261,17 @@
this
.
$confirm
(
this
.
trans
(
'
core.modal.confirmation-message
'
),
this
.
trans
(
'
core.modal.title
'
),
{
confirmButtonText
:
this
.
trans
(
'
core.button.delete
'
),
cancelButtonText
:
this
.
trans
(
'
core.button.cancel
'
),
type
:
'
warning
'
type
:
'
warning
'
,
})
.
then
(()
=>
{
this
.
filesAreDeleting
=
true
;
axios
.
post
(
route
(
'
api.media.media.batch-destroy
'
),
{
files
:
this
.
selectedMedia
files
:
this
.
selectedMedia
,
})
.
then
(
response
=>
{
.
then
(
(
response
)
=>
{
this
.
$message
({
type
:
'
success
'
,
message
:
response
.
data
.
message
message
:
response
.
data
.
message
,
});
this
.
filesAreDeleting
=
false
;
this
.
$refs
.
mediaTable
.
clearSelection
();
...
...
@@ -281,12 +281,12 @@
.
catch
(()
=>
{
this
.
$message
({
type
:
'
info
'
,
message
:
this
.
trans
(
'
core.delete cancelled
'
)
message
:
this
.
trans
(
'
core.delete cancelled
'
)
,
});
});
},
goToEdit
(
scope
)
{
this
.
$router
.
push
({
name
:
'
admin.media.media.edit
'
,
params
:
{
mediaId
:
scope
.
row
.
id
}})
this
.
$router
.
push
({
name
:
'
admin.media.media.edit
'
,
params
:
{
mediaId
:
scope
.
row
.
id
}
});
},
},
mounted
()
{
...
...
@@ -295,18 +295,18 @@
}
this
.
selectedMedia
.
length
=
0
;
this
.
fetchMediaData
();
this
.
$events
.
listen
(
'
fileWasUploaded
'
,
eventData
=>
{
this
.
$events
.
listen
(
'
fileWasUploaded
'
,
(
eventData
)
=>
{
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
folder_id
:
eventData
.
data
.
folder_id
});
this
.
queryServer
({
folder_id
:
eventData
.
data
.
folder_id
});
});
this
.
$events
.
listen
(
'
folderWasCreated
'
,
eventData
=>
{
this
.
$events
.
listen
(
'
folderWasCreated
'
,
(
eventData
)
=>
{
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
folder_id
:
eventData
.
data
.
folder_id
});
this
.
queryServer
({
folder_id
:
eventData
.
data
.
folder_id
});
});
this
.
$events
.
listen
(
'
folderWasUpdated
'
,
eventData
=>
{
this
.
$events
.
listen
(
'
folderWasUpdated
'
,
(
eventData
)
=>
{
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
folder_id
:
eventData
.
data
.
folder_id
});
this
.
queryServer
({
folder_id
:
eventData
.
data
.
folder_id
});
});
}
}
}
,
}
;
</
script
>
Modules/Media/Assets/js/components/MediaManager.vue
View file @
bfd7c30e
...
...
@@ -7,9 +7,9 @@
<
script
>
export
default
{
data
()
{
return
{}
return
{}
;
},
methods
:
{},
mounted
()
{}
}
mounted
()
{}
,
}
;
</
script
>
Modules/Media/Assets/js/components/NewFolder.vue
View file @
bfd7c30e
...
...
@@ -22,11 +22,11 @@
</
template
>
<
script
>
import
Form
from
'
form-backend-validation
'
import
Form
from
'
form-backend-validation
'
;
export
default
{
props
:
{
parentId
:
{
type
:
Number
}
parentId
:
{
type
:
Number
},
},
data
()
{
return
{
...
...
@@ -36,29 +36,29 @@
},
form
:
new
Form
(),
loading
:
false
,
}
}
;
},
methods
:
{
onSubmit
()
{
this
.
form
=
new
Form
(
_
.
merge
(
this
.
folder
,
{
parent_id
:
this
.
parentId
}));
this
.
form
=
new
Form
(
_
.
merge
(
this
.
folder
,
{
parent_id
:
this
.
parentId
}));
this
.
loading
=
true
;
this
.
form
.
post
(
route
(
'
api.media.folders.store
'
))
.
then
(
response
=>
{
.
then
(
(
response
)
=>
{
this
.
loading
=
false
;
this
.
$message
({
type
:
'
success
'
,
message
:
response
.
message
message
:
response
.
message
,
});
this
.
dialogFormVisible
=
false
;
this
.
folder
.
name
=
''
;
this
.
$events
.
emit
(
'
folderWasCreated
'
,
response
);
})
.
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.
'
,
});
});
},
...
...
@@ -68,8 +68,8 @@
},
},
mounted
()
{
}
}
}
,
}
;
</
script
>
<
style
>
.new-folder
{
...
...
Modules/Media/Assets/js/components/RenameFolder.vue
View file @
bfd7c30e
...
...
@@ -17,7 +17,7 @@
</
template
>
<
script
>
import
Form
from
'
form-backend-validation
'
import
Form
from
'
form-backend-validation
'
;
export
default
{
// props: {
...
...
@@ -33,28 +33,28 @@
},
form
:
new
Form
(),
loading
:
false
,
}
}
;
},
methods
:
{
onSubmit
()
{
this
.
form
=
new
Form
(
this
.
folder
);
this
.
loading
=
true
;
this
.
form
.
post
(
route
(
'
api.media.folders.update
'
,
{
folder
:
this
.
folder
.
id
}))
.
then
(
response
=>
{
this
.
form
.
post
(
route
(
'
api.media.folders.update
'
,
{
folder
:
this
.
folder
.
id
}))
.
then
(
(
response
)
=>
{
this
.
loading
=
false
;
this
.
$message
({
type
:
'
success
'
,
message
:
response
.
message
message
:
response
.
message
,
});
this
.
dialogFormVisible
=
false
;
this
.
$events
.
emit
(
'
folderWasUpdated
'
,
response
);
})
.
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.
'
,
});
});
},
...
...
@@ -64,12 +64,12 @@
},
},
mounted
()
{
this
.
$events
.
listen
(
'
editFolderWasClicked
'
,
eventData
=>
{
this
.
$events
.
listen
(
'
editFolderWasClicked
'
,
(
eventData
)
=>
{
this
.
folder
.
name
=
eventData
.
filename
;
this
.
folder
.
id
=
eventData
.
id
;
this
.
folder
.
parent_id
=
eventData
.
folder_id
;
this
.
dialogFormVisible
=
true
;
});
}
}
}
,
}
;
</
script
>
Modules/Media/Assets/js/components/SingleMedia.vue
View file @
bfd7c30e
...
...
@@ -29,18 +29,18 @@
</
template
>
<
script
>
import
axios
from
'
axios
'
;
import
UploadZone
from
'
./UploadZone.vue
'
;
import
MediaList
from
'
./MediaList.vue
'
;
import
StringHelpers
from
'
../../../../Core/Assets/js/mixins/StringHelpers
'
import
axios
from
'
axios
'
import
StringHelpers
from
'
../../../../Core/Assets/js/mixins/StringHelpers.vue
'
;
export
default
{
mixins
:
[
StringHelpers
],
props
:
{
zone
:
{
type
:
String
,
required
:
true
},
entity
:
{
type
:
String
,
required
:
true
},
entityId
:
{
type
:
Number
},
label
:
{
type
:
String
},
zone
:
{
type
:
String
,
required
:
true
},
entity
:
{
type
:
String
,
required
:
true
},
entityId
:
{
type
:
Number
},
label
:
{
type
:
String
},
},
components
:
{
'
upload-zone
'
:
UploadZone
,
...
...
@@ -58,11 +58,11 @@
dialogVisible
:
false
,
selectedMedia
:
{},
eventName
:
''
,
}
}
;
},
computed
:
{
hasSelectedMedia
()
{
return
!
_
.
isEmpty
(
this
.
selectedMedia
);
return
!
_
.
isEmpty
(
this
.
selectedMedia
);
},
},
methods
:
{
...
...
@@ -71,7 +71,7 @@
},
unSelectMedia
()
{
this
.
selectedMedia
=
{};
this
.
$emit
(
'
singleFileSelected
'
,
_
.
merge
({
id
:
null
},
{
zone
:
this
.
zone
}));
this
.
$emit
(
'
singleFileSelected
'
,
_
.
merge
({
id
:
null
},
{
zone
:
this
.
zone
}));
},
fetchMedia
()
{
axios
.
get
(
route
(
'
api.media.find-first-by-zone-and-entity
'
,
{
...
...
@@ -79,32 +79,31 @@
entity
:
this
.
entity
,
entity_id
:
this
.
entityId
,
}))
.
then
(
response
=>
{
this
.
$emit
(
'
singleFileSelected
'
,
_
.
merge
(
response
.
data
.
data
,
{
zone
:
this
.
zone
}));
.
then
(
(
response
)
=>
{
this
.
$emit
(
'
singleFileSelected
'
,
_
.
merge
(
response
.
data
.
data
,
{
zone
:
this
.
zone
}));
this
.
selectedMedia
=
response
.
data
.
data
;
})
})
;
},
getFieldLabel
()
{
return
this
.
label
||
this
.
ucwords
(
this
.
zone
.
replace
(
'
_
'
,
'
'
));
},
makeId
()
{
let
text
=
""
;
let
possible
=
"
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
"
;
let
text
=
''
;
const
possible
=
'
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
'
;
for
(
let
i
=
0
;
i
<
5
;
i
++
)
text
+=
possible
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
possible
.
length
));
for
(
let
i
=
0
;
i
<
5
;
i
++
)
{
text
+=
possible
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
possible
.
length
));
}
return
text
;
},
},
mounted
()
{
this
.
eventName
=
'
fileWasSelected
'
+
this
.
makeId
()
+
Math
.
floor
(
Math
.
random
()
*
999999
)
;
this
.
eventName
=
`fileWasSelected
${
this
.
makeId
()}${
Math
.
floor
(
Math
.
random
()
*
999999
)}
`
;
this
.
$events
.
listen
(
this
.
eventName
,
mediaData
=>
{
this
.
$events
.
listen
(
this
.
eventName
,
(
mediaData
)
=>
{
this
.
dialogVisible
=
false
;
this
.
selectedMedia
=
mediaData
;
this
.
$emit
(
'
singleFileSelected
'
,
_
.
merge
(
mediaData
,
{
zone
:
this
.
zone
}));
this
.
$emit
(
'
singleFileSelected
'
,
_
.
merge
(
mediaData
,
{
zone
:
this
.
zone
}));
});
}
}
}
,
}
;
</
script
>
Modules/Media/Assets/js/components/UploadButton.vue
View file @
bfd7c30e
...
...
@@ -13,56 +13,56 @@
</
template
>
<
script
>
import
axios
from
'
axios
'
import
axios
from
'
axios
'
;
export
default
{
props
:
{
parentId
:
{
type
:
Number
}
parentId
:
{
type
:
Number
},
},
data
()
{
return
{
fileIsUploading
:
false
,
}
}
;
},
computed
:
{
uploadUrl
()
{
return
route
(
'
api.media.store
'
).
domain
+
route
(
'
api.media.store
'
).
url
;
},
requestHeaders
()
{
le
t
userApiToken
=
document
.
head
.
querySelector
(
'
meta[name="user-api-token"]
'
);
cons
t
userApiToken
=
document
.
head
.
querySelector
(
'
meta[name="user-api-token"]
'
);
return
{
'
Authorization
'
:
'
Bearer
'
+
userApiToken
.
content
Authorization
:
`Bearer
${
userApiToken
.
content
}
`
,
};
},
},
methods
:
{
handleSuccess
(
response
,
file
,
fileList
)
{
handleSuccess
(
response
)
{
this
.
$events
.
emit
(
'
fileWasUploaded
'
,
response
);
},
uploadFile
(
event
)
{
this
.
fileIsUploading
=
true
;
le
t
data
=
new
FormData
();
cons
t
data
=
new
FormData
();
data
.
append
(
'
parent_id
'
,
this
.
parentId
);
data
.
append
(
'
file
'
,
event
.
file
);
axios
.
post
(
route
(
'
api.media.store
'
),
data
)
.
then
(
response
=>
{
.
then
(
(
response
)
=>
{
this
.
$events
.
emit
(
'
fileWasUploaded
'
,
response
);
this
.
fileIsUploading
=
false
;
})
.
catch
(
error
=>
{
.
catch
(
(
error
)
=>
{
console
.
log
(
error
.
response
.
data
);
this
.
fileIsUploading
=
false
;
this
.
$notify
.
error
({
title
:
'
Error
'
,
message
:
error
.
response
.
data
.
errors
.
file
[
0
]
message
:
error
.
response
.
data
.
errors
.
file
[
0
]
,
});
});
},
handleRemove
()
{},
},
mounted
()
{
}
}
}
,
}
;
</
script
>
<
style
>
.el-upload__input
{
...
...
Modules/Media/Assets/js/components/UploadZone.vue
View file @
bfd7c30e
...
...
@@ -23,29 +23,29 @@
data
()
{
return
{
fileList
:
[],
}
}
;
},
computed
:
{
uploadUrl
()
{
return
route
(
'
api.media.store
'
).
domain
+
route
(
'
api.media.store
'
).
url
;
},
requestHeaders
()
{
le
t
userApiToken
=
document
.
head
.
querySelector
(
'
meta[name="user-api-token"]
'
);
cons
t
userApiToken
=
document
.
head
.
querySelector
(
'
meta[name="user-api-token"]
'
);
return
{
'
Authorization
'
:
'
Bearer
'
+
userApiToken
.
content
Authorization
:
`Bearer
${
userApiToken
.
content
}
`
,
};
},
},
methods
:
{
handleSuccess
(
response
,
file
,
fileList
)
{
handleSuccess
(
response
)
{
this
.
$events
.
emit
(
'
fileWasUploaded
'
,
response
);
this
.
fileList
=
[];
},
handlePreview
()
{},
handleRemove
()
{},
},
mounted
()
{}
}
mounted
()
{}
,
}
;
</
script
>
<
style
>
.el-upload__input
{
...
...
Modules/Page/Assets/js/PageRoutes.js
View file @
bfd7c30e
import
PageTable
from
'
./components/PageTable.vue
'
import
PageTableServerSide
from
'
./components/PageTableServerSide.vue
'
import
PageForm
from
'
./components/PageForm.vue
'
import
PageTable
from
'
./components/PageTable.vue
'
;
import
PageTableServerSide
from
'
./components/PageTableServerSide.vue
'
;
import
PageForm
from
'
./components/PageForm.vue
'
;
const
locales
=
window
.
AsgardCMS
.
locales
;
...
...
@@ -17,7 +17,7 @@ export default [
props
:
{
locales
,
pageTitle
:
'
create page
'
,
}
}
,
},
{
path
:
'
/page/pages/:pageId/edit
'
,
...
...
@@ -26,6 +26,6 @@ export default [
props
:
{
locales
,
pageTitle
:
'
edit page
'
,
}
}
,
},
];
Modules/Page/Assets/js/components/PageTableServerSide.vue
View file @
bfd7c30e
...
...
@@ -105,9 +105,9 @@
</template>
<
script
>
import
axios
from
'
axios
'
import
_
from
"
lodash
"
;
import
ShortcutHelper
from
'
../../../../Core/Assets/js/mixins/ShortcutHelper
'
import
axios
from
'
axios
'
;
import
_
from
'
lodash
'
;
import
ShortcutHelper
from
'
../../../../Core/Assets/js/mixins/ShortcutHelper
'
;
let
data
;
...
...
@@ -129,16 +129,16 @@
tableIsLoading
:
false
,
showExtraButtons
:
false
,
selectedPages
:
{},
}
}
;
},
watch
:
{
selectedPages
()
{
this
.
selectedPages
.
length
>=
1
?
this
.
showExtraButtons
=
true
:
this
.
showExtraButtons
=
false
;
}
}
,
},
methods
:
{
queryServer
(
customProperties
)
{
le
t
properties
=
{
cons
t
properties
=
{
page
:
this
.
meta
.
current_page
,
per_page
:
this
.
meta
.
per_page
,
order_by
:
this
.
order_meta
.
order_by
,
...
...
@@ -147,7 +147,7 @@
};
axios
.
get
(
route
(
'
api.page.page.indexServerSide
'
,
_
.
merge
(
properties
,
customProperties
)))
.
then
(
response
=>
{
.
then
(
(
response
)
=>
{
this
.
tableIsLoading
=
false
;
this
.
data
=
response
.
data
.
data
;
this
.
meta
=
response
.
data
.
meta
;
...
...
@@ -162,58 +162,56 @@
this
.
queryServer
();
},
handleSizeChange
(
event
)
{
console
.
log
(
'
per page :
'
+
event
);
console
.
log
(
`per page :
${
event
}
`
);
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
per_page
:
event
});
this
.
queryServer
({
per_page
:
event
});
},
handleCurrentChange
(
event
)
{
console
.
log
(
'
current page :
'
+
event
);
console
.
log
(
`current page :
${
event
}
`
);
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
page
:
event
});
this
.
queryServer
({
page
:
event
});
},
handleSortChange
(
event
)
{
console
.
log
(
'
sorting
'
,
event
);
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
order_by
:
event
.
prop
,
order
:
event
.
order
,
});
this
.
queryServer
({
order_by
:
event
.
prop
,
order
:
event
.
order
});
},
performSearch
(
query
)
{
console
.
log
(
'
searching:
'
+
query
);
console
.
log
(
`searching:
${
query
}
`
);
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
search
:
query
});
this
.
queryServer
({
search
:
query
});
},
handleExtraActions
(
action
)
{
let
pageIds
=
_
.
map
(
this
.
selectedPages
,
function
(
elem
)
{
return
elem
.
id
;
});
axios
.
get
(
route
(
'
api.page.page.mark-status
'
,
{
action
:
action
,
pageIds
:
JSON
.
stringify
(
pageIds
)}))
.
then
(
response
=>
{
const
pageIds
=
_
.
map
(
this
.
selectedPages
,
elem
=>
elem
.
id
);
axios
.
get
(
route
(
'
api.page.page.mark-status
'
,
{
action
,
pageIds
:
JSON
.
stringify
(
pageIds
)
}))
.
then
((
response
)
=>
{
this
.
$message
({
type
:
'
success
'
,
message
:
response
.
data
.
message
message
:
response
.
data
.
message
,
});
this
.
$refs
.
pageTable
.
clearSelection
();
this
.
data
.
find
(
function
(
page
)
{
this
.
data
.
find
(
(
page
)
=>
{
if
(
pageIds
.
indexOf
(
page
.
id
)
>=
0
)
{
page
.
translations
.
status
=
action
===
'
mark-online
'
;
}
});
})
.
catch
(
error
=>
{
.
catch
(
()
=>
{
this
.
$message
({
type
:
'
error
'
,
message
:
this
.
trans
(
'
core.something went wrong
'
),
});
})
})
;
},
handleSelectionChange
(
selectedPages
)
{
this
.
selectedPages
=
selectedPages
;
},
goToEdit
(
scope
)
{
this
.
$router
.
push
({
name
:
'
admin.page.page.edit
'
,
params
:
{
pageId
:
scope
.
row
.
id
}})
this
.
$router
.
push
({
name
:
'
admin.page.page.edit
'
,
params
:
{
pageId
:
scope
.
row
.
id
}
});
},
},
mounted
()
{
this
.
fetchData
();
}
}
}
,
}
;
</
script
>
Themes/Adminlte/resources/assets/js/asgardcms.js
View file @
bfd7c30e
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,17 +25,18 @@ Vue.component('DeleteButton', require('../../../../../Modules/Core/Assets/js/com
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
:
[
routes
:
[
...
PageRoutes
,
...
MediaRoutes
,
],
...
...
@@ -47,7 +49,7 @@ function makeBaseUrl() {
return
`
${
currentLocale
}
/
${
adminPrefix
}
`
;
}
le
t
messages
=
{
cons
t
messages
=
{
[
currentLocale
]:
window
.
AsgardCMS
.
translations
,
};
...
...
@@ -62,7 +64,7 @@ const app = new Vue({
i18n
,
});
window
.
axios
.
interceptors
.
response
.
use
(
null
,
function
(
error
)
{
window
.
axios
.
interceptors
.
response
.
use
(
null
,
(
error
)
=>
{
if
(
error
.
response
===
undefined
)
{
console
.
log
(
error
);
return
;
...
...
Themes/Adminlte/resources/assets/js/mixins.js
View file @
bfd7c30e
import
Vue
from
'
vue
'
import
Vue
from
'
vue
'
;
import
TranslationHelper
from
'
../../../../../Modules/Core/Assets/js/mixins/TranslationHelper
'
;
Vue
.
mixin
(
TranslationHelper
);
public/js/app.js
View file @
bfd7c30e
This diff is collapsed.
Click to expand it.
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