Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
funkwhale
Manage
Activity
Members
Labels
Plan
Issues
489
Issue boards
Milestones
Wiki
Code
Merge requests
18
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
funkwhale
funkwhale
Commits
9f3c45a7
Verified
Commit
9f3c45a7
authored
5 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
See
#872
: admin UI to set banner image
parent
6b10cea3
No related branches found
No related tags found
1 merge request
!893
See #872: banner setting
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
front/src/components/admin/SettingsGroup.vue
+40
-1
40 additions, 1 deletion
front/src/components/admin/SettingsGroup.vue
front/src/views/admin/Settings.vue
+1
-0
1 addition, 0 deletions
front/src/views/admin/Settings.vue
with
41 additions
and
1 deletion
front/src/components/admin/SettingsGroup.vue
+
40
−
1
View file @
9f3c45a7
...
...
@@ -61,6 +61,14 @@
class=
"ui search selection dropdown"
>
<option
v-for=
"v in setting.additional_data.choices"
:value=
"v[0]"
>
{{ v[1] }}
</option>
</select>
<div
v-else-if=
"setting.field.widget.class === 'ImageWidget'"
>
<input
type=
"file"
:ref=
"setting.identifier"
>
<div
v-if=
"values[setting.identifier]"
>
<div
class=
"ui hidden divider"
></div>
<h3
class=
"ui header"
><translate
translate-context=
"Content/Settings/Title/Noun"
>
Current image
</translate></h3>
<img
class=
"ui image"
v-if=
"values[setting.identifier]"
:src=
"$store.getters['instance/absoluteUrl'](values[setting.identifier])"
/>
</div>
</div>
</div>
<button
type=
"submit"
...
...
@@ -98,8 +106,34 @@ export default {
this
.
isLoading
=
true
self
.
errors
=
[]
self
.
result
=
null
axios
.
post
(
'
instance/admin/settings/bulk/
'
,
self
.
values
).
then
((
response
)
=>
{
let
postData
=
self
.
values
let
contentType
=
'
application/json
'
let
fileSettingsIDs
=
this
.
fileSettings
.
map
((
s
)
=>
{
return
s
.
identifier
})
if
(
fileSettingsIDs
.
length
>
0
)
{
contentType
=
'
multipart/form-data
'
postData
=
new
FormData
()
this
.
settings
.
forEach
((
s
)
=>
{
if
(
fileSettingsIDs
.
indexOf
(
s
.
identifier
)
>
-
1
)
{
let
input
=
self
.
$refs
[
s
.
identifier
][
0
]
let
files
=
input
.
files
console
.
log
(
'
ref
'
,
input
,
files
)
if
(
files
&&
files
.
length
>
0
)
{
postData
.
append
(
s
.
identifier
,
files
[
0
])
}
}
else
{
postData
.
append
(
s
.
identifier
,
self
.
values
[
s
.
identifier
])
}
})
}
axios
.
post
(
'
instance/admin/settings/bulk/
'
,
postData
,
{
headers
:
{
'
Content-Type
'
:
contentType
,
},
}).
then
((
response
)
=>
{
self
.
result
=
true
response
.
data
.
forEach
((
s
)
=>
{
self
.
values
[
s
.
identifier
]
=
s
.
value
})
self
.
isLoading
=
false
self
.
$store
.
dispatch
(
'
instance/fetchSettings
'
)
},
error
=>
{
...
...
@@ -117,6 +151,11 @@ export default {
return
this
.
group
.
settings
.
map
(
e
=>
{
return
byIdentifier
[
e
]
})
},
fileSettings
()
{
return
this
.
settings
.
filter
((
s
)
=>
{
return
s
.
field
.
widget
.
class
=== '
ImageWidget
'
})
}
}
}
...
...
This diff is collapsed.
Click to expand it.
front/src/views/admin/Settings.vue
+
1
−
0
View file @
9f3c45a7
...
...
@@ -96,6 +96,7 @@ export default {
"
instance__short_description
"
,
"
instance__long_description
"
,
"
instance__terms
"
,
"
instance__banner
"
,
]
},
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment