chutier icon display promotion message if not loged in
This commit is contained in:
@@ -61,42 +61,48 @@ function edlp_studio_node_view(array &$build, \Drupal\Core\Entity\EntityInterfac
|
|||||||
// dpm($entity->id());
|
// dpm($entity->id());
|
||||||
$user = \Drupal::currentUser();
|
$user = \Drupal::currentUser();
|
||||||
// dpm($user);
|
// dpm($user);
|
||||||
|
// check if user loged in ? no -> popup message : yes -> links
|
||||||
if($user->id() == 0){
|
if($user->id() == 0){
|
||||||
// // TODO: check if user loged in ? yes -> links : no : popup message
|
$build['chutier_actions'] = array(
|
||||||
// $action = 'add';
|
'#type' => 'container',
|
||||||
}
|
'#attributes' => array(
|
||||||
// else{
|
'class' => array('chutier-icon', 'not-logedin')
|
||||||
// // TODO: check if node already in chutier ? no -> add link : yes -> remove link
|
),
|
||||||
// // use getUserChutiersContents() from \Drupal\edlp_studio\ChutierInterface
|
"popup"=>array(
|
||||||
// $contents = Chutier::getUserChutiersContents($user->id());
|
'#type'=>'container',
|
||||||
// dpm($contents);
|
'#attributes' => array(
|
||||||
// if(array_search($entity->id(), $contents) === false){
|
'class' => array('popup')
|
||||||
// $action = 'add';
|
),
|
||||||
// }else{
|
"content"=>array(
|
||||||
// $action = 'remove';
|
'#type'=>'container',
|
||||||
// }
|
'#attributes' => array(
|
||||||
// }
|
'class' => array('inner')
|
||||||
// $args = array(
|
),
|
||||||
// 'action'=>$action,
|
'text'=>array(
|
||||||
// 'id'=>$entity->id()
|
'#prefix'=>'<p>',
|
||||||
// );
|
'#markup'=>t('Le Studio rassemble vos documents favoris.Il permet de les sauvgarder et de les agencer en compositions.'),
|
||||||
// $url = Url::fromRoute('edlp_studio.chutier_controller_ajax_add_content', $args, array(
|
'#suffix'=>'</p>'
|
||||||
// 'attributes' => array(
|
),
|
||||||
// 'class' => ['chutier-link','chutier-ajax-link'],
|
'links'=>array(
|
||||||
// 'action' => $action,
|
'#prefix'=>'<p>',
|
||||||
// 'target_id' => $entity->id(),
|
'#markup'=>'todo: login link',
|
||||||
// )
|
'#suffix'=>'</p>'
|
||||||
// ));
|
)
|
||||||
$url = Chutier::getActionsUrl($entity->id(), $user->id());
|
)
|
||||||
$build['chutier_actions'] = array(
|
|
||||||
'#title' => t("Chutier."),
|
|
||||||
'#type' => 'link',
|
|
||||||
'#url' => $url,
|
|
||||||
'#options'=>array(
|
|
||||||
'attributes' => array(
|
|
||||||
'data-drupal-link-system-path' => $url->getInternalPath()
|
|
||||||
)
|
)
|
||||||
)
|
);
|
||||||
);
|
}else{
|
||||||
|
// TODO: check if user has permission 'use chutier'
|
||||||
|
$url = Chutier::getActionsUrl($entity->id(), $user->id());
|
||||||
|
$build['chutier_actions'] = array(
|
||||||
|
'#type' => 'link',
|
||||||
|
'#url' => $url,
|
||||||
|
'#options'=>array(
|
||||||
|
'attributes' => array(
|
||||||
|
'data-drupal-link-system-path' => $url->getInternalPath()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1459,6 +1459,7 @@ body.ajax-loading main[role="main"]:before {
|
|||||||
|
|
||||||
.chutier-icon {
|
.chutier-icon {
|
||||||
display: block;
|
display: block;
|
||||||
|
position: relative;
|
||||||
width: 1em;
|
width: 1em;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -1473,6 +1474,27 @@ body.ajax-loading main[role="main"]:before {
|
|||||||
background-image: url(../img/favori-on.svg); }
|
background-image: url(../img/favori-on.svg); }
|
||||||
.chutier-icon.ajax-loading {
|
.chutier-icon.ajax-loading {
|
||||||
opacity: 0.2; }
|
opacity: 0.2; }
|
||||||
|
.chutier-icon.not-logedin {
|
||||||
|
overflow: visible; }
|
||||||
|
.chutier-icon .popup {
|
||||||
|
z-index: 10;
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 300px;
|
||||||
|
height: auto;
|
||||||
|
min-height: 100px; }
|
||||||
|
.chutier-icon .popup .inner {
|
||||||
|
background-color: rgba(255, 255, 255, 0.9);
|
||||||
|
border: 1px solid red;
|
||||||
|
text-indent: 0;
|
||||||
|
padding: 0.5em;
|
||||||
|
margin: 1.2em 0 0 1.2em; }
|
||||||
|
.chutier-icon .popup .inner p {
|
||||||
|
margin: 0; }
|
||||||
|
.chutier-icon:hover .popup {
|
||||||
|
display: block; }
|
||||||
|
|
||||||
body.path-agenda main .col > .wrapper {
|
body.path-agenda main .col > .wrapper {
|
||||||
height: 100%; }
|
height: 100%; }
|
||||||
|
|||||||
@@ -387,8 +387,10 @@ main[role="main"]{
|
|||||||
// \__ \ _| || / _` | / _ \
|
// \__ \ _| || / _` | / _ \
|
||||||
// |___/\__|\_,_\__,_|_\___/
|
// |___/\__|\_,_\__,_|_\___/
|
||||||
.chutier-icon{
|
.chutier-icon{
|
||||||
|
$s:1em;
|
||||||
display: block;
|
display: block;
|
||||||
width:1em;height:1em;
|
position: relative;
|
||||||
|
width:$s;height:$s;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-indent: 50em;
|
text-indent: 50em;
|
||||||
// background-color: red;
|
// background-color: red;
|
||||||
@@ -403,6 +405,29 @@ main[role="main"]{
|
|||||||
&.ajax-loading{
|
&.ajax-loading{
|
||||||
opacity: 0.2;
|
opacity: 0.2;
|
||||||
}
|
}
|
||||||
|
&.not-logedin{
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
.popup{
|
||||||
|
z-index: 10;
|
||||||
|
display:none;
|
||||||
|
position: absolute;
|
||||||
|
top:0; left:0;
|
||||||
|
width:300px; height:auto; min-height: 100px;
|
||||||
|
.inner{
|
||||||
|
background-color: rgba(255,255,255,0.9);
|
||||||
|
border: 1px solid red;
|
||||||
|
text-indent: 0;
|
||||||
|
padding: 0.5em;
|
||||||
|
margin:$s*1.2 0 0 $s*1.2;
|
||||||
|
p{margin: 0;}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&:hover{
|
||||||
|
.popup{
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user