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
daaedb38
Unverified
Commit
daaedb38
authored
Sep 22, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sending parent id from vuejs to laravel to enable renaming child folders
parent
f2a33802
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
12 deletions
+25
-12
MediaList.vue
Modules/Media/Assets/js/components/MediaList.vue
+13
-3
RenameFolder.vue
Modules/Media/Assets/js/components/RenameFolder.vue
+10
-9
EloquentFolderRepository.php
.../Media/Repositories/Eloquent/EloquentFolderRepository.php
+1
-0
MediaTransformer.php
Modules/Media/Transformers/MediaTransformer.php
+1
-0
No files found.
Modules/Media/Assets/js/components/MediaList.vue
View file @
daaedb38
...
@@ -73,10 +73,13 @@
...
@@ -73,10 +73,13 @@
v-if=
"singleModal"
>
v-if=
"singleModal"
>
{{
trans
(
'
media.insert
'
)
}}
{{
trans
(
'
media.insert
'
)
}}
</a>
</a>
<a
class=
"btn btn-default btn-flat"
:href=
"getEditMediaUrl
(scope)"
<a
class=
"btn btn-default btn-flat"
@
click
.
prevent=
"loadEditForm
(scope)"
v-if=
"! singleModal && ! scope.row.is_folder"
><i
class=
"fa fa-pencil"
></i></a>
v-if=
"! singleModal && ! scope.row.is_folder"
><i
class=
"fa fa-pencil"
></i></a>
<rename-folder
:current-folder=
"scope.row"
v-if=
"! singleModal && scope.row.is_folder"
>
</rename-folder>
<a
@
click
.
prevent=
"showEditFolder(scope.row)"
class=
"btn btn-default btn-flat"
v-if=
"! singleModal && scope.row.is_folder"
>
<i
class=
"fa fa-pencil"
></i>
</a>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -95,6 +98,7 @@
...
@@ -95,6 +98,7 @@
</div>
</div>
</div>
</div>
</div>
</div>
<rename-folder></rename-folder>
</div>
</div>
</template>
</template>
...
@@ -195,6 +199,12 @@
...
@@ -195,6 +199,12 @@
getEditMediaUrl
(
scope
)
{
getEditMediaUrl
(
scope
)
{
return
route
(
'
admin.media.media.edit
'
,
{
media
:
scope
.
row
.
id
});
return
route
(
'
admin.media.media.edit
'
,
{
media
:
scope
.
row
.
id
});
},
},
loadEditForm
(
scope
)
{
this
.
$events
.
emit
(
'
editMediaWasClicked
'
,
scope
.
row
);
},
showEditFolder
(
scope
)
{
this
.
$events
.
emit
(
'
editFolderWasClicked
'
,
scope
);
},
changeRoot
(
folderId
,
index
)
{
changeRoot
(
folderId
,
index
)
{
this
.
tableIsLoading
=
true
;
this
.
tableIsLoading
=
true
;
this
.
queryServer
({
folder_id
:
folderId
});
this
.
queryServer
({
folder_id
:
folderId
});
...
...
Modules/Media/Assets/js/components/RenameFolder.vue
View file @
daaedb38
<
template
>
<
template
>
<div>
<div>
<a
@
click
.
prevent=
"dialogFormVisible = true"
class=
"btn btn-default btn-flat"
>
<i
class=
"fa fa-pencil"
></i>
</a>
<el-dialog
title=
"Rename Folder"
:visible
.
sync=
"dialogFormVisible"
size=
"tiny"
>
<el-dialog
title=
"Rename Folder"
:visible
.
sync=
"dialogFormVisible"
size=
"tiny"
>
<el-form
:model=
"folder"
v-loading
.
body=
"loading"
@
submit
.
native
.
prevent=
"onSubmit()"
>
<el-form
:model=
"folder"
v-loading
.
body=
"loading"
@
submit
.
native
.
prevent=
"onSubmit()"
>
<el-form-item
label=
"Folder name"
:class=
"
{'el-form-item is-error': form.errors.has('name') }">
<el-form-item
label=
"Folder name"
:class=
"
{'el-form-item is-error': form.errors.has('name') }">
...
@@ -24,15 +20,16 @@
...
@@ -24,15 +20,16 @@
import
Form
from
'
form-backend-validation
'
import
Form
from
'
form-backend-validation
'
export
default
{
export
default
{
props
:
{
//
props: {
currentFolder
:
{
type
:
Object
}
//
currentFolder: {type: Object}
},
//
},
data
()
{
data
()
{
return
{
return
{
dialogFormVisible
:
false
,
dialogFormVisible
:
false
,
folder
:
{
folder
:
{
name
:
''
,
name
:
''
,
id
:
''
,
id
:
''
,
parent_id
:
''
,
},
},
form
:
new
Form
(),
form
:
new
Form
(),
loading
:
false
,
loading
:
false
,
...
@@ -67,8 +64,12 @@
...
@@ -67,8 +64,12 @@
},
},
},
},
mounted
()
{
mounted
()
{
this
.
folder
.
name
=
this
.
currentFolder
.
filename
;
this
.
$events
.
listen
(
'
editFolderWasClicked
'
,
eventData
=>
{
this
.
folder
.
id
=
this
.
currentFolder
.
id
;
this
.
folder
.
name
=
eventData
.
filename
;
this
.
folder
.
id
=
eventData
.
id
;
this
.
folder
.
parent_id
=
eventData
.
folder_id
;
this
.
dialogFormVisible
=
true
;
});
}
}
}
}
</
script
>
</
script
>
Modules/Media/Repositories/Eloquent/EloquentFolderRepository.php
View file @
daaedb38
...
@@ -47,6 +47,7 @@ class EloquentFolderRepository extends EloquentBaseRepository implements FolderR
...
@@ -47,6 +47,7 @@ class EloquentFolderRepository extends EloquentBaseRepository implements FolderR
$formattedData
=
[
$formattedData
=
[
'filename'
=>
array_get
(
$data
,
'name'
),
'filename'
=>
array_get
(
$data
,
'name'
),
'path'
=>
$this
->
getPath
(
$data
),
'path'
=>
$this
->
getPath
(
$data
),
'parent_id'
=>
array_get
(
$data
,
'parent_id'
),
];
];
event
(
$event
=
new
FolderIsUpdating
(
$formattedData
));
event
(
$event
=
new
FolderIsUpdating
(
$formattedData
));
...
...
Modules/Media/Transformers/MediaTransformer.php
View file @
daaedb38
...
@@ -31,6 +31,7 @@ class MediaTransformer extends Resource
...
@@ -31,6 +31,7 @@ class MediaTransformer extends Resource
'media_type'
=>
$this
->
media_type
,
'media_type'
=>
$this
->
media_type
,
'fa_icon'
=>
FileHelper
::
getFaIcon
(
$this
->
media_type
),
'fa_icon'
=>
FileHelper
::
getFaIcon
(
$this
->
media_type
),
'created_at'
=>
$this
->
created_at
,
'created_at'
=>
$this
->
created_at
,
'folder_id'
=>
$this
->
folder_id
,
'small_thumb'
=>
$this
->
imagy
->
getThumbnail
(
$this
->
path
,
'smallThumb'
),
'small_thumb'
=>
$this
->
imagy
->
getThumbnail
(
$this
->
path
,
'smallThumb'
),
'medium_thumb'
=>
$this
->
imagy
->
getThumbnail
(
$this
->
path
,
'mediumThumb'
),
'medium_thumb'
=>
$this
->
imagy
->
getThumbnail
(
$this
->
path
,
'mediumThumb'
),
];
];
...
...
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