summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/align/components/annotations/annotationForms
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-09-09 18:55:59 +0200
committerJules Laplace <julescarbon@gmail.com>2020-09-09 18:55:59 +0200
commitaf17cb4e5de2d236305c208de9c4bc16efdc04b8 (patch)
tree10ffeaa0bb28d8891004a0c10a8325a425cef4b1 /animism-align/frontend/app/views/align/components/annotations/annotationForms
parent8bc34e487d138573374c4cbe2fe6e892565b9323 (diff)
keep track of carousel advance instructions
Diffstat (limited to 'animism-align/frontend/app/views/align/components/annotations/annotationForms')
-rw-r--r--animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.gallery.js79
-rw-r--r--animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js3
2 files changed, 80 insertions, 2 deletions
diff --git a/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.gallery.js b/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.gallery.js
index 5fb8958..c43d8d5 100644
--- a/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.gallery.js
+++ b/animism-align/frontend/app/views/align/components/annotations/annotationForms/annotationForm.gallery.js
@@ -1,7 +1,7 @@
import React, { Component } from 'react'
import { CURTAIN_COLOR_SELECT_OPTIONS } from 'app/constants'
-import { TextInput, Select, Checkbox } from 'app/common'
+import { TextInput, Select, Checkbox, LabelDescription } from 'app/common'
import { AnnotationFormFullscreen } from './annotationForm.utility'
export const AnnotationFormGallery = ({ annotation, media, handleSettingsSelect, handleSettingsChange }) => {
@@ -21,7 +21,7 @@ export const AnnotationFormGallery = ({ annotation, media, handleSettingsSelect,
className="media_id"
selected={annotation.settings.media_id}
options={image_list_items}
- defaultOption='Choose an image'
+ defaultOption='Choose a gallery'
onChange={handleSettingsSelect}
/>
@@ -74,3 +74,78 @@ export const AnnotationFormGallery = ({ annotation, media, handleSettingsSelect,
</div>
)
}
+
+export const AnnotationFormGalleryAdvance = ({ annotation, media, handleSettingsSelect, handleSettingsChange }) => {
+ if (!media.lookup) return <div />
+ const { lookup, order } = media
+ const image_list_items = order.filter(id => lookup[id].type === 'gallery').map(id => {
+ const image = lookup[id]
+ return {
+ name: image.id,
+ label: image.author + ' - ' + image.title
+ }
+ })
+ let item, gallery_items, frame_id, thumbnail
+ if (annotation.settings.media_id && lookup[annotation.settings.media_id]) {
+ item = lookup[annotation.settings.media_id]
+ gallery_items = item.settings.image_order.map((id, index) => {
+ const caption = item.settings.caption_lookup && item.settings.caption_lookup[id]
+ console.log(caption)
+ return {
+ name: index,
+ label: (index + 1) + ") " + (caption ? (caption.title || "") : "")
+ }
+ })
+ if (annotation.settings.frame_index) {
+ frame_id = item.settings.image_order[annotation.settings.frame_index]
+ thumbnail = item.settings.thumbnail_lookup[frame_id]
+ }
+ }
+ return (
+ <div className='options'>
+ <Select
+ name='media_id'
+ className="media_id"
+ selected={annotation.settings.media_id}
+ options={image_list_items}
+ defaultOption='Choose a gallery'
+ onChange={handleSettingsSelect}
+ />
+
+ {item && (
+ <Select
+ name='frame_index'
+ selected={annotation.settings.frame_index}
+ options={gallery_items}
+ defaultOption='Choose an image'
+ onChange={handleSettingsSelect}
+ />
+ )}
+
+ {thumbnail && (
+ <img src={thumbnail.url} />
+ )}
+
+ <Checkbox
+ label="Advance half a frame forward to fit two images in view"
+ name="half_frame"
+ checked={annotation.settings.half_frame}
+ onChange={handleSettingsSelect}
+ />
+
+ <Checkbox
+ label="Hide in transcript"
+ name="hide_in_transcript"
+ checked={annotation.settings.hide_in_transcript}
+ onChange={handleSettingsSelect}
+ />
+
+ <Checkbox
+ label="Show in checklist"
+ name="show_in_checklist"
+ checked={annotation.settings.show_in_checklist}
+ onChange={handleSettingsSelect}
+ />
+ </div>
+ )
+}
diff --git a/animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js b/animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js
index a4ad015..5cbe773 100644
--- a/animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js
+++ b/animism-align/frontend/app/views/align/components/annotations/annotationForms/index.js
@@ -12,6 +12,7 @@ import {
import {
AnnotationFormGallery,
+ AnnotationFormGalleryAdvance,
} from './annotationForm.gallery'
import {
@@ -30,6 +31,8 @@ export const annotationFormLookup = {
grid: AnnotationFormGallery,
vitrine: AnnotationFormGallery,
+ gallery_advance: AnnotationFormGalleryAdvance,
+
intro: AnnotationFormIntro,
curtain: AnnotationFormCurtain,
}