Skip to content

Commit

Permalink
[framework] removed misleading list of url addresses in administratio…
Browse files Browse the repository at this point in the history
…n (#2782)
  • Loading branch information
grossmannmartin authored Sep 13, 2023
1 parent c59b390 commit 0f8460e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 43 deletions.
42 changes: 1 addition & 41 deletions src/Controller/Admin/SuperadminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace Shopsys\FrameworkBundle\Controller\Admin;

use Shopsys\FrameworkBundle\Component\Domain\AdminDomainTabsFacade;
use Shopsys\FrameworkBundle\Component\Grid\ArrayDataSource;
use Shopsys\FrameworkBundle\Component\Grid\GridFactory;
use Shopsys\FrameworkBundle\Component\Router\LocalizedRouterFactory;
use Shopsys\FrameworkBundle\Form\Admin\Module\ModulesFormType;
use Shopsys\FrameworkBundle\Form\Admin\Superadmin\InputPriceTypeFormType;
Expand All @@ -21,7 +19,6 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\RequestContext;

class SuperadminController extends AdminBaseController
{
Expand All @@ -30,7 +27,6 @@ class SuperadminController extends AdminBaseController
* @param \Shopsys\FrameworkBundle\Model\Module\ModuleFacade $moduleFacade
* @param \Shopsys\FrameworkBundle\Model\Pricing\PricingSetting $pricingSetting
* @param \Shopsys\FrameworkBundle\Model\Pricing\DelayedPricingSetting $delayedPricingSetting
* @param \Shopsys\FrameworkBundle\Component\Grid\GridFactory $gridFactory
* @param \Shopsys\FrameworkBundle\Model\Localization\Localization $localization
* @param \Shopsys\FrameworkBundle\Component\Router\LocalizedRouterFactory $localizedRouterFactory
* @param \Shopsys\FrameworkBundle\Model\Mail\Setting\MailSettingFacade $mailSettingFacade
Expand All @@ -42,7 +38,6 @@ public function __construct(
protected readonly ModuleFacade $moduleFacade,
protected readonly PricingSetting $pricingSetting,
protected readonly DelayedPricingSetting $delayedPricingSetting,
protected readonly GridFactory $gridFactory,
protected readonly Localization $localization,
protected readonly LocalizedRouterFactory $localizedRouterFactory,
protected readonly MailSettingFacade $mailSettingFacade,
Expand Down Expand Up @@ -95,42 +90,7 @@ public function pricingAction(Request $request)
*/
public function urlsAction()
{
$allLocales = $this->localization->getLocalesOfAllDomains();
$dataSource = new ArrayDataSource($this->loadDataForUrls($allLocales));

$grid = $this->gridFactory->create('urlsList', $dataSource);

foreach ($allLocales as $locale) {
$grid->addColumn($locale, $locale, $this->localization->getLanguageName($locale));
}

return $this->render('@ShopsysFramework/Admin/Content/Superadmin/urlsListGrid.html.twig', [
'gridView' => $grid->createView(),
]);
}

/**
* @param array $locales
* @return array
*/
protected function loadDataForUrls(array $locales)
{
$data = [];
$requestContext = new RequestContext();

foreach ($locales as $locale) {
$rowIndex = 0;
$allRoutes = $this->localizedRouterFactory->getRouter($locale, $requestContext)
->getRouteCollection()
->all();

foreach ($allRoutes as $route) {
$data[$rowIndex][$locale] = $route->getPath();
$rowIndex++;
}
}

return $data;
return $this->render('@ShopsysFramework/Admin/Content/Superadmin/urlsListGrid.html.twig');
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/translations/messages.cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -2251,6 +2251,9 @@ msgstr "Obchodní podmínky"
msgid "The change will be applied to products in 10 minutes"
msgstr "Změna se u zboží projeví do 10 minut"

msgid "The current list of URL addresses can be found in the project's repository in the \"storefront/config/staticRewritePaths.js\" file."
msgstr "Aktuální seznam URL adres lze nalézt v repozitáři projektu v souboru \"storefront/config/staticRewritePaths.js\"."

msgid "The higher the priority, the higher the country will be shown in the listings. Countries with the same priority will be sorted alphabetically."
msgstr "Čím vyšší priorita, tím bude stát zobrazen výše v seznamech. Státy se stejnou prioritou budou seřazeny abecedně."

Expand Down
3 changes: 3 additions & 0 deletions src/Resources/translations/messages.en.po
Original file line number Diff line number Diff line change
Expand Up @@ -2251,6 +2251,9 @@ msgstr ""
msgid "The change will be applied to products in 10 minutes"
msgstr ""

msgid "The current list of URL addresses can be found in the project's repository in the \"storefront/config/staticRewritePaths.js\" file."
msgstr ""

msgid "The higher the priority, the higher the country will be shown in the listings. Countries with the same priority will be sorted alphabetically."
msgstr ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
{% block h1 %}{{ 'URL addresses'|trans }}{% endblock %}

{% block main_content %}
{{ gridView.render() }}
{% endblock%}
{{ 'The current list of URL addresses can be found in the project\'s repository in the "storefront/config/staticRewritePaths.js" file.'|trans }}
{% endblock%}

0 comments on commit 0f8460e

Please sign in to comment.