link unlink

This commit is contained in:
afornerot 2024-04-15 13:25:09 +02:00
parent 0b15ea51bd
commit d9448ccfee
5 changed files with 92 additions and 0 deletions

View File

@ -206,6 +206,9 @@ app_scrum_stat:
path: /user/scrum/stat/{id} path: /user/scrum/stat/{id}
defaults: { _controller: App\Controller\ScrumController:stat } defaults: { _controller: App\Controller\ScrumController:stat }
app_scrum_link:
path: /user/scrum/link/{id}
defaults: { _controller: App\Controller\ScrumController:link }
app_scrum_info: app_scrum_info:
path: /user/scrum/info/{id} path: /user/scrum/info/{id}

View File

@ -644,6 +644,21 @@ class ScrumController extends AbstractController
]); ]);
} }
public function link($id,Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->entity)->find($id);
if(!$data) return $this->redirectToRoute($this->route);
return $this->render($this->render.'link.html.twig',[
"useheader" => true,
"usesidebar" => false,
"maxwidth" => 1000,
"scrum" => $data,
]);
}
public function info($id,Request $request) public function info($id,Request $request)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();

View File

@ -100,6 +100,7 @@ class Scrumissue
/** /**
* @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrumissueblock", cascade={"persist"}, orphanRemoval=false) * @ORM\OneToMany(targetEntity="Scrumissue", mappedBy="scrumissueblock", cascade={"persist"}, orphanRemoval=false)
* @ORM\OrderBy({"giteanumber" = "ASC"})
*/ */
private $scrumissuedependencies; private $scrumissuedependencies;

View File

@ -337,6 +337,7 @@ class giteaService
$body = \Unirest\Request\Body::json($query); $body = \Unirest\Request\Body::json($query);
$body=str_replace('"'.$toblock.'"',$toblock,$body); $body=str_replace('"'.$toblock.'"',$toblock,$body);
$response=$this->api("POST",$apiurl,$body,$this->session->get("giteatoken")); $response=$this->api("POST",$apiurl,$body,$this->session->get("giteatoken"));
dump($response);
if(!$response||($response->code!="200"&&$response->code!="201")) return false; if(!$response||($response->code!="200"&&$response->code!="201")) return false;
else return $response->body; else return $response->body;
} }

View File

@ -0,0 +1,72 @@
{% extends 'base.html.twig' %}
{% block body %}
<h1>{{scrum.name}}</h1>
<div class="form-group ">
<label class="control-label required" for="scrum_category">
Le ticket n°
<span class="mandatory">*</span>
</label>
<select id="issue" class="form-control">
<option value="" selected></option>
{% for issue in scrum.scrumissues %}
<option value="{{issue.id}}">#{{issue.giteanumber}} = {{issue.giteatitle}}</option>
{% endfor %}
</select>
</div>
<div class="form-group ">
<label class="control-label required" for="scrum_category">
bloque / débloque le ticket n°
<span class="mandatory">*</span>
</label>
<select id="block" class="form-control">
<option value="" selected></option>
{% for issue in scrum.scrumissues %}
<option value="{{issue.giteanumber}}">#{{issue.giteanumber}} = {{issue.giteatitle}}</option>
{% endfor %}
</select>
</div>
<button onClick="lock()" class="btn btn-success">Bloque</button>
<button onClick="unlock()" class="btn btn-success">Débloque</button>
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$("#issue").select2();
$("#block").select2();
});
function lock() {
console.log($("#issue").val());
console.log($("#block").val());
$.ajax({
method: "POST",
url: "{{path("app_scrumissue_block")}}",
data: {
id:$("#issue").val(),
issueblocked:$("#block").val(),
},
success: function(data) {
}
});
}
function unlock() {
$.ajax({
method: "POST",
url: "{{path("app_scrumissue_unblock")}}",
data: {
id:$("#issue").val(),
},
success: function(data) {
}
});
}
{% endblock %}