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 {
|
} else {
|
||||||
var cited = {}
|
var cited = {}
|
||||||
pandoraAPI('getEdit', {id: config.edit, keys: []}).then(response => {
|
if (config.edit) {
|
||||||
var annotations = []
|
pandoraAPI('getEdit', {id: config.edit, keys: []}).then(response => {
|
||||||
response.data.clips.forEach(clip => {
|
var annotations = []
|
||||||
cited[clip.item] = {
|
response.data.clips.forEach(clip => {
|
||||||
title: clip.title,
|
cited[clip.item] = {
|
||||||
director: clip.director,
|
title: clip.title,
|
||||||
id: clip.item
|
director: clip.director,
|
||||||
}
|
id: clip.item
|
||||||
layers.forEach(layer => {
|
}
|
||||||
clip.layers[layer].forEach(annotation => {
|
layers.forEach(layer => {
|
||||||
if (config.user && annotation.user != config.user) {
|
clip.layers[layer].forEach(annotation => {
|
||||||
return
|
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)
|
|
||||||
}
|
}
|
||||||
} else {
|
;['title', 'director', 'date'].forEach(key => {
|
||||||
//if (annotation.value.slice(0, 2) != 'E:') {
|
annotation[key] = clip[key]
|
||||||
annotations.push(annotation)
|
})
|
||||||
//}
|
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 => {
|
} else {
|
||||||
config.annotations = annotations
|
if (!config.annotations) {
|
||||||
config.cited = Object.values(cited)
|
config.annotations = []
|
||||||
renderAnnotations(config)
|
}
|
||||||
})
|
renderAnnotations(config)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ from ..widgets import PrettyJSONWidget
|
||||||
|
|
||||||
@admin.decorators.register(models.Text)
|
@admin.decorators.register(models.Text)
|
||||||
class TextAdmin(admin.ModelAdmin):
|
class TextAdmin(admin.ModelAdmin):
|
||||||
|
save_on_top = True
|
||||||
|
|
||||||
formfield_overrides = {
|
formfield_overrides = {
|
||||||
JSONField: {'widget': PrettyJSONWidget}
|
JSONField: {'widget': PrettyJSONWidget}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue