navigation projet pour retour vers le groupe (ref #152)

This commit is contained in:
afornerot 2020-06-08 10:55:27 +02:00
parent a2c17379e4
commit eac7f63094
6 changed files with 58 additions and 14 deletions

View File

@ -352,6 +352,18 @@ class ProjectController extends Controller
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
}
// On recherche la premiere page associé au groupe du projet
$idpage=null;
if($id!=0) {
$groups=$entity->getGroups();
if($groups) {
if($groups[0]->getFgcanshare()) {
$pages=$groups[0]->getPages();
if($pages) $idpage=$pages[0]->getId();
}
}
}
// Permissions
$user=$this->getUser();
if($access=="config") {
@ -415,7 +427,8 @@ class ProjectController extends Controller
'projects' => $projects,
'countarticles' => $count,
'pagination' => $pagination,
'page' => $page
'page' => $page,
'idpage' => $idpage
]);
}

View File

@ -48,6 +48,7 @@ class ProjecttaskController extends Controller
if($project) $entity->setProject($project);
$entity->setPriority(0);
$entity->setPercentage(0);
$pageid=$request->get("page");
$form = $this->entityForm($entity,$access);
$form->handleRequest($request);
@ -76,7 +77,10 @@ class ProjecttaskController extends Controller
}
}
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]));
if(is_null($pageid))
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_projecttask_view',["id"=>$entity->getId()]));
else
return $this->redirect($this->generateUrl('cadoles_portal_'.$access.'_page_view',["id"=>$pageid]));
}
return $this->render($this->labelentity.':edit.html.twig', [
@ -87,7 +91,8 @@ class ProjecttaskController extends Controller
'entity' => $entity,
'mode' => "submit",
'access' => $access,
'form' => $form->createView()
'form' => $form->createView(),
'pageid' => $pageid
]);
}
@ -186,6 +191,16 @@ class ProjecttaskController extends Controller
$entity = $em->getRepository($this->labelentity)->find($id);
if (!$entity) throw $this->createNotFoundException('Unable to find entity.');
// On recherche la premiere page associé au groupe du projet
$groups=$entity->getProject()->getGroups();
$idpage=null;
if($groups) {
if($groups[0]->getFgcanshare()) {
$pages=$groups[0]->getPages();
if($pages) $idpage=$pages[0]->getId();
}
}
// Permissions
$user=$this->getUser();
if($access=="config") {
@ -278,7 +293,8 @@ class ProjecttaskController extends Controller
'canadd' => $canadd,
'projects' => $projects,
'projecttasks' => $projecttasks,
'files' => $files
'files' => $files,
'idpage' => $idpage,
]);
}

View File

@ -21,19 +21,19 @@
<div class="widget {%if entity.border %} widget-bordered {%else%} widget-notbordered {%endif%} widget-project" data-id="{{ entity.id }}" loc="{{ entity.loc }}" style="{{ stylewidget }}" height="{{ entity.height }}px">
<div class="widgetmenu">
{% if canupdate %}
<i class="fa fa-trash fa-fw" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-trash fa-fw" title="Supprimer le Widget" onClick="delWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
<i class="fa fa-file fa-fw" title="Modifier le Widget" onClick="modWidget({{ entity.id }})" style="{{ stylewidgetmenu }}"></i>
{% endif %}
{% if access=="config" %}
<a href='{{ path('cadoles_portal_config_project') }}' style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
{% else %}
{% set idproject = "" %}
{% set url= path('cadoles_portal_user_project_view') %}
{% set url= path('cadoles_portal_user_projecttask_submit') %}
{% if usage=="group" and firstproject is defined %}
{% set url= path('cadoles_portal_user_project_view',{id:firstproject}) %}
{% set url= path('cadoles_portal_user_projecttask_submit',{idproject:firstproject,page:entity.page.id}) %}
{% endif %}
<a onClick="showFrameitem('project','{{ url }}',true)" style="{{ stylewidgetmenu }}"><i class="fa fa-plus fa-fw"></i></a>
<a onClick="showFrameitem('project','{{ url }}',true)" style="{{ stylewidgetmenu }}" title="Ajouter une Tâche"><i class="fa fa-plus fa-fw"></i></a>
{% endif %}
</div>
@ -61,7 +61,7 @@
{% set colortask = projecttask.projecttasktag.color %}
{% endif %}
<div class="grid-item-content" style="background-color:#{{ colortask }}">
<a href="{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':projecttask.id}) }}">
<a title="Voir la Tâche" href="{{ path('cadoles_portal_'~access~'_projecttask_view',{'id':projecttask.id,page:entity.page.id}) }}">
<div class="item-link clearfix">
<div class="grid-item-logo" style="height:55px;width:10%; text-align: center;">

View File

@ -13,7 +13,13 @@
</div>
{% endif %}
<div style="margin:10px 0px 10px 0px; text-align:right;">
<div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%">
{% if not idpage is empty %}
<a href="{{path('cadoles_portal_user_page_view',{id:idpage})}}" class="btn btn-default">Revenir sur le Groupe</a>
{% endif %}
</div>
<div style="margin:10px 0px 10px 0px; text-align:right; display:inline-block;width:50%">
<label for="alltask" class="control-label">Afficher les tâches fermées</label>
<input id="alltask" name="alltask" type="checkbox" class="switch" style="margin-right:20px">

View File

@ -19,7 +19,11 @@
{% set projectid=entity.project.id %}
{%endif%}
<a class="btn btn-default" href='{{ path('cadoles_portal_'~access~'_project_view',{'id':projectid})}}'>Annuler</a>
{% if pageid is empty %}
<a class="btn btn-default" href='{{ path('cadoles_portal_'~access~'_project_view',{'id':projectid})}}'>Annuler</a>
{% else %}
<a class="btn btn-default" href="{{path('cadoles_core_home',{id:pageid})}}" target="_top">Annuler</a>
{% endif %}
{% endif %}
{% if mode=="update" %}

View File

@ -35,7 +35,12 @@
<a href="{{ path('cadoles_portal_config_project_view', {id:entity.project.id})}}">{{ entity.project.name }}</a>
</div>
{% else %}
<br>
<div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%">
{% if not idpage is empty %}
<a href="{{path('cadoles_portal_user_page_view',{id:idpage})}}" class="btn btn-default">Revenir sur le Groupe</a>
{% endif %}
</div>
<ul class="nav navbar-default nav-pills">
<li id="menuproject-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view") }}">