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
3b24b87a
Unverified
Commit
3b24b87a
authored
Sep 26, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removing upload zone on modal to insert.
Generate a random event name to trigger & listen to.
parent
b96f9290
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
SingleMedia.vue
Modules/Media/Assets/js/components/SingleMedia.vue
+17
-5
No files found.
Modules/Media/Assets/js/components/SingleMedia.vue
View file @
3b24b87a
...
...
@@ -15,13 +15,11 @@
</div>
<el-dialog
:title=
"trans('media.upload file')"
:visible
.
sync=
"dialogVisible"
size=
"full"
:before-close=
"handleClose"
>
<upload-zone></upload-zone>
<media-list
single-modal
></media-list>
<media-list
single-modal
:event-name=
"this.eventName"
></media-list>
<span
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"dialogVisible = false"
>
{{
trans
(
'
core.button.cancel
'
)
}}
</el-button>
...
...
@@ -59,6 +57,7 @@
return
{
dialogVisible
:
false
,
selectedMedia
:
{},
eventName
:
''
,
}
},
computed
:
{
...
...
@@ -71,7 +70,8 @@
done
();
},
unSelectMedia
()
{
this
.
selectedMedia
=
{}
this
.
selectedMedia
=
{};
this
.
$emit
(
'
singleFileSelected
'
,
_
.
merge
({
id
:
null
},
{
zone
:
this
.
zone
}));
},
fetchMedia
()
{
axios
.
get
(
route
(
'
api.media.find-first-by-zone-and-entity
'
,
{
...
...
@@ -80,15 +80,27 @@
entity_id
:
this
.
entityId
,
}))
.
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
"
;
for
(
let
i
=
0
;
i
<
5
;
i
++
)
text
+=
possible
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
possible
.
length
));
return
text
;
},
},
mounted
()
{
this
.
$events
.
listen
(
'
fileWasSelected
'
,
mediaData
=>
{
this
.
eventName
=
'
fileWasSelected
'
+
this
.
makeId
()
+
Math
.
floor
(
Math
.
random
()
*
999999
);
this
.
$events
.
listen
(
this
.
eventName
,
mediaData
=>
{
this
.
dialogVisible
=
false
;
this
.
selectedMedia
=
mediaData
;
this
.
$emit
(
'
singleFileSelected
'
,
_
.
merge
(
mediaData
,
{
zone
:
this
.
zone
}));
...
...
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