load body if no edit is defined
This commit is contained in:
parent
fa0c383227
commit
a334dc6b4f
2 changed files with 40 additions and 31 deletions
|
@ -353,41 +353,48 @@ function loadAnnotations(config) {
|
|||
})
|
||||
} else {
|
||||
var cited = {}
|
||||
pandoraAPI('getEdit', {id: config.edit, keys: []}).then(response => {
|
||||
var annotations = []
|
||||
response.data.clips.forEach(clip => {
|
||||
cited[clip.item] = {
|
||||
title: clip.title,
|
||||
director: clip.director,
|
||||
id: clip.item
|
||||
}
|
||||
layers.forEach(layer => {
|
||||
clip.layers[layer].forEach(annotation => {
|
||||
if (config.user && annotation.user != config.user) {
|
||||
return
|
||||
}
|
||||
;['title', 'director', 'date'].forEach(key => {
|
||||
annotation[key] = clip[key]
|
||||
})
|
||||
if (config.only_e) {
|
||||
if (annotation.value.slice(0, 2) == 'E:') {
|
||||
annotation.value = annotation.value.slice(2).trim()
|
||||
annotations.push(annotation)
|
||||
if (config.edit) {
|
||||
pandoraAPI('getEdit', {id: config.edit, keys: []}).then(response => {
|
||||
var annotations = []
|
||||
response.data.clips.forEach(clip => {
|
||||
cited[clip.item] = {
|
||||
title: clip.title,
|
||||
director: clip.director,
|
||||
id: clip.item
|
||||
}
|
||||
layers.forEach(layer => {
|
||||
clip.layers[layer].forEach(annotation => {
|
||||
if (config.user && annotation.user != config.user) {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
//if (annotation.value.slice(0, 2) != 'E:') {
|
||||
annotations.push(annotation)
|
||||
//}
|
||||
}
|
||||
;['title', 'director', 'date'].forEach(key => {
|
||||
annotation[key] = clip[key]
|
||||
})
|
||||
if (config.only_e) {
|
||||
if (annotation.value.slice(0, 2) == 'E:') {
|
||||
annotation.value = annotation.value.slice(2).trim()
|
||||
annotations.push(annotation)
|
||||
}
|
||||
} else {
|
||||
//if (annotation.value.slice(0, 2) != 'E:') {
|
||||
annotations.push(annotation)
|
||||
//}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
loadClips(annotations).then(annotations => {
|
||||
config.annotations = annotations
|
||||
config.cited = Object.values(cited)
|
||||
renderAnnotations(config)
|
||||
})
|
||||
})
|
||||
loadClips(annotations).then(annotations => {
|
||||
config.annotations = annotations
|
||||
config.cited = Object.values(cited)
|
||||
renderAnnotations(config)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
if (!config.annotations) {
|
||||
config.annotations = []
|
||||
}
|
||||
renderAnnotations(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@ from ..widgets import PrettyJSONWidget
|
|||
|
||||
@admin.decorators.register(models.Text)
|
||||
class TextAdmin(admin.ModelAdmin):
|
||||
save_on_top = True
|
||||
|
||||
formfield_overrides = {
|
||||
JSONField: {'widget': PrettyJSONWidget}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue