Skip to content

Commit

Permalink
API Move state to enwtine properties, provide API for preview.
Browse files Browse the repository at this point in the history
Also the preview state is now kept between panel loads. We also use a
redraw function to update appearance based on the state.
  • Loading branch information
mateusz authored and chillu committed Dec 10, 2012
1 parent 9312c70 commit 8f5acd7
Show file tree
Hide file tree
Showing 7 changed files with 399 additions and 126 deletions.
2 changes: 1 addition & 1 deletion admin/code/LeftAndMain.php
Expand Up @@ -1044,7 +1044,7 @@ public function getEditForm($id = null, $fields = null) {
$fields->push(new HiddenField('ParentID'));
}

// Added in-line to the form, but plucked into different view by LeftAndMain.Preview.js upon load
// Added in-line to the form, but plucked into different view by frontend scripts.
if(in_array('CMSPreviewable', class_implements($record))) {
$navField = new LiteralField('SilverStripeNavigator', $this->getSilverStripeNavigator());
$navField->setAllowHTML(true);
Expand Down
8 changes: 0 additions & 8 deletions admin/javascript/LeftAndMain.EditForm.js
Expand Up @@ -94,14 +94,6 @@
$('.cms-container').clearCurrentTabState(); // clear state to avoid override later on
firstTabWithErrors.closest('.tabset').tabs('select', firstTabWithErrors.attr('id'));
}

// Move navigator to preview if one is available.
// If not, just leave the links in the form.
var previewEl = $('.cms-preview');
if(previewEl.length) {
// TODO Relies on DOM element order (the second .cms-navigator is the "old" one)
previewEl.find('.cms-preview-controls').html(this.find('.cms-navigator').detach());
}

this._super();
},
Expand Down

0 comments on commit 8f5acd7

Please sign in to comment.