Skip to content

Commit

Permalink
Fix description case update not working (ckeditor value missing on fo…
Browse files Browse the repository at this point in the history
…rmdata sent)
  • Loading branch information
pampletousse authored and pampletousse committed Nov 20, 2023
1 parent 0e62172 commit 2d92b42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pod/video/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ def filter_fields_admin(form):
def create_with_fields(self, field_key):
"""Create VideoForm with specific fields. Keep video field to prevent error on save."""
fields = list(self.fields)
if "description" in field_key:
field_key.append("description_%s" % self.current_lang)
if "title" in field_key:
field_key.append("title_%s" % self.current_lang)
for field in fields:
if field not in field_key and field != "video":
del self.fields[field]
Expand Down
11 changes: 10 additions & 1 deletion pod/video/static/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,16 @@ async function bulk_update() {
if(element.hasAttribute("multiple")){
formData.append(element.getAttribute("name"), element.value);
}else{
value = element.type === "checkbox" ? element.checked : document.getElementById("id_"+element.getAttribute("name")).value;
switch(element.type){
case "checkbox":
value = element.checked
break;
case "textarea":
value = CKEDITOR.instances[element.id].getData();
break;
default:
document.getElementById("id_"+element.getAttribute("name")).value;
}
formData.append(element.getAttribute("name"), value);
}
update_fields.push(element.name);
Expand Down

0 comments on commit 2d92b42

Please sign in to comment.