fix studio
This commit is contained in:
@@ -187,10 +187,11 @@
|
|||||||
function onCreateCompoDone(data, $link, $form){
|
function onCreateCompoDone(data, $link, $form){
|
||||||
console.log('onActionToCompoDone',data);
|
console.log('onActionToCompoDone',data);
|
||||||
var $new_link = $(data.new_link);
|
var $new_link = $(data.new_link);
|
||||||
|
var $delete_link = $(data.delete_link);
|
||||||
$link
|
$link
|
||||||
.removeClass('folded')
|
.removeClass('folded')
|
||||||
.parents('li')
|
.parents('li')
|
||||||
.before($('<li>').append($new_link));
|
.before($('<li>').append($new_link).append($delete_link));
|
||||||
$form.remove();
|
$form.remove();
|
||||||
// open new composition to composer
|
// open new composition to composer
|
||||||
initAjaxCompoLinks();
|
initAjaxCompoLinks();
|
||||||
@@ -227,6 +228,12 @@
|
|||||||
console.log('onDeleteCompoDone',data);
|
console.log('onDeleteCompoDone',data);
|
||||||
if(data.status == "ok"){
|
if(data.status == "ok"){
|
||||||
$link.parents('li').remove();
|
$link.parents('li').remove();
|
||||||
|
console.log("$('.composition-link').length", $('.composition-link').length);
|
||||||
|
if($('.composition-link').length){
|
||||||
|
openCompo($('.composition-link').eq(0));
|
||||||
|
}else{
|
||||||
|
$('.composition', $composer).html();
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
console.warn(data.message);
|
console.warn(data.message);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function template_preprocess_edlp_compositions_list(&$vars){
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
'delete_link' => array(
|
'delete_link' => array(
|
||||||
'#title' => "delete",
|
'#title' => t("delete"),
|
||||||
'#type' => 'link',
|
'#type' => 'link',
|
||||||
'#url' => $delete_url,
|
'#url' => $delete_url,
|
||||||
'#options'=>array(
|
'#options'=>array(
|
||||||
|
|||||||
@@ -117,9 +117,26 @@ class CompositionController extends ControllerBase {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$delete_url = Url::fromRoute('edlp_studio.composition_controller_action_ajax', ['action' => 'delete', 'cid' => $this->compo->id()], ['absolute' => TRUE]);
|
||||||
|
|
||||||
|
$deletelink_build = array(
|
||||||
|
'#title' => t('Delete'),
|
||||||
|
'#type' => 'link',
|
||||||
|
'#url' => $delete_url,
|
||||||
|
'#options'=>array(
|
||||||
|
'attributes' => array(
|
||||||
|
'data-drupal-link-system-path' => $delete_url->getInternalPath(),
|
||||||
|
'cid' => $this->compo->id(),
|
||||||
|
'class' => ['delete-composition-link'],
|
||||||
|
'title'=>t('Delete @title', array('@title'=>$title)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
$data += array(
|
$data += array(
|
||||||
'new_name' => $title,
|
'new_name' => $title,
|
||||||
'new_link' => render($new_link_build),
|
'new_link' => render($new_link_build),
|
||||||
|
'delete_link' => render($deletelink_build),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'open':
|
case 'open':
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
$('body')
|
$('body')
|
||||||
.on('on-studio-chutier-updated', initAjaxLinks)
|
.on('on-studio-chutier-updated', initAjaxLinks)
|
||||||
.on('studio-initialized', function(e){
|
.on('studio-initialized', function(e){
|
||||||
_compoPlayer.initControls();
|
_compoPlayer.newCompo();
|
||||||
})
|
})
|
||||||
.on('studio-not-active', function(e){
|
.on('studio-not-active', function(e){
|
||||||
_compoPlayer.deactivate();
|
_compoPlayer.deactivate();
|
||||||
@@ -665,9 +665,15 @@
|
|||||||
|
|
||||||
// this.newCompo();
|
// this.newCompo();
|
||||||
},
|
},
|
||||||
|
newCompo(){
|
||||||
|
console.log('CompoPlayer newCompo()');
|
||||||
|
// this.$compo = $('.composition_ui .composer .composition');
|
||||||
|
this.initControls();
|
||||||
|
},
|
||||||
initControls(){
|
initControls(){
|
||||||
console.log('CompoPlayer initControls()');
|
console.log('CompoPlayer initControls()');
|
||||||
this.$composer = $('.composition_ui .composer');
|
this.$composer = $('.composition_ui .composer');
|
||||||
|
this.$compo = $('.composition_ui .composer .composition');
|
||||||
this.$controls = $('.composition_ui .composer .compo-player-controls');
|
this.$controls = $('.composition_ui .composer .compo-player-controls');
|
||||||
if(!this.$controls.is('.ready') && this.$compo){
|
if(!this.$controls.is('.ready') && this.$compo){
|
||||||
this.$previous = $('<div>').addClass('previous')
|
this.$previous = $('<div>').addClass('previous')
|
||||||
@@ -682,21 +688,14 @@
|
|||||||
|
|
||||||
this.$controls.addClass('ready');
|
this.$controls.addClass('ready');
|
||||||
|
|
||||||
|
this.refresh();
|
||||||
|
|
||||||
this.active = true; // TODO: set active false
|
this.active = true; // TODO: set active false
|
||||||
this.newCompo();
|
// this.newCompo();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
newCompo(){
|
|
||||||
console.log('CompoPlayer newCompo()');
|
|
||||||
this.$compo = $('.composition_ui .composer .composition');
|
|
||||||
this.initControls();
|
|
||||||
this.refresh();
|
|
||||||
},
|
|
||||||
refresh(){
|
refresh(){
|
||||||
// console.log('CompoPlayer refresh(), this', this);
|
// console.log('CompoPlayer refresh(), this', this);
|
||||||
// this.playing = false;
|
|
||||||
// this.paused = false;
|
|
||||||
// this.resetIndex();
|
|
||||||
this.stop();
|
this.stop();
|
||||||
|
|
||||||
// load new playlist
|
// load new playlist
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
$('body')
|
$('body')
|
||||||
.on('on-studio-chutier-updated', initAjaxLinks)
|
.on('on-studio-chutier-updated', initAjaxLinks)
|
||||||
.on('studio-initialized', function(e){
|
.on('studio-initialized', function(e){
|
||||||
_compoPlayer.initControls();
|
_compoPlayer.newCompo();
|
||||||
})
|
})
|
||||||
.on('studio-not-active', function(e){
|
.on('studio-not-active', function(e){
|
||||||
_compoPlayer.deactivate();
|
_compoPlayer.deactivate();
|
||||||
@@ -665,9 +665,15 @@
|
|||||||
|
|
||||||
// this.newCompo();
|
// this.newCompo();
|
||||||
},
|
},
|
||||||
|
newCompo(){
|
||||||
|
console.log('CompoPlayer newCompo()');
|
||||||
|
// this.$compo = $('.composition_ui .composer .composition');
|
||||||
|
this.initControls();
|
||||||
|
},
|
||||||
initControls(){
|
initControls(){
|
||||||
console.log('CompoPlayer initControls()');
|
console.log('CompoPlayer initControls()');
|
||||||
this.$composer = $('.composition_ui .composer');
|
this.$composer = $('.composition_ui .composer');
|
||||||
|
this.$compo = $('.composition_ui .composer .composition');
|
||||||
this.$controls = $('.composition_ui .composer .compo-player-controls');
|
this.$controls = $('.composition_ui .composer .compo-player-controls');
|
||||||
if(!this.$controls.is('.ready') && this.$compo){
|
if(!this.$controls.is('.ready') && this.$compo){
|
||||||
this.$previous = $('<div>').addClass('previous')
|
this.$previous = $('<div>').addClass('previous')
|
||||||
@@ -682,21 +688,14 @@
|
|||||||
|
|
||||||
this.$controls.addClass('ready');
|
this.$controls.addClass('ready');
|
||||||
|
|
||||||
|
this.refresh();
|
||||||
|
|
||||||
this.active = true; // TODO: set active false
|
this.active = true; // TODO: set active false
|
||||||
this.newCompo();
|
// this.newCompo();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
newCompo(){
|
|
||||||
console.log('CompoPlayer newCompo()');
|
|
||||||
this.$compo = $('.composition_ui .composer .composition');
|
|
||||||
this.initControls();
|
|
||||||
this.refresh();
|
|
||||||
},
|
|
||||||
refresh(){
|
refresh(){
|
||||||
// console.log('CompoPlayer refresh(), this', this);
|
// console.log('CompoPlayer refresh(), this', this);
|
||||||
// this.playing = false;
|
|
||||||
// this.paused = false;
|
|
||||||
// this.resetIndex();
|
|
||||||
this.stop();
|
this.stop();
|
||||||
|
|
||||||
// load new playlist
|
// load new playlist
|
||||||
|
|||||||
Reference in New Issue
Block a user