Restored seeder and fixed scroll on firefox

This commit is contained in:
Dan Brown 2017-09-10 13:29:48 +01:00
parent c1627a1468
commit 9dfbea8bf9
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
2 changed files with 7 additions and 7 deletions

View File

@ -15,13 +15,13 @@ class DummyContentSeeder extends Seeder
$role = \BookStack\Role::getRole('editor');
$user->attachRole($role);
factory(\BookStack\Book::class, 20)->create(['created_by' => $user->id, 'updated_by' => $user->id])
->each(function($book) use ($user) {
$chapters = factory(\BookStack\Chapter::class, 5)->create(['created_by' => $user->id, 'updated_by' => $user->id])->each(function($chapter) use ($user, $book) {
$pages = factory(\BookStack\Page::class, 5)->create(['created_by' => $user->id, 'updated_by' => $user->id, 'book_id' => $book->id]);
$chapter->pages()->saveMany($pages);
});
$chapters = factory(\BookStack\Chapter::class, 5)->create(['created_by' => $user->id, 'updated_by' => $user->id])
->each(function($chapter) use ($user, $book){
$pages = factory(\BookStack\Page::class, 5)->make(['created_by' => $user->id, 'updated_by' => $user->id, 'book_id' => $book->id]);
$chapter->pages()->saveMany($pages);
});
$pages = factory(\BookStack\Page::class, 3)->make(['created_by' => $user->id, 'updated_by' => $user->id]);
$book->chapters()->saveMany($chapters);
$book->pages()->saveMany($pages);
@ -32,7 +32,6 @@ class DummyContentSeeder extends Seeder
$chapters = factory(\BookStack\Chapter::class, 50)->make(['created_by' => $user->id, 'updated_by' => $user->id]);
$largeBook->pages()->saveMany($pages);
$largeBook->chapters()->saveMany($chapters);
app(\BookStack\Services\PermissionService::class)->buildJointPermissions();
app(\BookStack\Services\SearchService::class)->indexAllEntities();
}

View File

@ -93,7 +93,8 @@ Controllers(ngApp, window.$events);
*/
window.scrollToElement = function(element) {
if (!element) return;
let top = element.getBoundingClientRect().top + document.body.scrollTop;
let offset = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
let top = element.getBoundingClientRect().top + offset;
$('html, body').animate({
scrollTop: top - 60 // Adjust to change final scroll position top margin
}, 300);