studio chutier is updating when documents added or removed, also added remove link in document list

This commit is contained in:
Bachir Soussi Chiadmi
2018-03-12 18:33:48 +01:00
parent 119f89abca
commit 76dd9ddbc9
11 changed files with 253 additions and 107 deletions
@@ -56,7 +56,7 @@ class StudioUIController extends ControllerBase {
* Return renderable array.
*/
public function StudioUIJson() {
$renderable = $this->buildUI();
$renderable = $this->buildStudioUI();
$rendered = render($renderable);
// JSON
@@ -68,11 +68,27 @@ class StudioUIController extends ControllerBase {
}
public function buildUI(){
// get current user
// done by DependencyInjection of AccountInterface
// dpm($this->user->id());
public function StudioChutierUIJson(){
$renderable = $this->buildChutierUI();
$rendered = render($renderable);
// JSON
$response = new JsonResponse();
$response->setData([
'rendered'=> $rendered,
]);
return $response;
}
private function buildStudioUI(){
return [
'#theme' => 'edlp_studio_ui',
'#chutier_ui' => $this->buildChutierUI(),
'#composition_ui' => $this->buildCompostionUI(),
];
}
private function buildChutierUI(){
// get his docs in chutier
$documents_nids = Chutier::getUserChutiersContents($this->user->id());
// dpm($documents_nids);
@@ -84,8 +100,13 @@ class StudioUIController extends ControllerBase {
"#theme"=>'edlp_chutier_ui',
'#title' => t('Chutier'),
"#document_nodes" => $documents,
'#uid' => $this->user->id(),
);
return $chutier_ui;
}
private function buildCompostionUI(){
// TODO: get compositions
// TODO: add compositions theme, preprocess, twig template to studio module
// TODO: build content renderable array
@@ -95,13 +116,6 @@ class StudioUIController extends ControllerBase {
"#compositions" => array('#markup'=>'TODO : compositions UI'),
);
// TODO: add studio theme, preprocess, twig template to studio module
// TODO: build global studio renderable array
return [
'#theme' => 'edlp_studio_ui',
'#chutier_ui' => $chutier_ui,
'#composition_ui' => $composition_ui,
];
return $composition_ui;
}
}
@@ -102,5 +102,4 @@ interface ChutierInterface extends ContentEntityInterface, EntityChangedInterfac
*/
public static function getActionsURL($id, $uid);
}