Other various changes
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Controller;
|
||||
|
||||
use App\Entity\Note;
|
||||
use App\Entity\User;
|
||||
use App\Entity\SharedNote;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -17,9 +18,9 @@ class DefaultController extends AbstractController
|
||||
public function index(): Response
|
||||
{
|
||||
if ($this->isGranted('IS_AUTHENTICATED_FULLY')) {
|
||||
return $this->redirect('/index.php/home');
|
||||
return $this->redirect('/home');
|
||||
}
|
||||
return $this->render('default/index.html.twig');
|
||||
return $this->render('default/index.html.twig', ['onLoad' => null]);
|
||||
}
|
||||
|
||||
#[Route('/home', name: 'app_home')]
|
||||
@@ -31,6 +32,7 @@ class DefaultController extends AbstractController
|
||||
$meta = $user->getMetaData();
|
||||
|
||||
return $this->render('default/home.html.twig', [
|
||||
'onLoad' => 'setHeight()',
|
||||
'last4Notes' => $last4Notes,
|
||||
'reverseNoteSort' => $openNotes,
|
||||
'isAdmin' => $this->isGranted('ROLE_ADMIN'),
|
||||
@@ -45,7 +47,7 @@ class DefaultController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/profile', name: 'app_profile')]
|
||||
public function profile(): Response
|
||||
public function profile(EntityManagerInterface $emi): Response
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
@@ -55,6 +57,7 @@ class DefaultController extends AbstractController
|
||||
$meta = $user->getMetaData();
|
||||
if (!$meta) {
|
||||
$meta = [
|
||||
'onLoad' => null,
|
||||
'saveInterval' => 15,
|
||||
'saveReferences' => 'checked',
|
||||
'noteTextSize' => 12,
|
||||
@@ -67,8 +70,16 @@ class DefaultController extends AbstractController
|
||||
$meta['trackSaveSize'] = $meta['trackSaveSize'] ? 'checked' : null;
|
||||
}
|
||||
|
||||
$sharedWithMe = $emi->getRepository(SharedNote::class)->getNotesSharedWithMe($user);
|
||||
$shared = $emi->getRepository(SharedNote::class)->getNotesSharedByMe($user);
|
||||
dump($shared);
|
||||
|
||||
return $this->render('default/profile.html.twig', [
|
||||
'onLoad' => 'rollUp("user");rollUp("settings")',
|
||||
'meta' => $meta,
|
||||
'sharedWithMe' => $sharedWithMe,
|
||||
'shared' => $shared,
|
||||
'user' => $this->getUser(),
|
||||
]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user