|
|
@ -38,11 +38,12 @@ class EditorController {
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @return ViewHttpResponse the editor view for a test tactic.
|
|
|
|
* @return ViewHttpResponse the editor view for a test tactic.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private function openTestEditor(): ViewHttpResponse {
|
|
|
|
private function openTestEditor(CourtType $courtType): ViewHttpResponse {
|
|
|
|
return ViewHttpResponse::react("views/Editor.tsx", [
|
|
|
|
return ViewHttpResponse::react("views/Editor.tsx", [
|
|
|
|
"id" => -1, //-1 id means that the editor will not support saves
|
|
|
|
"id" => -1, //-1 id means that the editor will not support saves
|
|
|
|
"content" => '{"players": []}',
|
|
|
|
|
|
|
|
"name" => TacticModel::TACTIC_DEFAULT_NAME,
|
|
|
|
"name" => TacticModel::TACTIC_DEFAULT_NAME,
|
|
|
|
|
|
|
|
"content" => '{"players": []}',
|
|
|
|
|
|
|
|
"courtType" => $courtType->name()
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -55,6 +56,13 @@ class EditorController {
|
|
|
|
* @return ViewHttpResponse the editor view
|
|
|
|
* @return ViewHttpResponse the editor view
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function createNewOfKind(CourtType $type, SessionHandle $session): ViewHttpResponse {
|
|
|
|
public function createNewOfKind(CourtType $type, SessionHandle $session): ViewHttpResponse {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$action = $session->getAccount();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($action == null) {
|
|
|
|
|
|
|
|
return $this->openTestEditor($type);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$tactic = $this->model->makeNewDefault($session->getAccount()->getId(), $type);
|
|
|
|
$tactic = $this->model->makeNewDefault($session->getAccount()->getId(), $type);
|
|
|
|
return $this->openEditorFor($tactic);
|
|
|
|
return $this->openEditorFor($tactic);
|
|
|
|
}
|
|
|
|
}
|
|
|
|