Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
AURA
dashboard
Commits
8c328145
Commit
8c328145
authored
1 year ago
by
Konrad Mohrfeldt
Browse files
Options
Downloads
Patches
Plain Diff
feat: enable license support for images
refs
#185
parent
6cb4a75f
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/components/images/ImageEditor.vue
+38
-2
38 additions, 2 deletions
src/components/images/ImageEditor.vue
src/i18n/de.js
+3
-1
3 additions, 1 deletion
src/i18n/de.js
src/i18n/en.js
+3
-1
3 additions, 1 deletion
src/i18n/en.js
src/stores/images.ts
+2
-0
2 additions, 0 deletions
src/stores/images.ts
with
46 additions
and
4 deletions
src/components/images/ImageEditor.vue
+
38
−
2
View file @
8c328145
...
...
@@ -16,8 +16,37 @@
/>
</FormGroup>
<FormGroup
v-slot=
"controlAttributes"
:label=
"t('image.credits')"
>
<input
v-model=
"image.credits"
class=
"form-control"
v-bind=
"controlAttributes"
/>
<FormGroup
v-slot=
"controlAttributes"
:label=
"t('image.license')"
>
<select
v-model=
"image.licenseId"
class=
"form-control"
required
v-bind=
"controlAttributes"
>
<option
v-for=
"license in licenses"
:key=
"license.id"
:value=
"license.id"
>
{{
license
.
name
}}
</option>
</select>
</FormGroup>
<FormGroup
v-slot=
"controlAttributes"
:label=
"t('image.credits')"
:errors=
"[needsAuthorError]"
>
<input
v-model=
"image.credits"
class=
"form-control"
:required=
"selectedLicense?.needsAuthor"
v-bind=
"controlAttributes"
/>
</FormGroup>
<FormGroup
v-slot=
"controlAttributes"
:errors=
"[isUseExplicitlyGrantedByAuthorError]"
custom-control
>
<label
class=
"tw-flex tw-gap-2 tw-items-center tw-mb-0"
>
<input
v-model=
"image.isUseExplicitlyGrantedByAuthor"
type=
"checkbox"
:required=
"selectedLicense?.requiresExpressPermissionForPublication"
v-bind=
"controlAttributes"
/>
{{
t
(
'
image.isUseExplicitlyGrantedByAuthor
'
)
}}
</label>
</FormGroup>
</fieldset>
</
template
>
...
...
@@ -29,6 +58,7 @@ import { useI18n } from '@/i18n'
import
{
Image
,
NewImage
}
from
'
@/stores/images
'
import
{
useUpdatableState
}
from
'
@/util
'
import
ImagePreview
from
'
./ImagePreview.vue
'
import
{
useLicenseStore
,
useLicenseValidator
,
useSelectedLicense
}
from
'
@/stores/licenses
'
import
FormGroup
from
'
@/components/generic/FormGroup.vue
'
defineOptions
({
...
...
@@ -38,11 +68,17 @@ defineOptions({
const
modelValue
=
defineModel
<
Image
|
NewImage
>
({
required
:
true
})
const
attrs
=
useAttrs
()
const
{
t
}
=
useI18n
()
const
{
items
:
licenses
}
=
useLicenseStore
()
const
image
=
useUpdatableState
<
Image
|
NewImage
>
(
modelValue
,
(
image
)
=>
(
modelValue
.
value
=
image
),
(
image
)
=>
({
...
image
}),
)
const
selectedLicense
=
useSelectedLicense
(()
=>
image
.
value
.
licenseId
)
const
{
needsAuthorError
,
isUseExplicitlyGrantedByAuthorError
}
=
useLicenseValidator
(
selectedLicense
,
image
,
)
const
{
textarea
:
descriptionEl
}
=
useTextareaAutosize
({
watch
:
()
=>
image
.
value
.
altText
})
</
script
>
This diff is collapsed.
Click to expand it.
src/i18n/de.js
+
3
−
1
View file @
8c328145
...
...
@@ -370,7 +370,9 @@ export default {
image
:
{
altText
:
'
Alternativtext (für Screenreader)
'
,
credits
:
'
Bildnachweis
'
,
license
:
'
Lizenz
'
,
credits
:
'
Bildnachweis / Urheber:in
'
,
isUseExplicitlyGrantedByAuthor
:
'
Autor:in erlaubt Veröffentlichung
'
,
},
license
:
{
...
...
This diff is collapsed.
Click to expand it.
src/i18n/en.js
+
3
−
1
View file @
8c328145
...
...
@@ -362,7 +362,9 @@ export default {
image
:
{
altText
:
'
Alternative Text (for screen readers)
'
,
credits
:
'
Credits
'
,
license
:
'
License
'
,
credits
:
'
Credits / Author
'
,
isUseExplicitlyGrantedByAuthor
:
'
Use was explicitly granted by author
'
,
},
license
:
{
...
...
This diff is collapsed.
Click to expand it.
src/stores/images.ts
+
2
−
0
View file @
8c328145
...
...
@@ -17,6 +17,8 @@ export type Image = {
id
:
number
altText
:
string
credits
:
string
licenseId
:
number
|
null
isUseExplicitlyGrantedByAuthor
:
boolean
image
:
string
file
?:
File
ppoi
:
string
...
...
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