Skip to content

Commit

Permalink
minor rewrites
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinDev committed Feb 4, 2021
1 parent 4e12430 commit 775d44b
Show file tree
Hide file tree
Showing 17 changed files with 228 additions and 113 deletions.
2 changes: 1 addition & 1 deletion docs/feed.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<rss xmlns:dc=http://purl.org/dc/elements/1.1/ xmlns:atom=http://www.w3.org/2005/Atom version=2.0><channel><title>Pushword - Modern CMS to build rapidly Websites (powered by Symfony)</title> <link>https://pushword.piedweb.com/ <description></description> <link href=https://pushword.piedweb.com/feed.xml rel=self type=application/rss+xml> <item><title></title> <link>https://pushword.piedweb.com/architecture <guid>https://pushword.piedweb.com/architecture</guid> <pubdate>Tue, 02 Feb 2021 10:18:28 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/command <guid>https://pushword.piedweb.com/command</guid> <pubdate>Tue, 02 Feb 2021 10:18:28 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/component/entity-filter <guid>https://pushword.piedweb.com/component/entity-filter</guid> <pubdate>Tue, 02 Feb 2021 10:18:28 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/configuration <guid>https://pushword.piedweb.com/configuration</guid> <pubdate>Tue, 02 Feb 2021 10:18:28 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/contribute <guid>https://pushword.piedweb.com/contribute</guid> <pubdate>Tue, 02 Feb 2021 10:18:28 +0100</pubdate></item></channel> </rss>
<rss xmlns:dc=http://purl.org/dc/elements/1.1/ xmlns:atom=http://www.w3.org/2005/Atom version=2.0><channel><title>Pushword - Modern CMS to build rapidly Websites (powered by Symfony)</title> <link>https://pushword.piedweb.com/ <description></description> <link href=https://pushword.piedweb.com/feed.xml rel=self type=application/rss+xml> <item><title></title> <link>https://pushword.piedweb.com/architecture <guid>https://pushword.piedweb.com/architecture</guid> <pubdate>Thu, 04 Feb 2021 15:09:12 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/command <guid>https://pushword.piedweb.com/command</guid> <pubdate>Thu, 04 Feb 2021 15:09:12 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/component/entity-filter <guid>https://pushword.piedweb.com/component/entity-filter</guid> <pubdate>Thu, 04 Feb 2021 15:09:12 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/configuration <guid>https://pushword.piedweb.com/configuration</guid> <pubdate>Thu, 04 Feb 2021 15:09:12 +0100</pubdate></item> <item><title></title> <link>https://pushword.piedweb.com/contribute <guid>https://pushword.piedweb.com/contribute</guid> <pubdate>Thu, 04 Feb 2021 15:09:12 +0100</pubdate></item></channel> </rss>
4 changes: 1 addition & 3 deletions docs/roadmap.html

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions docs/sitemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,118 +2,118 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://pushword.piedweb.com/architecture</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/command</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/component/entity-filter</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/configuration</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/contribute</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/create-extension</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/editor</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/admin-block-editor</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/admin</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/conversation</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/facebook</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/flat</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/page-scanner</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/page-update-notifier</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/static-generator</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/svg</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/template-editor</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extension/version</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/extensions</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/installation</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/license</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/manage-assets</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/override-theme</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/roadmap</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/search.json</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/themes</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
<url>
<loc>https://pushword.piedweb.com/upgrade</loc>
<lastmod>2021-02-02</lastmod>
<lastmod>2021-02-04</lastmod>
</url>
</urlset>
4 changes: 1 addition & 3 deletions packages/core/src/Controller/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;

class MediaController extends AbstractController
final class MediaController extends AbstractController
{
protected $translator;

public function download(string $path)
{
$projectDir = $this->get('kernel')->getProjectDir();
Expand Down
30 changes: 12 additions & 18 deletions packages/core/src/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,28 @@
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment as Twig;

class PageController extends AbstractController
final class PageController extends AbstractController
{
/**
* @var ParameterBagInterface
*/
protected $params;
use RenderTrait;

private ParameterBagInterface $params;

/** @var AppPool */
protected $apps;
private AppPool $apps;

/** @var AppConfig */
protected $app;
private $app;

/** @var Twig */
protected $twig;
private Twig $twig;

/** @var */
protected $em;
private EntityManagerInterface $em;

public function __construct(
ParameterBagInterface $params,
Twig $twig,
EntityManagerInterface $em,
AppPool $apps
) {
$this->em = $em;
$this->params = $params;
$this->twig = $twig;
$this->apps = $apps;
}

Expand Down Expand Up @@ -76,7 +70,7 @@ public function show(?string $slug, string $host = '', Request $request): Respon
return $this->render($view, $params, $response);
}

protected function getView(string $path): string
private function getView(string $path): string
{
return $this->app->getView($path, $this->twig);
}
Expand Down Expand Up @@ -183,7 +177,7 @@ private function getPageRepository()
return Repository::getPageRepository($this->em, $this->params->get('pw.entity_page'));
}

protected function setApp($host): void
private function setApp($host): void
{
$this->app = $this->apps->switchCurrentApp($host)->get();
}
Expand Down Expand Up @@ -230,12 +224,12 @@ private function getPage(?string &$slug, string $host = '', bool $throwException
return $page;
}

protected function noramlizeSlug($slug): string
private function noramlizeSlug($slug): string
{
return (null === $slug || '' === $slug) ? 'homepage' : rtrim(strtolower($slug), '/');
}

protected function checkIfUriIsCanonical(Request $request, Page $page)
private function checkIfUriIsCanonical(Request $request, Page $page)
{
$real = $request->getRequestUri();

Expand Down
25 changes: 25 additions & 0 deletions packages/core/src/Controller/RenderTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace Pushword\Core\Controller;

use Twig\Environment as Twig;

trait RenderTrait
{
private Twig $twig;

/** @required */
public function setTwig(Twig $twig)
{
$this->twig = $twig;
}

/**
* Returns a rendered view.
* Use by abstract controller without de deprecation message.
*/
protected function renderView(string $view, array $parameters = []): string
{
return $this->twig->render($view, $parameters);
}
}
2 changes: 1 addition & 1 deletion packages/core/src/Controller/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;

class UserController extends AbstractController
final class UserController extends AbstractController
{
public function login(AuthenticationUtils $authenticationUtils): Response
{
Expand Down
116 changes: 116 additions & 0 deletions packages/core/src/templates/component/pager.html.twig~
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{# todo: drop pagerfanta #}
{%- block pager_widget -%}
<nav role="navigation" class="flex items-center justify-between"><div class="flex items-center justify-between flex-1"><div><span class="relative z-0 inline-flex shadow-sm">
{{- block('pager') -}}
</nav>
{%- endblock pager_widget -%}

{%- block pager -%}
{# Previous Page Link #}
{%- if pagerfanta.hasPreviousPage() -%}
{%- set path = route_generator.route(pagerfanta.getPreviousPage()) -%}
{{- block('previous_page_link') -}}
{%- else -%}
{{- block('previous_page_link_disabled') -}}
{%- endif -%}

{# First Page Link #}
{%- if start_page > 1 -%}
{%- set page = 1 -%}
{%- set path = route_generator.route(page) -%}
{{- block('page_link') -}}
{%- endif -%}

{# Second Page Link, displays if we are on page 3 #}
{%- if start_page == 3 -%}
{%- set page = 2 -%}
{%- set path = route_generator.route(page) -%}
{{- block('page_link') -}}
{%- endif -%}

{# Separator, creates a "..." separator to limit the number of items if we are starting beyond page 3 #}
{%- if start_page > 3 -%}
{{- block('ellipsis') -}}
{%- endif -%}

{# Page Links #}
{%- for page in range(start_page, end_page) -%}
{%- set path = route_generator.route(page) -%}
{%- if page == current_page -%}
{{- block('current_page_link') -}}
{%- else -%}
{{- block('page_link') -}}
{%- endif -%}
{%- endfor -%}

{# Separator, creates a "..." separator to limit the number of items if we are over 3 pages away from the last page #}
{%- if end_page < (nb_pages - 2) -%}
{{- block('ellipsis') -}}
{%- endif -%}

{# Second to Last Page Link, displays if we are on the third from last page #}
{%- if end_page == (nb_pages - 2) -%}
{%- set page = (nb_pages - 1) -%}
{%- set path = route_generator.route(page) -%}
{{- block('page_link') -}}
{%- endif -%}

{# Last Page Link #}
{%- if nb_pages > end_page -%}
{%- set page = nb_pages -%}
{%- set path = route_generator.route(page) -%}
{{- block('page_link') -}}
{%- endif -%}

{# Next Page Link #}
{%- if pagerfanta.hasNextPage() -%}
{%- set path = route_generator.route(pagerfanta.getNextPage()) -%}
{{- block('next_page_link') -}}
{%- else -%}
{{- block('next_page_link_disabled') -}}
{%- endif -%}
{%- endblock pager -%}

{%- block page_link -%}
<a href="{{- path -}}" class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium leading-5 text-gray-700 transition duration-150 ease-in-out bg-white border border-gray-300 hover:text-gray-500 focus:z-10 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-100 active:text-gray-700">{{- page -}}</a>
{%- endblock page_link -%}

{%- block current_page_link -%}
<span aria-current="page"><span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium leading-5 text-gray-500 bg-white border border-gray-300 cursor-default">{{- page -}}</span></span>
{%- endblock current_page_link -%}

{%- block previous_page_link -%}
<a href="{{- path -}}" rel="prev" class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium leading-5 text-gray-700 transition duration-150 ease-in-out bg-white border border-gray-300 rounded-l-md hover:text-gray-500 focus:z-10 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-100 active:text-gray-700">{{- block('previous_page_message') -}}</a>
{%- endblock previous_page_link -%}

{%- block previous_page_link_disabled -%}
<span aria-disabled="true"><span class="relative inline-flex items-center px-4 py-2 text-sm font-medium leading-5 text-gray-500 bg-white border border-gray-300 cursor-default rounded-l-md">{{- block('previous_page_message') -}}</span></span>
{%- endblock previous_page_link_disabled -%}

{%- block previous_page_message -%}
{%- if options['prev_message'] is defined -%}
{{- options['prev_message'] -}}
{%- else -%}
Previous
{%- endif -%}
{%- endblock previous_page_message -%}

{%- block next_page_link -%}
<a href="{{- path -}}" rel="next" class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium leading-5 text-gray-700 transition duration-150 ease-in-out bg-white border border-gray-300 rounded-r-md hover:text-gray-500 focus:z-10 focus:outline-none focus:border-blue-300 focus:shadow-outline-blue active:bg-gray-100 active:text-gray-700">Next</a>
{%- endblock next_page_link -%}

{%- block next_page_link_disabled -%}
<span aria-disabled="true"><span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium leading-5 text-gray-500 bg-white border border-gray-300 cursor-default rounded-r-md">{{- block('next_page_message') -}}</span></span>
{%- endblock next_page_link_disabled -%}

{%- block next_page_message -%}
{%- if options['next_message'] is defined -%}
{{- options['next_message'] -}}
{%- else -%}
Next
{%- endif -%}
{%- endblock next_page_message -%}

{%- block ellipsis -%}
<span aria-disabled="true"><span class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium leading-5 text-gray-700 bg-white border border-gray-300 cursor-default">&hellip;</span></span>
{%- endblock ellipsis -%}
Loading

0 comments on commit 775d44b

Please sign in to comment.