studio composition : fixed empty field documents bug
This commit is contained in:
@@ -116,7 +116,7 @@
|
|||||||
$('.composition-link').removeClass('is-active');
|
$('.composition-link').removeClass('is-active');
|
||||||
$link.removeClass('ajax-loading').addClass('is-active');
|
$link.removeClass('ajax-loading').addClass('is-active');
|
||||||
|
|
||||||
$composer.html(data.compo);
|
$('.composition', $composer).replaceWith(data.compo);
|
||||||
$composer.removeClass('ajax-loading');
|
$composer.removeClass('ajax-loading');
|
||||||
initDragAndDropUI();
|
initDragAndDropUI();
|
||||||
};
|
};
|
||||||
@@ -260,11 +260,18 @@
|
|||||||
// |___/|_| \__,_\__, | \_____| |___/|_| \___/ .__/ \___/|___|
|
// |___/|_| \__,_\__, | \_____| |___/|_| \___/ .__/ \___/|___|
|
||||||
// |___/ |_|
|
// |___/ |_|
|
||||||
function initDragAndDropUI(){
|
function initDragAndDropUI(){
|
||||||
|
// check if field--name-documents exists
|
||||||
// add real dom square element to handle sorting
|
if (!$('.composition_ui .composer .composition .field--name-documents').length) {
|
||||||
$('.composition_ui .composer .composition .field--name-documents .field__item').each(function(i){
|
// if not create it
|
||||||
|
$field_documents = $('<div>')
|
||||||
|
.addClass('field').addClass('field--name-documents')
|
||||||
|
.appendTo('.composition_ui .composer .composition');
|
||||||
|
}else{
|
||||||
|
// add real dom square element to handle sorting
|
||||||
|
$field_documents = $('.composition_ui .composer .composition .field--name-documents'); $('.field__item', $field_documents).each(function(i){
|
||||||
$(this).prepend($('<span>').addClass('handler'));
|
$(this).prepend($('<span>').addClass('handler'));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// create remove dropzone
|
// create remove dropzone
|
||||||
var $remove_zone = $('<div>').addClass('remove-drop-zone')
|
var $remove_zone = $('<div>').addClass('remove-drop-zone')
|
||||||
@@ -288,7 +295,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// create sortable
|
// create sortable
|
||||||
$('.composition_ui .composer .composition .field--name-documents').sortable({
|
$field_documents.sortable({
|
||||||
revert:false,
|
revert:false,
|
||||||
handle: ".handler",
|
handle: ".handler",
|
||||||
receive:function(e, ui){
|
receive:function(e, ui){
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class CompositionController extends ControllerBase {
|
|||||||
|
|
||||||
private function getRendredComposition(){
|
private function getRendredComposition(){
|
||||||
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('composition');
|
$view_builder = \Drupal::entityTypeManager()->getViewBuilder('composition');
|
||||||
$compobuild = $view_builder->view($this->compo, 'default');
|
$compobuild = $view_builder->view($this->compo, 'studio_ui');
|
||||||
$this->rendered_compo = render($compobuild);
|
$this->rendered_compo = render($compobuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user