mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-03-31 17:15:38 +00:00
rename page to article
This commit is contained in:
parent
649838d4ee
commit
c747166a30
43 changed files with 597 additions and 597 deletions
|
|
@ -10,14 +10,14 @@ use Symfony\Component\HttpFoundation\Response;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use App\Service\UserService;
|
||||
use App\Service\PageService;
|
||||
use App\Service\ArticleService;
|
||||
use App\Service\TorrentService;
|
||||
|
||||
class PageController extends AbstractController
|
||||
class ArticleController extends AbstractController
|
||||
{
|
||||
#[Route(
|
||||
'/{_locale}/page/{id}',
|
||||
name: 'page_info',
|
||||
'/{_locale}/article/{id}',
|
||||
name: 'article_info',
|
||||
requirements:
|
||||
[
|
||||
'id' => '\d+'
|
||||
|
|
@ -38,14 +38,14 @@ class PageController extends AbstractController
|
|||
$request->getClientIp()
|
||||
);
|
||||
|
||||
return $this->render('default/page/info.html.twig', [
|
||||
return $this->render('default/article/info.html.twig', [
|
||||
'title' => 'test'
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route(
|
||||
'/{_locale}/submit/page',
|
||||
name: 'page_submit',
|
||||
'/{_locale}/submit/article',
|
||||
name: 'article_submit',
|
||||
methods:
|
||||
[
|
||||
'GET',
|
||||
|
|
@ -56,8 +56,8 @@ class PageController extends AbstractController
|
|||
Request $request,
|
||||
TranslatorInterface $translator,
|
||||
UserService $userService,
|
||||
PageService $pageService,
|
||||
PageService $torrentService
|
||||
ArticleService $articleService,
|
||||
ArticleService $torrentService
|
||||
): Response
|
||||
{
|
||||
// Init user
|
||||
|
|
@ -91,12 +91,12 @@ class PageController extends AbstractController
|
|||
'attribute' =>
|
||||
[
|
||||
'value' => $request->get('title'),
|
||||
'minlength' => $this->getParameter('app.page.title.length.min'),
|
||||
'maxlength' => $this->getParameter('app.page.title.length.max'),
|
||||
'minlength' => $this->getParameter('app.article.title.length.min'),
|
||||
'maxlength' => $this->getParameter('app.article.title.length.max'),
|
||||
'placeholder' => sprintf(
|
||||
$translator->trans('Page title (%s-%s chars)'),
|
||||
number_format($this->getParameter('app.page.title.length.min')),
|
||||
number_format($this->getParameter('app.page.title.length.max'))
|
||||
$translator->trans('Article title (%s-%s chars)'),
|
||||
number_format($this->getParameter('app.article.title.length.min')),
|
||||
number_format($this->getParameter('app.article.title.length.max'))
|
||||
),
|
||||
]
|
||||
],
|
||||
|
|
@ -106,12 +106,12 @@ class PageController extends AbstractController
|
|||
'attribute' =>
|
||||
[
|
||||
'value' => $request->get('description'),
|
||||
'minlength' => $this->getParameter('app.page.description.length.min'),
|
||||
'maxlength' => $this->getParameter('app.page.description.length.max'),
|
||||
'minlength' => $this->getParameter('app.article.description.length.min'),
|
||||
'maxlength' => $this->getParameter('app.article.description.length.max'),
|
||||
'placeholder' => sprintf(
|
||||
$translator->trans('Page description (%s-%s chars)'),
|
||||
number_format($this->getParameter('app.page.description.length.min')),
|
||||
number_format($this->getParameter('app.page.description.length.max'))
|
||||
$translator->trans('Article description (%s-%s chars)'),
|
||||
number_format($this->getParameter('app.article.description.length.min')),
|
||||
number_format($this->getParameter('app.article.description.length.max'))
|
||||
),
|
||||
]
|
||||
],
|
||||
|
|
@ -144,24 +144,24 @@ class PageController extends AbstractController
|
|||
}
|
||||
|
||||
/// Title
|
||||
if (mb_strlen($request->get('title')) < $this->getParameter('app.page.title.length.min') ||
|
||||
mb_strlen($request->get('title')) > $this->getParameter('app.page.title.length.max'))
|
||||
if (mb_strlen($request->get('title')) < $this->getParameter('app.article.title.length.min') ||
|
||||
mb_strlen($request->get('title')) > $this->getParameter('app.article.title.length.max'))
|
||||
{
|
||||
$form['title']['error'][] = sprintf(
|
||||
$translator->trans('Page title out of %s-%s chars'),
|
||||
number_format($this->getParameter('app.page.title.length.min')),
|
||||
number_format($this->getParameter('app.page.title.length.max'))
|
||||
$translator->trans('Article title out of %s-%s chars'),
|
||||
number_format($this->getParameter('app.article.title.length.min')),
|
||||
number_format($this->getParameter('app.article.title.length.max'))
|
||||
);
|
||||
}
|
||||
|
||||
/// Description
|
||||
if (mb_strlen($request->get('description')) < $this->getParameter('app.page.description.length.min') ||
|
||||
mb_strlen($request->get('description')) > $this->getParameter('app.page.description.length.max'))
|
||||
if (mb_strlen($request->get('description')) < $this->getParameter('app.article.description.length.min') ||
|
||||
mb_strlen($request->get('description')) > $this->getParameter('app.article.description.length.max'))
|
||||
{
|
||||
$form['description']['error'][] = sprintf(
|
||||
$translator->trans('Page description out of %s-%s chars'),
|
||||
number_format($this->getParameter('app.page.description.length.min')),
|
||||
number_format($this->getParameter('app.page.description.length.max'))
|
||||
$translator->trans('Article description out of %s-%s chars'),
|
||||
number_format($this->getParameter('app.article.description.length.min')),
|
||||
number_format($this->getParameter('app.article.description.length.max'))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -212,7 +212,7 @@ class PageController extends AbstractController
|
|||
empty($form['torrents']['error'])
|
||||
)
|
||||
{
|
||||
$page = $pageService->submit(
|
||||
$article = $articleService->submit(
|
||||
$user->getId(),
|
||||
time(),
|
||||
(string) $request->get('locale'),
|
||||
|
|
@ -225,17 +225,17 @@ class PageController extends AbstractController
|
|||
|
||||
// Redirect
|
||||
return $this->redirectToRoute(
|
||||
'page_info',
|
||||
'article_info',
|
||||
[
|
||||
'_locale' => $request->get('_locale'),
|
||||
'id' => $page->getId()
|
||||
'id' => $article->getId()
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->render(
|
||||
'default/page/submit.html.twig',
|
||||
'default/article/submit.html.twig',
|
||||
[
|
||||
'locales' => explode('|', $this->getParameter('app.locales')),
|
||||
'form' => $form,
|
||||
|
|
@ -9,7 +9,7 @@ use Symfony\Component\HttpFoundation\Response;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
use App\Service\UserService;
|
||||
use App\Service\PageService;
|
||||
use App\Service\ArticleService;
|
||||
use App\Service\TorrentService;
|
||||
|
||||
class SearchController extends AbstractController
|
||||
|
|
@ -25,7 +25,7 @@ class SearchController extends AbstractController
|
|||
public function index(
|
||||
Request $request,
|
||||
UserService $userService,
|
||||
PageService $pageService,
|
||||
ArticleService $articleService,
|
||||
TorrentService $torrentService
|
||||
): Response
|
||||
{
|
||||
|
|
@ -34,11 +34,11 @@ class SearchController extends AbstractController
|
|||
$request->getClientIp()
|
||||
);
|
||||
|
||||
$page = $request->query->get('page') ? (int) $request->query->get('page') : 1;
|
||||
$article = $request->query->get('article') ? (int) $request->query->get('article') : 1;
|
||||
|
||||
switch ($request->query->get('type'))
|
||||
{
|
||||
case 'page':
|
||||
case 'article':
|
||||
|
||||
break;
|
||||
case 'torrent':
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class TorrentController extends AbstractController
|
|||
$torrent->getId()
|
||||
)
|
||||
],
|
||||
'pages' => [],
|
||||
'articles' => [],
|
||||
'contributors' => $contributors
|
||||
],
|
||||
'file' =>
|
||||
|
|
@ -282,7 +282,7 @@ class TorrentController extends AbstractController
|
|||
$user->isApproved()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'torrent_info',
|
||||
[
|
||||
|
|
@ -465,7 +465,7 @@ class TorrentController extends AbstractController
|
|||
$user->isApproved()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'torrent_info',
|
||||
[
|
||||
|
|
@ -544,7 +544,7 @@ class TorrentController extends AbstractController
|
|||
$torrentLocales->getId()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'torrent_locales_edit',
|
||||
[
|
||||
|
|
@ -606,7 +606,7 @@ class TorrentController extends AbstractController
|
|||
$torrentLocales->getId()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'torrent_locales_edit',
|
||||
[
|
||||
|
|
@ -751,7 +751,7 @@ class TorrentController extends AbstractController
|
|||
$user->isApproved()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'torrent_info',
|
||||
[
|
||||
|
|
@ -828,7 +828,7 @@ class TorrentController extends AbstractController
|
|||
$torrentSensitive->getId()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'torrent_sensitive_edit',
|
||||
[
|
||||
|
|
@ -890,7 +890,7 @@ class TorrentController extends AbstractController
|
|||
$torrentSensitive->getId()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'torrent_sensitive_edit',
|
||||
[
|
||||
|
|
@ -947,7 +947,7 @@ class TorrentController extends AbstractController
|
|||
time()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'torrent_info',
|
||||
[
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
|
||||
use App\Service\ActivityService;
|
||||
use App\Service\UserService;
|
||||
use App\Service\PageService;
|
||||
use App\Service\ArticleService;
|
||||
use App\Service\TorrentService;
|
||||
|
||||
class UserController extends AbstractController
|
||||
|
|
@ -300,7 +300,7 @@ class UserController extends AbstractController
|
|||
time()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'user_info',
|
||||
[
|
||||
|
|
@ -352,7 +352,7 @@ class UserController extends AbstractController
|
|||
$userTarget->getId()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'user_info',
|
||||
[
|
||||
|
|
@ -404,7 +404,7 @@ class UserController extends AbstractController
|
|||
$userTarget->getId()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'user_info',
|
||||
[
|
||||
|
|
@ -430,7 +430,7 @@ class UserController extends AbstractController
|
|||
Request $request,
|
||||
TranslatorInterface $translator,
|
||||
UserService $userService,
|
||||
PageService $pageService,
|
||||
ArticleService $articleService,
|
||||
TorrentService $torrentService
|
||||
): Response
|
||||
{
|
||||
|
|
@ -477,7 +477,7 @@ class UserController extends AbstractController
|
|||
$userTarget->getId()
|
||||
);
|
||||
|
||||
// Redirect to info page created
|
||||
// Redirect to info article created
|
||||
return $this->redirectToRoute(
|
||||
'user_info',
|
||||
[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue