class Cloner
{
-
/**
* @var PageRepo
*/
$directChildren = $original->getDirectChildren();
foreach ($directChildren as $child) {
-
if ($child instanceof Chapter && userCan('chapter-create', $copyBook)) {
$this->cloneChapter($child, $copyBook, $child->name);
}
return $tags;
}
-
-}
\ No newline at end of file
+}
session()->flashInput(['name' => $chapter->name]);
return view('chapters.copy', [
- 'book' => $chapter->book,
+ 'book' => $chapter->book,
'chapter' => $chapter,
]);
}
if (is_null($newParentBook)) {
$this->showErrorNotification(trans('errors.selected_book_not_found'));
+
return redirect()->back();
}
if (is_null($newParent)) {
$this->showErrorNotification(trans('errors.selected_book_chapter_not_found'));
+
return redirect()->back();
}
$resp->assertOk();
$resp->assertSee('Copy Chapter');
$resp->assertElementExists("input[name=\"name\"][value=\"{$chapter->name}\"]");
- $resp->assertElementExists("input[name=\"entity_selection\"]");
+ $resp->assertElementExists('input[name="entity_selection"]');
}
public function test_copy()
$otherBook = Book::query()->where('id', '!=', $chapter->book_id)->first();
$resp = $this->asEditor()->post($chapter->getUrl('/copy'), [
- 'name' => 'My copied chapter',
+ 'name' => 'My copied chapter',
'entity_selection' => 'book:' . $otherBook->id,
]);
$role = Role::query()->first();
$resp = $this->asAdmin()->get("/settings/roles/new?copy_from={$role->id}");
$resp->assertOk();
- $resp->assertElementExists('input[name="display_name"][value="' . ($role->display_name . ' (Copy)') . '"]');
+ $resp->assertElementExists('input[name="display_name"][value="' . ($role->display_name . ' (Copy)') . '"]');
}
public function test_manage_user_permission()