Skip to content

Commit

Permalink
Fixed Fiber not posting the id of an added content_item
Browse files Browse the repository at this point in the history
  • Loading branch information
bsimons committed Jan 23, 2017
1 parent f4af8a1 commit 675793a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fiber/static/fiber/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,12 @@ var AddContentItemFormDialog = ChangeContentItemFormDialog.extend({

this.after_action_success = $.proxy(function(responseText, statusText, xhr, $form) {
// find id of added content item
// Django 1.8.x: "/admin/fiber/fiber_admin/fiber/contentitem/<pk>/
var added_content_item_id = xhr.responseXML.URL.replace(/\/$/,'').split('/').pop();
if (added_content_item_id === 'change') {
// Django > 1.8.x: "/admin/fiber/fiber_admin/fiber/contentitem/<pk>/change/"
added_content_item_id = xhr.responseXML.URL.replace(/\/$/,'').split('/').slice(-2)[0]
}

if (added_content_item_id) {
this.add_content_item(added_content_item_id);
Expand Down

0 comments on commit 675793a

Please sign in to comment.