Skip to content

Commit

Permalink
Fix: fisharebest#3455 - no names for new records, select2 not re-init…
Browse files Browse the repository at this point in the history
…ialised correctly
  • Loading branch information
fisharebest committed Aug 5, 2020
1 parent 42f3c8e commit edbd59d
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 10 deletions.
4 changes: 3 additions & 1 deletion app/Http/RequestHandlers/CreateMediaObjectAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* webtrees: online genealogy
* Copyright (C) 2019 webtrees development team
* Copyright (C) 2020 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -20,6 +20,7 @@
namespace Fisharebest\Webtrees\Http\RequestHandlers;

use Fig\Http\Message\StatusCodeInterface;
use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Services\MediaFileService;
use Fisharebest\Webtrees\Services\PendingChangesService;
Expand Down Expand Up @@ -90,6 +91,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}

$record = $tree->createMediaObject($gedcom);
$record = Factory::media()->new($record->xref(), $record->gedcom(), null, $tree);

// Accept the new record to keep the filesystem synchronized with the genealogy.
$this->pending_changes_service->acceptRecord($record);
Expand Down
4 changes: 3 additions & 1 deletion app/Http/RequestHandlers/CreateNoteAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* webtrees: online genealogy
* Copyright (C) 2019 webtrees development team
* Copyright (C) 2020 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -19,6 +19,7 @@

namespace Fisharebest\Webtrees\Http\RequestHandlers;

use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -61,6 +62,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}

$record = $tree->createRecord($gedcom);
$record = Factory::note()->new($record->xref(), $record->gedcom(), null, $tree);

// id and text are for select2 / autocomplete
// html is for interactive modals
Expand Down
4 changes: 3 additions & 1 deletion app/Http/RequestHandlers/CreateRepositoryAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* webtrees: online genealogy
* Copyright (C) 2019 webtrees development team
* Copyright (C) 2020 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -19,6 +19,7 @@

namespace Fisharebest\Webtrees\Http\RequestHandlers;

use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -66,6 +67,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}

$record = $tree->createRecord($gedcom);
$record = Factory::repository()->new($record->xref(), $record->gedcom(), null, $tree);

// id and text are for select2 / autocomplete
// html is for interactive modals
Expand Down
4 changes: 3 additions & 1 deletion app/Http/RequestHandlers/CreateSourceAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* webtrees: online genealogy
* Copyright (C) 2019 webtrees development team
* Copyright (C) 2020 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -19,6 +19,7 @@

namespace Fisharebest\Webtrees\Http\RequestHandlers;

use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -99,6 +100,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}

$record = $tree->createRecord($gedcom);
$record = Factory::source()->new($record->xref(), $record->gedcom(), null, $tree);

// id and text are for select2 / autocomplete
// html is for interactive modals
Expand Down
4 changes: 3 additions & 1 deletion app/Http/RequestHandlers/CreateSubmitterAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* webtrees: online genealogy
* Copyright (C) 2019 webtrees development team
* Copyright (C) 2020 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
Expand All @@ -19,6 +19,7 @@

namespace Fisharebest\Webtrees\Http\RequestHandlers;

use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;
use Psr\Http\Message\ResponseInterface;
Expand Down Expand Up @@ -66,6 +67,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}

$record = $tree->createRecord($gedcom);
$record = Factory::submitter()->new($record->xref(), $record->gedcom(), null, $tree);

return response([
'id' => $record->xref(),
Expand Down
10 changes: 9 additions & 1 deletion resources/views/modals/create-media-object.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

use Fisharebest\Webtrees\Http\RequestHandlers\CreateMediaObjectAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;

/**
* @var string $max_upload_size
* @var array<string> $media_types
* @var Tree $tree
* @var array<string> $unused_files
*/

?>

Expand Down Expand Up @@ -41,7 +49,7 @@ use Fisharebest\Webtrees\I18N;
option.innerHTML = option.innerText;

$(select)
.select2()
.select2({ escapeMarkup: (x) => x })
.empty()
.append(option)
.trigger("change");
Expand Down
7 changes: 6 additions & 1 deletion resources/views/modals/create-note-object.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

use Fisharebest\Webtrees\Http\RequestHandlers\CreateNoteAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;

/**
* @var Tree $tree
*/

?>

Expand Down Expand Up @@ -42,7 +47,7 @@ use Fisharebest\Webtrees\I18N;
option.innerHTML = data.text;

$(select)
.select2()
.select2({ escapeMarkup: (x) => x })
.empty()
.append(option)
.trigger("change");
Expand Down
7 changes: 6 additions & 1 deletion resources/views/modals/create-repository.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

use Fisharebest\Webtrees\Http\RequestHandlers\CreateRepositoryAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;

/**
* @var Tree $tree
*/

?>

Expand Down Expand Up @@ -41,7 +46,7 @@ use Fisharebest\Webtrees\I18N;
option.innerHTML = option.innerText;

$(select)
.select2()
.select2({ escapeMarkup: (x) => x })
.empty()
.append(option)
.trigger("change");
Expand Down
7 changes: 6 additions & 1 deletion resources/views/modals/create-source.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

use Fisharebest\Webtrees\Http\RequestHandlers\CreateSourceAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;

/**
* @var Tree $tree
*/

?>

Expand Down Expand Up @@ -41,7 +46,7 @@ use Fisharebest\Webtrees\I18N;
option.innerHTML = option.innerText;

$(select)
.select2()
.select2({ escapeMarkup: (x) => x })
.empty()
.append(option)
.trigger("change");
Expand Down
7 changes: 6 additions & 1 deletion resources/views/modals/create-submitter.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

use Fisharebest\Webtrees\Http\RequestHandlers\CreateSubmitterAction;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Tree;

/**
* @var Tree $tree
*/

?>

Expand Down Expand Up @@ -41,7 +46,7 @@ use Fisharebest\Webtrees\I18N;
option.innerHTML = option.innerText;

$(select)
.select2()
.select2({ escapeMarkup: (x) => x })
.empty()
.append(option)
.trigger("change");
Expand Down

0 comments on commit edbd59d

Please sign in to comment.