studio-ui composer is ready to test actively
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
var _settings = drupalSettings.edlp_studio;
|
||||
var $composer;
|
||||
|
||||
// audio play is handled by edlp_theme
|
||||
|
||||
function init(){
|
||||
console.log('Studio Init');
|
||||
initEvents();
|
||||
@@ -21,11 +23,11 @@
|
||||
initAjaxCompoLinks();
|
||||
initDragAndDropUI();
|
||||
}
|
||||
|
||||
// ___ _ _ _ _ _ _ _ _ _
|
||||
// / __| |_ _ _| |_(_)___ _ _ | \| |___ __| |___ | | (_)_ _ | |__ ___
|
||||
// | (__| ' \ || | _| / -_) '_| | .` / _ \/ _` / -_) | |__| | ' \| / /(_-<
|
||||
// \___|_||_\_,_|\__|_\___|_| |_|\_\___/\__,_\___| |____|_|_||_|_\_\/__/
|
||||
|
||||
function initAjaxChutierLinks(){
|
||||
console.log('studio initAjaxChutierLinks');
|
||||
$('.chutier-ajax-link:not(.ajax-enabled)')
|
||||
@@ -119,6 +121,9 @@
|
||||
$('.composition', $composer).replaceWith(data.compo);
|
||||
$composer.removeClass('ajax-loading');
|
||||
initDragAndDropUI();
|
||||
$('body').trigger({
|
||||
'type':'on-studio-compo-opened'
|
||||
});
|
||||
};
|
||||
function onErrorOpenCompo(jqxhr, textStatus, error, $link){
|
||||
$link.removeClass('ajax-loading');
|
||||
@@ -172,12 +177,15 @@
|
||||
};
|
||||
function onCreateCompoDone(data, $link, $form){
|
||||
console.log('onActionToCompoDone',data);
|
||||
var $new_link = $(data.new_link);
|
||||
$link
|
||||
.removeClass('folded')
|
||||
.parents('li')
|
||||
.before($('<li>').append(data.new_link));
|
||||
.before($('<li>').append($new_link));
|
||||
$form.remove();
|
||||
// TODO: open new composition to composer
|
||||
// open new composition to composer
|
||||
initAjaxCompoLinks();
|
||||
openCompo($new_link);
|
||||
};
|
||||
function onErrorCreateCompo(jqxhr, textStatus, error, $link){
|
||||
console.warn('action to compo load failed : '+error, jqxhr.responseText);
|
||||
@@ -219,7 +227,6 @@
|
||||
console.warn('delete compo load failed : '+error, jqxhr.responseText);
|
||||
};
|
||||
|
||||
|
||||
// ___ _ _ _ _
|
||||
// / __| |_ _ _ __| (_)___ ___ _ _(_)
|
||||
// \__ \ _| || / _` | / _ \___| || | |
|
||||
@@ -253,7 +260,6 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ___ __ ___ _ _ ___
|
||||
// | \ _ _ __ _ __ _ / _|___ | \ _ _ ___ _ __ | | | |_ _|
|
||||
// | |) | '_/ _` / _` | > _|_ _| | |) | '_/ _ \ '_ \ | |_| || |
|
||||
@@ -337,9 +343,6 @@
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
// TODO: how to remove an item
|
||||
|
||||
function onOrderChanged(e, ui){
|
||||
console.log('onOrderChanged : e', e);
|
||||
var cid = $(e.target).parents('.composition').attr('cid');
|
||||
@@ -351,7 +354,6 @@
|
||||
// console.log(documents);
|
||||
recordCompoList(cid, documents);
|
||||
};
|
||||
|
||||
function recordCompoList(cid, docs){
|
||||
console.log('recordCompoList '+cid, docs);
|
||||
var ajax_path = _settings.save_compo_ajax_url+'/'+cid;
|
||||
@@ -366,8 +368,10 @@
|
||||
.fail(function(jqxhr, textStatus, error){
|
||||
onErrorRecordCompo(jqxhr, textStatus, error);
|
||||
});
|
||||
$('body').trigger({
|
||||
'type':'on-studio-compo-updated'
|
||||
});
|
||||
}
|
||||
|
||||
function onRecordCompoDone(data){
|
||||
console.log('onDeleteCompoDone',data);
|
||||
if(data.status == "ok"){
|
||||
@@ -379,7 +383,5 @@
|
||||
console.warn('record compo failed : '+error, jqxhr.responseText);
|
||||
};
|
||||
|
||||
|
||||
|
||||
init();
|
||||
})(jQuery, Drupal, drupalSettings);
|
||||
|
||||
@@ -110,7 +110,7 @@ class CompositionController extends ControllerBase {
|
||||
'#options'=>array(
|
||||
'attributes' => array(
|
||||
'data-drupal-link-system-path' => $url->getInternalPath(),
|
||||
'nid' => $this->compo->id(),
|
||||
'cid' => $this->compo->id(),
|
||||
'class' => ['composition-link'],
|
||||
'title'=>$title,
|
||||
),
|
||||
@@ -173,8 +173,10 @@ class CompositionController extends ControllerBase {
|
||||
$this->compo->setName($name);
|
||||
}
|
||||
$documents = array();
|
||||
foreach ($new_documents as $nid) {
|
||||
$documents[] = ['target_id'=>$nid];
|
||||
if(count($new_documents)){
|
||||
foreach ($new_documents as $nid) {
|
||||
$documents[] = ['target_id'=>$nid];
|
||||
}
|
||||
}
|
||||
$this->compo->set('documents', $documents);
|
||||
$this->compo->save();
|
||||
|
||||
@@ -119,7 +119,9 @@ class StudioUIController extends ControllerBase {
|
||||
'#composer_actions' => array(
|
||||
'play_composition'=>array(
|
||||
"#type"=>'container',
|
||||
"#markup"=>t('Play my composition'),
|
||||
"#attributes"=>array(
|
||||
"class"=>array("compo-player-controls")
|
||||
)
|
||||
),// TODO: add social media links (what about composition visibility uotside studio_ui ?)
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user