author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
---|---|---|---|---|---|---|---|---|---|
95,144 |
21.04.2019 14:15:11
| -7,200 |
77a1ccecf9763b758d6c8b785599589c1e5ce715
|
Move `instanceof StreamedResponse` to start of method
|
[
{
"change_type": "MODIFY",
"old_path": "src/Snippet/HtmlInjector.php",
"new_path": "src/Snippet/HtmlInjector.php",
"diff": "@@ -56,15 +56,15 @@ class HtmlInjector\npublic function inject(WidgetInterface $widget, Response $response): void\n{\n- $html = $response->getContent();\n- $functionMap = $this->getMap();\n- $target = $widget->getTarget();\n-\n// Don't try to modify the response body for streamed responses. Stuff will break, if we do.\nif ($response instanceof StreamedResponse) {\nreturn;\n}\n+ $html = $response->getContent();\n+ $functionMap = $this->getMap();\n+ $target = $widget->getTarget();\n+\nif ($widget instanceof ResponseAware) {\n$widget->setResponse($response);\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Move `instanceof StreamedResponse` to start of method
|
95,144 |
21.04.2019 14:45:36
| -7,200 |
9c317abb616a857564174f6b1be7411c5cbf6958
|
Set config as true global
|
[
{
"change_type": "MODIFY",
"old_path": "config/packages/twig.yaml",
"new_path": "config/packages/twig.yaml",
"diff": "@@ -7,3 +7,5 @@ twig:\npaths:\n'%kernel.project_dir%/public/theme/%bolt.theme%': ''\n'%kernel.project_dir%/templates/': 'bolt'\n+ globals:\n+ 'config': '@Bolt\\Configuration\\Config'\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/TwigAwareController.php",
"new_path": "src/Controller/TwigAwareController.php",
"diff": "@@ -42,9 +42,7 @@ class TwigAwareController extends AbstractController\n*/\nprotected function renderTemplate($template, array $parameters = [], ?Response $response = null): Response\n{\n- // Set config and version.\n- $parameters['config'] = $parameters['config'] ?? $this->config;\n- $parameters['version'] = $parameters['version'] ?? Version::VERSION;\n+ // Set User in global Twig environment\n$parameters['user'] = $parameters['user'] ?? $this->getUser();\n// Resolve string|array of templates into the first one that is found.\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Set config as true global
|
95,144 |
21.04.2019 14:51:30
| -7,200 |
dd626d1f8f5e304a6959f0931f7b59757f6d2c8d
|
Add config as true global
|
[
{
"change_type": "MODIFY",
"old_path": "config/packages/twig.yaml",
"new_path": "config/packages/twig.yaml",
"diff": "@@ -7,3 +7,5 @@ twig:\npaths:\n'%kernel.project_dir%/public/theme/%bolt.theme%': ''\n'%kernel.project_dir%/templates/': 'bolt'\n+ globals:\n+ 'config': '@Bolt\\Configuration\\Config'\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/TwigAwareController.php",
"new_path": "src/Controller/TwigAwareController.php",
"diff": "@@ -46,9 +46,7 @@ class TwigAwareController extends AbstractController\n*/\nprotected function renderTemplate($template, array $parameters = [], ?Response $response = null): Response\n{\n- // Set config and version.\n- $parameters['config'] = $parameters['config'] ?? $this->config;\n- $parameters['version'] = $parameters['version'] ?? Version::VERSION;\n+ // Set User in global Twig environment\n$parameters['user'] = $parameters['user'] ?? $this->getUser();\n// Resolve string|array of templates into the first one that is found.\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Add config as true global
|
95,144 |
21.04.2019 15:07:40
| -7,200 |
60122b1ecd57681e3252e3c7826937e05d60a2cc
|
Remove methods from Twigaware interface
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/TwigAware.php",
"new_path": "src/Widget/TwigAware.php",
"diff": "@@ -16,8 +16,4 @@ interface TwigAware\npublic function setTwig(Environment $twig): WidgetInterface;\npublic function getTwig(): Environment;\n-\n- public function getTemplate(): string;\n-\n- public function setTemplate(string $template): WidgetInterface;\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Remove methods from Twigaware interface
|
95,144 |
21.04.2019 15:24:04
| -7,200 |
9bdd3bc94b6456dfd2e5925365e55bbe53ceb9f7
|
Init $template as string
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/BaseWidget.php",
"new_path": "src/Widget/BaseWidget.php",
"diff": "@@ -20,7 +20,7 @@ class BaseWidget implements WidgetInterface\nprotected $priority = 0;\n/** @var string */\n- protected $template;\n+ protected $template = '';\n/** @var Response */\nprotected $response;\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Init $template as string
|
95,144 |
21.04.2019 16:54:20
| -7,200 |
bc0b59db0fa61e06eb3684b0967fbeb75a2b2e9b
|
Remove $type, and remove the initial `''` for $template
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/BaseWidget.php",
"new_path": "src/Widget/BaseWidget.php",
"diff": "@@ -14,13 +14,12 @@ use Twig\\Environment;\nclass BaseWidget implements WidgetInterface\n{\nprotected $name = 'Nameless widget';\n- protected $type = 'widget';\nprotected $target = Target::NOWHERE;\nprotected $zone = RequestZone::EVERYWHERE;\nprotected $priority = 0;\n/** @var string */\n- protected $template = '';\n+ protected $template;\n/** @var Response */\nprotected $response;\n@@ -47,18 +46,6 @@ class BaseWidget implements WidgetInterface\nreturn $this->name;\n}\n- public function setType(string $type): WidgetInterface\n- {\n- $this->type = $type;\n-\n- return $this;\n- }\n-\n- public function getType(): string\n- {\n- return $this->type;\n- }\n-\npublic function setTarget(string $target): WidgetInterface\n{\n$this->target = $target;\n@@ -110,7 +97,7 @@ class BaseWidget implements WidgetInterface\nreturn $this;\n}\n- public function getTemplate(): string\n+ public function getTemplate(): ?string\n{\nreturn $this->template;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/BoltHeaderWidget.php",
"new_path": "src/Widget/BoltHeaderWidget.php",
"diff": "@@ -10,7 +10,6 @@ use Bolt\\Snippet\\Target;\nclass BoltHeaderWidget extends BaseWidget implements ResponseAware\n{\nprotected $name = 'Bolt Header Widget';\n- protected $type = 'snippet';\nprotected $target = Target::NOWHERE;\nprotected $zone = RequestZone::FRONTEND;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/CanonicalLinkWidget.php",
"new_path": "src/Widget/CanonicalLinkWidget.php",
"diff": "@@ -10,7 +10,6 @@ use Bolt\\Snippet\\Target;\nclass CanonicalLinkWidget extends BaseWidget\n{\nprotected $name = 'Canonical Link';\n- protected $type = 'widget';\nprotected $target = Target::NOWHERE;\nprotected $zone = RequestZone::NOWHERE;\nprotected $priority = 200;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -14,7 +14,6 @@ use GuzzleHttp\\Exception\\RequestException;\nclass NewsWidget extends BaseWidget implements TwigAware, RequestAware\n{\nprotected $name = 'News Widget';\n- protected $type = 'widget';\nprotected $target = Target::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\nprotected $priority = 150;\nprotected $template = '@bolt/widgets/news.twig';\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -9,7 +9,6 @@ use Bolt\\Snippet\\Target;\nclass WeatherWidget extends BaseWidget implements TwigAware\n{\nprotected $name = 'Weather Widget';\n- protected $type = 'widget';\nprotected $target = Target::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\nprotected $priority = 200;\nprotected $template = '@bolt/widgets/weather.twig';\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/WidgetInterface.php",
"new_path": "src/Widget/WidgetInterface.php",
"diff": "@@ -8,8 +8,6 @@ interface WidgetInterface\n{\npublic function getName(): string;\n- public function getType(): string;\n-\n/**\n* @return string from Bolt\\Snippet\\Target constants enum\n*/\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Remove $type, and remove the initial `''` for $template
|
95,112 |
21.04.2019 18:07:59
| -7,200 |
989e5e9745283d16f5ae6a3ab31436739a1b05e1
|
Changes in Widgets
|
[
{
"change_type": "MODIFY",
"old_path": "phpunit.xml.dist",
"new_path": "phpunit.xml.dist",
"diff": "<!-- define your env variables for the test env here -->\n<!-- ###+ doctrine/doctrine-bundle ### -->\n- <env name=\"DATABASE_URL\" value=\"sqlite:///%kernel.project_dir%/var/data/bolt-test.sqlite\" force=\"true\"/>\n+ <env name=\"DATABASE_URL\" value=\"sqlite::memory:\" force=\"true\"/>\n<!-- ###- doctrine/doctrine-bundle ### -->\n<!-- ###+ symfony/swiftmailer-bundle ### -->\n"
},
{
"change_type": "MODIFY",
"old_path": "src/EventSubscriber/WidgetsSubscriber.php",
"new_path": "src/EventSubscriber/WidgetsSubscriber.php",
"diff": "@@ -4,10 +4,10 @@ declare(strict_types=1);\nnamespace Bolt\\EventSubscriber;\n-use Bolt\\Widget\\Injector\\RequestZone;\n-use Bolt\\Widget\\Injector\\Target;\nuse Bolt\\Widget\\BoltHeaderWidget;\nuse Bolt\\Widget\\CanonicalLinkWidget;\n+use Bolt\\Widget\\Injector\\RequestZone;\n+use Bolt\\Widget\\Injector\\Target;\nuse Bolt\\Widget\\NewsWidget;\nuse Bolt\\Widget\\SnippetWidget;\nuse Bolt\\Widget\\WeatherWidget;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/BaseWidget.php",
"new_path": "src/Widget/BaseWidget.php",
"diff": "@@ -4,21 +4,29 @@ declare(strict_types=1);\nnamespace Bolt\\Widget;\n-use Bolt\\Widget\\Injector\\RequestZone;\n-use Bolt\\Widget\\Injector\\Target;\nuse Cocur\\Slugify\\Slugify;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Twig\\Environment;\n-class BaseWidget implements WidgetInterface\n+/**\n+ * BaseWidget can be used as easy starter pack or for as a base for heavy widgets.\n+ */\n+abstract class BaseWidget implements WidgetInterface\n{\n- protected $name = 'Nameless widget';\n- protected $target = Target::NOWHERE;\n- protected $zone = RequestZone::EVERYWHERE;\n+ /** @var string */\n+ protected $name;\n+\n+ /** @var string from Target enum */\n+ protected $target;\n+\n+ /** @var string from RequestZone */\n+ protected $zone;\n+\n+ /** @var int */\nprotected $priority = 0;\n- /** @var string */\n+ /** @var string path to Twig template */\nprotected $template;\n/** @var Response */\n@@ -33,7 +41,7 @@ class BaseWidget implements WidgetInterface\n/** @var Environment */\nprivate $twig;\n- public function setName(string $name): WidgetInterface\n+ public function setName(string $name): self\n{\n$this->name = $name;\n$this->slug = null;\n@@ -46,7 +54,7 @@ class BaseWidget implements WidgetInterface\nreturn $this->name;\n}\n- public function setTarget(string $target): WidgetInterface\n+ public function setTarget(string $target): self\n{\n$this->target = $target;\n@@ -58,7 +66,7 @@ class BaseWidget implements WidgetInterface\nreturn $this->target;\n}\n- public function setPriority(int $priority): WidgetInterface\n+ public function setPriority(int $priority): self\n{\n$this->priority = $priority;\n@@ -77,7 +85,7 @@ class BaseWidget implements WidgetInterface\n}\nif ($this instanceof TwigAware) {\n- $output = $this->twig->render($this->getTemplate(), $params);\n+ $output = $this->getTWig()->render($this->getTemplate(), $params);\n} else {\n$output = $this->getTemplate();\n}\n@@ -90,19 +98,19 @@ class BaseWidget implements WidgetInterface\n);\n}\n- public function setTemplate(string $template): WidgetInterface\n+ public function setTemplate(string $template): self\n{\n$this->template = $template;\nreturn $this;\n}\n- public function getTemplate(): ?string\n+ public function getTemplate(): string\n{\nreturn $this->template;\n}\n- public function setTwig(Environment $twig): WidgetInterface\n+ public function setTwig(Environment $twig): self\n{\n$this->twig = $twig;\n@@ -114,7 +122,7 @@ class BaseWidget implements WidgetInterface\nreturn $this->twig;\n}\n- public function setRequest(Request $request): WidgetInterface\n+ public function setRequest(Request $request): self\n{\n$this->request = $request;\n@@ -126,21 +134,19 @@ class BaseWidget implements WidgetInterface\nreturn $this->request;\n}\n- public function setResponse(?Response $response = null): WidgetInterface\n+ public function setResponse(Response $response): self\n{\n- if ($response !== null) {\n$this->response = $response;\n- }\nreturn $this;\n}\n- public function getResponse(): ?Response\n+ public function getResponse(): Response\n{\nreturn $this->response;\n}\n- public function setZone(string $zone): WidgetInterface\n+ public function setZone(string $zone): self\n{\n$this->zone = $zone;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/BoltHeaderWidget.php",
"new_path": "src/Widget/BoltHeaderWidget.php",
"diff": "@@ -6,12 +6,14 @@ namespace Bolt\\Widget;\nuse Bolt\\Widget\\Injector\\RequestZone;\nuse Bolt\\Widget\\Injector\\Target;\n+use Symfony\\Component\\HttpFoundation\\Response;\n-class BoltHeaderWidget extends BaseWidget implements ResponseAware\n+class BoltHeaderWidget implements WidgetInterface, ResponseAware\n{\n- protected $name = 'Bolt Header Widget';\n- protected $target = Target::NOWHERE;\n- protected $zone = RequestZone::FRONTEND;\n+ /**\n+ * @var Response\n+ */\n+ private $response;\npublic function __invoke(array $params = []): string\n{\n@@ -19,4 +21,36 @@ class BoltHeaderWidget extends BaseWidget implements ResponseAware\nreturn '';\n}\n+\n+ public function getName(): string\n+ {\n+ return 'Bolt Header Widget';\n+ }\n+\n+ public function getTarget(): string\n+ {\n+ return Target::NOWHERE;\n+ }\n+\n+ public function getPriority(): int\n+ {\n+ return 0;\n+ }\n+\n+ public function getZone(): string\n+ {\n+ return RequestZone::FRONTEND;\n+ }\n+\n+ public function setResponse(Response $response): self\n+ {\n+ $this->response = $response;\n+\n+ return $this;\n+ }\n+\n+ public function getResponse(): Response\n+ {\n+ return $this->response;\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/Injector/HtmlInjector.php",
"new_path": "src/Widget/Injector/HtmlInjector.php",
"diff": "@@ -5,7 +5,6 @@ declare(strict_types=1);\nnamespace Bolt\\Widget\\Injector;\nuse Bolt\\Common\\Str;\n-use Bolt\\Widget\\Injector\\Target;\nuse Bolt\\Widget\\ResponseAware;\nuse Bolt\\Widget\\WidgetInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/Injector/QueueProcessor.php",
"new_path": "src/Widget/Injector/QueueProcessor.php",
"diff": "@@ -4,7 +4,6 @@ declare(strict_types=1);\nnamespace Bolt\\Widget\\Injector;\n-use Bolt\\Widget\\Injector\\HtmlInjector;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Tightenco\\Collect\\Support\\Collection;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -6,12 +6,12 @@ namespace Bolt\\Widget;\nuse Bolt\\Common\\Exception\\ParseException;\nuse Bolt\\Common\\Json;\n-use Bolt\\Widget\\Injector\\Target;\nuse Bolt\\Version;\n+use Bolt\\Widget\\Injector\\Target;\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\RequestException;\n-class NewsWidget extends BaseWidget implements TwigAware, RequestAware\n+class NewsWidget extends BaseWidget implements TwigAware\n{\nprotected $name = 'News Widget';\nprotected $target = Target::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/RequestAware.php",
"new_path": "src/Widget/RequestAware.php",
"diff": "@@ -10,9 +10,9 @@ use Symfony\\Component\\HttpFoundation\\Request;\n* Interface RequestAware - Widgets that make use of the Request to provide\n* their functionality need to implement this interface.\n*/\n-interface RequestAware\n+interface RequestAware extends WidgetInterface\n{\n- public function setRequest(Request $request): WidgetInterface;\n+ public function setRequest(Request $request);\npublic function getRequest(): Request;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/ResponseAware.php",
"new_path": "src/Widget/ResponseAware.php",
"diff": "@@ -10,9 +10,9 @@ use Symfony\\Component\\HttpFoundation\\Response;\n* Interface ResponseAware - Widgets that make use of the Response to provide\n* their functionality need to implement this interface.\n*/\n-interface ResponseAware\n+interface ResponseAware extends WidgetInterface\n{\n- public function setResponse(Response $response): WidgetInterface;\n+ public function setResponse(Response $response);\n- public function getResponse(): ?Response;\n+ public function getResponse(): Response;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/TwigAware.php",
"new_path": "src/Widget/TwigAware.php",
"diff": "@@ -11,9 +11,9 @@ use Twig\\Environment;\n* contents need to implement this interface, in order to access the current\n* Twig\\Environment and to render a Twig template.\n*/\n-interface TwigAware\n+interface TwigAware extends WidgetInterface\n{\n- public function setTwig(Environment $twig): WidgetInterface;\n+ public function setTwig(Environment $twig);\npublic function getTwig(): Environment;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/WidgetInterface.php",
"new_path": "src/Widget/WidgetInterface.php",
"diff": "@@ -4,6 +4,9 @@ declare(strict_types=1);\nnamespace Bolt\\Widget;\n+/**\n+ * Every widget must implement this interface.\n+ */\ninterface WidgetInterface\n{\npublic function getName(): string;\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/DbAwareTestCase.php",
"new_path": "tests/php/DbAwareTestCase.php",
"diff": "@@ -27,7 +27,6 @@ class DbAwareTestCase extends WebTestCase\nself::runCommand('doctrine:database:drop --force');\nself::runCommand('doctrine:database:create');\nself::runCommand('doctrine:schema:create');\n- self::runCommand('doctrine:fixtures:load --no-interaction');\n$this->entityManager = static::createClient()->getContainer()\n->get('doctrine')\n@@ -36,7 +35,7 @@ class DbAwareTestCase extends WebTestCase\nparent::setUp();\n}\n- private static function runCommand($command)\n+ protected static function runCommand($command)\n{\n$command = sprintf('%s --quiet', $command);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Repository/TaxonomyRepositoryTest.php",
"new_path": "tests/php/Repository/TaxonomyRepositoryTest.php",
"diff": "@@ -12,6 +12,16 @@ use Bolt\\Tests\\DbAwareTestCase;\n*/\nclass TaxonomyRepositoryTest extends DbAwareTestCase\n{\n+ protected function setUp(): void\n+ {\n+ $this->markTestIncomplete(\"This test takes like forever to run so let's skip it until it will be finished\");\n+\n+ parent::setUp();\n+\n+ // fixtures loading takes a lot of time, it would be better to load database dump for tests\n+ self::runCommand('doctrine:fixtures:load --no-interaction');\n+ }\n+\npublic function testSearchByType(): void\n{\n$taxonomies = $this->getEm()\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/WidgetsTest.php",
"new_path": "tests/php/WidgetsTest.php",
"diff": "@@ -23,14 +23,14 @@ class WidgetsTest extends TestCase\n{\npublic function testProcessWidgetsInQueue(): void\n{\n- $queueprocessor = new QueueProcessor(new HtmlInjector());\n+ $queueProcessor = new QueueProcessor(new HtmlInjector());\n$requestStack = new RequestStack();\n$requestStack->push(Request::createFromGlobals());\n$loader = new ArrayLoader(['weather.twig' => '[Hello, weather!]']);\n$twig = new Environment($loader);\n- $widgets = new Widgets($requestStack, $queueprocessor, $twig);\n+ $widgets = new Widgets($requestStack, $queueProcessor, $twig);\n$response = new Response('<html><body>foo</body></html>');\n$snippet = (new SnippetWidget())\n@@ -45,14 +45,14 @@ class WidgetsTest extends TestCase\npublic function testRenderWidget(): void\n{\n- $queueprocessor = new QueueProcessor(new HtmlInjector());\n+ $queueProcessor = new QueueProcessor(new HtmlInjector());\n$requestStack = new RequestStack();\n$requestStack->push(Request::createFromGlobals());\n$loader = new ArrayLoader(['weather.twig' => '[Hello, weather!]']);\n$twig = new Environment($loader);\n- $widgets = new Widgets($requestStack, $queueprocessor, $twig);\n+ $widgets = new Widgets($requestStack, $queueProcessor, $twig);\n$weatherWidget = new WeatherWidget();\n$weatherWidget->setTemplate('weather.twig');\n@@ -68,14 +68,14 @@ class WidgetsTest extends TestCase\npublic function testRenderWidgetWithExtraParameters(): void\n{\n- $queueprocessor = new QueueProcessor(new HtmlInjector());\n+ $queueProcessor = new QueueProcessor(new HtmlInjector());\n$requestStack = new RequestStack();\n$requestStack->push(Request::createFromGlobals());\n$loader = new ArrayLoader(['weather.twig' => '[Hello, {{ foo }}!]']);\n$twig = new Environment($loader);\n- $widgets = new Widgets($requestStack, $queueprocessor, $twig);\n+ $widgets = new Widgets($requestStack, $queueProcessor, $twig);\n$weatherWidget = new WeatherWidget();\n$weatherWidget->setTemplate('weather.twig');\n@@ -90,19 +90,19 @@ class WidgetsTest extends TestCase\npublic function testProcessHeaderWidget(): void\n{\n- $queueprocessor = new QueueProcessor(new HtmlInjector());\n+ $request = new Request();\n+ $request->attributes->set(RequestZone::KEY, RequestZone::FRONTEND);\n$requestStack = new RequestStack();\n- $requestStack->push(Request::createFromGlobals());\n+ $requestStack->push($request);\n- $loader = new ArrayLoader(['weather.twig' => '[Hello, weather!]']);\n- $twig = new Environment($loader);\n+ $queueProcessor = new QueueProcessor(new HtmlInjector());\n+ $twig = new Environment(new ArrayLoader());\n- $widgets = new Widgets($requestStack, $queueprocessor, $twig);\n+ $widgets = new Widgets($requestStack, $queueProcessor, $twig);\n$response = new Response('<html><body>foo</body></html>');\n$headerWidget = new BoltHeaderWidget();\n- $headerWidget->setZone(RequestZone::NOWHERE);\n$widgets->registerWidget($headerWidget);\n$widgets->processQueue($response);\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Changes in Widgets
|
95,144 |
21.04.2019 18:32:08
| -7,200 |
af1cc729e46cd5b4c1d0f222b7743af95b3d2f15
|
Change BaseWidget description
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/BaseWidget.php",
"new_path": "src/Widget/BaseWidget.php",
"diff": "@@ -10,7 +10,7 @@ use Symfony\\Component\\HttpFoundation\\Response;\nuse Twig\\Environment;\n/**\n- * BaseWidget can be used as easy starter pack or for as a base for heavy widgets.\n+ * BaseWidget can be used as easy starter pack or as a base for your own widgets.\n*/\nabstract class BaseWidget implements WidgetInterface\n{\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Change BaseWidget description
Co-Authored-By: JarJak <egger1991@gmail.com>
|
95,112 |
21.04.2019 19:06:15
| -7,200 |
871a5b93088e9b659692d4241a7243025e0778a9
|
Improve Widgets
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/BaseWidget.php",
"new_path": "src/Widget/BaseWidget.php",
"diff": "@@ -4,16 +4,16 @@ declare(strict_types=1);\nnamespace Bolt\\Widget;\n+use Bolt\\Widget\\Exception\\WidgetException;\nuse Cocur\\Slugify\\Slugify;\n-use Symfony\\Component\\HttpFoundation\\Request;\n-use Symfony\\Component\\HttpFoundation\\Response;\n-use Twig\\Environment;\n/**\n* BaseWidget can be used as easy starter pack or as a base for your own widgets.\n*/\nabstract class BaseWidget implements WidgetInterface\n{\n+ use TwigTrait, RequestTrait, ResponseTrait;\n+\n/** @var string */\nprotected $name;\n@@ -29,18 +29,9 @@ abstract class BaseWidget implements WidgetInterface\n/** @var string path to Twig template */\nprotected $template;\n- /** @var Response */\n- protected $response;\n-\n/** @var ?string */\nprotected $slug;\n- /** @var Request */\n- private $request;\n-\n- /** @var Environment */\n- private $twig;\n-\npublic function setName(string $name): self\n{\n$this->name = $name;\n@@ -51,6 +42,9 @@ abstract class BaseWidget implements WidgetInterface\npublic function getName(): string\n{\n+ if ($this->name === null) {\n+ throw new WidgetException('Widget of class '.self::class.' does not have a name!');\n+ }\nreturn $this->name;\n}\n@@ -63,6 +57,9 @@ abstract class BaseWidget implements WidgetInterface\npublic function getTarget(): string\n{\n+ if ($this->target === null) {\n+ throw new WidgetException(\"Widget {$this->getName()} does not have Target set\");\n+ }\nreturn $this->target;\n}\n@@ -75,6 +72,9 @@ abstract class BaseWidget implements WidgetInterface\npublic function getPriority(): int\n{\n+ if ($this->priority === null) {\n+ throw new WidgetException(\"Widget {$this->getName()} does not have priority set\");\n+ }\nreturn $this->priority;\n}\n@@ -107,43 +107,10 @@ abstract class BaseWidget implements WidgetInterface\npublic function getTemplate(): string\n{\n- return $this->template;\n+ if ($this->template === null) {\n+ throw new WidgetException(\"Widget {$this->getName()} does not have template set\");\n}\n-\n- public function setTwig(Environment $twig): self\n- {\n- $this->twig = $twig;\n-\n- return $this;\n- }\n-\n- public function getTwig(): Environment\n- {\n- return $this->twig;\n- }\n-\n- public function setRequest(Request $request): self\n- {\n- $this->request = $request;\n-\n- return $this;\n- }\n-\n- public function getRequest(): Request\n- {\n- return $this->request;\n- }\n-\n- public function setResponse(Response $response): self\n- {\n- $this->response = $response;\n-\n- return $this;\n- }\n-\n- public function getResponse(): Response\n- {\n- return $this->response;\n+ return $this->template;\n}\npublic function setZone(string $zone): self\n@@ -155,14 +122,16 @@ abstract class BaseWidget implements WidgetInterface\npublic function getZone(): string\n{\n+ if ($this->zone === null) {\n+ throw new WidgetException(\"Widget {$this->getName()} does not have Zone set\");\n+ }\nreturn $this->zone;\n}\npublic function getSlug(): string\n{\nif ($this->slug === null) {\n- $slugify = Slugify::create();\n- $this->slug = $slugify->slugify($this->name);\n+ $this->slug = Slugify::create()->slugify($this->getName());\n}\nreturn $this->slug;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/BoltHeaderWidget.php",
"new_path": "src/Widget/BoltHeaderWidget.php",
"diff": "@@ -6,14 +6,10 @@ namespace Bolt\\Widget;\nuse Bolt\\Widget\\Injector\\RequestZone;\nuse Bolt\\Widget\\Injector\\Target;\n-use Symfony\\Component\\HttpFoundation\\Response;\nclass BoltHeaderWidget implements WidgetInterface, ResponseAware\n{\n- /**\n- * @var Response\n- */\n- private $response;\n+ use ResponseTrait;\npublic function __invoke(array $params = []): string\n{\n@@ -41,16 +37,4 @@ class BoltHeaderWidget implements WidgetInterface, ResponseAware\n{\nreturn RequestZone::FRONTEND;\n}\n-\n- public function setResponse(Response $response): self\n- {\n- $this->response = $response;\n-\n- return $this;\n- }\n-\n- public function getResponse(): Response\n- {\n- return $this->response;\n- }\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Widget/Exception/WidgetException.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Widget\\Exception;\n+\n+class WidgetException extends \\Exception\n+{\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Widget/Injector/AdditionalTarget.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Widget\\Injector;\n+\n+/**\n+ * This class provides some Widget locations that could be useful for template designers.\n+ * Keep in mind that if widget uses one of those targets, template designer must add\n+ * {{ widgets(targets) }} to Twig template, otherwise they won't be injected automatically.\n+ */\n+class AdditionalTarget extends Target\n+{\n+ public const WIDGET_FRONT_MAIN_TOP = 'main_top';\n+ public const WIDGET_FRONT_MAIN_BREAK = 'main_break';\n+ public const WIDGET_FRONT_MAIN_BOTTOM = 'main_bottom';\n+ public const WIDGET_FRONT_ASIDE_TOP = 'aside_top';\n+ public const WIDGET_FRONT_ASIDE_MIDDLE = 'aside_middle';\n+ public const WIDGET_FRONT_ASIDE_BOTTOM = 'aside_bottom';\n+ public const WIDGET_FRONT_FOOTER = 'footer';\n+\n+ public const WIDGET_BACK_DASHBOARD_ASIDE_TOP = 'dashboard_aside_top';\n+ public const WIDGET_BACK_DASHBOARD_ASIDE_MIDDLE = 'dashboard_aside_middle';\n+ public const WIDGET_BACK_DASHBOARD_ASIDE_BOTTOM = 'dashboard_aside_bottom';\n+ public const WIDGET_BACK_DASHBOARD_BELOW_HEADER = 'dashboard_below_header';\n+ public const WIDGET_BACK_DASHBOARD_BOTTOM = 'dashboard_bottom';\n+ public const WIDGET_BACK_OVERVIEW_ASIDE_TOP = 'overview_aside_top';\n+ public const WIDGET_BACK_OVERVIEW_ASIDE_MIDDLE = 'overview_aside_middle';\n+ public const WIDGET_BACK_OVERVIEW_ASIDE_BOTTOM = 'overview_aside_bottom';\n+ public const WIDGET_BACK_OVERVIEW_BELOW_HEADER = 'overview_below_header';\n+ public const WIDGET_BACK_OVERVIEW_BOTTOM = 'overview_bottom';\n+ public const WIDGET_BACK_EDITCONTENT_ASIDE_TOP = 'editcontent_aside_top';\n+ public const WIDGET_BACK_EDITCONTENT_ASIDE_MIDDLE = 'editcontent_aside_middle';\n+ public const WIDGET_BACK_EDITCONTENT_ASIDE_BOTTOM = 'editcontent_aside_bottom';\n+ public const WIDGET_BACK_EDITCONTENT_BELOW_HEADER = 'editcontent_below_header';\n+ public const WIDGET_BACK_EDITCONTENT_BOTTOM = 'editcontent_bottom';\n+ public const WIDGET_BACK_FILES_BELOW_HEADER = 'files_below_header';\n+ public const WIDGET_BACK_FILES_BOTTOM = 'files_bottom';\n+ public const WIDGET_BACK_EDITFILE_BELOW_HEADER = 'editfile_below_header';\n+ public const WIDGET_BACK_EDITFILE_BOTTOM = 'editfile_bottom';\n+ public const WIDGET_BACK_LOGIN_TOP = 'login_top';\n+ public const WIDGET_BACK_LOGIN_MIDDLE = 'login_middle';\n+ public const WIDGET_BACK_LOGIN_BOTTOM = 'login_bottom';\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/Injector/Target.php",
"new_path": "src/Widget/Injector/Target.php",
"diff": "@@ -7,9 +7,7 @@ namespace Bolt\\Widget\\Injector;\nuse ReflectionClass;\n/**\n- * Bolt Snippet target location.\n- *\n- * This class categorizes all possible widget locations in constants.\n+ * This class categorizes all possible automatic widget locations.\n*/\nclass Target\n{\n@@ -44,37 +42,7 @@ class Target\npublic const BEFORE_BODY_JS = 'beforebodyjs';\npublic const AFTER_BODY_JS = 'afterbodyjs';\n- public const WIDGET_FRONT_MAIN_TOP = 'main_top';\n- public const WIDGET_FRONT_MAIN_BREAK = 'main_break';\n- public const WIDGET_FRONT_MAIN_BOTTOM = 'main_bottom';\n- public const WIDGET_FRONT_ASIDE_TOP = 'aside_top';\n- public const WIDGET_FRONT_ASIDE_MIDDLE = 'aside_middle';\n- public const WIDGET_FRONT_ASIDE_BOTTOM = 'aside_bottom';\n- public const WIDGET_FRONT_FOOTER = 'footer';\n-\n- public const WIDGET_BACK_DASHBOARD_ASIDE_TOP = 'dashboard_aside_top';\n- public const WIDGET_BACK_DASHBOARD_ASIDE_MIDDLE = 'dashboard_aside_middle';\n- public const WIDGET_BACK_DASHBOARD_ASIDE_BOTTOM = 'dashboard_aside_bottom';\n- public const WIDGET_BACK_DASHBOARD_BELOW_HEADER = 'dashboard_below_header';\n- public const WIDGET_BACK_DASHBOARD_BOTTOM = 'dashboard_bottom';\n- public const WIDGET_BACK_OVERVIEW_ASIDE_TOP = 'overview_aside_top';\n- public const WIDGET_BACK_OVERVIEW_ASIDE_MIDDLE = 'overview_aside_middle';\n- public const WIDGET_BACK_OVERVIEW_ASIDE_BOTTOM = 'overview_aside_bottom';\n- public const WIDGET_BACK_OVERVIEW_BELOW_HEADER = 'overview_below_header';\n- public const WIDGET_BACK_OVERVIEW_BOTTOM = 'overview_bottom';\n- public const WIDGET_BACK_EDITCONTENT_ASIDE_TOP = 'editcontent_aside_top';\n- public const WIDGET_BACK_EDITCONTENT_ASIDE_MIDDLE = 'editcontent_aside_middle';\n- public const WIDGET_BACK_EDITCONTENT_ASIDE_BOTTOM = 'editcontent_aside_bottom';\n- public const WIDGET_BACK_EDITCONTENT_BELOW_HEADER = 'editcontent_below_header';\n- public const WIDGET_BACK_EDITCONTENT_BOTTOM = 'editcontent_bottom';\n- public const WIDGET_BACK_FILES_BELOW_HEADER = 'files_below_header';\n- public const WIDGET_BACK_FILES_BOTTOM = 'files_bottom';\n- public const WIDGET_BACK_EDITFILE_BELOW_HEADER = 'editfile_below_header';\n- public const WIDGET_BACK_EDITFILE_BOTTOM = 'editfile_bottom';\n- public const WIDGET_BACK_LOGIN_TOP = 'login_top';\n- public const WIDGET_BACK_LOGIN_MIDDLE = 'login_middle';\n- public const WIDGET_BACK_LOGIN_BOTTOM = 'login_bottom';\n-\n+ // this one goes nowhere in html\npublic const NOWHERE = 'nowhere';\npublic function listAll(): array\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -7,6 +7,7 @@ namespace Bolt\\Widget;\nuse Bolt\\Common\\Exception\\ParseException;\nuse Bolt\\Common\\Json;\nuse Bolt\\Version;\n+use Bolt\\Widget\\Injector\\RequestZone;\nuse Bolt\\Widget\\Injector\\Target;\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\RequestException;\n@@ -17,6 +18,7 @@ class NewsWidget extends BaseWidget implements TwigAware\nprotected $target = Target::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\nprotected $priority = 150;\nprotected $template = '@bolt/widgets/news.twig';\n+ protected $zone = RequestZone::NOWHERE;\npublic function __invoke(array $params = []): string\n{\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Widget/RequestTrait.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Widget;\n+\n+use Bolt\\Widget\\Exception\\WidgetException;\n+use Symfony\\Component\\HttpFoundation\\Request;\n+\n+trait RequestTrait\n+{\n+ private $request;\n+\n+ public function setRequest(Request $request): self\n+ {\n+ $this->request = $request;\n+\n+ return $this;\n+ }\n+\n+ public function getRequest(): Request\n+ {\n+ if ($this->request === null) {\n+ throw new WidgetException(\"Widget {$this->getName()} does not have Request set\");\n+ }\n+ return $this->request;\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Widget/ResponseTrait.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Widget;\n+\n+use Bolt\\Widget\\Exception\\WidgetException;\n+use Symfony\\Component\\HttpFoundation\\Response;\n+\n+trait ResponseTrait\n+{\n+ private $response;\n+\n+ public function setResponse(Response $response): self\n+ {\n+ $this->response = $response;\n+\n+ return $this;\n+ }\n+\n+ public function getResponse(): Response\n+ {\n+ if ($this->response === null) {\n+ throw new WidgetException(\"Widget {$this->getName()} does not have Response set\");\n+ }\n+ return $this->response;\n+ }\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Widget/TwigTrait.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Widget;\n+\n+use Bolt\\Widget\\Exception\\WidgetException;\n+use Twig\\Environment;\n+\n+trait TwigTrait\n+{\n+ private $twig;\n+\n+ public function setTwig(Environment $twig): self\n+ {\n+ $this->twig = $twig;\n+\n+ return $this;\n+ }\n+\n+ public function getTwig(): Environment\n+ {\n+ if ($this->twig === null) {\n+ throw new WidgetException(\"Widget {$this->getName()} does not have Twig set\");\n+ }\n+ return $this->twig;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -4,6 +4,7 @@ declare(strict_types=1);\nnamespace Bolt\\Widget;\n+use Bolt\\Widget\\Injector\\RequestZone;\nuse Bolt\\Widget\\Injector\\Target;\nclass WeatherWidget extends BaseWidget implements TwigAware\n@@ -12,4 +13,5 @@ class WeatherWidget extends BaseWidget implements TwigAware\nprotected $target = Target::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\nprotected $priority = 200;\nprotected $template = '@bolt/widgets/weather.twig';\n+ protected $zone = RequestZone::BACKEND;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/WidgetsTest.php",
"new_path": "tests/php/WidgetsTest.php",
"diff": "@@ -109,4 +109,26 @@ class WidgetsTest extends TestCase\n$this->assertSame('Bolt', $response->headers->get('X-Powered-By'));\n}\n+\n+ public function testProcessWeatherWidget(): void\n+ {\n+ $request = new Request();\n+ $request->attributes->set(RequestZone::KEY, RequestZone::BACKEND);\n+ $requestStack = new RequestStack();\n+ $requestStack->push($request);\n+\n+ $queueProcessor = new QueueProcessor(new HtmlInjector());\n+ $twig = new Environment(new ArrayLoader());\n+\n+ $widgets = new Widgets($requestStack, $queueProcessor, $twig);\n+\n+ $response = new Response('<html><body>foo</body></html>');\n+\n+ $weatherWidget = new WeatherWidget();\n+\n+ $widgets->registerWidget($weather);\n+ $widgets->processQueue($response);\n+\n+ $this->assertContains('Bolt', $response->headers->get('X-Powered-By'));\n+ }\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Improve Widgets
|
95,112 |
22.04.2019 00:55:13
| -7,200 |
74ee8fd30247f72acc1b9dfa4ad2d2f9c0cca97f
|
Html Injector rewritten
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/Injector/HtmlInjector.php",
"new_path": "src/Widget/Injector/HtmlInjector.php",
"diff": "@@ -81,20 +81,36 @@ class HtmlInjector\n}\n/**\n- * insert some HTML into the start of the head section of\n- * an HTML page, right after the <head> tag.\n+ * insert some HTML into the very beginning of HTML / Content.\n*/\n- protected function headTagStart(string $snippet, string $rawHtml): string\n+ protected function beforeContent(string $snippet, string $rawHtml): string\n{\n- $matches = $this->getMatches($rawHtml, '<head', true, false);\n+ return $snippet . $rawHtml;\n+ }\n- if ($matches) {\n- $replacement = sprintf(\"%s\\n%s\\t%s\", $matches[0], $matches[1], $snippet);\n+ /**\n+ * insert some HTML into the very end of HTML / Content.\n+ */\n+ protected function afterContent(string $snippet, string $rawHtml): string\n+ {\n+ return $rawHtml . $snippet;\n+ }\n- return Str::replaceFirst($rawHtml, $matches[0], $replacement);\n+ /**\n+ * Nowhere, don't replace anything.\n+ */\n+ public static function nowhere(string $snippet, string $rawHtml): string\n+ {\n+ return $rawHtml;\n}\n- return $this->nowhere($snippet, $rawHtml);\n+ /**\n+ * insert some HTML into the start of the head section of\n+ * an HTML page, right after the <head> tag.\n+ */\n+ protected function headTagStart(string $snippet, string $rawHtml): string\n+ {\n+ return self::injectAfterTagStart($rawHtml, 'head', $snippet);\n}\n/**\n@@ -103,15 +119,7 @@ class HtmlInjector\n*/\nprotected function headTagEnd(string $snippet, string $rawHtml): string\n{\n- $matches = $this->getMatches($rawHtml, '</head', false, false);\n-\n- if ($matches) {\n- $replacement = sprintf(\"%s\\t%s\\n%s\", $matches[1], $snippet, $matches[0]);\n-\n- return Str::replaceFirst($rawHtml, $matches[0], $replacement);\n- }\n-\n- return $this->nowhere($snippet, $rawHtml);\n+ return self::injectBeforeTagEnd($rawHtml, 'head', $snippet);\n}\n/**\n@@ -120,15 +128,7 @@ class HtmlInjector\n*/\nprotected function bodyTagStart(string $snippet, string $rawHtml): string\n{\n- $matches = $this->getMatches($rawHtml, '<body', true, false);\n-\n- if ($matches) {\n- $replacement = sprintf(\"%s\\n%s\\t%s\", $matches[0], $matches[1], $snippet);\n-\n- return Str::replaceFirst($rawHtml, $matches[0], $replacement);\n- }\n-\n- return $this->nowhere($snippet, $rawHtml);\n+ return self::injectAfterTagStart($rawHtml, 'body', $snippet);\n}\n/**\n@@ -137,15 +137,7 @@ class HtmlInjector\n*/\nprotected function bodyTagEnd(string $snippet, string $rawHtml): string\n{\n- $matches = $this->getMatches($rawHtml, '</body', false, false);\n-\n- if ($matches) {\n- $replacement = sprintf(\"%s\\t%s\\n%s\", $matches[1], $snippet, $matches[0]);\n-\n- return Str::replaceFirst($rawHtml, $matches[0], $replacement);\n- }\n-\n- return $this->nowhere($snippet, $rawHtml);\n+ return self::injectBeforeTagEnd($rawHtml, 'body', $snippet);\n}\n/**\n@@ -154,158 +146,148 @@ class HtmlInjector\n*/\nprotected function htmlTagEnd(string $snippet, string $rawHtml): string\n{\n- $matches = $this->getMatches($rawHtml, '</html', false, false);\n-\n- if ($matches) {\n- $replacement = sprintf(\"%s\\t%s\\n%s\", $matches[1], $snippet, $matches[0]);\n-\n- return Str::replaceFirst($rawHtml, $matches[0], $replacement);\n- }\n-\n- return $this->nowhere($snippet, $rawHtml);\n- }\n-\n- /**\n- * insert some HTML into the very beginning of HTML / Content.\n- */\n- protected function beforeContent(string $snippet, string $rawHtml): string\n- {\n- return $snippet . $rawHtml;\n- }\n-\n- /**\n- * insert some HTML into the very end of HTML / Content.\n- */\n- protected function afterContent(string $snippet, string $rawHtml): string\n- {\n- return $rawHtml . $snippet;\n+ return self::injectBeforeTagEnd($rawHtml, 'html', $snippet);\n}\n/**\n* insert some HTML into the head section of an HTML page.\n+ * If there is no Metatag anywhere, place it right before end of head.\n*/\nprotected function metaTagsAfter(string $snippet, string $rawHtml): string\n{\n- $matches = $this->getMatches($rawHtml, '<meta', true, true);\n-\n- if ($matches) {\n- $last = count($matches[0]) - 1;\n- $replacement = sprintf(\"%s\\n%s%s\", $matches[0][$last], $matches[1][$last], $snippet);\n-\n- return Str::replaceFirst($rawHtml, $matches[0][$last], $replacement);\n+ $result = self::injectAfterTagEnd($rawHtml, 'meta', $snippet);\n+ if ($result === $rawHtml) {\n+ $result = self::injectBeforeTagEnd($rawHtml, 'head', $snippet);\n}\n- return $this->headTagEnd($snippet, $rawHtml);\n+ return $result;\n}\n/**\n* insert some HTML into the head section of an HTML page.\n+ * If there is no CSS anywhere, place it right before end of head.\n*/\nprotected function cssTagsAfter(string $snippet, string $rawHtml): string\n{\n- $matches = $this->getMatches($rawHtml, '<link', true, true);\n-\n- if ($matches) {\n- $last = count($matches[0]) - 1;\n- $replacement = sprintf(\"%s\\n%s%s\", $matches[0][$last], $matches[1][$last], $snippet);\n-\n- return Str::replaceFirst($rawHtml, $matches[0][$last], $replacement);\n+ $result = self::injectAfterTagEnd($rawHtml, 'link', $snippet);\n+ if ($result === $rawHtml) {\n+ $result = self::injectAfterTagEnd($rawHtml, 'style', $snippet);\n+ }\n+ if ($result === $rawHtml) {\n+ $result = self::injectBeforeTagEnd($rawHtml, 'head', $snippet);\n}\n- return $this->headTagEnd($snippet, $rawHtml);\n+ return $result;\n}\n/**\n* insert some HTML before the first CSS include in the page.\n+ * If there is no CSS anywhere, place it right after start of head.\n*/\nprotected function cssTagsBefore(string $snippet, string $rawHtml): string\n{\n- $matches = $this->getMatches($rawHtml, '<link', true, false);\n-\n- if ($matches) {\n- $replacement = sprintf(\"%s%s\\n%s\\t%s\", $matches[1], $snippet, $matches[0], $matches[1]);\n-\n- return Str::replaceFirst($rawHtml, $matches[0], $replacement);\n+ $result = self::injectBeforeTagStart($rawHtml, 'link', $snippet);\n+ if ($result === $rawHtml) {\n+ $result = self::injectBeforeTagStart($rawHtml, 'style', $snippet);\n+ }\n+ if ($result === $rawHtml) {\n+ $result = self::injectAfterTagStart($rawHtml, 'head', $snippet);\n}\n- return $this->nowhere($snippet, $rawHtml);\n+ return $result;\n}\n/**\n* insert some HTML before the first javascript include in the page.\n+ * If there is no JS anywhere, place it right after start of body.\n*/\nprotected function jsTagsBefore(string $snippet, string $rawHtml): string\n{\n- $matches = $this->getMatches($rawHtml, '<script', true, false);\n-\n- if ($matches) {\n- $replacement = sprintf(\"%s%s\\n%s\\t%s\", $matches[1], $snippet, $matches[0], $matches[1]);\n-\n- return Str::replaceFirst($rawHtml, $matches[0], $replacement);\n+ $result = self::injectBeforeTagStart($rawHtml, 'script', $snippet);\n+ if ($result === $rawHtml) {\n+ $result = self::injectAfterTagStart($rawHtml, 'body', $snippet);\n}\n- return $this->nowhere($snippet, $rawHtml);\n+ return $result;\n}\n/**\n* insert some HTML after the last javascript include.\n- * First in the head section, but if there is no script in the head, place\n- * it anywhere.\n+ * If there is no JS anywhere, place it right before end of body.\n*/\nprotected function jsTagsAfter(string $snippet, string $rawHtml, $insidehead = false): string\n{\n- if ($insidehead) {\n- $pos = mb_strpos($rawHtml, '</head>');\n- $context = mb_substr($rawHtml, 0, $pos);\n- } else {\n- $context = $rawHtml;\n+ $result = self::injectAfterTagEnd($rawHtml, 'script', $snippet);\n+ if ($result === $rawHtml) {\n+ $result = self::injectBeforeTagEnd($rawHtml, 'body', $snippet);\n+ }\n+\n+ return $result;\n+ }\n+\n+ private static function findTagStart(string $rawHtml, string $htmlTag): ?string\n+ {\n+ preg_match('~(<'.$htmlTag.'[^>]*?>)~mi', $rawHtml, $matches);\n+\n+ if (empty($matches)) {\n+ return null;\n+ }\n+ return $matches[1];\n}\n- // This match tag is a unique case\n- $matches = $this->getMatches($context, '(.*)</script>', false, true);\n+ private static function findTagEnd(string $rawHtml, string $htmlTag): ?string\n+ {\n+ preg_match_all('~((<'.$htmlTag.'[^>]*?>)|(</'.$htmlTag.'>))~mi', $rawHtml, $allMatches);\n- if ($matches) {\n- // Attempt to insert it after the last <script> tag within context, matching indentation.\n- $last = count($matches[0]) - 1;\n- $replacement = sprintf(\"%s\\n%s%s\", $matches[0][$last], $matches[1][$last], $snippet);\n+ if (empty($allMatches)) {\n+ return null;\n+ }\n+ foreach (array_reverse($allMatches[0]) as $match) {\n+ if ($match !== '') {\n+ return $match;\n+ }\n+ }\n- return Str::replaceFirst($rawHtml, $matches[0][$last], $replacement);\n- } elseif ($insidehead) {\n- // Second attempt: entire document\n- return $this->jsTagsAfter($snippet, $rawHtml, false);\n+ return null;\n}\n- return $this->headTagEnd($snippet, $rawHtml);\n+ public static function injectBeforeTagStart(string $rawHtml, string $htmlTag, string $injection): string\n+ {\n+ $match = static::findTagStart($rawHtml, $htmlTag);\n+ if ($match === null) {\n+ return static::nowhere($injection, $rawHtml);\n}\n- /**\n- * Nowhere, don't replace anything.\n- */\n- public function nowhere(string $snippet, string $rawHtml): string\n+ return Str::replaceFirst($rawHtml, $match, $injection.$match, true);\n+ }\n+\n+ public static function injectAfterTagStart(string $rawHtml, string $htmlTag, string $injection): string\n{\n- return $rawHtml;\n+ $match = static::findTagStart($rawHtml, $htmlTag);\n+ if ($match === null) {\n+ return static::nowhere($injection, $rawHtml);\n}\n- /**\n- * Get a set of matches.\n- *\n- * @param string $rawHtml The original HTML\n- * @param string $htmlTag HTML tag fragment we're matching, e.g. '<head' or '</head'\n- * @param bool $matchRemainder TRUE matches the remainder of the line, not just the tag - (.*)\n- * @param bool $matchAll TRUE returns all matched instances - preg_match_all()\n- */\n- private function getMatches(string $rawHtml, string $htmlTag, bool $matchRemainder, bool $matchAll): ?array\n+ return Str::replaceFirst($rawHtml, $match, $match.$injection, true);\n+ }\n+\n+ public static function injectBeforeTagEnd(string $rawHtml, string $htmlTag, string $injection): string\n{\n- $matches = null;\n- $matchRemainder = $matchRemainder ? '(.*)' : '';\n- $regex = sprintf(\"~([ \\t]*)%s%s~mi\", $htmlTag, $matchRemainder);\n+ $match = static::findTagEnd($rawHtml, $htmlTag);\n+ if ($match === null) {\n+ return static::nowhere($injection, $rawHtml);\n+ }\n- if ($matchAll && preg_match_all($regex, $rawHtml, $matches)) {\n- return $matches;\n- } elseif (! $matchAll && preg_match($regex, $rawHtml, $matches)) {\n- return $matches;\n+ return Str::replaceLast($rawHtml, $match, $injection.$match, true);\n}\n- return null;\n+ public static function injectAfterTagEnd(string $rawHtml, string $htmlTag, string $injection): string\n+ {\n+ $match = static::findTagEnd($rawHtml, $htmlTag);\n+ if ($match === null) {\n+ return static::nowhere($injection, $rawHtml);\n+ }\n+\n+ return Str::replaceLast($rawHtml, $match, $match.$injection, true);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/StringTestCase.php",
"new_path": "tests/php/StringTestCase.php",
"diff": "@@ -8,7 +8,7 @@ use PHPUnit\\Framework\\TestCase;\nclass StringTestCase extends TestCase\n{\n- public static function assertSameStrings(string $expected, string $actual)\n+ public static function assertSameHtml(string $expected, string $actual)\n{\nself::assertSame(\npreg_replace('/\\s+/', '', $expected),\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/php/Widget/Injector/HtmlInjector2Test.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Tests\\Widget\\Injector;\n+\n+use Bolt\\Tests\\StringTestCase;\n+use Bolt\\Widget\\Injector\\HtmlInjector;\n+\n+class HtmlInjector2Test extends StringTestCase\n+{\n+ const HTML = '<html><body class=\"something\"\n+ >foo<p><p\n+ class=\"inner\">bar</p></p><script></script><script\n+ /></body></html>';\n+\n+ public function providerInjectBeforeTagStart()\n+ {\n+ return [\n+ [\n+ 'body',\n+ '<html>koala<body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script></script><script /></body></html>'\n+ ],\n+ [\n+ 'script',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p>koala<script></script><script /></body></html>'\n+ ],\n+ [\n+ 'p',\n+ '<html><body class=\"something\">fookoala<p><p class=\"inner\">bar</p></p><script></script><script /></body></html>'\n+ ],\n+ [\n+ 'nope',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script></script><script /></body></html>'\n+ ]\n+ ];\n+ }\n+\n+ public function providerInjectBeforeTagEnd()\n+ {\n+ return [\n+ [\n+ 'body',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script></script><script />koala</body></html>'\n+ ],\n+ [\n+ 'script',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script></script>koala<script /></body></html>'\n+ ],\n+ [\n+ 'p',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p>koala</p><script></script><script /></body></html>'\n+ ],\n+ [\n+ 'nope',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script></script><script /></body></html>'\n+ ]\n+ ];\n+ }\n+\n+ public function providerInjectAfterTagStart()\n+ {\n+ return [\n+ [\n+ 'body',\n+ '<html><body class=\"something\">koalafoo<p><p class=\"inner\">bar</p></p><script></script><script /></body></html>'\n+ ],\n+ [\n+ 'script',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script>koala</script><script /></body></html>'\n+ ],\n+ [\n+ 'p',\n+ '<html><body class=\"something\">foo<p>koala<p class=\"inner\">bar</p></p><script></script><script /></body></html>'\n+ ],\n+ [\n+ 'nope',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script></script><script /></body></html>'\n+ ]\n+ ];\n+ }\n+\n+ public function providerInjectAfterTagEnd()\n+ {\n+ return [\n+ [\n+ 'body',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script></script><script /></body>koala</html>'\n+ ],\n+ [\n+ 'script',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script></script><script />koala</body></html>'\n+ ],\n+ [\n+ 'p',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p>koala<script></script><script /></body></html>'\n+ ],\n+ [\n+ 'nope',\n+ '<html><body class=\"something\">foo<p><p class=\"inner\">bar</p></p><script></script><script /></body></html>'\n+ ]\n+ ];\n+ }\n+\n+ /**\n+ * @dataProvider providerInjectBeforeTagStart\n+ */\n+ public function testInjectBeforeTagStart(string $tag, string $expected)\n+ {\n+ $result = HtmlInjector::injectBeforeTagStart(\n+ self::HTML,\n+ $tag,\n+ 'koala'\n+ );\n+ self::assertSameHtml(\n+ $expected,\n+ $result\n+ );\n+ }\n+\n+ /**\n+ * @dataProvider providerInjectBeforeTagEnd\n+ */\n+ public function testInjectBeforeTagEnd(string $tag, string $expected)\n+ {\n+ $result = HtmlInjector::injectBeforeTagEnd(\n+ self::HTML,\n+ $tag,\n+ 'koala'\n+ );\n+ self::assertSameHtml(\n+ $expected,\n+ $result\n+ );\n+ }\n+\n+ /**\n+ * @dataProvider providerInjectAfterTagStart\n+ */\n+ public function testInjectAfterTagStart(string $tag, string $expected)\n+ {\n+ $result = HtmlInjector::injectAfterTagStart(\n+ self::HTML,\n+ $tag,\n+ 'koala'\n+ );\n+ self::assertSameHtml(\n+ $expected,\n+ $result\n+ );\n+ }\n+\n+ /**\n+ * @dataProvider providerInjectAfterTagEnd\n+ */\n+ public function testInjectAfterTagEnd(string $tag, string $expected)\n+ {\n+ $result = HtmlInjector::injectAfterTagEnd(\n+ self::HTML,\n+ $tag,\n+ 'koala'\n+ );\n+ self::assertSameHtml(\n+ $expected,\n+ $result\n+ );\n+ }\n+\n+ public function testInjectAfterLinkEnd()\n+ {\n+ $tag = 'link';\n+ $expected = '<html><head>bar<link src=\"foo\"></head><link src=\"bar\" /><body>foo<link src=\"baz\"></link></body><link src=\"end\">koalabaz</html>';\n+ $html = '<html><head>bar<link src=\"foo\"></head><link src=\"bar\" /><body>foo<link src=\"baz\"></link></body><link src=\"end\">baz</html>';\n+\n+ $result = HtmlInjector::injectAfterTagEnd(\n+ $html,\n+ $tag,\n+ 'koala'\n+ );\n+ self::assertSameHtml(\n+ $expected,\n+ $result\n+ );\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Widget/Injector/HtmlInjectorTest.php",
"new_path": "tests/php/Widget/Injector/HtmlInjectorTest.php",
"diff": "@@ -75,7 +75,24 @@ class HtmlInjectorTest extends StringTestCase\n$response = new Response($this->getHtml());\n$injector->inject($snippet, $response);\n- self::assertSameStrings($expected, $response->getContent());\n+ self::assertSameHtml($expected, $response->getContent());\n+ }\n+\n+ /**\n+ * @dataProvider providerTarget\n+ */\n+ public function testInjectNoSpaces(string $constant): void\n+ {\n+ $expected = file_get_contents(self::TEST_TEMPLATES_BASE_PATH . 'result.' . $constant . '.html');\n+ $constant = constant('Bolt\\Widget\\Injector\\Target::' . $constant);\n+ $injector = new HtmlInjector();\n+\n+ $snippet = new SnippetWidget('koala', '', $constant);\n+\n+ $response = new Response(preg_replace('/\\s+/', '', $this->getHtml()));\n+ $injector->inject($snippet, $response);\n+\n+ self::assertSameHtml($expected, $response->getContent());\n}\n/**\n@@ -91,7 +108,7 @@ class HtmlInjectorTest extends StringTestCase\n$response = new Response($html);\n$injector->inject($snippet, $response);\n- self::assertSameStrings($html, $response->getContent());\n+ self::assertSameHtml($html, $response->getContent());\n}\n/**\n@@ -107,7 +124,7 @@ class HtmlInjectorTest extends StringTestCase\n$response = new Response();\n$injector->inject($snippet, $response);\n- self::assertSameStrings(\"\", $response->getContent());\n+ self::assertSameHtml(\"\", $response->getContent());\n}\n/**\n@@ -123,7 +140,7 @@ class HtmlInjectorTest extends StringTestCase\n$response = new Response();\n$injector->inject($snippet, $response);\n- self::assertSameStrings(\"koala\", $response->getContent());\n+ self::assertSameHtml(\"koala\", $response->getContent());\n}\nprotected function getHtml()\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Widget/WidgetsTest.php",
"new_path": "tests/php/Widget/WidgetsTest.php",
"diff": "@@ -40,7 +40,7 @@ class WidgetsTest extends StringTestCase\n$widgets->registerWidget($snippet);\n$widgets->processQueue($response);\n- $this->assertSameStrings(\"<html><body>foo*foo*</body></html>\", $response->getContent());\n+ $this->assertSameHtml(\"<html><body>foo*foo*</body></html>\", $response->getContent());\n}\npublic function testRenderWidget(): void\n@@ -59,7 +59,7 @@ class WidgetsTest extends StringTestCase\n$widgets->registerWidget($weatherWidget);\n- $this->assertSameStrings(\n+ $this->assertSameHtml(\n'<div id=\"widget-weather-widget\" name=\"Weather Widget\">[Hello, weather!]</div>',\n$widgets->renderWidgetByName('Weather Widget')\n);\n@@ -82,7 +82,7 @@ class WidgetsTest extends StringTestCase\n$widgets->registerWidget($weatherWidget);\n- $this->assertSameStrings(\n+ $this->assertSameHtml(\n'<div id=\"widget-weather-widget\" name=\"Weather Widget\">[Hello, Bar!]</div>',\n$widgets->renderWidgetByName('Weather Widget', ['foo' => 'Bar'])\n);\n@@ -107,7 +107,7 @@ class WidgetsTest extends StringTestCase\n$widgets->registerWidget($headerWidget);\n$widgets->processQueue($response);\n- $this->assertSameStrings('Bolt', $response->headers->get('X-Powered-By'));\n+ $this->assertSameHtml('Bolt', $response->headers->get('X-Powered-By'));\n}\npublic function testProcessWeatherWidgetInTarget(): void\n@@ -134,9 +134,39 @@ class WidgetsTest extends StringTestCase\n$widgets->registerWidget($weather);\n$widgets->processQueue($response);\n- $this->assertSameStrings(\n+ $this->assertSameHtml(\n'<html><body>foo<div id=\"widget-weather-widget\" name=\"Weather Widget\">[Hello, weather!]</div></body></html>',\n$response->getContent()\n);\n}\n+\n+ public function testProcessWeatherWidgetInTarget2(): void\n+ {\n+ $request = new Request();\n+ $request->attributes->set(RequestZone::KEY, RequestZone::BACKEND);\n+ $requestStack = new RequestStack();\n+ $requestStack->push($request);\n+\n+ $queueProcessor = new QueueProcessor(new HtmlInjector());\n+ $loader = new ArrayLoader(['weather.twig' => '[Hello, weather!]']);\n+ $twig = new Environment($loader);\n+\n+ $widgets = new Widgets($requestStack, $queueProcessor, $twig);\n+\n+ $response = new Response('<html><body>foo</body></html>');\n+\n+ $weather = new WeatherWidget();\n+\n+ // overwrite things just to simplify test\n+ $weather->setTarget(Target::START_OF_BODY);\n+ $weather->setTemplate('weather.twig');\n+\n+ $widgets->registerWidget($weather);\n+ $widgets->processQueue($response);\n+\n+ $this->assertSameHtml(\n+ '<html><body><div id=\"widget-weather-widget\" name=\"Weather Widget\">[Hello, weather!]</div>foo</body></html>',\n+ $response->getContent()\n+ );\n+ }\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Html Injector rewritten
|
95,112 |
22.04.2019 00:59:21
| -7,200 |
3cc070a34d427a5634805f578795345798033932
|
Fix NewsWidget
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -12,7 +12,7 @@ use Bolt\\Widget\\Injector\\RequestZone;\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\RequestException;\n-class NewsWidget extends BaseWidget implements TwigAware\n+class NewsWidget extends BaseWidget implements TwigAware, RequestAware\n{\nprotected $name = 'News Widget';\nprotected $target = AdditionalTarget::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Fix NewsWidget
|
95,112 |
22.04.2019 01:20:41
| -7,200 |
17a97c5632711cfad594210b378d181179ff6457
|
Fix setting deps in Widget Queue Processor
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/Injector/HtmlInjector.php",
"new_path": "src/Widget/Injector/HtmlInjector.php",
"diff": "@@ -5,10 +5,8 @@ declare(strict_types=1);\nnamespace Bolt\\Widget\\Injector;\nuse Bolt\\Common\\Str;\n-use Bolt\\Widget\\ResponseAware;\nuse Bolt\\Widget\\WidgetInterface;\nuse Symfony\\Component\\HttpFoundation\\Response;\n-use Symfony\\Component\\HttpFoundation\\StreamedResponse;\n/**\n* Class for matching HTML elements and injecting text.\n@@ -58,19 +56,10 @@ class HtmlInjector\npublic function inject(WidgetInterface $widget, Response $response): void\n{\n- // Don't try to modify the response body for streamed responses. Stuff will break, if we do.\n- if ($response instanceof StreamedResponse) {\n- return;\n- }\n-\n$html = $response->getContent();\n$functionMap = $this->getMap();\n$target = $widget->getTarget();\n- if ($widget instanceof ResponseAware) {\n- $widget->setResponse($response);\n- }\n-\n$output = $widget();\nif (isset($functionMap[$target])) {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/Injector/QueueProcessor.php",
"new_path": "src/Widget/Injector/QueueProcessor.php",
"diff": "@@ -4,6 +4,10 @@ declare(strict_types=1);\nnamespace Bolt\\Widget\\Injector;\n+use Bolt\\Widget\\RequestAware;\n+use Bolt\\Widget\\ResponseAware;\n+use Bolt\\Widget\\WidgetInterface;\n+use Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Tightenco\\Collect\\Support\\Collection;\n@@ -22,19 +26,14 @@ class QueueProcessor\n$this->injector = $injector;\n}\n- public function process(Response $response, Collection $queue, string $zone): Response\n+ public function guardResponse(Response $response, callable $process): Response\n{\n// First, gather all html <!-- comments -->, because they shouldn't be\n// considered for replacements. We use a callback, so we can fill our\n// $this->matchedComments array\npreg_replace_callback('/<!--(.*)-->/Uis', [$this, 'pregCallback'], $response->getContent());\n- foreach ($queue as $widget) {\n- if ($widget->getZone() === $zone) {\n- $this->injector->inject($widget, $response);\n- }\n- // unset($this->queue[$key]);\n- }\n+ $process($response);\n// Finally, replace back ###comment### with its original comment.\nif (! empty($this->matchedComments)) {\n@@ -45,6 +44,22 @@ class QueueProcessor\nreturn $response;\n}\n+ public function process(Response $response, Request $request, Collection $queue, string $zone): void\n+ {\n+ /** @var WidgetInterface $widget */\n+ foreach ($queue as $widget) {\n+ if ($widget->getZone() === $zone || $widget->getZone() === RequestZone::EVERYWHERE) {\n+ if ($widget instanceof RequestAware) {\n+ $widget->setRequest($request);\n+ }\n+ if ($widget instanceof ResponseAware) {\n+ $widget->setResponse($response);\n+ }\n+ $this->injector->inject($widget, $response);\n+ }\n+ }\n+ }\n+\n/**\n* Callback method to identify comments and store them in the\n* matchedComments array.\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/Injector/RequestZone.php",
"new_path": "src/Widget/Injector/RequestZone.php",
"diff": "@@ -12,7 +12,7 @@ use Symfony\\Component\\HttpFoundation\\Request;\n*/\nclass RequestZone\n{\n- public const KEY = 'zone';\n+ private const KEY = 'zone';\npublic const FRONTEND = 'frontend';\npublic const BACKEND = 'backend';\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -18,7 +18,7 @@ class NewsWidget extends BaseWidget implements TwigAware, RequestAware\nprotected $target = AdditionalTarget::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\nprotected $priority = 150;\nprotected $template = '@bolt/widgets/news.twig';\n- protected $zone = RequestZone::NOWHERE;\n+ protected $zone = RequestZone::BACKEND;\npublic function __invoke(array $params = []): string\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widgets.php",
"new_path": "src/Widgets.php",
"diff": "@@ -11,6 +11,7 @@ use Bolt\\Widget\\TwigAware;\nuse Bolt\\Widget\\WidgetInterface;\nuse Symfony\\Component\\HttpFoundation\\RequestStack;\nuse Symfony\\Component\\HttpFoundation\\Response;\n+use Symfony\\Component\\HttpFoundation\\StreamedResponse;\nuse Tightenco\\Collect\\Support\\Collection;\nuse Twig\\Environment;\n@@ -86,7 +87,24 @@ class Widgets\npublic function processQueue(Response $response): Response\n{\n- $zone = RequestZone::getFromRequest($this->requestStack->getCurrentRequest());\n- return $this->queueProcessor->process($response, $this->queue, $zone);\n+ // Don't try to modify the response body for streamed responses. Stuff will break, if we do.\n+ if ($response instanceof StreamedResponse) {\n+ return $response;\n+ }\n+\n+ $request = $this->requestStack->getCurrentRequest();\n+ $zone = RequestZone::getFromRequest($request);\n+ if ($zone === RequestZone::NOWHERE) {\n+ return $response;\n+ }\n+\n+ $queue = $this->queue;\n+\n+ return $this->queueProcessor->guardResponse(\n+ $response,\n+ function (Response $response) use ($request, $queue, $zone): void {\n+ $this->queueProcessor->process($response, $request, $queue, $zone);\n+ }\n+ );\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Widget/WidgetsTest.php",
"new_path": "tests/php/Widget/WidgetsTest.php",
"diff": "@@ -25,7 +25,10 @@ class WidgetsTest extends StringTestCase\n{\n$queueProcessor = new QueueProcessor(new HtmlInjector());\n$requestStack = new RequestStack();\n- $requestStack->push(Request::createFromGlobals());\n+\n+ $request = Request::createFromGlobals();\n+ RequestZone::setToRequest($request, RequestZone::BACKEND);\n+ $requestStack->push($request);\n$loader = new ArrayLoader(['weather.twig' => '[Hello, weather!]']);\n$twig = new Environment($loader);\n@@ -35,6 +38,7 @@ class WidgetsTest extends StringTestCase\n$snippet = (new SnippetWidget())\n->setTemplate('*foo*')\n+ ->setZone(RequestZone::EVERYWHERE)\n->setTarget(Target::END_OF_BODY);\n$widgets->registerWidget($snippet);\n@@ -91,7 +95,7 @@ class WidgetsTest extends StringTestCase\npublic function testProcessHeaderWidget(): void\n{\n$request = new Request();\n- $request->attributes->set(RequestZone::KEY, RequestZone::FRONTEND);\n+ RequestZone::setToRequest($request, RequestZone::FRONTEND);\n$requestStack = new RequestStack();\n$requestStack->push($request);\n@@ -113,7 +117,7 @@ class WidgetsTest extends StringTestCase\npublic function testProcessWeatherWidgetInTarget(): void\n{\n$request = new Request();\n- $request->attributes->set(RequestZone::KEY, RequestZone::BACKEND);\n+ RequestZone::setToRequest($request, RequestZone::BACKEND);\n$requestStack = new RequestStack();\n$requestStack->push($request);\n@@ -143,7 +147,7 @@ class WidgetsTest extends StringTestCase\npublic function testProcessWeatherWidgetInTarget2(): void\n{\n$request = new Request();\n- $request->attributes->set(RequestZone::KEY, RequestZone::BACKEND);\n+ RequestZone::setToRequest($request, RequestZone::BACKEND);\n$requestStack = new RequestStack();\n$requestStack->push($request);\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Fix setting deps in Widget Queue Processor
|
95,144 |
22.04.2019 12:47:06
| -7,200 |
dff15a15c67d4155800c35fb992aedc49cde30a4
|
Only invoke widget, when we intend to inject it.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/Injector/HtmlInjector.php",
"new_path": "src/Widget/Injector/HtmlInjector.php",
"diff": "@@ -60,9 +60,8 @@ class HtmlInjector\n$functionMap = $this->getMap();\n$target = $widget->getTarget();\n- $output = $widget();\n-\nif (isset($functionMap[$target])) {\n+ $output = $widget();\n$html = $this->{$functionMap[$target]}($output, $html);\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Only invoke widget, when we intend to inject it.
|
95,144 |
22.04.2019 15:38:38
| -7,200 |
85b752b4a2a3ba1143178b2646b3bc0bb535cf0b
|
Working on config parsers
|
[
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/BaseParser.php",
"new_path": "src/Configuration/Parser/BaseParser.php",
"diff": "@@ -6,7 +6,6 @@ namespace Bolt\\Configuration\\Parser;\nuse Bolt\\Configuration\\PathResolver;\nuse Symfony\\Component\\Config\\FileLocator;\n-use Symfony\\Component\\HttpFoundation\\File\\Exception\\FileNotFoundException;\nuse Symfony\\Component\\Yaml\\Yaml;\nuse Tightenco\\Collect\\Support\\Collection;\n@@ -21,22 +20,28 @@ abstract class BaseParser\n/** @var string[] */\nprotected $filenames = [];\n- public function __construct()\n+ /** @var string */\n+ protected $filename;\n+\n+ public function __construct(string $filename)\n{\n$configDirectories = [dirname(dirname(dirname(__DIR__))) . '/config/bolt'];\n$this->fileLocator = new FileLocator($configDirectories);\n$this->pathResolver = new PathResolver(dirname(dirname(dirname(__DIR__))), []);\n+ $this->filename = $filename;\n}\n/**\n* Read and parse a YAML configuration file.\n+ *\n+ * If filename doesn't exist and/or isn't readable, we attempt to locate it\n+ * in our config folder. This way you can pass in either an absolute\n+ * filename or simply 'menu.yaml'.\n*/\nprotected function parseConfigYaml(string $filename): Collection\n{\n- try {\n+ if (! is_readable($filename)) {\n$filename = $this->fileLocator->locate($filename, null, true);\n- } catch (FileNotFoundException $e) {\n- return new Collection();\n}\n$yaml = Yaml::parseFile($filename);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/MenuParser.php",
"new_path": "src/Configuration/Parser/MenuParser.php",
"diff": "@@ -11,7 +11,7 @@ class MenuParser extends BaseParser\n/** @var array */\nprivate $itemBase = [];\n- public function __construct()\n+ public function __construct(string $filename = 'menu.yaml')\n{\n$this->itemBase = [\n'label' => '',\n@@ -23,7 +23,7 @@ class MenuParser extends BaseParser\n'current' => false,\n];\n- parent::__construct();\n+ parent::__construct($filename);\n}\n/**\n@@ -31,8 +31,7 @@ class MenuParser extends BaseParser\n*/\npublic function parse(): Collection\n{\n- // @todo Allow setting of file/path. See Github issue https://github.com/bolt/four/issues/379\n- $menuYaml = $this->parseConfigYaml('menu.yaml');\n+ $menuYaml = $this->parseConfigYaml($this->filename);\n$menu = [];\n@@ -50,7 +49,7 @@ class MenuParser extends BaseParser\n$menu = [];\nforeach ($items as $item) {\n- $item = array_merge($this->itemBase, $item);\n+ $item = array_merge($this->itemBase, (array) $item);\nif (isset($item['submenu']) && is_array($item['submenu'])) {\n$item['submenu'] = $this->parseItems($item['submenu']);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/fixtures/config/bogus.yaml",
"diff": "+# Random yaml, to test parsing a nonsense file.\n+\n+foo: bar\n+\n+what:\n+ - is\n+ - going\n+ - on\n+ - here?\n+\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/fixtures/config/broken.yaml",
"diff": "+# Broken yaml, to test parsing a broken file.\n+\n+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praeclare enim Plato:\n+Beatum, cui etiam in senectute contigerit, ut sapientiam verasque opiniones\n+assequi possit. Quamquam tu hanc copiosiorem etiam soles dicere. Duae sunt enim\n+res quoque, ne tu verba solum putes. Quae tamen a te agetur non melior.\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/MenuParserTest.php",
"new_path": "tests/php/Configuration/Parser/MenuParserTest.php",
"diff": "@@ -6,6 +6,8 @@ namespace Bolt\\Tests\\Configuration\\Parser;\nuse Bolt\\Configuration\\Parser\\MenuParser;\nuse PHPUnit\\Framework\\TestCase;\n+use Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException;\n+use Symfony\\Component\\Yaml\\Exception\\ParseException;\nuse Tightenco\\Collect\\Support\\Collection;\nclass MenuParserTest extends TestCase\n@@ -15,10 +17,38 @@ class MenuParserTest extends TestCase\n$menuParser = new MenuParser();\n$config = $menuParser->parse();\n- // @todo Test breakage on corrupt files. See Github issue https://github.com/bolt/four/issues/379\n$this->assertInstanceOf(Collection::class, $config);\n}\n+ public function testIgnoreNonsensicalFileParse(): void\n+ {\n+ $file = dirname(dirname(dirname(__DIR__))).'/fixtures/config/bogus.yaml';\n+ $menuParser = new MenuParser($file);\n+ $config = $menuParser->parse();\n+\n+ $this->assertInstanceOf(Collection::class, $config);\n+ }\n+\n+ public function testBreakOnInvalidFileParse(): void\n+ {\n+ $file = dirname(dirname(dirname(__DIR__))).'/fixtures/config/broken.yaml';\n+ $menuParser = new MenuParser($file);\n+\n+ $this->expectException(ParseException::class);\n+\n+ $menuParser->parse();\n+ }\n+\n+ public function testBreakOnMissingFileParse(): void\n+ {\n+ $menuParser = new MenuParser('foo.yml');\n+\n+ $this->expectException(FileLocatorFileNotFoundException::class);\n+\n+ $menuParser->parse();\n+ }\n+\n+\npublic function testHasMenu(): void\n{\n$menuParser = new MenuParser();\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/php/Configuration/Parser/TaxonomyParserTest.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Tests\\Configuration\\Parser;\n+\n+use Bolt\\Configuration\\Parser\\MenuParser;\n+use Bolt\\Configuration\\Parser\\TaxonomyParser;\n+use PHPUnit\\Framework\\TestCase;\n+use Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException;\n+use Symfony\\Component\\Yaml\\Exception\\ParseException;\n+use Tightenco\\Collect\\Support\\Collection;\n+\n+class TaxonomyParserTest extends TestCase\n+{\n+ public function testCanParse(): void\n+ {\n+ $taxonomyParser = new TaxonomyParser();\n+ $config = $taxonomyParser->parse();\n+\n+ $this->assertInstanceOf(Collection::class, $config);\n+ }\n+\n+ public function testIgnoreNonsensicalFileParse(): void\n+ {\n+ $file = dirname(dirname(dirname(__DIR__))).'/fixtures/config/bogus.yaml';\n+ $taxonomyParser = new TaxonomyParser($file);\n+ $config = $taxonomyParser->parse();\n+\n+ $this->assertInstanceOf(Collection::class, $config);\n+ }\n+\n+ public function testBreakOnInvalidFileParse(): void\n+ {\n+ $file = dirname(dirname(dirname(__DIR__))).'/fixtures/config/broken.yaml';\n+ $taxonomyParser = new TaxonomyParser($file);\n+\n+ $this->expectException(ParseException::class);\n+\n+ $taxonomyParser->parse();\n+ }\n+\n+ public function testBreakOnMissingFileParse(): void\n+ {\n+ $taxonomyParser = new TaxonomyParser('foo.yml');\n+\n+ $this->expectException(FileLocatorFileNotFoundException::class);\n+\n+ $taxonomyParser->parse();\n+ }\n+\n+//\n+// public function testHasMenu(): void\n+// {\n+// $menuParser = new MenuParser();\n+// $config = $menuParser->parse();\n+//\n+// $this->assertCount(2, $config);\n+//\n+// $this->assertArrayHasKey('main', $config);\n+// $this->assertCount(4, $config['main']);\n+//\n+// $this->assertSame('Home', $config['main'][0]['label']);\n+// $this->assertSame('This is the <b>first<b> menu item.', $config['main'][0]['title']);\n+// $this->assertSame('homepage', $config['main'][0]['link']);\n+// $this->assertSame('homepage', $config['main'][0]['class']);\n+// $this->assertNull($config['main'][0]['submenu']);\n+// $this->assertSame('', $config['main'][0]['uri']);\n+// $this->assertFalse($config['main'][0]['current']);\n+// $this->assertArrayNotHasKey('foobar', $config['main'][0]);\n+//\n+// $this->assertCount(4, $config['main'][1]['submenu']);\n+// $this->assertSame('Sub 1', $config['main'][1]['submenu'][0]['label']);\n+//\n+// $this->assertArrayNotHasKey('foo', $config);\n+// }\n+}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Working on config parsers
|
95,144 |
22.04.2019 19:18:28
| -7,200 |
578b40cdf4a8d84af7b704b0b8c7c2791c837bd1
|
More tests for TaxonomyParserTest
|
[
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/BaseParser.php",
"new_path": "src/Configuration/Parser/BaseParser.php",
"diff": "@@ -47,10 +47,8 @@ abstract class BaseParser\n}\n} catch (FileLocatorFileNotFoundException $e) {\nif ($ignoreMissing) {\n- echo \"[a]\";\nreturn new Collection([]);\n}\n- echo \"[b]\";\n// If not $ignoreMissing, we throw the exception regardless.\nthrow $e;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/TaxonomyParser.php",
"new_path": "src/Configuration/Parser/TaxonomyParser.php",
"diff": "@@ -25,6 +25,11 @@ class TaxonomyParser extends BaseParser\nif (isset($taxonomy['name']) === false) {\n$taxonomy['name'] = ucwords(str_replace('-', ' ', Str::humanize($taxonomy['slug'])));\n}\n+\n+ if (isset($taxonomy['slug']) === false) {\n+ $taxonomy['slug'] = Str::slug($taxonomy['name']);\n+ }\n+\nif (isset($taxonomy['singular_name']) === false) {\nif (isset($taxonomy['singular_slug'])) {\n$taxonomy['singular_name'] = ucwords(str_replace('-', ' ', Str::humanize($taxonomy['singular_slug'])));\n@@ -32,21 +37,35 @@ class TaxonomyParser extends BaseParser\n$taxonomy['singular_name'] = ucwords(str_replace('-', ' ', Str::humanize($taxonomy['slug'])));\n}\n}\n- if (isset($taxonomy['slug']) === false) {\n- $taxonomy['slug'] = Str::slug($taxonomy['name']);\n- }\n+\nif (isset($taxonomy['singular_slug']) === false) {\n$taxonomy['singular_slug'] = Str::slug($taxonomy['singular_name']);\n}\n+\nif (isset($taxonomy['has_sortorder']) === false) {\n$taxonomy['has_sortorder'] = false;\n}\n+\nif (isset($taxonomy['allow_spaces']) === false) {\n$taxonomy['allow_spaces'] = false;\n}\n+\nif (isset($taxonomy['allow_empty']) === false) {\n$taxonomy['allow_empty'] = true;\n}\n+\n+ if (isset($taxonomy['behaves_like']) === false) {\n+ $taxonomy['behaves_like'] = 'tags';\n+ }\n+\n+ if (isset($taxonomy['prefix']) === false) {\n+ $taxonomy['prefix'] = '';\n+ }\n+\n+ if (isset($taxonomy['postfix']) === false) {\n+ $taxonomy['postfix'] = '';\n+ }\n+\nif ($taxonomy['behaves_like'] === 'grouping') {\n$taxonomy['multiple'] = false;\n} elseif ($taxonomy['behaves_like'] === 'tags' || (isset($taxonomy['multiple']) && $taxonomy['multiple'] === true)) {\n@@ -74,11 +93,12 @@ class TaxonomyParser extends BaseParser\nif (isset($taxonomy['behaves_like']) === false) {\n$taxonomy['behaves_like'] = 'tags';\n}\n+\n// If taxonomy is like tags, set 'tagcloud' to true by default.\nif ($taxonomy['behaves_like'] === 'tags' && isset($taxonomy['tagcloud']) === false) {\n$taxonomy['tagcloud'] = true;\n} else {\n- $taxonomy += ['tagcloud' => false];\n+ $taxonomy['tagcloud'] = false;\n}\n$taxonomies[$key] = $taxonomy;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/fixtures/config/minimal_taxonomy.yaml",
"diff": "+# Minimal Taxonomy\n+\n+foo:\n+ name: Bar\n+\n+\n+qux:\n+ slug: corge\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/TaxonomyParserTest.php",
"new_path": "tests/php/Configuration/Parser/TaxonomyParserTest.php",
"diff": "@@ -40,29 +40,70 @@ class TaxonomyParserTest extends TestCase\n$taxonomyParser->parse();\n}\n-//\n-// public function testHasMenu(): void\n-// {\n-// $menuParser = new MenuParser();\n-// $config = $menuParser->parse();\n-//\n-// $this->assertCount(2, $config);\n-//\n-// $this->assertArrayHasKey('main', $config);\n-// $this->assertCount(4, $config['main']);\n-//\n-// $this->assertSame('Home', $config['main'][0]['label']);\n-// $this->assertSame('This is the <b>first<b> menu item.', $config['main'][0]['title']);\n-// $this->assertSame('homepage', $config['main'][0]['link']);\n-// $this->assertSame('homepage', $config['main'][0]['class']);\n-// $this->assertNull($config['main'][0]['submenu']);\n-// $this->assertSame('', $config['main'][0]['uri']);\n-// $this->assertFalse($config['main'][0]['current']);\n-// $this->assertArrayNotHasKey('foobar', $config['main'][0]);\n-//\n-// $this->assertCount(4, $config['main'][1]['submenu']);\n-// $this->assertSame('Sub 1', $config['main'][1]['submenu'][0]['label']);\n-//\n-// $this->assertArrayNotHasKey('foo', $config);\n-// }\n+\n+ public function testHasTaxonomies(): void\n+ {\n+ $taxonomyParser = new TaxonomyParser();\n+ $config = $taxonomyParser->parse();\n+\n+ $this->assertCount(3, $config);\n+\n+ $this->assertArrayHasKey('tags', $config);\n+ $this->assertCount(13, $config['tags']);\n+\n+ $this->assertSame('tags', $config['tags']['slug']);\n+ $this->assertSame('tag', $config['tags']['singular_slug']);\n+ $this->assertSame('tags', $config['tags']['behaves_like']);\n+ $this->assertSame('Add some freeform tags. Start a new tag by typing a comma or space.', $config['tags']['postfix']);\n+ $this->assertFalse($config['tags']['allow_spaces']);\n+ $this->assertSame('Tags', $config['tags']['name']);\n+ $this->assertSame('Tag', $config['tags']['singular_name']);\n+ $this->assertFalse($config['tags']['has_sortorder']);\n+ $this->assertTrue($config['tags']['allow_empty']);\n+ $this->assertTrue($config['tags']['multiple']);\n+ $this->assertEmpty($config['tags']['options']);\n+ $this->assertTrue($config['tags']['tagcloud']);\n+\n+ $this->assertCount(8, $config['categories']['options']);\n+\n+ $this->assertArrayNotHasKey('foobar', $config['tags']);\n+ $this->assertArrayNotHasKey('foo', $config);\n+ }\n+\n+\n+ public function testInferTaxonomyValues(): void\n+ {\n+ $file = dirname(dirname(dirname(__DIR__))).'/fixtures/config/minimal_taxonomy.yaml';\n+ $taxonomyParser = new TaxonomyParser($file);\n+ $config = $taxonomyParser->parse();\n+\n+ $this->assertCount(2, $config);\n+\n+ $this->assertArrayHasKey('foo', $config);\n+ $this->assertCount(13, $config['foo']);\n+\n+ $this->assertSame('Bar', $config['foo']['name']);\n+ $this->assertSame('bar', $config['foo']['slug']);\n+ $this->assertSame('Bar', $config['foo']['singular_name']);\n+ $this->assertSame('bar', $config['foo']['singular_slug']);\n+ $this->assertFalse($config['foo']['has_sortorder']);\n+ $this->assertFalse($config['foo']['allow_spaces']);\n+ $this->assertSame('tags', $config['foo']['behaves_like']);\n+ $this->assertSame('', $config['foo']['prefix']);\n+ $this->assertSame('', $config['foo']['postfix']);\n+ $this->assertTrue($config['foo']['allow_empty']);\n+ $this->assertTrue($config['foo']['multiple']);\n+ $this->assertEmpty($config['foo']['options']);\n+ $this->assertTrue($config['foo']['tagcloud']);\n+\n+ $this->assertCount(13, $config['qux']);\n+\n+ $this->assertSame('Corge', $config['qux']['name']);\n+ $this->assertSame('corge', $config['qux']['slug']);\n+ $this->assertSame('Corge', $config['qux']['singular_name']);\n+ $this->assertSame('corge', $config['qux']['singular_slug']);\n+\n+\n+ }\n+\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
More tests for TaxonomyParserTest
|
95,144 |
26.04.2019 15:51:32
| -7,200 |
170544974ac735d761dcfded9bfc5b3bc3ad775b
|
Add ParserTestBase
|
[
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"new_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"diff": "@@ -7,18 +7,12 @@ namespace Bolt\\Tests\\Configuration\\Parser;\nuse Bolt\\Configuration\\Parser\\ContentTypesParser;\nuse Bolt\\Configuration\\Parser\\GeneralParser;\nuse Bolt\\Exception\\ConfigurationException;\n-use PHPUnit\\Framework\\TestCase;\nuse Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException;\nuse Symfony\\Component\\Yaml\\Exception\\ParseException;\nuse Tightenco\\Collect\\Support\\Collection;\n-class ContentTypesParserTest extends TestCase\n+class ContentTypesParserTest extends ParserTestBase\n{\n- public static function getBasePath(): string\n- {\n- return dirname(dirname(dirname(__DIR__))) . '/fixtures/config/';\n- }\n-\npublic function testCanParse(): void\n{\n$generalParser = new GeneralParser();\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/GeneralParserTest.php",
"new_path": "tests/php/Configuration/Parser/GeneralParserTest.php",
"diff": "@@ -5,18 +5,12 @@ declare(strict_types=1);\nnamespace Bolt\\Tests\\Configuration\\Parser;\nuse Bolt\\Configuration\\Parser\\GeneralParser;\n-use PHPUnit\\Framework\\TestCase;\nuse Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException;\nuse Symfony\\Component\\Yaml\\Exception\\ParseException;\nuse Tightenco\\Collect\\Support\\Collection;\n-class GeneralParserTest extends TestCase\n+class GeneralParserTest extends ParserTestBase\n{\n- public static function getBasePath(): string\n- {\n- return dirname(dirname(dirname(__DIR__))) . '/fixtures/config/';\n- }\n-\npublic function testCanParse(): void\n{\n$generalParser = new GeneralParser();\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/MenuParserTest.php",
"new_path": "tests/php/Configuration/Parser/MenuParserTest.php",
"diff": "@@ -5,18 +5,12 @@ declare(strict_types=1);\nnamespace Bolt\\Tests\\Configuration\\Parser;\nuse Bolt\\Configuration\\Parser\\MenuParser;\n-use PHPUnit\\Framework\\TestCase;\nuse Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException;\nuse Symfony\\Component\\Yaml\\Exception\\ParseException;\nuse Tightenco\\Collect\\Support\\Collection;\n-class MenuParserTest extends TestCase\n+class MenuParserTest extends ParserTestBase\n{\n- public static function getBasePath(): string\n- {\n- return dirname(dirname(dirname(__DIR__))) . '/fixtures/config/';\n- }\n-\npublic function testCanParse(): void\n{\n$menuParser = new MenuParser();\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "tests/php/Configuration/Parser/ParserTestBase.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Tests\\Configuration\\Parser;\n+\n+use PHPUnit\\Framework\\TestCase;\n+\n+class ParserTestBase extends TestCase\n+{\n+ public static function getBasePath(): string\n+ {\n+ return dirname(dirname(dirname(__DIR__))) . '/fixtures/config/';\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/TaxonomyParserTest.php",
"new_path": "tests/php/Configuration/Parser/TaxonomyParserTest.php",
"diff": "@@ -5,18 +5,12 @@ declare(strict_types=1);\nnamespace Bolt\\Tests\\Configuration\\Parser;\nuse Bolt\\Configuration\\Parser\\TaxonomyParser;\n-use PHPUnit\\Framework\\TestCase;\nuse Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException;\nuse Symfony\\Component\\Yaml\\Exception\\ParseException;\nuse Tightenco\\Collect\\Support\\Collection;\n-class TaxonomyParserTest extends TestCase\n+class TaxonomyParserTest extends ParserTestBase\n{\n- public static function getBasePath(): string\n- {\n- return dirname(dirname(dirname(__DIR__))) . '/fixtures/config/';\n- }\n-\npublic function testCanParse(): void\n{\n$taxonomyParser = new TaxonomyParser();\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Add ParserTestBase
|
95,144 |
26.04.2019 15:52:35
| -7,200 |
1f9eed5739f43687de18c34e9e37ca6eb9403900
|
make parent class abstract
|
[
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/ParserTestBase.php",
"new_path": "tests/php/Configuration/Parser/ParserTestBase.php",
"diff": "@@ -6,7 +6,7 @@ namespace Bolt\\Tests\\Configuration\\Parser;\nuse PHPUnit\\Framework\\TestCase;\n-class ParserTestBase extends TestCase\n+abstract class ParserTestBase extends TestCase\n{\npublic static function getBasePath(): string\n{\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
make parent class abstract
|
95,144 |
28.04.2019 18:25:12
| -7,200 |
3f0896112688406421dce694eadd35d073636a43
|
Make `with-images` and `without-images` groups in fixtures
|
[
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/ContentFixtures.php",
"new_path": "src/DataFixtures/ContentFixtures.php",
"diff": "@@ -10,6 +10,7 @@ use Bolt\\Configuration\\FileLocations;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Entity\\Field;\nuse Bolt\\Enum\\Statuses;\n+use Doctrine\\Bundle\\FixturesBundle\\FixtureGroupInterface;\nuse Doctrine\\Common\\DataFixtures\\DependentFixtureInterface;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\nuse Faker\\Factory;\n@@ -18,7 +19,7 @@ use Gedmo\\Translatable\\Entity\\Repository\\TranslationRepository;\nuse Gedmo\\Translatable\\Entity\\Translation;\nuse Tightenco\\Collect\\Support\\Collection;\n-class ContentFixtures extends BaseFixture implements DependentFixtureInterface\n+class ContentFixtures extends BaseFixture implements DependentFixtureInterface, FixtureGroupInterface\n{\n/** @var Generator */\nprivate $faker;\n@@ -53,9 +54,14 @@ class ContentFixtures extends BaseFixture implements DependentFixtureInterface\n];\n}\n+ public static function getGroups(): array\n+ {\n+ return ['with-images', 'without-images'];\n+ }\n+\npublic function load(ObjectManager $manager): void\n{\n- $path = $this->fileLocations->get('files')->getBasepath() . '/stock/';\n+ $path = $this->fileLocations->get('files')->getBasepath();\n$this->imagesIndex = $this->getImagesIndex($path);\n$this->loadContent($manager);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/DataFixtures/ImageFetchFixtures.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\DataFixtures;\n+\n+use Bolt\\Configuration\\FileLocations;\n+use Bolt\\Factory\\MediaFactory;\n+use Doctrine\\Bundle\\FixturesBundle\\FixtureGroupInterface;\n+use Doctrine\\Common\\Persistence\\ObjectManager;\n+use Faker\\Factory;\n+use Faker\\Generator;\n+use GuzzleHttp\\Client;\n+use Illuminate\\Support\\Collection;\n+\n+class ImageFetchFixtures extends BaseFixture implements FixtureGroupInterface\n+{\n+ /** @var Generator */\n+ private $faker;\n+\n+ /** @var Collection */\n+ private $urls;\n+\n+ /** @var MediaFactory */\n+ private $mediaFactory;\n+\n+ /** @var FileLocations */\n+ private $fileLocations;\n+\n+ private const AMOUNT = 10;\n+ private const MAX_AMOUNT = 40;\n+\n+ public function __construct(FileLocations $fileLocations, MediaFactory $mediaFactory)\n+ {\n+ $this->urls = new Collection([\n+ 'https://source.unsplash.com/1280x1024/?business,workspace,interior/',\n+ 'https://source.unsplash.com/1280x1024/?cityscape,landscape,nature/',\n+ 'https://source.unsplash.com/1280x1024/?animal,kitten,puppy,cute/',\n+ 'https://source.unsplash.com/1280x1024/?technology/',\n+ ]);\n+\n+ $this->faker = Factory::create();\n+ $this->mediaFactory = $mediaFactory;\n+ $this->fileLocations = $fileLocations;\n+ }\n+\n+ public static function getGroups(): array\n+ {\n+ return ['with-images'];\n+ }\n+\n+ public function load(ObjectManager $manager): void\n+ {\n+ $path = $this->fileLocations->get('files')->getBasepath();\n+\n+ // We only fetch more images, if we're currently under the MAX_AMOUNT\n+ if ($this->getImagesIndex($path)->count() <= self::MAX_AMOUNT) {\n+ $this->fetchImages();\n+ }\n+ }\n+\n+ private function fetchImages(): void\n+ {\n+ $outputPath = $this->fileLocations->get('files')->getBasepath() . '/stock/';\n+\n+ if (! is_dir($outputPath)) {\n+ mkdir($outputPath);\n+ }\n+\n+ for ($i = 1; $i <= self::AMOUNT; $i++) {\n+ $url = $this->urls->random() . random_int(10000, 99999);\n+ $filename = 'image_' . random_int(10000, 99999) . '.jpg';\n+\n+ $client = new Client();\n+ $resource = fopen($outputPath . $filename, 'w');\n+ $client->request('GET', $url, ['sink' => $resource]);\n+ echo ' image';\n+ }\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/ImagesFixtures.php",
"new_path": "src/DataFixtures/ImagesFixtures.php",
"diff": "@@ -6,13 +6,13 @@ namespace Bolt\\DataFixtures;\nuse Bolt\\Configuration\\FileLocations;\nuse Bolt\\Factory\\MediaFactory;\n+use Doctrine\\Bundle\\FixturesBundle\\FixtureGroupInterface;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\nuse Faker\\Factory;\nuse Faker\\Generator;\n-use GuzzleHttp\\Client;\nuse Illuminate\\Support\\Collection;\n-class ImagesFixtures extends BaseFixture\n+class ImagesFixtures extends BaseFixture implements FixtureGroupInterface\n{\n/** @var Generator */\nprivate $faker;\n@@ -27,50 +27,31 @@ class ImagesFixtures extends BaseFixture\nprivate $fileLocations;\nprivate const AMOUNT = 10;\n+ private const MAX_AMOUNT = 40;\npublic function __construct(FileLocations $fileLocations, MediaFactory $mediaFactory)\n{\n- $this->urls = new Collection([\n- 'https://source.unsplash.com/1280x1024/?business,workspace,interior/',\n- 'https://source.unsplash.com/1280x1024/?cityscape,landscape,nature/',\n- 'https://source.unsplash.com/1280x1024/?animal,kitten,puppy,cute/',\n- 'https://source.unsplash.com/1280x1024/?technology/',\n- ]);\n-\n$this->faker = Factory::create();\n$this->mediaFactory = $mediaFactory;\n$this->fileLocations = $fileLocations;\n}\n- public function load(ObjectManager $manager): void\n+ public static function getGroups(): array\n{\n- $this->fetchImages();\n- $this->loadImages($manager);\n-\n- $manager->flush();\n+ return ['with-images', 'without-images'];\n}\n- private function fetchImages(): void\n+ public function load(ObjectManager $manager): void\n{\n- $outputPath = $this->fileLocations->get('files')->getBasepath() . '/stock/';\n-\n- if (! is_dir($outputPath)) {\n- mkdir($outputPath);\n- }\n-\n- for ($i = 1; $i <= self::AMOUNT; $i++) {\n- $url = $this->urls->random() . random_int(10000, 99999);\n- $filename = 'image_' . random_int(10000, 99999) . '.jpg';\n+ // Regardless of whether we fetch images, we still populate the Media Entities\n+ $this->loadImages($manager);\n- $client = new Client();\n- $resource = fopen($outputPath . $filename, 'w');\n- $client->request('GET', $url, ['sink' => $resource]);\n- }\n+ $manager->flush();\n}\nprivate function loadImages(ObjectManager $manager): void\n{\n- $path = $this->fileLocations->get('files')->getBasepath() . '/stock/';\n+ $path = $this->fileLocations->get('files')->getBasepath();\n$index = $this->getImagesIndex($path);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/TaxonomyFixtures.php",
"new_path": "src/DataFixtures/TaxonomyFixtures.php",
"diff": "@@ -8,9 +8,10 @@ use Bolt\\Collection\\DeepCollection;\nuse Bolt\\Configuration\\Config;\nuse Bolt\\Entity\\Taxonomy;\nuse Bolt\\Utils\\Str;\n+use Doctrine\\Bundle\\FixturesBundle\\FixtureGroupInterface;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\n-class TaxonomyFixtures extends BaseFixture\n+class TaxonomyFixtures extends BaseFixture implements FixtureGroupInterface\n{\n/** @var Config */\nprivate $config;\n@@ -27,6 +28,11 @@ class TaxonomyFixtures extends BaseFixture\n$manager->flush();\n}\n+ public static function getGroups(): array\n+ {\n+ return ['with-images', 'without-images'];\n+ }\n+\nprivate function loadTaxonomies(ObjectManager $manager): void\n{\n$order = 1;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/UserFixtures.php",
"new_path": "src/DataFixtures/UserFixtures.php",
"diff": "@@ -5,10 +5,11 @@ declare(strict_types=1);\nnamespace Bolt\\DataFixtures;\nuse Bolt\\Entity\\User;\n+use Doctrine\\Bundle\\FixturesBundle\\FixtureGroupInterface;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\nuse Symfony\\Component\\Security\\Core\\Encoder\\UserPasswordEncoderInterface;\n-class UserFixtures extends BaseFixture\n+class UserFixtures extends BaseFixture implements FixtureGroupInterface\n{\n/** @var UserPasswordEncoderInterface */\nprivate $passwordEncoder;\n@@ -25,6 +26,11 @@ class UserFixtures extends BaseFixture\n$manager->flush();\n}\n+ public static function getGroups(): array\n+ {\n+ return ['with-images', 'without-images'];\n+ }\n+\nprivate function loadUsers(ObjectManager $manager): void\n{\nforeach ($this->getUserData() as $userData) {\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Make `with-images` and `without-images` groups in fixtures
|
95,144 |
28.04.2019 19:04:01
| -7,200 |
6dc72e4e870d97cf6387a2c318db32fe610c08d8
|
Speed up Fixtures in tests
|
[
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/ImageFetchFixtures.php",
"new_path": "src/DataFixtures/ImageFetchFixtures.php",
"diff": "@@ -5,32 +5,23 @@ declare(strict_types=1);\nnamespace Bolt\\DataFixtures;\nuse Bolt\\Configuration\\FileLocations;\n-use Bolt\\Factory\\MediaFactory;\nuse Doctrine\\Bundle\\FixturesBundle\\FixtureGroupInterface;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\n-use Faker\\Factory;\n-use Faker\\Generator;\nuse GuzzleHttp\\Client;\nuse Illuminate\\Support\\Collection;\nclass ImageFetchFixtures extends BaseFixture implements FixtureGroupInterface\n{\n- /** @var Generator */\n- private $faker;\n-\n/** @var Collection */\nprivate $urls;\n- /** @var MediaFactory */\n- private $mediaFactory;\n-\n/** @var FileLocations */\nprivate $fileLocations;\nprivate const AMOUNT = 10;\nprivate const MAX_AMOUNT = 40;\n- public function __construct(FileLocations $fileLocations, MediaFactory $mediaFactory)\n+ public function __construct(FileLocations $fileLocations)\n{\n$this->urls = new Collection([\n'https://source.unsplash.com/1280x1024/?business,workspace,interior/',\n@@ -39,8 +30,6 @@ class ImageFetchFixtures extends BaseFixture implements FixtureGroupInterface\n'https://source.unsplash.com/1280x1024/?technology/',\n]);\n- $this->faker = Factory::create();\n- $this->mediaFactory = $mediaFactory;\n$this->fileLocations = $fileLocations;\n}\n@@ -74,7 +63,6 @@ class ImageFetchFixtures extends BaseFixture implements FixtureGroupInterface\n$client = new Client();\n$resource = fopen($outputPath . $filename, 'w');\n$client->request('GET', $url, ['sink' => $resource]);\n- echo ' image';\n}\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/ImagesFixtures.php",
"new_path": "src/DataFixtures/ImagesFixtures.php",
"diff": "@@ -10,25 +10,18 @@ use Doctrine\\Bundle\\FixturesBundle\\FixtureGroupInterface;\nuse Doctrine\\Common\\Persistence\\ObjectManager;\nuse Faker\\Factory;\nuse Faker\\Generator;\n-use Illuminate\\Support\\Collection;\nclass ImagesFixtures extends BaseFixture implements FixtureGroupInterface\n{\n/** @var Generator */\nprivate $faker;\n- /** @var Collection */\n- private $urls;\n-\n/** @var MediaFactory */\nprivate $mediaFactory;\n/** @var FileLocations */\nprivate $fileLocations;\n- private const AMOUNT = 10;\n- private const MAX_AMOUNT = 40;\n-\npublic function __construct(FileLocations $fileLocations, MediaFactory $mediaFactory)\n{\n$this->faker = Factory::create();\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Repository/TaxonomyRepositoryTest.php",
"new_path": "tests/php/Repository/TaxonomyRepositoryTest.php",
"diff": "@@ -14,12 +14,10 @@ class TaxonomyRepositoryTest extends DbAwareTestCase\n{\nprotected function setUp(): void\n{\n- $this->markTestIncomplete(\"This test takes like forever to run so let's skip it until it will be finished\");\n-\nparent::setUp();\n// fixtures loading takes a lot of time, it would be better to load database dump for tests\n- self::runCommand('doctrine:fixtures:load --no-interaction');\n+ self::runCommand('doctrine:fixtures:load --no-interaction --group=without-images');\n}\npublic function testSearchByType(): void\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Speed up Fixtures in tests
|
95,144 |
28.04.2019 19:46:01
| -7,200 |
97e9ec6746a0e84fe84fb667c06cdf39b5a0e4da
|
Add Relations in Fixtures
|
[
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/ContentFixtures.php",
"new_path": "src/DataFixtures/ContentFixtures.php",
"diff": "@@ -135,6 +135,9 @@ class ContentFixtures extends BaseFixture implements DependentFixtureInterface,\n}\n}\n+ $refKey = sprintf('content_%s_%s', $contentType['slug'], $content->getSlug());\n+ $this->addReference($refKey, $content);\n+\n$manager->persist($content);\n}\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/DataFixtures/RelationsFixtures.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\DataFixtures;\n+\n+use Bolt\\Configuration\\Config;\n+use Bolt\\Entity\\Content;\n+use Bolt\\Entity\\Relation;\n+use Doctrine\\Bundle\\FixturesBundle\\FixtureGroupInterface;\n+use Doctrine\\Common\\DataFixtures\\DependentFixtureInterface;\n+use Doctrine\\Common\\Persistence\\ObjectManager;\n+\n+class RelationsFixtures extends BaseFixture implements DependentFixtureInterface, FixtureGroupInterface\n+{\n+ /** @var Config */\n+ private $config;\n+\n+ public const AMOUNT = 8;\n+\n+ public function __construct(Config $config)\n+ {\n+ $this->config = $config;\n+ }\n+\n+ public function getDependencies()\n+ {\n+ return [\n+ UserFixtures::class,\n+ TaxonomyFixtures::class,\n+ ContentFixtures::class,\n+ ];\n+ }\n+\n+ public static function getGroups(): array\n+ {\n+ return ['with-images', 'without-images'];\n+ }\n+\n+ public function load(ObjectManager $manager): void\n+ {\n+ $this->loadContent($manager);\n+\n+ $manager->flush();\n+ }\n+\n+ private function loadContent(ObjectManager $manager): void\n+ {\n+ $contentTypes = $this->config->get('contenttypes');\n+\n+ foreach ($contentTypes as $contentType) {\n+ foreach ($contentType['relations']->keys() as $contentTypeTo) {\n+ for ($i = 1; $i <= self::AMOUNT; $i++) {\n+ $this->addRelation($contentType['slug'], $contentTypeTo, $manager);\n+ }\n+ }\n+ }\n+ }\n+\n+ private function addRelation($contentTypeFrom, $contentTypeTo, $manager): void\n+ {\n+ /** @var Content $contentFrom */\n+ $contentFrom = $this->getRandomReference('content_' . $contentTypeFrom);\n+\n+ /** @var Content $contentTo */\n+ $contentTo = $this->getRandomReference('content_' . $contentTypeTo);\n+\n+ $relation = new Relation($contentFrom, $contentTo);\n+\n+ $manager->persist($relation);\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Entity/Content.php",
"new_path": "src/Entity/Content.php",
"diff": "@@ -185,6 +185,15 @@ class Content\nthrow new \\RuntimeException('Content not fully initialized');\n}\n+ return $this->getDefinition()->get('slug');\n+ }\n+\n+ public function getContentTypeSingularSlug(): string\n+ {\n+ if ($this->getDefinition() === null) {\n+ throw new \\RuntimeException('Content not fully initialized');\n+ }\n+\nreturn $this->getDefinition()->get('singular_slug');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Twig/ContentExtension.php",
"new_path": "src/Twig/ContentExtension.php",
"diff": "@@ -198,7 +198,7 @@ class ContentExtension extends AbstractExtension\nreturn $this->urlGenerator->generate('record', [\n'slugOrId' => $content->getSlug() ?: $content->getId(),\n- 'contentTypeSlug' => $content->getContentTypeSlug(),\n+ 'contentTypeSlug' => $content->getContentTypeSingularSlug(),\n], $absolute ? UrlGeneratorInterface::ABSOLUTE_URL : UrlGeneratorInterface::ABSOLUTE_PATH);\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Add Relations in Fixtures
|
95,144 |
28.04.2019 20:19:13
| -7,200 |
590647cad7756926f1c2f2cef87818dcf9bdae9f
|
Show Relations in frontend
|
[
{
"change_type": "MODIFY",
"old_path": "public/theme/skeleton/partials/_recordfooter.twig",
"new_path": "public/theme/skeleton/partials/_recordfooter.twig",
"diff": "<ul>\n{% for content_type, related_records in related_content_types %}\n<li>\n- <h4>Related {{ app.config.contenttypes[content_type].name }}</h4>\n+ <h4>Related {{ config.get('contenttypes/' ~ content_type ~ '/name') }}</h4>\n<ul>\n{% for related_record in related_records %}\n<li><a href=\"{{ related_record|link }}\">{{ related_record|title }}</a></li>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/ImageFetchFixtures.php",
"new_path": "src/DataFixtures/ImageFetchFixtures.php",
"diff": "@@ -19,7 +19,7 @@ class ImageFetchFixtures extends BaseFixture implements FixtureGroupInterface\nprivate $fileLocations;\nprivate const AMOUNT = 10;\n- private const MAX_AMOUNT = 40;\n+ private const MAX_AMOUNT = 50;\npublic function __construct(FileLocations $fileLocations)\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/RelationsFixtures.php",
"new_path": "src/DataFixtures/RelationsFixtures.php",
"diff": "@@ -16,7 +16,7 @@ class RelationsFixtures extends BaseFixture implements DependentFixtureInterface\n/** @var Config */\nprivate $config;\n- public const AMOUNT = 8;\n+ public const AMOUNT = 15;\npublic function __construct(Config $config)\n{\n@@ -57,7 +57,7 @@ class RelationsFixtures extends BaseFixture implements DependentFixtureInterface\n}\n}\n- private function addRelation($contentTypeFrom, $contentTypeTo, $manager): void\n+ private function addRelation(string $contentTypeFrom, string $contentTypeTo, ObjectManager $manager): void\n{\n/** @var Content $contentFrom */\n$contentFrom = $this->getRandomReference('content_' . $contentTypeFrom);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Repository/RelationRepository.php",
"new_path": "src/Repository/RelationRepository.php",
"diff": "@@ -6,6 +6,7 @@ namespace Bolt\\Repository;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Entity\\Relation;\n+use Bolt\\Enum\\Statuses;\nuse Doctrine\\ORM\\EntityManager;\nuse Doctrine\\ORM\\QueryBuilder;\nuse Gedmo\\Sortable\\Entity\\Repository\\SortableRepository;\n@@ -33,15 +34,15 @@ class RelationRepository extends SortableRepository\n/**\n* @var Relation[]\n*/\n- public function findRelations(Content $from, ?string $name, bool $biDirectional = false, ?int $limit = null): array\n+ public function findRelations(Content $from, ?string $name, bool $biDirectional = false, ?int $limit = null, bool $publishedOnly = true): array\n{\n- $result = $this->buildRelationQuery($from, $name)\n+ $result = $this->buildRelationQuery($from, $name, false, $publishedOnly)\n->setMaxResults($limit)\n->getQuery()\n->getResult();\nif (empty($result) === true && $biDirectional === true) {\n- $result = $this->buildRelationQuery($from, $name, true)\n+ $result = $this->buildRelationQuery($from, $name, true, $publishedOnly)\n->setMaxResults($limit)\n->getQuery()\n->getResult();\n@@ -50,15 +51,15 @@ class RelationRepository extends SortableRepository\nreturn $result;\n}\n- public function findFirstRelation(Content $from, ?string $name, bool $biDirectional = false): ?Relation\n+ public function findFirstRelation(Content $from, ?string $name, bool $biDirectional = false, bool $publishedOnly = true): ?Relation\n{\n- $result = $this->buildRelationQuery($from, $name)\n+ $result = $this->buildRelationQuery($from, $name, false, $publishedOnly)\n->setMaxResults(1)\n->getQuery()\n->getOneOrNullResult();\nif ($result === null && $biDirectional === true) {\n- $result = $this->buildRelationQuery($from, $name, true)\n+ $result = $this->buildRelationQuery($from, $name, true, $publishedOnly)\n->setMaxResults(1)\n->getQuery()\n->getOneOrNullResult();\n@@ -67,7 +68,7 @@ class RelationRepository extends SortableRepository\nreturn $result;\n}\n- private function buildRelationQuery(Content $from, ?string $name, bool $reversed = false): QueryBuilder\n+ private function buildRelationQuery(Content $from, ?string $name, bool $reversed = false, bool $publishedOnly = true): QueryBuilder\n{\n$qb = $this->createQueryBuilder('r')\n->select('r, cfrom, cto')\n@@ -75,6 +76,12 @@ class RelationRepository extends SortableRepository\n->join('r.toContent', 'cto')\n->orderBy('r.position', 'DESC');\n+\n+ if ($publishedOnly === true) {\n+ $qb->andWhere('cto.status = :status')\n+ ->setParameter('status', Statuses::PUBLISHED, \\PDO::PARAM_STR);\n+ }\n+\nif ($name !== null) {\n$qb->andWhere('r.name = :name')\n->setParameter('name', $name, \\PDO::PARAM_STR);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Twig/RelatedExtension.php",
"new_path": "src/Twig/RelatedExtension.php",
"diff": "@@ -51,9 +51,9 @@ class RelatedExtension extends AbstractExtension\n/**\n* @return array name => Content[]\n*/\n- public function getAllRelatedContent(Content $content, bool $bidirectional = true, ?int $limit = null): array\n+ public function getAllRelatedContent(Content $content, bool $bidirectional = true, ?int $limit = null, bool $publishedOnly = true): array\n{\n- $relations = $this->relationRepository->findRelations($content, null, $bidirectional, $limit);\n+ $relations = $this->relationRepository->findRelations($content, null, $bidirectional, $limit, $publishedOnly);\nreturn (new Collection($relations))\n->reduce(function (array $result, Relation $relation) use ($content): array {\n@@ -71,11 +71,11 @@ class RelatedExtension extends AbstractExtension\n/**\n* @return Content[]\n*/\n- public function getRelatedContent(Content $content, ?string $name = null, ?string $ct = null, bool $bidirectional = true, ?int $limit = null): array\n+ public function getRelatedContent(Content $content, ?string $name = null, ?string $ct = null, bool $bidirectional = true, ?int $limit = null, bool $publishedOnly = true): array\n{\n$name = $name ?? $ct;\n- $relations = $this->relationRepository->findRelations($content, $name, $bidirectional, $limit);\n+ $relations = $this->relationRepository->findRelations($content, $name, $bidirectional, $limit, $publishedOnly);\nreturn (new Collection($relations))\n->map(function (Relation $relation) use ($content) {\n@@ -85,11 +85,11 @@ class RelatedExtension extends AbstractExtension\n->toArray();\n}\n- public function getFirstRelatedContent(Content $content, ?string $name = null, ?string $ct = null, bool $bidirectional = true): ?Content\n+ public function getFirstRelatedContent(Content $content, ?string $name = null, ?string $ct = null, bool $bidirectional = true, bool $publishedOnly = true): ?Content\n{\n$name = $name ?? $ct;\n- $relation = $this->relationRepository->findFirstRelation($content, $name, $bidirectional);\n+ $relation = $this->relationRepository->findFirstRelation($content, $name, $bidirectional, $publishedOnly);\nif ($relation === null) {\nreturn null;\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Show Relations in frontend
|
95,144 |
07.05.2019 15:10:28
| -7,200 |
62c0ad4067d8ef8013d7091f3ace4edce54a6cdb
|
Poking at phpspec tests with a stick until they pass
|
[
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "@@ -39,9 +39,7 @@ csfix:\nmake csclear\nvendor/bin/ecs check src --fix\nvendor/bin/ecs check tests/spec --fix --config vendor/symplify/easy-coding-standard/config/common/namespaces.yml\n- vendor/bin/ecs check tests/php --fix --config vendor/symplify/easy-coding-standard/config/common/namespaces.yml\n- vendor/bin/ecs check tests/php --fix --config vendor/symplify/easy-coding-standard/config/common/phpunit.yml\n- vendor/bin/ecs check tests/php --fix --config vendor/symplify/easy-coding-standard/config/common/strict.yml\n+ vendor/bin/ecs check tests/php --fix --config vendor/symplify/easy-coding-standard/config/common/namespaces.yml --config vendor/symplify/easy-coding-standard/config/common/phpunit.yml --config vendor/symplify/easy-coding-standard/config/common/strict.yml\nmake stancheck\nstancheck:\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Repository/RelationRepository.php",
"new_path": "src/Repository/RelationRepository.php",
"diff": "@@ -76,7 +76,6 @@ class RelationRepository extends SortableRepository\n->join('r.toContent', 'cto')\n->orderBy('r.position', 'DESC');\n-\nif ($publishedOnly === true) {\n$qb->andWhere('cto.status = :status')\n->setParameter('status', Statuses::PUBLISHED, \\PDO::PARAM_STR);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/spec/Bolt/Twig/RelatedExtensionSpec.php",
"new_path": "tests/spec/Bolt/Twig/RelatedExtensionSpec.php",
"diff": "@@ -22,7 +22,7 @@ class RelatedExtensionSpec extends ObjectBehavior\nfunction it_gets_all_related_content(Content $content, RelationRepository $relationRepository, Relation $relation, Content $related)\n{\n- $relationRepository->findRelations($content, null, true, null)\n+ $relationRepository->findRelations($content, null, true, null, true)\n->shouldBeCalledOnce()\n->willReturn([$relation, $relation]);\n@@ -42,7 +42,7 @@ class RelatedExtensionSpec extends ObjectBehavior\nfunction it_gets_related_content(Content $content, RelationRepository $relationRepository, Relation $relation, Content $related)\n{\n- $relationRepository->findRelations($content, self::TEST_CT_SLUG, true, null)\n+ $relationRepository->findRelations($content, self::TEST_CT_SLUG, true, null, true)\n->shouldBeCalledOnce()\n->willReturn([$relation]);\n@@ -58,7 +58,7 @@ class RelatedExtensionSpec extends ObjectBehavior\nfunction it_gets_related_content_unidirectional_with_limit(Content $content, RelationRepository $relationRepository, Relation $relation, Content $related)\n{\n- $relationRepository->findRelations($content, self::TEST_CT_SLUG, false, 3)\n+ $relationRepository->findRelations($content, self::TEST_CT_SLUG, false, 3, true)\n->shouldBeCalledOnce()\n->willReturn([$relation, $relation, $relation]);\n@@ -67,7 +67,7 @@ class RelatedExtensionSpec extends ObjectBehavior\n$content->getId()->willReturn(self::ORIGIN_ID);\n$related->getId()->willReturn(self::RELATED_ID);\n- $result = $this->getRelatedContent($content, null, self::TEST_CT_SLUG, false, 3);\n+ $result = $this->getRelatedContent($content, null, self::TEST_CT_SLUG, false, 3, true);\n$result->shouldBeArray();\n$result->shouldHaveCount(3);\n$result[0]->shouldBeAnInstanceOf(Content::class);\n@@ -75,7 +75,7 @@ class RelatedExtensionSpec extends ObjectBehavior\nfunction it_gets_first_related_content(Content $content, RelationRepository $relationRepository, Relation $relation, Content $related)\n{\n- $relationRepository->findFirstRelation($content, self::TEST_CT_SLUG, true, null)\n+ $relationRepository->findFirstRelation($content, self::TEST_CT_SLUG, true, true)\n->shouldBeCalledOnce()\n->willReturn($relation);\n@@ -90,7 +90,7 @@ class RelatedExtensionSpec extends ObjectBehavior\nfunction it_couldnt_find_related_content(Content $content, RelationRepository $relationRepository)\n{\n- $relationRepository->findRelations($content, null, true, null)->willReturn([]);\n+ $relationRepository->findRelations($content, null, true, null, true)->willReturn([]);\n$result = $this->getRelatedContent($content);\n$result->shouldBeArray();\n$result->shouldHaveCount(0);\n@@ -98,7 +98,7 @@ class RelatedExtensionSpec extends ObjectBehavior\nfunction it_couldnt_find_first_related_content(Content $content, RelationRepository $relationRepository)\n{\n- $relationRepository->findFirstRelation($content, null, true)->willReturn(null);\n+ $relationRepository->findFirstRelation($content, null, true, true)->willReturn(null);\n$result = $this->getFirstRelatedContent($content);\n$result->shouldBeNull();\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Poking at phpspec tests with a stick until they pass
|
95,144 |
07.05.2019 15:55:39
| -7,200 |
2fd53f70b243fa5360a4303e8f0d6a77741d3d5b
|
Flush referencesIndex, to make multiple in-memory tests run correctly
|
[
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/BaseFixture.php",
"new_path": "src/DataFixtures/BaseFixture.php",
"diff": "@@ -14,6 +14,15 @@ abstract class BaseFixture extends Fixture\nprivate $referencesIndex = [];\nprivate $taxonomyIndex = [];\n+ /**\n+ * During unit-tests, the fixtures are ran multiple times. Flush the\n+ * in-memory index, to prevent stale links to missing references.\n+ */\n+ protected function flushReferencesIndex(): void\n+ {\n+ $this->referencesIndex = [];\n+ }\n+\nprotected function getRandomReference(string $entityName)\n{\nif (isset($this->referencesIndex[$entityName]) === false) {\n"
},
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/RelationsFixtures.php",
"new_path": "src/DataFixtures/RelationsFixtures.php",
"diff": "@@ -39,6 +39,8 @@ class RelationsFixtures extends BaseFixture implements DependentFixtureInterface\npublic function load(ObjectManager $manager): void\n{\n+ $this->flushReferencesIndex();\n+\n$this->loadContent($manager);\n$manager->flush();\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Flush referencesIndex, to make multiple in-memory tests run correctly
|
95,144 |
07.05.2019 16:17:15
| -7,200 |
6a7d0b2145cfeaf305e37346e912b05ccd4d4961
|
Cleanup, better variable names
|
[
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Config.php",
"new_path": "src/Configuration/Config.php",
"diff": "@@ -124,7 +124,7 @@ class Config\n$timestamps = [];\nforeach ($configs as $config) {\n- foreach ($config->getFilenames() as $file) {\n+ foreach ($config->getParsedFilenames() as $file) {\n$timestamps[$file] = filemtime($file);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/BaseParser.php",
"new_path": "src/Configuration/Parser/BaseParser.php",
"diff": "@@ -18,18 +18,18 @@ abstract class BaseParser\n/** @var PathResolver */\nprotected $pathResolver;\n- /** @var string[] */\n- protected $filenames = [];\n-\n/** @var string */\n- protected $filename;\n+ protected $initialFilename;\n+\n+ /** @var string[] */\n+ protected $parsedFilenames = [];\npublic function __construct(string $filename)\n{\n$configDirectories = [dirname(dirname(dirname(__DIR__))) . '/config/bolt'];\n$this->fileLocator = new FileLocator($configDirectories);\n$this->pathResolver = new PathResolver(dirname(dirname(dirname(__DIR__))), []);\n- $this->filename = $filename;\n+ $this->initialFilename = $filename;\n}\n/**\n@@ -39,7 +39,7 @@ abstract class BaseParser\n* in our config folder. This way you can pass in either an absolute\n* filename or simply 'menu.yaml'.\n*/\n- protected function parseConfigYaml(string $filename, $ignoreMissing = false): Collection\n+ protected function parseConfigYaml(string $filename, bool $ignoreMissing = false): Collection\n{\ntry {\nif (! is_readable($filename)) {\n@@ -56,7 +56,7 @@ abstract class BaseParser\n$yaml = Yaml::parseFile($filename);\n- $this->filenames[] = $filename;\n+ $this->parsedFilenames[] = $filename;\n// Unset the repeated nodes key after parse\nunset($yaml['__nodes']);\n@@ -64,19 +64,19 @@ abstract class BaseParser\nreturn new Collection($yaml);\n}\n- public function getFilenames(): array\n+ public function getParsedFilenames(): array\n{\n- return $this->filenames;\n+ return $this->parsedFilenames;\n}\n- public function getFilename()\n+ public function getInitialFilename()\n{\n- return $this->filename;\n+ return $this->initialFilename;\n}\npublic function getFilenameLocalOverrides()\n{\n- return preg_replace('/([a-z0-9_-]+).(ya?ml)$/i', '$1_local.$2', $this->filename);\n+ return preg_replace('/([a-z0-9_-]+).(ya?ml)$/i', '$1_local.$2', $this->initialFilename);\n}\nabstract public function parse(): Collection;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/ContentTypesParser.php",
"new_path": "src/Configuration/Parser/ContentTypesParser.php",
"diff": "@@ -32,7 +32,7 @@ class ContentTypesParser extends BaseParser\npublic function parse(): Collection\n{\n$contentTypes = [];\n- $tempContentTypes = $this->parseConfigYaml($this->getFilename());\n+ $tempContentTypes = $this->parseConfigYaml($this->getInitialFilename());\nforeach ($tempContentTypes as $key => $contentType) {\nif (is_array($contentType)) {\n$contentType = $this->parseContentType($key, $contentType);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/GeneralParser.php",
"new_path": "src/Configuration/Parser/GeneralParser.php",
"diff": "@@ -23,7 +23,7 @@ class GeneralParser extends BaseParser\npublic function parse(): Collection\n{\n$defaultconfig = $this->getDefaultConfig();\n- $tempconfig = $this->parseConfigYaml($this->getFilename());\n+ $tempconfig = $this->parseConfigYaml($this->getInitialFilename());\n$tempconfiglocal = $this->parseConfigYaml($this->getFilenameLocalOverrides(), true);\n$general = Arr::replaceRecursive($defaultconfig, Arr::replaceRecursive($tempconfig, $tempconfiglocal));\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/MenuParser.php",
"new_path": "src/Configuration/Parser/MenuParser.php",
"diff": "@@ -31,7 +31,7 @@ class MenuParser extends BaseParser\n*/\npublic function parse(): Collection\n{\n- $menuYaml = $this->parseConfigYaml($this->getFilename());\n+ $menuYaml = $this->parseConfigYaml($this->getInitialFilename());\n$menu = [];\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/TaxonomyParser.php",
"new_path": "src/Configuration/Parser/TaxonomyParser.php",
"diff": "@@ -19,7 +19,7 @@ class TaxonomyParser extends BaseParser\n*/\npublic function parse(): Collection\n{\n- $taxonomies = $this->parseConfigYaml($this->getFilename());\n+ $taxonomies = $this->parseConfigYaml($this->getInitialFilename());\nforeach ($taxonomies as $key => $taxonomy) {\nif (isset($taxonomy['name']) === false) {\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"new_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"diff": "@@ -15,7 +15,7 @@ class ContentTypesParserTest extends ParserTestBase\n{\nconst NUMBER_OF_CONTENT_TYPES_IN_MINIMAL_FILE = 3;\n- const AMOUNT_OF_ATTRIBUTES_IN_CONTENTTYPE = 20;\n+ const AMOUNT_OF_ATTRIBUTES_IN_CONTENT_TYPE = 20;\npublic function testCanParse(): void\n{\n@@ -67,7 +67,7 @@ class ContentTypesParserTest extends ParserTestBase\n$this->assertCount(6, $config);\n$this->assertArrayHasKey('homepage', $config);\n- $this->assertCount(self::AMOUNT_OF_ATTRIBUTES_IN_CONTENTTYPE, $config['homepage']);\n+ $this->assertCount(self::AMOUNT_OF_ATTRIBUTES_IN_CONTENT_TYPE, $config['homepage']);\n$this->assertSame('Homepage', $config['homepage']['name']);\n$this->assertSame('Homepage', $config['homepage']['singular_name']);\n@@ -95,7 +95,7 @@ class ContentTypesParserTest extends ParserTestBase\n$this->assertCount(self::NUMBER_OF_CONTENT_TYPES_IN_MINIMAL_FILE, $config);\n$this->assertArrayHasKey('foo', $config);\n- $this->assertCount(self::AMOUNT_OF_ATTRIBUTES_IN_CONTENTTYPE, $config['foo']);\n+ $this->assertCount(self::AMOUNT_OF_ATTRIBUTES_IN_CONTENT_TYPE, $config['foo']);\n$this->assertSame('Bars', $config['foo']['name']);\n$this->assertSame('foo', $config['foo']['slug']);\n@@ -123,7 +123,7 @@ class ContentTypesParserTest extends ParserTestBase\n$this->assertIsIterable($config['foo']['relations']);\n$this->assertArrayHasKey('qux', $config);\n- $this->assertCount(self::AMOUNT_OF_ATTRIBUTES_IN_CONTENTTYPE, $config['qux']);\n+ $this->assertCount(self::AMOUNT_OF_ATTRIBUTES_IN_CONTENT_TYPE, $config['qux']);\n$this->assertSame('Corges', $config['qux']['name']);\n$this->assertSame('corges', $config['qux']['slug']);\n@@ -131,7 +131,7 @@ class ContentTypesParserTest extends ParserTestBase\n$this->assertSame('corge', $config['qux']['singular_slug']);\n$this->assertArrayHasKey('grault', $config);\n- $this->assertCount(self::AMOUNT_OF_ATTRIBUTES_IN_CONTENTTYPE, $config['grault']);\n+ $this->assertCount(self::AMOUNT_OF_ATTRIBUTES_IN_CONTENT_TYPE, $config['grault']);\n$this->assertSame('Grault', $config['grault']['name']);\n$this->assertSame('grault', $config['grault']['slug']);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/GeneralParserTest.php",
"new_path": "tests/php/Configuration/Parser/GeneralParserTest.php",
"diff": "@@ -65,9 +65,9 @@ class GeneralParserTest extends ParserTestBase\n$generalParser = new GeneralParser($file);\n$config = $generalParser->parse();\n- $this->assertCount(2, $generalParser->getFilenames());\n+ $this->assertCount(2, $generalParser->getParsedFilenames());\n- $this->assertSame($file, $generalParser->getFilename());\n+ $this->assertSame($file, $generalParser->getInitialFilename());\n$this->assertSame(self::getBasePath() . 'bogus_local.yaml', $generalParser->getFilenameLocalOverrides());\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Cleanup, better variable names
|
95,144 |
07.05.2019 16:18:41
| -7,200 |
171b37a062970ccafc73b31c0a52f460afd6f240
|
Rename $filename to $initialFilename
|
[
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/BaseParser.php",
"new_path": "src/Configuration/Parser/BaseParser.php",
"diff": "@@ -24,12 +24,12 @@ abstract class BaseParser\n/** @var string[] */\nprotected $parsedFilenames = [];\n- public function __construct(string $filename)\n+ public function __construct(string $initialFilename)\n{\n$configDirectories = [dirname(dirname(dirname(__DIR__))) . '/config/bolt'];\n$this->fileLocator = new FileLocator($configDirectories);\n$this->pathResolver = new PathResolver(dirname(dirname(dirname(__DIR__))), []);\n- $this->initialFilename = $filename;\n+ $this->initialFilename = $initialFilename;\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/GeneralParser.php",
"new_path": "src/Configuration/Parser/GeneralParser.php",
"diff": "@@ -12,9 +12,9 @@ use Webmozart\\PathUtil\\Path;\nclass GeneralParser extends BaseParser\n{\n- public function __construct(string $filename = 'config.yaml')\n+ public function __construct(string $initialFilename = 'config.yaml')\n{\n- parent::__construct($filename);\n+ parent::__construct($initialFilename);\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/MenuParser.php",
"new_path": "src/Configuration/Parser/MenuParser.php",
"diff": "@@ -11,7 +11,7 @@ class MenuParser extends BaseParser\n/** @var array */\nprivate $itemBase = [];\n- public function __construct(string $filename = 'menu.yaml')\n+ public function __construct(string $initialFilename = 'menu.yaml')\n{\n$this->itemBase = [\n'label' => '',\n@@ -23,7 +23,7 @@ class MenuParser extends BaseParser\n'current' => false,\n];\n- parent::__construct($filename);\n+ parent::__construct($initialFilename);\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/TaxonomyParser.php",
"new_path": "src/Configuration/Parser/TaxonomyParser.php",
"diff": "@@ -9,9 +9,9 @@ use Tightenco\\Collect\\Support\\Collection;\nclass TaxonomyParser extends BaseParser\n{\n- public function __construct(string $filename = 'taxonomy.yaml')\n+ public function __construct(string $initialFilename = 'taxonomy.yaml')\n{\n- parent::__construct($filename);\n+ parent::__construct($initialFilename);\n}\n/**\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Rename $filename to $initialFilename
|
95,144 |
07.05.2019 18:04:43
| -7,200 |
4dfd403710586f1f765004e6f0c691e96ff78d30
|
Update packages, add Luxon, reduce flag sizes
|
[
{
"change_type": "MODIFY",
"old_path": "assets/js/filters/date.js",
"new_path": "assets/js/filters/date.js",
"diff": "import Vue from 'vue';\n-import moment from 'moment';\n+import { DateTime } from 'luxon';\nVue.filter('date', string => {\nif (string) {\n- return moment(String(string))\n- .add(1, 'days')\n- .format('MMM DD, YYYY');\n+ return DateTime.fromISO(String(string)).toLocaleString();\n}\n});\nVue.filter('datetime', string => {\nif (string) {\n- return moment(String(string))\n- .add(1, 'days')\n- .format('MMMM Do YYYY, h:mm:ss a');\n+ return DateTime.fromISO(String(string)).toLocaleString(DateTime.DATETIME_FULL);\n}\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/vendor/flagkit/flagkit.scss",
"new_path": "assets/scss/vendor/flagkit/flagkit.scss",
"diff": "$fp-path: '/assets/icons/flags/';\n+$fp-enable-4x3: true;\n+$fp-enable-1x1: false;\n@import 'flagpack/src/flagpack.scss';\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"url\": \"git://github.com/bolt/four.git\"\n},\n\"dependencies\": {\n- \"@babel/polyfill\": \"^7.4.3\",\n- \"@vue/cli-service\": \"^3.6.0\",\n+ \"@babel/polyfill\": \"^7.4.4\",\n+ \"@vue/cli-service\": \"^3.7.0\",\n\"axios\": \"^0.18.0\",\n\"baguettebox.js\": \"^1.11.0\",\n\"bootstrap\": \"^4.3.1\",\n- \"codemirror\": \"^5.45.0\",\n+ \"codemirror\": \"^5.46.0\",\n\"flagpack\": \"^1.0.3\",\n- \"jquery\": \"^3.4.0\",\n- \"moment\": \"^2.24.0\",\n+ \"jquery\": \"^3.4.1\",\n+ \"luxon\": \"^1.13.0\",\n\"no-scroll\": \"^2.1.1\",\n\"popper.js\": \"^1.15.0\",\n\"register-service-worker\": \"^1.6.2\",\n\"simplemde\": \"^1.11.2\",\n\"stylelint-config-recommended-scss\": \"^3.3.0\",\n- \"stylelint-scss\": \"^3.6.0\",\n+ \"stylelint-scss\": \"^3.6.1\",\n\"terser\": \"^3.17.0\",\n\"tinycolor2\": \"^1.4.1\",\n\"vue\": \"^2.6.10\",\n\"vue-flatpickr-component\": \"^8.1.2\",\n- \"vue-multiselect\": \"^2.1.4\",\n+ \"vue-multiselect\": \"^2.1.6\",\n\"vue-notification\": \"^1.3.16\",\n\"vue-simplemde\": \"^0.5.1\",\n\"vue-trumbowyg\": \"^3.4.2\",\n\"vuex\": \"^3.1.0\"\n},\n\"devDependencies\": {\n- \"@babel/core\": \"^7.4.3\",\n- \"@babel/plugin-transform-regenerator\": \"^7.4.3\",\n- \"@babel/plugin-transform-runtime\": \"^7.4.3\",\n- \"@babel/polyfill\": \"^7.4.3\",\n- \"@babel/preset-env\": \"^7.4.3\",\n+ \"@babel/core\": \"^7.4.4\",\n+ \"@babel/plugin-transform-regenerator\": \"^7.4.4\",\n+ \"@babel/plugin-transform-runtime\": \"^7.4.4\",\n+ \"@babel/polyfill\": \"^7.4.4\",\n+ \"@babel/preset-env\": \"^7.4.4\",\n\"@symfony/webpack-encore\": \"^0.27.0\",\n\"@vue/test-utils\": \"^1.0.0-beta.29\",\n\"ajv-keywords\": \"^3.4.0\",\n\"autoprefixer\": \"^9.5.1\",\n\"babel-core\": \"^7.0.0-bridge.0\",\n\"babel-eslint\": \"^10.0.1\",\n- \"babel-jest\": \"^24.7.1\",\n+ \"babel-jest\": \"^24.8.0\",\n\"eslint\": \"^5.16.0\",\n- \"eslint-config-prettier\": \"^4.1.0\",\n+ \"eslint-config-prettier\": \"^4.2.0\",\n\"eslint-plugin-prettier\": \"^3.0.1\",\n\"eslint-plugin-standard\": \"^4.0.0\",\n\"eslint-plugin-vue\": \"^5.2.2\",\n- \"jest\": \"^24.7.1\",\n+ \"jest\": \"^24.8.0\",\n\"jest-serializer-vue\": \"^2.0.2\",\n- \"node-sass\": \"^4.11.0\",\n+ \"node-sass\": \"^4.12.0\",\n\"postcss-loader\": \"^3.0.0\",\n\"postcss-preset-env\": \"^6.6.0\",\n\"prettier\": \"^1.17.0\",\n\"vue-router\": \"^3.0.6\",\n\"vue-template-compiler\": \"^2.6.10\",\n\"webpackbar\": \"^3.2.0\",\n- \"workbox-webpack-plugin\": \"^4.3.0\"\n+ \"workbox-webpack-plugin\": \"^4.3.1\"\n},\n\"scripts\": {\n\"start\": \"encore dev-server --port=8234 --progress --disable-host-check --verbose\",\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Update packages, add Luxon, reduce flag sizes
|
95,144 |
07.05.2019 19:32:40
| -7,200 |
4d688cdaf272100cf0418fcb5843775dae0fc1a8
|
fix relative filename
|
[
{
"change_type": "MODIFY",
"old_path": "src/DataFixtures/ContentFixtures.php",
"new_path": "src/DataFixtures/ContentFixtures.php",
"diff": "@@ -162,7 +162,7 @@ class ContentFixtures extends BaseFixture implements DependentFixtureInterface,\ncase 'file':\n$randomImage = $this->imagesIndex->random();\n$data = [\n- 'filename' => 'stock/' . $randomImage->getFilename(),\n+ 'filename' => $randomImage->getRelativePathname(),\n'alt' => $this->faker->sentence(4, true),\n'title' => $this->faker->sentence(7, true),\n];\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Repository/RelationRepository.php",
"new_path": "src/Repository/RelationRepository.php",
"diff": "@@ -76,7 +76,6 @@ class RelationRepository extends SortableRepository\n->join('r.toContent', 'cto')\n->orderBy('r.position', 'DESC');\n-\nif ($publishedOnly === true) {\n$qb->andWhere('cto.status = :status')\n->setParameter('status', Statuses::PUBLISHED, \\PDO::PARAM_STR);\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
fix relative filename
|
95,144 |
09.05.2019 17:53:47
| -7,200 |
9fe2550f287296cb69d5f34293c2d95ef7ffbe94
|
Add missing attributes to json_records
|
[
{
"change_type": "MODIFY",
"old_path": "assets/js/app/listing/Components/Table/Row/_Meta.vue",
"new_path": "assets/js/app/listing/Components/Table/Row/_Meta.vue",
"diff": "<div class=\"listing__row--item is-meta\">\n<ul class=\"listing__row--list\">\n<li v-if=\"size === 'normal'\">\n- <i class=\"fas fa-user mr-2\"></i> {{ record.author.displayName }}\n+ <i class=\"fas fa-user mr-2\"></i> {{ record.authorName }}\n</li>\n<li v-if=\"size === 'normal'\">\n- <i class=\"fas mr-2\" :class=\"record.icon\"></i>\n+ <i class=\"fas mr-2\" :class=\"record.extras.icon\"></i>\n<template v-if=\"type === 'dashboard'\"\n><a :href=\"`/bolt/content/${record.contentType}`\">\n{{ record.contentType }}</a\n</li>\n<li>\n<span class=\"status mr-2\" :class=\"`is-${record.status}`\"></span\n- >{{ record.publishedAt.date|date }}\n+ >{{ record.publishedAt|date }}\n</li>\n</ul>\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Entity/Content.php",
"new_path": "src/Entity/Content.php",
"diff": "@@ -66,6 +66,7 @@ class Content\n* @var string\n*\n* @ORM\\Column(type=\"string\", length=191)\n+ * @Groups(\"get_content\")\n*/\nprivate $status;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Entity/ContentExtrasTrait.php",
"new_path": "src/Entity/ContentExtrasTrait.php",
"diff": "@@ -38,6 +38,7 @@ trait ContentExtrasTrait\n'excerpt' => $this->contentExtension->getExcerpt($content),\n'link' => $this->contentExtension->getLink($content),\n'editLink' => $this->contentExtension->getEditLink($content),\n+ 'icon' => $this->contentExtension->getIcon($content),\n];\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Twig/ContentExtension.php",
"new_path": "src/Twig/ContentExtension.php",
"diff": "@@ -231,4 +231,13 @@ class ContentExtension extends AbstractExtension\nreturn new Collection($taxonomies);\n}\n+\n+ public function getIcon(Content $content): ?string\n+ {\n+ if ($content->getId() === null) {\n+ return null;\n+ }\n+\n+ return $content->getDefinition()['icon_one'];\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Twig/JsonExtension.php",
"new_path": "src/Twig/JsonExtension.php",
"diff": "@@ -58,7 +58,8 @@ class JsonExtension extends AbstractExtension\nprivate function contentToArray(Content $content): array\n{\n- // we do it that way because in current API Platform version a Resource can't implement \\JsonSerializable\n+ // we do it that way because in current API Platform version a Resource\n+ // can't implement \\JsonSerializable\nreturn $this->normalizer->normalize($content, null, ['group' => [self::SERIALIZE_GROUP]]);\n}\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Add missing attributes to json_records
|
95,144 |
09.05.2019 18:17:45
| -7,200 |
70851034a445ed80ca28cea5feaa62793b907396
|
Use ->getIcon instead
|
[
{
"change_type": "MODIFY",
"old_path": "src/Entity/Content.php",
"new_path": "src/Entity/Content.php",
"diff": "@@ -74,6 +74,7 @@ class Content\n* @var \\DateTime\n*\n* @ORM\\Column(type=\"datetime\")\n+ * @Groups(\"get_content\")\n*/\nprivate $createdAt;\n@@ -97,6 +98,7 @@ class Content\n* @var \\DateTime|null\n*\n* @ORM\\Column(type=\"datetime\", nullable=true)\n+ * @Groups(\"get_content\")\n*/\nprivate $depublishedAt = null;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Entity/ContentExtrasTrait.php",
"new_path": "src/Entity/ContentExtrasTrait.php",
"diff": "@@ -38,7 +38,7 @@ trait ContentExtrasTrait\n'excerpt' => $this->contentExtension->getExcerpt($content),\n'link' => $this->contentExtension->getLink($content),\n'editLink' => $this->contentExtension->getEditLink($content),\n- 'icon' => $this->contentExtension->getIcon($content),\n+ 'icon' => $this->getIcon(),\n];\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Twig/ContentExtension.php",
"new_path": "src/Twig/ContentExtension.php",
"diff": "@@ -231,13 +231,4 @@ class ContentExtension extends AbstractExtension\nreturn new Collection($taxonomies);\n}\n-\n- public function getIcon(Content $content): ?string\n- {\n- if ($content->getId() === null) {\n- return null;\n- }\n-\n- return $content->getDefinition()['icon_one'];\n- }\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Use ->getIcon instead
|
95,144 |
09.05.2019 22:04:32
| -7,200 |
5fc20dfe71667e55e22bd1ed12ef2a2ba80274cf
|
Allow for caching of widgets
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/BaseWidget.php",
"new_path": "src/Widget/BaseWidget.php",
"diff": "@@ -15,6 +15,7 @@ abstract class BaseWidget implements WidgetInterface\nuse TwigTrait;\nuse RequestTrait;\nuse ResponseTrait;\n+ use CacheTrait;\n/** @var string */\nprotected $name;\n@@ -34,6 +35,9 @@ abstract class BaseWidget implements WidgetInterface\n/** @var ?string */\nprotected $slug;\n+ /** @var int duration (in seconds) to cache output */\n+ protected $cacheDuration = 600;\n+\npublic function setName(string $name): self\n{\n$this->name = $name;\n@@ -138,4 +142,9 @@ abstract class BaseWidget implements WidgetInterface\nreturn $this->slug;\n}\n+\n+ public function getCacheDuration(): int\n+ {\n+ return $this->cacheDuration;\n+ }\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Widget/CacheAware.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Widget;\n+\n+use Psr\\SimpleCache\\CacheInterface;\n+\n+/**\n+ * Interface CacheAware - Widgets that make use of caching need to implement\n+ * this interface, in order to have their contents cached.\n+ */\n+interface CacheAware extends WidgetInterface\n+{\n+ public function setCacheInterface(CacheInterface $config): void;\n+\n+ public function cachedInvoke(): string;\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Widget/CacheTrait.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Widget;\n+\n+use Psr\\SimpleCache\\CacheInterface;\n+\n+trait CacheTrait\n+{\n+ /** @var CacheInterface */\n+ private $cache;\n+\n+ /** @var string */\n+ private $key;\n+\n+ public function setCacheInterface(CacheInterface $cache): void\n+ {\n+ $this->cache = $cache;\n+ $this->key = $this->createKey();\n+ }\n+\n+ public function cachedInvoke(): string\n+ {\n+ if ($this->isCached()) {\n+ return $this->getFromCache();\n+ }\n+\n+ /** @var WidgetInterface $this */\n+ $output = $this();\n+\n+ $this->setToCache($output);\n+\n+ return $output;\n+ }\n+\n+ private function setToCache(string $output): void\n+ {\n+ $this->cache->set($this->key, $output, $this->getCacheDuration());\n+ }\n+\n+ private function getFromCache(): string\n+ {\n+ return $this->cache->get($this->key);\n+ }\n+\n+ private function isCached(): bool\n+ {\n+ return $this->cache->has($this->key);\n+ }\n+\n+ private function createKey()\n+ {\n+ return $this->getName() . $this->getTarget() . $this->getZone() . $this->getPriority();\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -12,13 +12,14 @@ use Bolt\\Widget\\Injector\\RequestZone;\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\RequestException;\n-class NewsWidget extends BaseWidget implements TwigAware, RequestAware\n+class NewsWidget extends BaseWidget implements TwigAware, RequestAware, CacheAware\n{\nprotected $name = 'News Widget';\nprotected $target = AdditionalTarget::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\nprotected $priority = 150;\nprotected $template = '@bolt/widgets/news.twig';\nprotected $zone = RequestZone::BACKEND;\n+ protected $cacheDuration = 3600;\npublic function __invoke(array $params = []): string\n{\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widgets.php",
"new_path": "src/Widgets.php",
"diff": "@@ -4,11 +4,13 @@ declare(strict_types=1);\nnamespace Bolt;\n+use Bolt\\Widget\\CacheAware;\nuse Bolt\\Widget\\Injector\\QueueProcessor;\nuse Bolt\\Widget\\Injector\\RequestZone;\nuse Bolt\\Widget\\RequestAware;\nuse Bolt\\Widget\\TwigAware;\nuse Bolt\\Widget\\WidgetInterface;\n+use Psr\\SimpleCache\\CacheInterface;\nuse Symfony\\Component\\HttpFoundation\\RequestStack;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\HttpFoundation\\StreamedResponse;\n@@ -32,12 +34,16 @@ class Widgets\n/** @var Environment */\nprivate $twig;\n- public function __construct(RequestStack $requestStack, QueueProcessor $queueProcessor, Environment $twig)\n+ /** @var CacheInterface */\n+ private $cache;\n+\n+ public function __construct(RequestStack $requestStack, QueueProcessor $queueProcessor, Environment $twig, CacheInterface $cache)\n{\n$this->queue = new Collection([]);\n$this->requestStack = $requestStack;\n$this->queueProcessor = $queueProcessor;\n$this->twig = $twig;\n+ $this->cache = $cache;\n}\npublic function registerWidget(WidgetInterface $widget): void\n@@ -56,11 +62,7 @@ class Widgets\n})->first();\nif ($widget) {\n- if ($widget instanceof RequestAware) {\n- $widget->setRequest($this->requestStack->getCurrentRequest());\n- }\n-\n- return $widget($params);\n+ return $this->invokeWidget($widget, $params);\n}\n}\n@@ -75,14 +77,26 @@ class Widgets\n$output = '';\nforeach ($widgets as $widget) {\n+ $output .= $this->invokeWidget($widget, $params);\n+ }\n+\n+ return $output;\n+ }\n+\n+ private function invokeWidget(WidgetInterface $widget, array $params = []): string\n+ {\nif ($widget instanceof RequestAware) {\n$widget->setRequest($this->requestStack->getCurrentRequest());\n}\n- $output .= $widget($params);\n+ if ($widget instanceof CacheAware) {\n+ $widget->setCacheInterface($this->cache);\n+\n+ return $widget->cachedInvoke();\n}\n- return $output;\n+ // Call the magic `__invoke` method on the $widget object\n+ return $widget($params);\n}\npublic function processQueue(Response $response): Response\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Allow for caching of widgets
|
95,144 |
09.05.2019 22:09:36
| -7,200 |
8d8ec16a4ede066db1d0c146d0c668d04d7409ad
|
Needs to be `$this->__invoke();`
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/CacheTrait.php",
"new_path": "src/Widget/CacheTrait.php",
"diff": "@@ -26,8 +26,7 @@ trait CacheTrait\nreturn $this->getFromCache();\n}\n- /** @var WidgetInterface $this */\n- $output = $this();\n+ $output = $this->__invoke();\n$this->setToCache($output);\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Needs to be `$this->__invoke();`
|
95,144 |
10.05.2019 14:41:05
| -7,200 |
62c6ad25894ac1bf73c50f56756b6415a57de8a9
|
Working on caching
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/BaseWidget.php",
"new_path": "src/Widget/BaseWidget.php",
"diff": "@@ -15,7 +15,6 @@ abstract class BaseWidget implements WidgetInterface\nuse TwigTrait;\nuse RequestTrait;\nuse ResponseTrait;\n- use CacheTrait;\n/** @var string */\nprotected $name;\n@@ -84,7 +83,20 @@ abstract class BaseWidget implements WidgetInterface\nreturn $this->priority;\n}\n+ /**\n+ * Method to 'invoke' the widget. Simple wrapper around the 'run' method,\n+ * which can be overridden in a custom Widget or trait\n+ */\npublic function __invoke(array $params = []): string\n+ {\n+ return $this->run($params);\n+ }\n+\n+ /**\n+ * Actual method that 'runs' the widget and returns the output. For reasons\n+ * of extensibility: Do not call directly, but call `$widget()` to invoke.\n+ */\n+ protected function run(array $params = []): string\n{\nif (array_key_exists('template', $params)) {\n$this->setTemplate($params['template']);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/CacheAware.php",
"new_path": "src/Widget/CacheAware.php",
"diff": "@@ -13,6 +13,4 @@ use Psr\\SimpleCache\\CacheInterface;\ninterface CacheAware extends WidgetInterface\n{\npublic function setCacheInterface(CacheInterface $config): void;\n-\n- public function cachedInvoke(): string;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/CacheTrait.php",
"new_path": "src/Widget/CacheTrait.php",
"diff": "@@ -4,6 +4,7 @@ declare(strict_types=1);\nnamespace Bolt\\Widget;\n+use Bolt\\Widget\\Exception\\WidgetException;\nuse Psr\\SimpleCache\\CacheInterface;\ntrait CacheTrait\n@@ -20,13 +21,17 @@ trait CacheTrait\n$this->key = $this->createKey();\n}\n- public function cachedInvoke(): string\n+ public function __invoke(array $params = []): string\n{\n+ if (!$this->cache instanceof CacheInterface) {\n+ throw new WidgetException('Widget of class '.self::class.' is not initialised properly. Make sure the Widget `implements CacheAware`.');\n+ }\n+\nif ($this->isCached()) {\nreturn $this->getFromCache();\n}\n- $output = $this->__invoke();\n+ $output = $this->run($params);\n$this->setToCache($output);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -14,6 +14,8 @@ use GuzzleHttp\\Exception\\RequestException;\nclass NewsWidget extends BaseWidget implements TwigAware, RequestAware, CacheAware\n{\n+ use CacheTrait;\n+\nprotected $name = 'News Widget';\nprotected $target = AdditionalTarget::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\nprotected $priority = 150;\n@@ -21,7 +23,7 @@ class NewsWidget extends BaseWidget implements TwigAware, RequestAware, CacheAwa\nprotected $zone = RequestZone::BACKEND;\nprotected $cacheDuration = 3600;\n- public function __invoke(array $params = []): string\n+ protected function run(array $params = []): string\n{\n$news = $this->getNews();\n@@ -35,7 +37,7 @@ class NewsWidget extends BaseWidget implements TwigAware, RequestAware, CacheAwa\n'datefetched' => '2019-04-04 07:25:00',\n];\n- return parent::__invoke($context);\n+ return parent::run($context);\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/SnippetWidget.php",
"new_path": "src/Widget/SnippetWidget.php",
"diff": "@@ -27,7 +27,7 @@ class SnippetWidget extends BaseWidget\n$this->zone = $zone;\n}\n- public function __invoke(array $params = []): string\n+ public function run(array $params = []): string\n{\nreturn $this->getTemplate();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widgets.php",
"new_path": "src/Widgets.php",
"diff": "@@ -91,8 +91,6 @@ class Widgets\nif ($widget instanceof CacheAware) {\n$widget->setCacheInterface($this->cache);\n-\n- return $widget->cachedInvoke();\n}\n// Call the magic `__invoke` method on the $widget object\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Working on caching
|
95,144 |
10.05.2019 16:01:22
| -7,200 |
513ba618f7b11d7205d77dd805ccd057ff06f0a8
|
Tweaks in widget caching
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/CacheAware.php",
"new_path": "src/Widget/CacheAware.php",
"diff": "@@ -12,5 +12,5 @@ use Psr\\SimpleCache\\CacheInterface;\n*/\ninterface CacheAware extends WidgetInterface\n{\n- public function setCacheInterface(CacheInterface $config): void;\n+ public function setCache(CacheInterface $config): void;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/SnippetWidget.php",
"new_path": "src/Widget/SnippetWidget.php",
"diff": "@@ -27,7 +27,7 @@ class SnippetWidget extends BaseWidget\n$this->zone = $zone;\n}\n- public function run(array $params = []): string\n+ protected function run(array $params = []): string\n{\nreturn $this->getTemplate();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widgets.php",
"new_path": "src/Widgets.php",
"diff": "@@ -90,7 +90,7 @@ class Widgets\n}\nif ($widget instanceof CacheAware) {\n- $widget->setCacheInterface($this->cache);\n+ $widget->setCache($this->cache);\n}\n// Call the magic `__invoke` method on the $widget object\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Tweaks in widget caching
|
95,144 |
10.05.2019 16:05:21
| -7,200 |
f8eb284ba91b30a80360b64f965dae1d1a54bbe6
|
Missing rename of setCacheInterface
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/CacheTrait.php",
"new_path": "src/Widget/CacheTrait.php",
"diff": "@@ -15,7 +15,7 @@ trait CacheTrait\n/** @var string */\nprivate $key;\n- public function setCacheInterface(CacheInterface $cache): void\n+ public function setCache(CacheInterface $cache): void\n{\n$this->cache = $cache;\n$this->key = $this->createKey();\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Missing rename of setCacheInterface
|
95,144 |
12.05.2019 16:46:22
| -7,200 |
18bd0d334455579cc512d60cc32b652c8bea2785
|
Make Weather widget work
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -6,6 +6,8 @@ namespace Bolt\\Widget;\nuse Bolt\\Widget\\Injector\\AdditionalTarget;\nuse Bolt\\Widget\\Injector\\RequestZone;\n+use GuzzleHttp\\Client;\n+use GuzzleHttp\\Exception\\RequestException;\nclass WeatherWidget extends BaseWidget implements TwigAware\n{\n@@ -14,4 +16,70 @@ class WeatherWidget extends BaseWidget implements TwigAware\nprotected $priority = 200;\nprotected $template = '@bolt/widgets/weather.twig';\nprotected $zone = RequestZone::BACKEND;\n+\n+ /** @var string Open API key, don't use more than once per second */\n+ public const KEY = '0acbdeea56dfafe244ac87707c5fdcb2';\n+\n+ public function run(array $params = []): string\n+ {\n+ $ip = $this->getIP();\n+\n+ $location = $this->getLocation($ip);\n+\n+ $weather = $this->getWeather($location);\n+\n+ $context = [\n+ 'location' => $location,\n+ 'weather' => $weather,\n+ ];\n+\n+ return parent::run($context);\n+ }\n+\n+ private function getIP(): string\n+ {\n+ try {\n+ $client = new Client(['base_uri' => 'http://checkip.dyndns.com/']);\n+ $dnsResponse = $client->request('GET', '/')->getBody()->getContents();\n+ } catch (RequestException $e) {\n+ $dnsResponse = 'Just assume we are at 127.0.0.1';\n+ }\n+\n+ preg_match('/(\\d{1,3}\\.){3}\\d{1,3}/', $dnsResponse, $matches);\n+\n+ return $matches[0];\n+ }\n+\n+ private function getLocation(string $ip): array\n+ {\n+ try {\n+ $client = new Client(['base_uri' => \"http://ipinfo.io/{$ip}\"]);\n+ $details = json_decode($client->request('GET', '/')->getBody()->getContents(), true);\n+ } catch (RequestException $e) {\n+ $details = [];\n+ }\n+\n+ return $details;\n+ }\n+\n+ private function getWeather(array $location): array\n+ {\n+ [$lat, $lon] = explode(',', $location['loc']);\n+\n+ $url = sprintf(\n+ 'https://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&appid=%s&units=metric',\n+ $lat,\n+ $lon,\n+ $this::KEY\n+ );\n+\n+ try {\n+ $client = new Client();\n+ $details = json_decode($client->request('GET', $url)->getBody()->getContents(), true);\n+ } catch (RequestException $e) {\n+ $details = [];\n+ }\n+\n+ return $details;\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/widgets/weather.twig",
"new_path": "templates/widgets/weather.twig",
"diff": "<div class=\"card mb-4\">\n<div class=\"image card-img-top\"\n- style=\"background-image: url(https://source.unsplash.com/400x240/?rain,sun,snow,storm,weather,sunny); height: 200px; padding-top: 60px;\">\n- <center style='text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4); color: #FFF;'>\n- <span>Sunny, with occasional clouds</span><br>\n- <span style=\"font-size: 200%;\"><i class=\"fas fa-sun\"></i> 18 ° C</span><br>\n- <span>Den Haag, Netherlands</span>\n+ style=\"background-image: url(https://source.unsplash.com/400x240/?{{ location.city|url_encode }},{{ location.region|url_encode }},{{ location.country|url_encode }}); height: 200px; padding-top: 60px;\">\n+ <center style='text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6); color: #FFF;'>\n+ <span style=\"font-size: 125%;\">{{ weather.weather|first['description']|capitalize }} in {{ weather.name }}, {{ location.country }}</span><br>\n+ <span style=\"font-size: 200%;\">\n+ <img src='http://openweathermap.org/img/w/{{ weather.weather|first['icon'] }}.png'>\n+ {{ weather.main.temp|number_format(1) }} ° C</span><br>\n</center>\n</div>\n<div class=\"card-body\">\n<a>\n<i class=\"fa fa-socks\"></i>\n- This is a random widget\n+ Current weather, by OpenWeatherMap\n</a>\n</div>\n</div>\n\\ No newline at end of file\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Make Weather widget work
|
95,144 |
16.05.2019 21:07:36
| -7,200 |
502677405fc0a13b11790b55301200924f4fa556
|
Ninja-fixing `z-index` clashes
|
[
{
"change_type": "MODIFY",
"old_path": "assets/scss/init/_variables.scss",
"new_path": "assets/scss/init/_variables.scss",
"diff": "@@ -8,4 +8,4 @@ $bolt-blue: #255687; // Nice and bright, pretty light\n$bolt-bluegray: #2F3E4D; // Nice dark and desaturated\n$bolt-saturated: #003E7C; // Very saturated. Use with care\n-\n+$big-z-index: 1000;\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/layout/_admin.scss",
"new_path": "assets/scss/layout/_admin.scss",
"diff": "@@ -40,7 +40,7 @@ $admin-header-height: 70px;\nleft: 0;\nheight: $admin-toolbar-height;\nwidth: 100vw;\n- z-index: 1001;\n+ z-index: $big-z-index + 100;\n}\n&__header {\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/admin/_sidebar.scss",
"new_path": "assets/scss/modules/admin/_sidebar.scss",
"diff": ".admin__sidebar {\nposition: relative;\n- z-index: 1000;\n+ z-index: $big-z-index + 10;\nbackground: var(--admin-sidebar);\ncolor: var(--admin-sidebar-text);\nheight: 100%;\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/listing/row/_container.scss",
"new_path": "assets/scss/modules/listing/row/_container.scss",
"diff": "display: flex;\nflex-wrap: wrap;\nwidth: 100%;\n- z-index: 1000;\n+ z-index: $big-z-index;\n&:hover {\n- z-index: 1001;\n+ z-index: $big-z-index + 1;\n}\n&.sortable-ghost {\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"babel-eslint\": \"^10.0.1\",\n\"babel-jest\": \"^24.8.0\",\n\"eslint\": \"^5.16.0\",\n- \"eslint-config-prettier\": \"^4.2.0\",\n- \"eslint-plugin-prettier\": \"^3.0.1\",\n+ \"eslint-config-prettier\": \"^4.3.0\",\n+ \"eslint-plugin-prettier\": \"^3.1.0\",\n\"eslint-plugin-standard\": \"^4.0.0\",\n\"eslint-plugin-vue\": \"^5.2.2\",\n\"jest\": \"^24.8.0\",\n\"node-sass\": \"^4.12.0\",\n\"postcss-loader\": \"^3.0.0\",\n\"postcss-preset-env\": \"^6.6.0\",\n- \"prettier\": \"^1.17.0\",\n+ \"prettier\": \"^1.17.1\",\n\"regenerator-runtime\": \"^0.13.2\",\n\"sass-loader\": \"^7.1.0\",\n\"stylelint\": \"^10.0.1\",\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Ninja-fixing `z-index` clashes
|
95,144 |
20.05.2019 19:39:38
| -7,200 |
525762f4be5f8a70127b277e6937a3c5a9d11834
|
Add StopwatchTrait and StopwatchInterface for Widgets
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/CacheTrait.php",
"new_path": "src/Widget/CacheTrait.php",
"diff": "@@ -55,6 +55,6 @@ trait CacheTrait\nprivate function createKey()\n{\n- return $this->getName() . $this->getTarget() . $this->getZone() . $this->getPriority();\n+ return sprintf('%s--%s-%s', $this->getSlug(), $this->getZone(), $this->getCacheDuration());\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -12,9 +12,10 @@ use Bolt\\Widget\\Injector\\RequestZone;\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\RequestException;\n-class NewsWidget extends BaseWidget implements TwigAware, RequestAware, CacheAware\n+class NewsWidget extends BaseWidget implements TwigAware, RequestAware, CacheAware, StopwatchAware\n{\nuse CacheTrait;\n+ use StopwatchTrait;\nprotected $name = 'News Widget';\nprotected $target = AdditionalTarget::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/RequestTrait.php",
"new_path": "src/Widget/RequestTrait.php",
"diff": "@@ -9,6 +9,7 @@ use Symfony\\Component\\HttpFoundation\\Request;\ntrait RequestTrait\n{\n+ /** @var Request */\nprivate $request;\npublic function setRequest(Request $request): self\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/ResponseTrait.php",
"new_path": "src/Widget/ResponseTrait.php",
"diff": "@@ -9,6 +9,7 @@ use Symfony\\Component\\HttpFoundation\\Response;\ntrait ResponseTrait\n{\n+ /** @var Response */\nprivate $response;\npublic function setResponse(Response $response): self\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Widget/StopwatchAware.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Widget;\n+\n+use Symfony\\Component\\Stopwatch\\Stopwatch;\n+\n+/**\n+ * Interface StopwatchAware - Widgets that implement this interface, will have\n+ * their execution time show up in Symfony's Profiler\n+ */\n+interface StopwatchAware extends WidgetInterface\n+{\n+ public function startStopwatch(Stopwatch $stopwatch);\n+\n+ public function stopStopwatch();\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Widget/StopwatchTrait.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Widget;\n+\n+use Symfony\\Component\\Stopwatch\\Stopwatch;\n+\n+trait StopwatchTrait\n+{\n+ /** @var Stopwatch */\n+ private $stopwatch;\n+\n+ public function startStopwatch(Stopwatch $stopwatch): void\n+ {\n+ $this->stopwatch = $stopwatch;\n+\n+ $this->stopwatch->start('widget.' . $this->getSlug());\n+ }\n+\n+ public function stopStopwatch(): void\n+ {\n+ $this->stopwatch->stop('widget.' . $this->getSlug());\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/TwigTrait.php",
"new_path": "src/Widget/TwigTrait.php",
"diff": "@@ -9,6 +9,7 @@ use Twig\\Environment;\ntrait TwigTrait\n{\n+ /** @var Environment */\nprivate $twig;\npublic function setTwig(Environment $twig): self\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -9,13 +9,17 @@ use Bolt\\Widget\\Injector\\RequestZone;\nuse GuzzleHttp\\Client;\nuse GuzzleHttp\\Exception\\RequestException;\n-class WeatherWidget extends BaseWidget implements TwigAware\n+class WeatherWidget extends BaseWidget implements TwigAware, CacheAware, StopwatchAware\n{\n+ use CacheTrait;\n+ use StopwatchTrait;\n+\nprotected $name = 'Weather Widget';\nprotected $target = AdditionalTarget::WIDGET_BACK_DASHBOARD_ASIDE_TOP;\nprotected $priority = 200;\nprotected $template = '@bolt/widgets/weather.twig';\nprotected $zone = RequestZone::BACKEND;\n+ protected $cacheDuration = 3600;\n/** @var string Open API key, don't use more than once per second */\npublic const KEY = '0acbdeea56dfafe244ac87707c5fdcb2';\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widgets.php",
"new_path": "src/Widgets.php",
"diff": "@@ -8,12 +8,14 @@ use Bolt\\Widget\\CacheAware;\nuse Bolt\\Widget\\Injector\\QueueProcessor;\nuse Bolt\\Widget\\Injector\\RequestZone;\nuse Bolt\\Widget\\RequestAware;\n+use Bolt\\Widget\\StopwatchAware;\nuse Bolt\\Widget\\TwigAware;\nuse Bolt\\Widget\\WidgetInterface;\nuse Psr\\SimpleCache\\CacheInterface;\nuse Symfony\\Component\\HttpFoundation\\RequestStack;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Symfony\\Component\\HttpFoundation\\StreamedResponse;\n+use Symfony\\Component\\Stopwatch\\Stopwatch;\nuse Tightenco\\Collect\\Support\\Collection;\nuse Twig\\Environment;\n@@ -37,13 +39,22 @@ class Widgets\n/** @var CacheInterface */\nprivate $cache;\n- public function __construct(RequestStack $requestStack, QueueProcessor $queueProcessor, Environment $twig, CacheInterface $cache)\n- {\n+ /** @var Stopwatch */\n+ private $stopwatch;\n+\n+ public function __construct(\n+ RequestStack $requestStack,\n+ QueueProcessor $queueProcessor,\n+ Environment $twig,\n+ CacheInterface $cache,\n+ Stopwatch $stopwatch\n+) {\n$this->queue = new Collection([]);\n$this->requestStack = $requestStack;\n$this->queueProcessor = $queueProcessor;\n$this->twig = $twig;\n$this->cache = $cache;\n+ $this->stopwatch = $stopwatch;\n}\npublic function registerWidget(WidgetInterface $widget): void\n@@ -85,6 +96,10 @@ class Widgets\nprivate function invokeWidget(WidgetInterface $widget, array $params = []): string\n{\n+ if ($widget instanceof StopwatchAware) {\n+ $widget->startStopwatch($this->stopwatch);\n+ }\n+\nif ($widget instanceof RequestAware) {\n$widget->setRequest($this->requestStack->getCurrentRequest());\n}\n@@ -94,7 +109,13 @@ class Widgets\n}\n// Call the magic `__invoke` method on the $widget object\n- return $widget($params);\n+ $renderedWidget = $widget($params);\n+\n+ if ($widget instanceof StopwatchAware) {\n+ $widget->stopStopwatch();\n+ }\n+\n+ return $renderedWidget;\n}\npublic function processQueue(Response $response): Response\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Add StopwatchTrait and StopwatchInterface for Widgets
|
95,144 |
21.05.2019 09:38:47
| -7,200 |
7ba4c095a917f9d8c3e59f505aabc647d9bd4d79
|
Let injected snippets use cache too
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/Injector/QueueProcessor.php",
"new_path": "src/Widget/Injector/QueueProcessor.php",
"diff": "@@ -4,9 +4,11 @@ declare(strict_types=1);\nnamespace Bolt\\Widget\\Injector;\n+use Bolt\\Widget\\CacheAware;\nuse Bolt\\Widget\\RequestAware;\nuse Bolt\\Widget\\ResponseAware;\nuse Bolt\\Widget\\WidgetInterface;\n+use Psr\\SimpleCache\\CacheInterface;\nuse Symfony\\Component\\HttpFoundation\\Request;\nuse Symfony\\Component\\HttpFoundation\\Response;\nuse Tightenco\\Collect\\Support\\Collection;\n@@ -44,7 +46,7 @@ class QueueProcessor\nreturn $response;\n}\n- public function process(Response $response, Request $request, Collection $queue, string $zone): void\n+ public function process(Response $response, Request $request, Collection $queue, CacheInterface $cache, string $zone): void\n{\n/** @var WidgetInterface $widget */\nforeach ($queue as $widget) {\n@@ -55,6 +57,9 @@ class QueueProcessor\nif ($widget instanceof ResponseAware) {\n$widget->setResponse($response);\n}\n+ if ($widget instanceof CacheAware) {\n+ $widget->setCache($cache);\n+ }\n$this->injector->inject($widget, $response);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widgets.php",
"new_path": "src/Widgets.php",
"diff": "@@ -132,11 +132,12 @@ class Widgets\n}\n$queue = $this->queue;\n+ $cache = $this->cache;\nreturn $this->queueProcessor->guardResponse(\n$response,\n- function (Response $response) use ($request, $queue, $zone): void {\n- $this->queueProcessor->process($response, $request, $queue, $zone);\n+ function (Response $response) use ($request, $queue, $cache, $zone): void {\n+ $this->queueProcessor->process($response, $request, $queue, $cache, $zone);\n}\n);\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Let injected snippets use cache too
|
95,144 |
21.05.2019 16:25:27
| -7,200 |
c4a75883de9a216e4d70492e8a091be57dbb3b04
|
Cleanup of composer.json
|
[
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "{\n\"name\": \"bolt/bolt\",\n- \"license\": \"MIT\",\n\"type\": \"library\",\n\"description\": \"Bolt 4 skeleton / prototype\",\n+ \"license\": \"MIT\",\n\"require\": {\n\"php\": \">=7.1.3\",\n\"ext-json\": \"*\",\n\"miljar/php-exif\": \"^0.6.4\",\n\"nelmio/cors-bundle\": \"^1.5\",\n\"nesbot/carbon\": \"^1.34\",\n- \"phpdocumentor/reflection-docblock\": \"^4.2\",\n\"php-translation/symfony-bundle\": \"^0.8\",\n+ \"phpdocumentor/reflection-docblock\": \"^4.2\",\n\"sensio/framework-extra-bundle\": \"^5.1\",\n\"sensiolabs/security-checker\": \"^5.0\",\n\"siriusphp/upload\": \"^2.1\",\n\"webonyx/graphql-php\": \"^0.13\",\n\"white-october/pagerfanta-bundle\": \"^1.2\"\n},\n+ \"conflict\": {\n+ \"symfony/symfony\": \"*\"\n+ },\n\"require-dev\": {\n\"ext-curl\": \"*\",\n\"ext-pdo_sqlite\": \"*\",\n\"symfony/web-server-bundle\": \"^4.2\",\n\"symplify/easy-coding-standard\": \"^5.4.14\"\n},\n- \"repositories\": [\n- { \"type\": \"vcs\", \"url\": \"https://github.com/jarjak/php-matcher\", \"no-api\": true }\n- ],\n- \"minimum-stability\": \"stable\",\n- \"prefer-stable\": true,\n\"config\": {\n\"platform\": {\n\"php\": \"7.1.3\"\n},\n\"sort-packages\": true\n},\n+ \"extra\": {\n+ \"symfony\": {\n+ \"allow-contrib\": true,\n+ \"require\": \"^4.2\"\n+ }\n+ },\n\"autoload\": {\n\"psr-4\": {\n\"Bolt\\\\\": \"src/\"\n},\n- \"files\": [\"src/Entity/Translation.php\"]\n+ \"files\": [\n+ \"src/Entity/Translation.php\"\n+ ]\n},\n\"autoload-dev\": {\n\"psr-4\": {\n\"spec\\\\Bolt\\\\\": \"tests/spec/Bolt/\"\n}\n},\n- \"scripts\": {\n- \"periodical-tasks\": [\n- \"security-checker security:check\"\n+ \"repositories\": [\n+ {\n+ \"type\": \"vcs\",\n+ \"url\": \"https://github.com/jarjak/php-matcher\",\n+ \"no-api\": true\n+ }\n],\n- \"auto-scripts\": {\n- \"cache:clear\": \"symfony-cmd\",\n- \"assets:install --symlink --relative %PUBLIC_DIR%\": \"symfony-cmd\"\n- },\n+ \"minimum-stability\": \"stable\",\n+ \"prefer-stable\": true,\n+ \"scripts\": {\n\"post-install-cmd\": [\n\"@auto-scripts\"\n],\n\"post-update-cmd\": [\n\"@auto-scripts\"\n- ]\n- },\n- \"conflict\": {\n- \"symfony/symfony\": \"*\"\n+ ],\n+ \"auto-scripts\": {\n+ \"cache:clear\": \"symfony-cmd\",\n+ \"assets:install --symlink --relative %PUBLIC_DIR%\": \"symfony-cmd\"\n},\n- \"extra\": {\n- \"symfony\": {\n- \"allow-contrib\": true,\n- \"require\": \"^4.2\"\n- }\n+ \"periodical-tasks\": [\n+ \"security-checker security:check\"\n+ ]\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"axios\": \"^0.18.0\",\n\"baguettebox.js\": \"^1.11.0\",\n\"bootstrap\": \"^4.3.1\",\n- \"codemirror\": \"^5.46.0\",\n+ \"codemirror\": \"^5.47.0\",\n\"flagpack\": \"^1.0.3\",\n\"jquery\": \"^3.4.1\",\n- \"luxon\": \"^1.13.2\",\n+ \"luxon\": \"^1.15.0\",\n\"no-scroll\": \"^2.1.1\",\n\"popper.js\": \"^1.15.0\",\n\"register-service-worker\": \"^1.6.2\",\n\"simplemde\": \"^1.11.2\",\n\"stylelint-config-recommended-scss\": \"^3.3.0\",\n\"stylelint-scss\": \"^3.6.1\",\n- \"terser\": \"^3.17.0\",\n+ \"terser\": \"^4.0.0\",\n\"tinycolor2\": \"^1.4.1\",\n\"vue\": \"^2.6.10\",\n\"vue-flatpickr-component\": \"^8.1.2\",\n\"vue-notification\": \"^1.3.16\",\n\"vue-simplemde\": \"^0.5.1\",\n\"vue-trumbowyg\": \"^3.4.2\",\n- \"vuedraggable\": \"^2.20.0\",\n+ \"vuedraggable\": \"^2.21.0\",\n\"vuex\": \"^3.1.1\"\n},\n\"devDependencies\": {\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Cleanup of composer.json
|
95,144 |
22.05.2019 16:04:30
| -7,200 |
26cffdbc968b9786612a8c09c08593a9bc9eb47e
|
Working on editing relations
|
[
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/ContentEditController.php",
"new_path": "src/Controller/Backend/ContentEditController.php",
"diff": "@@ -9,9 +9,12 @@ use Bolt\\Controller\\CsrfTrait;\nuse Bolt\\Controller\\TwigAwareController;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Entity\\Field;\n+use Bolt\\Entity\\Relation;\nuse Bolt\\Entity\\Taxonomy;\nuse Bolt\\Enum\\Statuses;\nuse Bolt\\Event\\Listener\\ContentFillListener;\n+use Bolt\\Repository\\ContentRepository;\n+use Bolt\\Repository\\RelationRepository;\nuse Bolt\\Repository\\TaxonomyRepository;\nuse Bolt\\TemplateChooser;\nuse Carbon\\Carbon;\n@@ -32,33 +35,30 @@ class ContentEditController extends TwigAwareController implements BackendZone\n{\nuse CsrfTrait;\n- /**\n- * @var TaxonomyRepository\n- */\n+ /** @var TaxonomyRepository */\nprivate $taxonomyRepository;\n- /**\n- * @var ObjectManager\n- */\n+ /** @var RelationRepository */\n+ private $relationRepository;\n+\n+ /** @var ContentRepository */\n+ private $contentRepository;\n+\n+ /** @var ObjectManager */\nprivate $em;\n- /**\n- * @var UrlGeneratorInterface\n- */\n+ /** @var UrlGeneratorInterface */\nprivate $urlGenerator;\n- /**\n- * @var TemplateChooser\n- */\n+ /** @var TemplateChooser */\nprivate $templateChooser;\n-\n- /**\n- * @var ContentFillListener\n- */\n+ /** @var ContentFillListener */\nprivate $contentFillListener;\npublic function __construct(\nTaxonomyRepository $taxonomyRepository,\n+ RelationRepository $relationRepository,\n+ ContentRepository $contentRepository,\nObjectManager $em,\nUrlGeneratorInterface $urlGenerator,\nContentFillListener $contentFillListener,\n@@ -66,6 +66,8 @@ class ContentEditController extends TwigAwareController implements BackendZone\nCsrfTokenManagerInterface $csrfTokenManager\n) {\n$this->taxonomyRepository = $taxonomyRepository;\n+ $this->relationRepository = $relationRepository;\n+ $this->contentRepository = $contentRepository;\n$this->em = $em;\n$this->urlGenerator = $urlGenerator;\n$this->contentFillListener = $contentFillListener;\n@@ -227,6 +229,12 @@ class ContentEditController extends TwigAwareController implements BackendZone\n}\n}\n+ if (isset($formData['relationship'])) {\n+ foreach ($formData['relationship'] as $relation) {\n+ $this->updateRelation($content, $relation);\n+ }\n+ }\n+\nreturn $content;\n}\n@@ -281,6 +289,30 @@ class ContentEditController extends TwigAwareController implements BackendZone\n}\n}\n+ private function updateRelation(Content $content, $newRelations): void\n+ {\n+ $newRelations = (new Collection(Json::findArray($newRelations)))->filter();\n+ $currentRelations = $this->relationRepository->findRelations($content, null, true, null, false);\n+\n+ // Remove old ones\n+ foreach ($currentRelations as $currentRelation) {\n+ $this->em->remove($currentRelation);\n+ }\n+\n+ // Then (re-) add selected ones\n+ foreach ($newRelations as $id) {\n+ $contentTo = $this->contentRepository->findOneBy(['id' => $id]);\n+\n+ if ($contentTo === null) {\n+ continue; // Don't add relations to things that have gone missing\n+ }\n+\n+ $relation = new Relation($content, $contentTo);\n+\n+ $this->em->persist($relation);\n+ }\n+ }\n+\nprivate function getEditLocale(Request $request, Content $content): string\n{\n$locale = $request->query->get('edit_locale', '');\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Working on editing relations
|
95,144 |
22.05.2019 16:40:52
| -7,200 |
1dac8a33e4589cfbf65320d528d859e4a7ee1f6c
|
Updating templates for editing Relations
|
[
{
"change_type": "MODIFY",
"old_path": "config/bolt/contenttypes.yaml",
"new_path": "config/bolt/contenttypes.yaml",
"diff": "@@ -277,40 +277,14 @@ blocks:\nslug:\ntype: slug\nuses: [ title ]\n-\n-# selectfield:\n-# type: select\n-# values: [ foo, bar, baz ]\n-# selectfieldd:\n-# type: select\n-# values:\n-# foo: \"Fooo\"\n-# bar: Bario\n-# baz: Bazz\n-# multiselect:\n-# type: select\n-# values: [ A-tuin, Donatello, Rafael, Leonardo, Michelangelo, Koopa, Squirtle ]\n-# multiple: false\n-# postfix: \"Select your favourite turtle(s).\"\n-#\n-# multiselect2:\n-# type: select\n-# values: [ A-tuin, Donatello, Rafael, Leonardo, Michelangelo, Koopa, Squirtle ]\n-# multiple: true\n-# required: true\n-# postfix: \"Select your favourite turtle(s).\"\ncontent:\ntype: html\nheight: 150px\n-# contentlink:\n-# type: text\n-# label: Link\n-# placeholder: 'contenttype/slug or http://example.org/'\n-# postfix: \"Use this to add a link for this Block. This could either be an 'internal' link like <tt>page/about</tt>, if you use a contentType/slug combination. Otherwise use a proper URL, like `http://example.org`.\"\n-# image:\n-# type: image\n-# attrib: title\n-# extensions: [ gif, jpg, png ]\n+ relations:\n+ pages:\n+ multiple: false\n+ order: title\n+ label: Select a page\nshow_on_dashboard: true\nviewless: true\ndefault_status: published\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "templates/content/_relationships.html.twig",
"diff": "+\n+{% for contentType, relation in record.definition.relations %}\n+\n+ {% set options = record|related_options(contentType) %}\n+ {% set value = record|related_values(contentType) %}\n+\n+ <div class=\"form-group editor--group is-normal\">\n+ <label for=\"field-title\">\n+ {{ relation.label }}:\n+ </label>\n+ <div>\n+ <editor-select\n+ :value=\"{{ value }}\"\n+ :name=\"'relationship[{{ contentType }}]'\"\n+ :id=\"'relationship-{{ contentType }}'\"\n+ :options=\"{{ options }}\"\n+ :multiple=\"{{ relation.multiple ? 'true' : 'false' }}\"\n+ :taggable=false\n+ :allowempty=true\n+ ></editor-select>\n+ </div>\n+\n+ </div>\n+\n+{% endfor %}\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/content/_taxonomies.html.twig",
"new_path": "templates/content/_taxonomies.html.twig",
"diff": "-<div class=\"tab-pane\" id=\"relations\" role=\"tabpanel\" aria-labelledby=\"relations-tab\">\n{% for taxonomy in record.definition.taxonomy %}\n{% set definition = config.get('taxonomies/' ~ taxonomy) %}\n</label>\n<div>\n<editor-select\n- :value=\"{{ value|json_encode }}\"\n+ :value=\"{{ value }}\"\n:name=\"'taxonomy[{{ definition.slug }}]'\"\n:id=\"'taxonomy-{{ definition.slug }}'\"\n- :options=\"{{ options|json_encode }}\"\n+ :options=\"{{ options }}\"\n:multiple=\"{{ definition.multiple ? 'true' : 'false' }}\"\n:taggable=\"{{ (definition.behaves_like == 'tags') ? 'true' : 'false' }}\"\n:allowempty={{ definition.allow_empty ? 'true' : 'false' }}\n></editor-select>\n-\n- {# (Current saved value: <code>{{ value|json_encode }}</code> ) #}\n</div>\n</div>\n{% endif %}\n{% endfor %}\n-\n-</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/content/edit.html.twig",
"new_path": "templates/content/edit.html.twig",
"diff": "{# This 'topsection' gets output _before_ the main form, allowing `dump()`, without breaking Vue #}\n{% block topsection %}\n+{# {{ dump(record.definition.relations) }}#}\n+\n+{# {{ dump(record|related_all(true, null, false)) }}#}\n+\n{% endblock %}\n{% block main %}\n{% include '@bolt/content/_fields.html.twig' %}\n+ <div class=\"tab-pane\" id=\"relations\" role=\"tabpanel\" aria-labelledby=\"relations-tab\">\n+\n+ {% include '@bolt/content/_relationships.html.twig' %}\n+\n{% include '@bolt/content/_taxonomies.html.twig' %}\n+ </div>\n</div>\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Updating templates for editing Relations
|
95,144 |
22.05.2019 17:24:28
| -7,200 |
dbbe394bec542e832d32da6f226a588c4326dff9
|
Use my own fork, until upstream is fixed
|
[
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"erusev/parsedown\": \"^1.7\",\n\"ezyang/htmlpurifier\": \"^4.10\",\n\"fzaninotto/faker\": \"^1.8\",\n- \"gedmo/doctrine-extensions\": \"^2.4.4\",\n+ \"gedmo/doctrine-extensions\": \"v2.4.x-dev\",\n\"guzzlehttp/guzzle\": \"^6.3\",\n\"knplabs/knp-menu-bundle\": \"^2.0\",\n\"league/glide-symfony\": \"^1.0\",\n}\n},\n\"repositories\": [\n+ {\n+ \"type\": \"vcs\",\n+ \"url\": \"https://github.com/bobdenotter/DoctrineExtensions\",\n+ \"no-api\": true\n+ },\n{\n\"type\": \"vcs\",\n\"url\": \"https://github.com/jarjak/php-matcher\",\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Use my own fork, until upstream is fixed
|
95,144 |
23.05.2019 10:53:27
| -7,200 |
aa1d729ea3586610d3579fe319c92125f5305601
|
Update RelatedExtensionSpec.php with black magic and voodoo
|
[
{
"change_type": "MODIFY",
"old_path": "tests/spec/Bolt/Twig/RelatedExtensionSpec.php",
"new_path": "tests/spec/Bolt/Twig/RelatedExtensionSpec.php",
"diff": "@@ -4,8 +4,10 @@ declare(strict_types=1);\nnamespace spec\\Bolt\\Twig;\n+use Bolt\\Configuration\\Config;\nuse Bolt\\Entity\\Content;\nuse Bolt\\Entity\\Relation;\n+use Bolt\\Repository\\ContentRepository;\nuse Bolt\\Repository\\RelationRepository;\nuse PhpSpec\\ObjectBehavior;\n@@ -15,9 +17,9 @@ class RelatedExtensionSpec extends ObjectBehavior\nconst RELATED_ID = 2;\nconst TEST_CT_SLUG = 'ct-slug';\n- function let(RelationRepository $relationRepository)\n+ function let(RelationRepository $relationRepository, ContentRepository $contentRepository, Config $config)\n{\n- $this->beConstructedWith($relationRepository);\n+ $this->beConstructedWith($relationRepository, $contentRepository, $config);\n}\nfunction it_gets_all_related_content(Content $content, RelationRepository $relationRepository, Relation $relation, Content $related)\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Update RelatedExtensionSpec.php with black magic and voodoo
|
95,144 |
26.05.2019 12:41:02
| -7,200 |
02512325090570c751220e63534dab7841c56682
|
Add Controllers for 'duplicate', 'change status' and 'delete'
|
[
{
"change_type": "MODIFY",
"old_path": "assets/js/app/listing/Components/Table/Row/_Actions.vue",
"new_path": "assets/js/app/listing/Components/Table/Row/_Actions.vue",
"diff": "<i class=\"fas fa-w fa-external-link-square-alt\"></i>\nView on Site\n</a>\n- <a v-if=\"record.status !== 'published'\" class=\"dropdown-item\" :href=\"record.extras.statusLink + '?status=published'\">\n+ <a v-if=\"record.status !== 'published'\" class=\"dropdown-item\" :href=\"record.extras.statusLink + '&status=published'\">\n<span class=\"status mr-1 is-published\"></span>\nChange status to 'publish'\n</a>\n- <a v-if=\"record.status !== 'held'\" class=\"dropdown-item\" :href=\"record.extras.statusLink + '?status=held'\">\n+ <a v-if=\"record.status !== 'held'\" class=\"dropdown-item\" :href=\"record.extras.statusLink + '&status=held'\">\n<span class=\"status mr-1 is-held\"></span>\nChange status to 'held'\n</a>\n- <a v-if=\"record.status !== 'draft'\" class=\"dropdown-item\" :href=\"record.extras.statusLink + '?status=draft'\">\n+ <a v-if=\"record.status !== 'draft'\" class=\"dropdown-item\" :href=\"record.extras.statusLink + '&status=draft'\">\n<span class=\"status mr-1 is-draft\"></span>\nChange status to 'draft'\n</a>\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/ContentEditController.php",
"new_path": "src/Controller/Backend/ContentEditController.php",
"diff": "@@ -109,7 +109,7 @@ class ContentEditController extends TwigAwareController implements BackendZone\n*/\npublic function save(Request $request, ?Content $content = null): Response\n{\n- $this->validateToken($request);\n+ $this->validateCsrf($request, 'editrecord');\n$content = $this->contentFromPost($content, $request);\n@@ -132,7 +132,7 @@ class ContentEditController extends TwigAwareController implements BackendZone\n*/\npublic function viewSaved(Request $request, ?Content $content = null): RedirectResponse\n{\n- $this->validateToken($request);\n+ $this->validateCsrf($request, 'editrecord');\n$urlParams = [\n'slugOrId' => $content->getId(),\n@@ -149,7 +149,7 @@ class ContentEditController extends TwigAwareController implements BackendZone\n*/\npublic function preview(Request $request, ?Content $content = null): Response\n{\n- $this->validateToken($request);\n+ $this->validateCsrf($request, 'editrecord');\n$content = $this->contentFromPost($content, $request);\n$recordSlug = $content->getDefinition()->get('singular_slug');\n@@ -165,32 +165,76 @@ class ContentEditController extends TwigAwareController implements BackendZone\n}\n/**\n- * @Route(\"/duplicate/{id}\", name=\"bolt_content_duplicate\", methods={\"POST\"}, requirements={\"id\": \"\\d+\"})\n+ * @Route(\"/duplicate/{id}\", name=\"bolt_content_duplicate\", methods={\"GET\"}, requirements={\"id\": \"\\d+\"})\n*/\npublic function duplicate(Request $request, Content $content): Response\n{\n- // @todo Make \"Duplicate Content\" controller #424\n+ $content->setId(null);\n+ $content->setCreatedAt(null);\n+ $content->setAuthor($this->getUser());\n+ $content->setModifiedAt(null);\n+ $content->setDepublishedAt(null);\n+ $content->setPublishedAt(null);\n+\n+ $twigvars = [\n+ 'record' => $content,\n+ 'locales' => $content->getLocales(),\n+ 'currentlocale' => $this->getEditLocale($request, $content),\n+ ];\n+\n+ return $this->renderTemplate('@bolt/content/edit.html.twig', $twigvars);\n+ }\n+\n+ /**\n+ * @Route(\"/duplicate/{id}\", name=\"bolt_content_duplicate_post\", methods={\"POST\"}, requirements={\"id\": \"\\d+\"})\n+ */\n+ public function duplicateSave(Request $request, ?Content $content = null): Response\n+ {\n+ return $this->new($content->getContentType(), $request);\n}\n/**\n- * @Route(\"/status/{id}\", name=\"bolt_content_status\", methods={\"POST\"}, requirements={\"id\": \"\\d+\"})\n+ * @Route(\"/status/{id}\", name=\"bolt_content_status\", methods={\"GET\"}, requirements={\"id\": \"\\d+\"})\n*/\npublic function status(Request $request, Content $content): Response\n{\n- // @todo Make \"Change Content status\" controller #426\n+ if (! $this->isCsrfTokenValid('status', $request->get('token'))) {\n+ $url = $this->urlGenerator->generate('bolt_dashboard');\n+ return new RedirectResponse($url);\n+ }\n+\n+ $content->setStatus($request->get('status'));\n+\n+ $this->em->persist($content);\n+ $this->em->flush();\n+\n+ $this->addFlash('success', 'content.status_changed_successfully');\n+\n+ $params = ['contentType' => $content->getContentTypeSlug()];\n+ $url = $this->urlGenerator->generate('bolt_content_overview', $params);\n+\n+ return new RedirectResponse($url);\n}\n/**\n- * @Route(\"/delete/{id}\", name=\"bolt_content_delete\", methods={\"POST\"}, requirements={\"id\": \"\\d+\"})\n+ * @Route(\"/delete/{id}\", name=\"bolt_content_delete\", methods={\"GET\"}, requirements={\"id\": \"\\d+\"})\n*/\npublic function delete(Request $request, Content $content): Response\n{\n- // @todo Make \"Delete Content\" controller #425\n+ if (! $this->isCsrfTokenValid('delete', $request->get('token'))) {\n+ $url = $this->urlGenerator->generate('bolt_dashboard');\n+ return new RedirectResponse($url);\n}\n- private function validateToken(Request $request): void\n- {\n- $this->validateCsrf($request, 'editrecord');\n+ $this->em->remove($content);\n+ $this->em->flush();\n+\n+ $this->addFlash('success', 'content.deleted_successfully');\n+\n+ $params = ['contentType' => $content->getContentTypeSlug()];\n+ $url = $this->urlGenerator->generate('bolt_content_overview', $params);\n+\n+ return new RedirectResponse($url);\n}\nprivate function contentFromPost(?Content $content, Request $request): Content\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Entity/Content.php",
"new_path": "src/Entity/Content.php",
"diff": "@@ -149,6 +149,11 @@ class Content\nreturn sprintf('New %s', $contentName);\n}\n+ public function setId(?int $id = null): void\n+ {\n+ $this->id = $id;\n+ }\n+\npublic function getId(): ?int\n{\nreturn $this->id;\n@@ -246,12 +251,12 @@ class Content\nreturn $this;\n}\n- public function getCreatedAt(): \\DateTime\n+ public function getCreatedAt(): ?\\DateTime\n{\nreturn $this->createdAt;\n}\n- public function setCreatedAt(\\DateTime $createdAt): self\n+ public function setCreatedAt(?\\DateTime $createdAt): self\n{\n$this->createdAt = $createdAt;\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Twig/ContentExtension.php",
"new_path": "src/Twig/ContentExtension.php",
"diff": "@@ -11,6 +11,7 @@ use Bolt\\Repository\\ContentRepository;\nuse Bolt\\Utils\\Excerpt;\nuse Bolt\\Utils\\Html;\nuse Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n+use Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface;\nuse Tightenco\\Collect\\Support\\Collection;\nuse Twig\\Extension\\AbstractExtension;\nuse Twig\\TwigFilter;\n@@ -28,10 +29,14 @@ class ContentExtension extends AbstractExtension\n*/\nprivate $contentRepository;\n- public function __construct(UrlGeneratorInterface $urlGenerator, ContentRepository $contentRepository)\n+ /** @var CsrfTokenManagerInterface */\n+ private $csrfTokenManager;\n+\n+ public function __construct(UrlGeneratorInterface $urlGenerator, ContentRepository $contentRepository, CsrfTokenManagerInterface $csrfTokenManager)\n{\n$this->urlGenerator = $urlGenerator;\n$this->contentRepository = $contentRepository;\n+ $this->csrfTokenManager = $csrfTokenManager;\n}\n/**\n@@ -219,7 +224,12 @@ class ContentExtension extends AbstractExtension\nreturn null;\n}\n- return $this->generateLink('bolt_content_delete', ['id' => $content->getId()], $absolute);\n+ $params = [\n+ 'id' => $content->getId(),\n+ 'token' => (string) $this->csrfTokenManager->getToken('delete'),\n+ ];\n+\n+ return $this->generateLink('bolt_content_delete', $params, $absolute);\n}\npublic function getDuplicateLink(Content $content, bool $absolute = false): ?string\n@@ -237,7 +247,12 @@ class ContentExtension extends AbstractExtension\nreturn null;\n}\n- return $this->generateLink('bolt_content_status', ['id' => $content->getId()], $absolute);\n+ $params = [\n+ 'id' => $content->getId(),\n+ 'token' => (string) $this->csrfTokenManager->getToken('status'),\n+ ];\n+\n+ return $this->generateLink('bolt_content_status', $params, $absolute);\n}\nprivate function generateLink(string $route, array $params, $absolute = false): string\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/spec/Bolt/Twig/ContentExtensionSpec.php",
"new_path": "tests/spec/Bolt/Twig/ContentExtensionSpec.php",
"diff": "@@ -14,6 +14,7 @@ use Doctrine\\Common\\Collections\\ArrayCollection;\nuse PhpSpec\\ObjectBehavior;\nuse Prophecy\\Argument;\nuse Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\n+use Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface;\n/**\n* @mixin ContentExtension\n@@ -29,9 +30,9 @@ class ContentExtensionSpec extends ObjectBehavior\nconst TEST_CT_SLUG = 'ct-slug';\nconst TEST_ID = 42;\n- function let(UrlGeneratorInterface $urlGenerator, ContentRepository $contentRepository)\n+ function let(UrlGeneratorInterface $urlGenerator, ContentRepository $contentRepository, CsrfTokenManagerInterface $csrfTokenManager)\n{\n- $this->beConstructedWith($urlGenerator, $contentRepository);\n+ $this->beConstructedWith($urlGenerator, $contentRepository, $csrfTokenManager);\n}\nfunction it_gets_title(Content $content, TextField $field, ContentType $definition)\n"
},
{
"change_type": "MODIFY",
"old_path": "translations/messages.en.xlf",
"new_path": "translations/messages.en.xlf",
"diff": "<target>Display Name</target>\n</segment>\n</unit>\n+ <unit id=\"EvAqL__\" name=\"caption.duplicate\">\n+ <segment>\n+ <source>caption.duplicate</source>\n+ <target>Duplicate</target>\n+ </segment>\n+ </unit>\n</file>\n</xliff>\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Add Controllers for 'duplicate', 'change status' and 'delete'
|
95,144 |
27.05.2019 20:42:53
| -7,200 |
5d7978896397b35ea8a7f7cea2a882e6ff5487a0
|
Only get existing Relations from content that was persisted before
|
[
{
"change_type": "MODIFY",
"old_path": "src/Repository/RelationRepository.php",
"new_path": "src/Repository/RelationRepository.php",
"diff": "@@ -36,6 +36,11 @@ class RelationRepository extends SortableRepository\n*/\npublic function findRelations(Content $from, ?string $name, bool $biDirectional = false, ?int $limit = null, bool $publishedOnly = true): array\n{\n+ // Only get existing Relations from content that was persisted before\n+ if ($from->getId() === null) {\n+ return [];\n+ }\n+\n$result = $this->buildRelationQuery($from, $name, false, $publishedOnly)\n->setMaxResults($limit)\n->getQuery()\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Only get existing Relations from content that was persisted before
|
95,144 |
28.05.2019 16:38:43
| -7,200 |
3dd6bb68e8772841e2c2985db3ea65fccce17e50
|
Don't overlap rows in listings
|
[
{
"change_type": "MODIFY",
"old_path": "assets/js/app/listing/Components/Table/Row/_Actions.vue",
"new_path": "assets/js/app/listing/Components/Table/Row/_Actions.vue",
"diff": "</span>\n</div>\n</div>\n-\n-\n- </div>\n- </div>\n- <!-- <button\n- type=\"button\"\n- class=\"listing--actions--quickedit\"\n- @click=\"quickEditor()\"\n- >\n- <i class=\"far fa-caret-square-down mr-1\"></i>Quick Edit\n- </button> -->\n</div>\n</template>\nexport default {\nname: 'Actions',\nprops: ['type', 'record'],\n- methods: {\n- quickEditor() {\n- this.$emit('quickeditor', true);\n- },\n- },\n};\n</script>\n"
},
{
"change_type": "DELETE",
"old_path": "assets/js/app/listing/Components/Table/Row/_QuickEditor.vue",
"new_path": null,
"diff": "-<template>\n- <div class=\"quickedit__row\" :class=\"{ 'is-large': size === 'large' }\">\n- <div class=\"quickedit__row--item is-content\">\n- <h4>quick edit settings</h4>\n- </div>\n- <div class=\"quickedit__row--item is-actions\">\n- <button\n- v-if=\"size !== 'large'\"\n- type=\"button\"\n- class=\"btn btn-sm btn-secondary\"\n- @click=\"cancel()\"\n- >\n- <i class=\"fas fa-ban mr-1\"></i>Cancel\n- </button>\n- <button type=\"button\" class=\"btn btn-sm btn-success\">\n- <i class=\"fas fa-save mr-1\"></i>Save\n- </button>\n- </div>\n- </div>\n-</template>\n-\n-<script>\n-export default {\n- name: 'QuickEditor',\n- props: ['size'],\n- methods: {\n- cancel() {\n- this.$emit('quickeditor', false);\n- },\n- },\n-};\n-</script>\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/js/app/listing/Components/Table/Row/index.vue",
"new_path": "assets/js/app/listing/Components/Table/Row/index.vue",
"diff": "<template>\n<transition-group\n- name=\"quickeditor\"\ntag=\"div\"\nclass=\"listing--container\"\n:class=\"{ 'is-dashboard': type === 'dashboard' }\"\n<!-- row -->\n<div\n- v-if=\"!quickEditor\"\nkey=\"row\"\nclass=\"listing__row\"\n:class=\"`is-${size}`\"\n+ @mouseleave=\"leave\"\n>\n<!-- column thumbnail -->\n<div\n:type=\"type\"\n:record=\"record\"\n:size=\"size\"\n- @quickeditor=\"quickEditor = $event\"\n></row-actions>\n<!-- end column -->\n<!-- end column -->\n</div>\n- <!-- quick editor -->\n- <row-quick-editor\n- v-if=\"quickEditor\"\n- key=\"quickeditor\"\n- :size=\"size\"\n- @quickeditor=\"quickEditor = $event\"\n- ></row-quick-editor>\n</transition-group>\n</template>\n@@ -68,7 +59,6 @@ import Checkbox from './_Checkbox';\nimport Meta from './_Meta';\nimport Actions from './_Actions';\nimport Sorting from './_Sorting';\n-import QuickEditor from './_QuickEditor';\nexport default {\nname: 'TableRow',\n@@ -77,14 +67,14 @@ export default {\n'row-meta': Meta,\n'row-actions': Actions,\n'row-sorting': Sorting,\n- 'row-quick-editor': QuickEditor,\n},\nmixins: [type],\nprops: ['record'],\n- data: () => {\n- return {\n- quickEditor: false,\n- };\n+ methods: {\n+ leave(event) {\n+ // When we 'leave' the row, make sure we close the dropdown.\n+ $('.dropdown-toggle[aria-expanded=\"true\"').dropdown('toggle');\n+ },\n},\ncomputed: {\nsize() {\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/listing/row/_container.scss",
"new_path": "assets/scss/modules/listing/row/_container.scss",
"diff": "width: 100%;\nz-index: $big-z-index;\n+ // We raise the z-index by 1, to make sure the \"Edit\" dropdown is on top\n&:hover {\nz-index: $big-z-index + 1;\n}\n}\n&.is-dashboard {\n- .listing__row,\n- .quickedit__row {\n+ .listing__row{\nwidth: 100%;\n}\n}\n- .listing__row,\n- .quickedit__row {\n+ .listing__row {\nwidth: calc(100% - #{$checkbox-row-width});\n}\n}\n"
},
{
"change_type": "DELETE",
"old_path": "assets/scss/modules/listing/row/_quick-edit.scss",
"new_path": null,
"diff": "-.quickedit__row {\n- min-height: 200px;\n- flex: auto;\n- box-shadow: $card-box-shadow;\n- display: flex;\n- z-index: 99;\n- justify-content: space-between;\n- flex-direction: column;\n- background: var(--foreground);\n- margin-bottom: $spacer / 1.25;\n- border-radius: $border-radius;\n- position: relative;\n-\n- &--item {\n- padding: $spacer;\n-\n- &.is-actions {\n- background: var(--shade-100);\n- display: flex;\n- align-items: center;\n- padding: $spacer / 2;\n- justify-content: space-between;\n- }\n- }\n-}\n-\n-.quickeditor-enter-active,\n-.quickeditor-leave-active {\n- transition: transform 0.45s, opacity 0.25s;\n-}\n-\n-.quickeditor-enter,\n-.quickeditor-leave-to {\n- opacity: 0;\n- transform: translateY(30px);\n- transform-origin: top;\n- position: absolute;\n- right: 0;\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/listing/row/row.scss",
"new_path": "assets/scss/modules/listing/row/row.scss",
"diff": "@@ -173,17 +173,6 @@ $checkbox-row-width: 30px;\n}\n}\n- &--quickedit {\n- background: transparent;\n- border: 0;\n- color: var(--primary);\n- padding: 0;\n-\n- &:hover {\n- cursor: pointer;\n- text-decoration: underline;\n- }\n- }\n}\n.dropdown-menu {\n@@ -214,4 +203,3 @@ $checkbox-row-width: 30px;\n@import '_container';\n@import '_checkbox';\n-@import '_quick-edit';\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Don't overlap rows in listings
|
95,144 |
29.05.2019 20:55:24
| -7,200 |
7ce0ee6d191e7caf4db6eef3f3043117aa16e20a
|
Cleanup of a bunch of Vue stuff
|
[
{
"change_type": "RENAME",
"old_path": "assets/js/app/login/Components/Email/Email.vue",
"new_path": "assets/js/app/editor/Components/Editor/Email/Email.vue",
"diff": "<script>\nexport default {\n- name: 'FieldEmail',\n+ name: 'EditorEmail',\nprops: ['value', 'name', 'id'],\n};\n</script>\n"
},
{
"change_type": "RENAME",
"old_path": "assets/js/app/editor/Components/General/Language/Language.vue",
"new_path": "assets/js/app/editor/Components/Editor/Language/Language.vue",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "assets/js/app/login/Components/Password/Password.vue",
"new_path": "assets/js/app/editor/Components/Editor/Password/Password.vue",
"diff": "<script>\nexport default {\n- name: 'FieldPassword',\n+ name: 'EditorPassword',\nprops: ['value', 'name', 'id'],\nmethods: {\n"
},
{
"change_type": "RENAME",
"old_path": "assets/js/app/login/Components/User/Theme.vue",
"new_path": "assets/js/app/editor/Components/Editor/ThemeSelect/ThemeSelect.vue",
"diff": "<script>\nexport default {\n- name: 'UserTheme',\n+ name: 'ThemeSelect',\ndata: () => ({\nthemes: [\n"
},
{
"change_type": "DELETE",
"old_path": "assets/js/app/editor/Components/Editor/index.js",
"new_path": null,
"diff": "-import Text from './Text/Text';\n-import Slug from './Slug/Slug';\n-\n-import Date from './Date/Date';\n-\n-import Select from './Select/Select';\n-\n-import Number from './Number/Number';\n-\n-import Html from './Html/Html';\n-import Markdown from './Markdown/Markdown';\n-import Textarea from './Textarea/Textarea';\n-import Embed from './Embed/Embed';\n-\n-import Image from './Image/Image';\n-\n-export { Text, Slug, Number, Date, Select, Html, Markdown, Textarea, Embed, Image };\n"
},
{
"change_type": "DELETE",
"old_path": "assets/js/app/editor/Components/General/index.js",
"new_path": null,
"diff": "-import Language from './Language/Language';\n-\n-export { Language };\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/js/app/editor/index.js",
"new_path": "assets/js/app/editor/index.js",
"diff": "@@ -6,20 +6,20 @@ import store from './store';\n/**\n* Components\n*/\n-import {\n- Date,\n- Embed,\n- Html,\n- Image,\n- Markdown,\n- Number,\n- Select,\n- Slug,\n- Text,\n- Textarea,\n-} from './Components/Editor';\n-\n-import { Language } from './Components/General';\n+import Text from './Components/Editor/Text/Text';\n+import Slug from './Components/Editor/Slug/Slug';\n+import Date from './Components/Editor/Date/Date';\n+import Select from './Components/Editor/Select/Select';\n+import Number from './Components/Editor/Number/Number';\n+import Html from './Components/Editor/Html/Html';\n+import Markdown from './Components/Editor/Markdown/Markdown';\n+import Textarea from './Components/Editor/Textarea/Textarea';\n+import Embed from './Components/Editor/Embed/Embed';\n+import Image from './Components/Editor/Image/Image';\n+import Email from './Components/Editor/Email/Email';\n+import Password from './Components/Editor/Password/Password';\n+import ThemeSelect from './Components/Editor/ThemeSelect/ThemeSelect';\n+import Language from './Components/Editor/Language/Language';\nnew Vue({\nstore,\n@@ -28,6 +28,8 @@ new Vue({\ncomponents: {\n\"editor-date\": Date,\n\"editor-embed\": Embed,\n+ \"editor-email\": Email,\n+ \"editor-password\": Password,\n\"editor-html\": Html,\n\"editor-image\": Image,\n\"editor-markdown\": Markdown,\n@@ -37,5 +39,6 @@ new Vue({\n\"editor-text\": Text,\n\"editor-textarea\": Textarea,\n\"general-language\": Language,\n+ \"theme-select\": ThemeSelect,\n}\n});\n"
},
{
"change_type": "DELETE",
"old_path": "assets/js/app/login/Components/Admin/DashboardContentList.vue",
"new_path": null,
"diff": "-<template>\n- <div>\n- <div v-if=\"loading\" class=\"row col\"><p>Loading...</p></div>\n-\n- <div v-else>\n- <h3>Latest {{ type }}</h3>\n- <table>\n- <tbody>\n- <template v-for=\"record in records\" class=\"row col\">\n- <tr :key=\"record.id\">\n- <td>{{ record.id }}</td>\n- <td>\n- <a :href=\"record.extras.editLink\">{{ record.extras.title }}</a>\n- </td>\n- </tr>\n- <!-- Maybe is better to have a component to print each row? -->\n- <!-- <Context :id=\"item.id\" :key=\"item.id\" :contenttype=\"content.contenttype\" :title=\"item.fields[0]\"></Context> -->\n- </template>\n- </tbody>\n- </table>\n- </div>\n- </div>\n-</template>\n-\n-<script>\n-import { getRecords, fetchRecords } from './../../../../services/api/content';\n-\n-export default {\n- name: 'Context',\n- components: {\n- // Context\n- },\n- props: ['type', 'limit'],\n- data() {\n- return {\n- message: '',\n- loading: true,\n- records: [],\n- };\n- },\n- created() {\n- // @todo is this ever used?\n- console.warn('remove above todo');\n- this.records = getRecords(this.type);\n-\n- fetchRecords(this.type)\n- .then(records => {\n- this.records = records;\n- })\n- .catch(error => console.warn(error))\n- .finally(() => {\n- this.loading = false;\n- });\n- },\n-};\n-</script>\n"
},
{
"change_type": "DELETE",
"old_path": "assets/js/app/login/Components/Admin/DashboardNews.vue",
"new_path": null,
"diff": "-<template>\n- <div>\n- <div v-for=\"newsItem in news\" :key=\"newsItem.id\" class=\"card card mb-4\">\n- <div class=\"card-header\">{{ newsItem.title }}</div>\n- <!-- eslint-disable-next-line vue/no-v-html -->\n- <div class=\"card-body\" v-html=\"newsItem.teaser\"></div>\n- </div>\n- </div>\n-</template>\n-\n-<script>\n-import { fetchNews, getNews } from '../../../../services/api/dashboardNews';\n-\n-export default {\n- name: 'DashBoardNews',\n-\n- data() {\n- return {\n- loading: true,\n- news: [],\n- };\n- },\n- created() {\n- this.news = getNews();\n-\n- // Asynchronously fetch (might take a while)\n- setTimeout(() => {\n- fetchNews()\n- .then(news => {\n- this.news = news;\n- })\n- .catch(error => console.warn(error))\n- .finally(() => {\n- this.loading = false;\n- });\n- }, 200);\n- },\n-};\n-</script>\n-\n-<style></style>\n"
},
{
"change_type": "DELETE",
"old_path": "assets/js/app/login/Components/Admin/Header.vue",
"new_path": null,
"diff": "-<template>\n- <nav class=\"admin__header--topbar\">\n- <!-- eslint-disable-next-line vue/no-v-html -->\n- <h2 class=\"admin__header--title\" v-html=\"title\"></h2>\n- </nav>\n-</template>\n-\n-<script>\n-export default {\n- name: 'AdminHeader',\n- props: ['title'],\n-};\n-</script>\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/js/app/login/index.js",
"new_path": "assets/js/app/login/index.js",
"diff": "import Vue from 'vue';\n-import Theme from './Components/User/Theme';\n-import Password from './Components/Password/Password';\n-import Email from './Components/Email/Email';\n+import Password from '../editor/Components/Editor/Password/Password';\nimport Text from '../editor/Components/Editor/Text/Text';\n-Vue.component('user-theme', Theme);\nVue.component('field-password', Password);\n-Vue.component('field-email', Email);\nVue.component('editor-text', Text);\nnew Vue({\nel: '#login-form',\nname: 'BoltLogin',\n- components: { 'editor-text': Text, 'field-password': Password },\n+ components: {\n+ 'editor-text': Text,\n+ 'editor-password': Password\n+ },\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/ProfileController.php",
"new_path": "src/Controller/Backend/ProfileController.php",
"diff": "@@ -98,6 +98,8 @@ class ProfileController extends TwigAwareController implements BackendZone\n$request->getSession()->set('_locale', $locale);\n+ $this->addFlash('success', 'user.updated_profile');\n+\nreturn new RedirectResponse($url);\n}\n@@ -124,7 +126,7 @@ class ProfileController extends TwigAwareController implements BackendZone\n}\n// Validate password\n- if ($newPassword !== null && mb_strlen($newPassword) < 6) {\n+ if (!empty($newPassword) && mb_strlen($newPassword) < 6) {\n$this->addFlash('danger', 'user.not_valid_password');\nreturn false;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/_partials/fields/email.html.twig",
"new_path": "templates/_partials/fields/email.html.twig",
"diff": "{% extends '@bolt/_partials/fields/_base.html.twig' %}\n{% block field %}\n- <field-email\n+ <editor-email\n:id=\"'{{ id }}'\"\n:name=\"'{{ name }}'\"\n:value=\"{{ value|json_encode }}\"\n- ></field-email>\n+ ></editor-email>\n{% endblock %}\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/_partials/fields/password.html.twig",
"new_path": "templates/_partials/fields/password.html.twig",
"diff": "{% extends '@bolt/_partials/fields/_base.html.twig' %}\n{% block field %}\n- <field-password\n+ <editor-password\n:id=\"'{{ id }}'\"\n:name=\"'{{ name }}'\"\n:value=\"{{ value|json_encode }}\"\n- ></field-password>\n+ ></editor-password>\n{% endblock %}\n\\ No newline at end of file\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Cleanup of a bunch of Vue stuff
|
95,144 |
30.05.2019 10:31:45
| -7,200 |
3b8f48b97f2352b1c9dd28fba868150adf097ce0
|
Update to Symfony 4.3 stable
|
[
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"ext-pdo\": \"*\",\n\"api-platform/core\": \"^2.4\",\n\"bolt/common\": \"^2.0.2\",\n- \"cocur/slugify\": \"^3.1\",\n- \"doctrine/annotations\": \"^1.0\",\n- \"doctrine/doctrine-bundle\": \"^1.8\",\n+ \"cocur/slugify\": \"^3.2\",\n+ \"doctrine/annotations\": \"^1.6\",\n+ \"doctrine/doctrine-bundle\": \"^1.11\",\n\"doctrine/doctrine-cache-bundle\": \"^1.3.1\",\n- \"doctrine/orm\": \"^2.5.11\",\n+ \"doctrine/orm\": \"^2.6\",\n\"easycorp/easy-log-handler\": \"^1.0.7\",\n\"embed/embed\": \"^3.3\",\n\"erusev/parsedown\": \"^1.7\",\n\"fzaninotto/faker\": \"^1.8\",\n\"gedmo/doctrine-extensions\": \"v2.4.x-dev\",\n\"guzzlehttp/guzzle\": \"^6.3\",\n- \"knplabs/knp-menu-bundle\": \"^2.0\",\n+ \"knplabs/knp-menu-bundle\": \"^2.2\",\n\"league/glide-symfony\": \"^1.0\",\n\"miljar/php-exif\": \"^0.6.4\",\n\"nelmio/cors-bundle\": \"^1.5\",\n- \"nesbot/carbon\": \"^1.34\",\n+ \"nesbot/carbon\": \"^1.37\",\n\"php-translation/symfony-bundle\": \"^0.8\",\n- \"phpdocumentor/reflection-docblock\": \"^4.2\",\n- \"sensio/framework-extra-bundle\": \"^5.1\",\n+ \"phpdocumentor/reflection-docblock\": \"^4.3\",\n+ \"sensio/framework-extra-bundle\": \"^5.3\",\n\"sensiolabs/security-checker\": \"^5.0\",\n\"siriusphp/upload\": \"^2.1\",\n\"stof/doctrine-extensions-bundle\": \"^1.3\",\n- \"symfony/asset\": \"^4.2\",\n- \"symfony/console\": \"^4.2\",\n- \"symfony/dependency-injection\": \"^4.2\",\n- \"symfony/expression-language\": \"^4.2\",\n+ \"symfony/asset\": \"^4.3\",\n+ \"symfony/console\": \"^4.3\",\n+ \"symfony/dependency-injection\": \"^4.3\",\n+ \"symfony/expression-language\": \"^4.3\",\n\"symfony/flex\": \"^1.2\",\n- \"symfony/form\": \"^4.2\",\n- \"symfony/framework-bundle\": \"^4.2\",\n- \"symfony/monolog-bridge\": \"^4.1\",\n+ \"symfony/form\": \"^4.3\",\n+ \"symfony/framework-bundle\": \"^4.3\",\n+ \"symfony/monolog-bridge\": \"^4.3\",\n\"symfony/monolog-bundle\": \"^3.3\",\n- \"symfony/polyfill-php72\": \"^1.8\",\n- \"symfony/security-bundle\": \"^4.2\",\n- \"symfony/serializer\": \"^4.2\",\n+ \"symfony/polyfill-php72\": \"^1.11\",\n+ \"symfony/security-bundle\": \"^4.3\",\n+ \"symfony/serializer\": \"^4.3\",\n\"symfony/swiftmailer-bundle\": \"^3.2\",\n- \"symfony/translation\": \"^4.2\",\n- \"symfony/twig-bundle\": \"^4.2\",\n- \"symfony/validator\": \"^4.2\",\n- \"symfony/var-dumper\": \"^4.2\",\n- \"symfony/webpack-encore-bundle\": \"^1.0\",\n- \"symfony/yaml\": \"^4.2\",\n- \"tightenco/collect\": \"^5.7\",\n+ \"symfony/translation\": \"^4.3\",\n+ \"symfony/twig-bundle\": \"^4.3\",\n+ \"symfony/validator\": \"^4.3\",\n+ \"symfony/var-dumper\": \"^4.3\",\n+ \"symfony/webpack-encore-bundle\": \"^1.6\",\n+ \"symfony/yaml\": \"^4.3\",\n+ \"tightenco/collect\": \"^5.8\",\n\"twig/extensions\": \"^1.5\",\n\"webmozart/path-util\": \"^2.3\",\n\"webonyx/graphql-php\": \"^0.13\",\n\"behat/mink-extension\": \"^2.3\",\n\"behat/mink-goutte-driver\": \"^1.2\",\n\"behatch/contexts\": \"^3.2\",\n- \"coduo/php-matcher\": \"dev-patch-2@dev\",\n+ \"coduo/php-matcher\": \"^3.1.2\",\n\"dama/doctrine-test-bundle\": \"^5.0\",\n\"doctrine/doctrine-fixtures-bundle\": \"^3.1\",\n\"lakion/mink-debug-extension\": \"^1.2\",\n\"phpstan/phpstan-symfony\": \"^0.11\",\n\"phpunit/phpunit\": \"^7.0\",\n\"roave/security-advisories\": \"dev-master@dev\",\n- \"symfony/browser-kit\": \"^4.2\",\n- \"symfony/css-selector\": \"^4.2\",\n- \"symfony/debug-bundle\": \"^4.2\",\n- \"symfony/dotenv\": \"^4.2\",\n+ \"symfony/browser-kit\": \"^4.3\",\n+ \"symfony/css-selector\": \"^4.3\",\n+ \"symfony/debug-bundle\": \"^4.3\",\n+ \"symfony/dotenv\": \"^4.3\",\n\"symfony/maker-bundle\": \"^1.11\",\n- \"symfony/stopwatch\": \"^4.2\",\n- \"symfony/web-profiler-bundle\": \"^4.2\",\n- \"symfony/web-server-bundle\": \"^4.2\",\n+ \"symfony/stopwatch\": \"^4.3\",\n+ \"symfony/web-profiler-bundle\": \"^4.3\",\n+ \"symfony/web-server-bundle\": \"^4.3\",\n\"symplify/easy-coding-standard\": \"^5.4.14\"\n},\n\"config\": {\n\"extra\": {\n\"symfony\": {\n\"allow-contrib\": true,\n- \"require\": \"^4.2\"\n+ \"require\": \"^4.3\"\n}\n},\n\"autoload\": {\n\"type\": \"vcs\",\n\"url\": \"https://github.com/bobdenotter/DoctrineExtensions\",\n\"no-api\": true\n- },\n- {\n- \"type\": \"vcs\",\n- \"url\": \"https://github.com/jarjak/php-matcher\",\n- \"no-api\": true\n}\n],\n\"minimum-stability\": \"stable\",\n"
},
{
"change_type": "MODIFY",
"old_path": "symfony.lock",
"new_path": "symfony.lock",
"diff": "\"symfony/cache\": {\n\"version\": \"v3.4.0-beta2\"\n},\n+ \"symfony/cache-contracts\": {\n+ \"version\": \"v1.1.1\"\n+ },\n\"symfony/class-loader\": {\n\"version\": \"v3.4.21\"\n},\n\"symfony/event-dispatcher\": {\n\"version\": \"v3.4.0-beta2\"\n},\n+ \"symfony/event-dispatcher-contracts\": {\n+ \"version\": \"v1.1.1\"\n+ },\n\"symfony/expression-language\": {\n\"version\": \"v3.4.0-beta2\"\n},\n\"ref\": \"fadbfe33303a76e25cb63401050439aa9b1a9c7f\"\n}\n},\n+ \"symfony/mime\": {\n+ \"version\": \"v4.3.0\"\n+ },\n\"symfony/monolog-bridge\": {\n\"version\": \"v3.4.0-beta2\"\n},\n\"symfony/polyfill-php72\": {\n\"version\": \"v1.6.0\"\n},\n+ \"symfony/polyfill-php73\": {\n+ \"version\": \"v1.11.0\"\n+ },\n\"symfony/process\": {\n\"version\": \"v3.4.0-beta2\"\n},\n\"symfony/serializer\": {\n\"version\": \"v4.1.4\"\n},\n+ \"symfony/service-contracts\": {\n+ \"version\": \"v1.1.2\"\n+ },\n\"symfony/stopwatch\": {\n\"version\": \"v3.4.0-beta2\"\n},\n\"ref\": \"58f37511a2ceec2761716413ce679cbe118e37c3\"\n}\n},\n+ \"symfony/translation-contracts\": {\n+ \"version\": \"v1.1.2\"\n+ },\n\"symfony/twig-bridge\": {\n\"version\": \"v3.4.0-beta2\"\n},\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Update to Symfony 4.3 stable
|
95,144 |
30.05.2019 14:43:28
| -7,200 |
ef75c6ef3ad3aedbdd036ed61e2515a00e16753b
|
Call `$kernel->boot()` ourselves.
|
[
{
"change_type": "MODIFY",
"old_path": "tests/php/DbAwareTestCase.php",
"new_path": "tests/php/DbAwareTestCase.php",
"diff": "@@ -47,6 +47,10 @@ class DbAwareTestCase extends WebTestCase\nif (self::$application === null) {\n$client = static::createClient();\n+ // Since Symfony 4.3.0, the `doRun` method no longer triggers `->boot()`, so we do it ourselves.\n+ // @see: https://github.com/symfony/framework-bundle/commit/2c0499210e365bdfe81ae2c56a5a81c5ec687532\n+ $client->getKernel()->boot();\n+\nself::$application = new Application($client->getKernel());\nself::$application->setAutoExit(false);\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Call `$kernel->boot()` ourselves.
|
95,144 |
30.05.2019 15:32:13
| -7,200 |
0e793364f2206f0c0531069cf0088f120983cf3b
|
Nope, still need `jarjak/php-matcher`
|
[
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"behat/mink-extension\": \"^2.3\",\n\"behat/mink-goutte-driver\": \"^1.2\",\n\"behatch/contexts\": \"^3.2\",\n- \"coduo/php-matcher\": \"^3.1.2\",\n+ \"coduo/php-matcher\": \"dev-patch-2@dev\",\n\"dama/doctrine-test-bundle\": \"^5.0\",\n\"doctrine/doctrine-fixtures-bundle\": \"^3.1\",\n\"lakion/mink-debug-extension\": \"^1.2\",\n\"type\": \"vcs\",\n\"url\": \"https://github.com/bobdenotter/DoctrineExtensions\",\n\"no-api\": true\n+ },\n+ {\n+ \"type\": \"vcs\",\n+ \"url\": \"https://github.com/jarjak/php-matcher\",\n+ \"no-api\": true\n}\n],\n\"minimum-stability\": \"stable\",\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Nope, still need `jarjak/php-matcher`
|
95,144 |
31.05.2019 11:46:56
| -7,200 |
29e1561713dde760d24bda94e332b218e49320b8
|
Explicitly require `psr/simple-cache`
|
[
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"nesbot/carbon\": \"^1.37\",\n\"php-translation/symfony-bundle\": \"^0.8\",\n\"phpdocumentor/reflection-docblock\": \"^4.3\",\n+ \"psr/simple-cache\": \"^1.0\",\n\"sensio/framework-extra-bundle\": \"^5.3\",\n\"sensiolabs/security-checker\": \"^5.0\",\n\"siriusphp/upload\": \"^2.1\",\n"
},
{
"change_type": "MODIFY",
"old_path": "symfony.lock",
"new_path": "symfony.lock",
"diff": "\"knplabs/knp-menu-bundle\": {\n\"version\": \"v2.2.1\"\n},\n+ \"kylekatarnls/update-helper\": {\n+ \"version\": \"1.1.0\"\n+ },\n\"lakion/mink-debug-extension\": {\n\"version\": \"v1.2.3\"\n},\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Explicitly require `psr/simple-cache`
|
95,144 |
31.05.2019 14:32:49
| -7,200 |
de9275b3b9fe450d210f1fd3ee9389fa2b63841e
|
Don't hardcode projectDir
|
[
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Config.php",
"new_path": "src/Configuration/Config.php",
"diff": "@@ -14,6 +14,7 @@ use Bolt\\Configuration\\Parser\\TaxonomyParser;\nuse Psr\\SimpleCache\\CacheInterface;\nuse Symfony\\Component\\Stopwatch\\Stopwatch;\nuse Tightenco\\Collect\\Support\\Collection;\n+use Webmozart\\PathUtil\\Path;\nclass Config\n{\n@@ -92,19 +93,19 @@ class Config\n*/\nprivate function parseConfig(): array\n{\n- $general = new GeneralParser();\n+ $general = new GeneralParser($this->projectDir);\n$config = new Collection([\n'general' => $general->parse(),\n]);\n- $taxonomy = new TaxonomyParser();\n+ $taxonomy = new TaxonomyParser($this->projectDir);\n$config['taxonomies'] = $taxonomy->parse();\n- $contentTypes = new ContentTypesParser($config->get('general'));\n+ $contentTypes = new ContentTypesParser($this->projectDir, $config->get('general'));\n$config['contenttypes'] = $contentTypes->parse();\n- $menu = new MenuParser();\n+ $menu = new MenuParser($this->projectDir);\n$config['menu'] = $menu->parse();\n// @todo Add these config files if needed, or refactor them out otherwise\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/BaseParser.php",
"new_path": "src/Configuration/Parser/BaseParser.php",
"diff": "@@ -24,10 +24,9 @@ abstract class BaseParser\n/** @var string[] */\nprotected $parsedFilenames = [];\n- public function __construct(string $initialFilename)\n+ public function __construct(string $projectDir, string $initialFilename)\n{\n- $configDirectories = [dirname(dirname(dirname(__DIR__))) . '/config/bolt'];\n- $this->fileLocator = new FileLocator($configDirectories);\n+ $this->fileLocator = new FileLocator([$projectDir . '/config/bolt']);\n$this->pathResolver = new PathResolver(dirname(dirname(dirname(__DIR__))), []);\n$this->initialFilename = $initialFilename;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/ContentTypesParser.php",
"new_path": "src/Configuration/Parser/ContentTypesParser.php",
"diff": "@@ -13,15 +13,13 @@ use Tightenco\\Collect\\Support\\Collection;\nclass ContentTypesParser extends BaseParser\n{\n- /**\n- * @var Collection\n- */\n+ /** @var Collection */\nprivate $generalConfig;\n- public function __construct(Collection $generalConfig, string $filename = 'contenttypes.yaml')\n+ public function __construct(string $projectDir, Collection $generalConfig, string $filename = 'contenttypes.yaml')\n{\n$this->generalConfig = $generalConfig;\n- parent::__construct($filename);\n+ parent::__construct($projectDir, $filename);\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/GeneralParser.php",
"new_path": "src/Configuration/Parser/GeneralParser.php",
"diff": "@@ -12,9 +12,9 @@ use Webmozart\\PathUtil\\Path;\nclass GeneralParser extends BaseParser\n{\n- public function __construct(string $initialFilename = 'config.yaml')\n+ public function __construct(string $projectDir, string $initialFilename = 'config.yaml')\n{\n- parent::__construct($initialFilename);\n+ parent::__construct($projectDir, $initialFilename);\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/MenuParser.php",
"new_path": "src/Configuration/Parser/MenuParser.php",
"diff": "@@ -11,7 +11,7 @@ class MenuParser extends BaseParser\n/** @var array */\nprivate $itemBase = [];\n- public function __construct(string $initialFilename = 'menu.yaml')\n+ public function __construct(string $projectDir, string $initialFilename = 'menu.yaml')\n{\n$this->itemBase = [\n'label' => '',\n@@ -23,7 +23,7 @@ class MenuParser extends BaseParser\n'current' => false,\n];\n- parent::__construct($initialFilename);\n+ parent::__construct($projectDir, $initialFilename);\n}\n/**\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/TaxonomyParser.php",
"new_path": "src/Configuration/Parser/TaxonomyParser.php",
"diff": "@@ -9,9 +9,9 @@ use Tightenco\\Collect\\Support\\Collection;\nclass TaxonomyParser extends BaseParser\n{\n- public function __construct(string $initialFilename = 'taxonomy.yaml')\n+ public function __construct(string $projectDir, string $initialFilename = 'taxonomy.yaml')\n{\n- parent::__construct($initialFilename);\n+ parent::__construct($projectDir, $initialFilename);\n}\n/**\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Don't hardcode projectDir
|
95,144 |
31.05.2019 14:33:23
| -7,200 |
2d9f3514055b47be7221b537a7c1e8d0b91b849d
|
Update tests with non-hardcoded $projectDir
|
[
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/ConfigTest.php",
"new_path": "tests/php/Configuration/ConfigTest.php",
"diff": "@@ -17,7 +17,7 @@ class ConfigTest extends TestCase\npublic function testCanParse(): void\n{\n- $projectDir = dirname(__DIR__);\n+ $projectDir = dirname(dirname(dirname(__DIR__)));\n$cache = new Psr6Cache(new TraceableAdapter(new FilesystemAdapter()));\n$config = new Config(new Stopwatch(), $projectDir, $cache);\n@@ -26,7 +26,7 @@ class ConfigTest extends TestCase\npublic function testConfigGet()\n{\n- $projectDir = dirname(__DIR__);\n+ $projectDir = dirname(dirname(dirname(__DIR__)));\n$cache = new Psr6Cache(new TraceableAdapter(new FilesystemAdapter()));\n$config = new Config(new Stopwatch(), $projectDir, $cache);\n@@ -35,7 +35,7 @@ class ConfigTest extends TestCase\npublic function testConfigHas()\n{\n- $projectDir = dirname(__DIR__);\n+ $projectDir = dirname(dirname(dirname(__DIR__)));\n$cache = new Psr6Cache(new TraceableAdapter(new FilesystemAdapter()));\n$config = new Config(new Stopwatch(), $projectDir, $cache);\n@@ -45,7 +45,7 @@ class ConfigTest extends TestCase\npublic function testConfigGetMediaTypes()\n{\n- $projectDir = dirname(__DIR__);\n+ $projectDir = dirname(dirname(dirname(__DIR__)));\n$cache = new Psr6Cache(new TraceableAdapter(new FilesystemAdapter()));\n$config = new Config(new Stopwatch(), $projectDir, $cache);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"new_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"diff": "@@ -19,8 +19,8 @@ class ContentTypesParserTest extends ParserTestBase\npublic function testCanParse(): void\n{\n- $generalParser = new GeneralParser();\n- $contentTypesParser = new ContentTypesParser($generalParser->parse());\n+ $generalParser = new GeneralParser($this->getProjectDir());\n+ $contentTypesParser = new ContentTypesParser($this->getProjectDir(), $generalParser->parse());\n$config = $contentTypesParser->parse();\n$this->assertInstanceOf(Collection::class, $config);\n@@ -29,8 +29,8 @@ class ContentTypesParserTest extends ParserTestBase\npublic function testIgnoreNonsensicalFileParse(): void\n{\n$file = self::getBasePath() . 'bogus.yaml';\n- $generalParser = new GeneralParser();\n- $contentTypesParser = new ContentTypesParser($generalParser->parse(), $file);\n+ $generalParser = new GeneralParser($this->getProjectDir());\n+ $contentTypesParser = new ContentTypesParser($this->getProjectDir(), $generalParser->parse(), $file);\n$this->expectException(ConfigurationException::class);\n@@ -40,8 +40,8 @@ class ContentTypesParserTest extends ParserTestBase\npublic function testBreakOnInvalidFileParse(): void\n{\n$file = self::getBasePath() . 'broken.yaml';\n- $generalParser = new GeneralParser();\n- $contentTypesParser = new ContentTypesParser($generalParser->parse(), $file);\n+ $generalParser = new GeneralParser($this->getProjectDir());\n+ $contentTypesParser = new ContentTypesParser($this->getProjectDir(), $generalParser->parse(), $file);\n$this->expectException(ParseException::class);\n@@ -50,8 +50,8 @@ class ContentTypesParserTest extends ParserTestBase\npublic function testBreakOnMissingFileParse(): void\n{\n- $generalParser = new GeneralParser();\n- $contentTypesParser = new ContentTypesParser($generalParser->parse(), 'foo.yml');\n+ $generalParser = new GeneralParser($this->getProjectDir());\n+ $contentTypesParser = new ContentTypesParser($this->getProjectDir(), $generalParser->parse(), 'foo.yml');\n$this->expectException(FileLocatorFileNotFoundException::class);\n@@ -60,8 +60,8 @@ class ContentTypesParserTest extends ParserTestBase\npublic function testHasConfig(): void\n{\n- $generalParser = new GeneralParser();\n- $contentTypesParser = new ContentTypesParser($generalParser->parse());\n+ $generalParser = new GeneralParser($this->getProjectDir());\n+ $contentTypesParser = new ContentTypesParser($this->getProjectDir(), $generalParser->parse());\n$config = $contentTypesParser->parse();\n$this->assertCount(6, $config);\n@@ -88,8 +88,8 @@ class ContentTypesParserTest extends ParserTestBase\n{\n$file = self::getBasePath() . 'minimal_content_types.yaml';\n- $generalParser = new GeneralParser();\n- $contentTypesParser = new ContentTypesParser($generalParser->parse(), $file);\n+ $generalParser = new GeneralParser($this->getProjectDir());\n+ $contentTypesParser = new ContentTypesParser($this->getProjectDir(), $generalParser->parse(), $file);\n$config = $contentTypesParser->parse();\n$this->assertCount(self::NUMBER_OF_CONTENT_TYPES_IN_MINIMAL_FILE, $config);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/GeneralParserTest.php",
"new_path": "tests/php/Configuration/Parser/GeneralParserTest.php",
"diff": "@@ -13,7 +13,8 @@ class GeneralParserTest extends ParserTestBase\n{\npublic function testCanParse(): void\n{\n- $generalParser = new GeneralParser();\n+\n+ $generalParser = new GeneralParser($this->getProjectDir());\n$config = $generalParser->parse();\n$this->assertInstanceOf(Collection::class, $config);\n@@ -22,7 +23,7 @@ class GeneralParserTest extends ParserTestBase\npublic function testIgnoreNonsensicalFileParse(): void\n{\n$file = self::getBasePath() . 'bogus.yaml';\n- $generalParser = new GeneralParser($file);\n+ $generalParser = new GeneralParser($this->getProjectDir(), $file);\n$config = $generalParser->parse();\n$this->assertInstanceOf(Collection::class, $config);\n@@ -31,7 +32,7 @@ class GeneralParserTest extends ParserTestBase\npublic function testBreakOnInvalidFileParse(): void\n{\n$file = self::getBasePath() . 'broken.yaml';\n- $generalParser = new GeneralParser($file);\n+ $generalParser = new GeneralParser($this->getProjectDir(), $file);\n$this->expectException(ParseException::class);\n@@ -40,7 +41,7 @@ class GeneralParserTest extends ParserTestBase\npublic function testBreakOnMissingFileParse(): void\n{\n- $generalParser = new GeneralParser('foo.yml');\n+ $generalParser = new GeneralParser($this->getProjectDir(), 'foo.yml');\n$this->expectException(FileLocatorFileNotFoundException::class);\n@@ -49,7 +50,7 @@ class GeneralParserTest extends ParserTestBase\npublic function testHasConfig(): void\n{\n- $generalParser = new GeneralParser();\n+ $generalParser = new GeneralParser($this->getProjectDir());\n$config = $generalParser->parse();\n// Something in the file\n@@ -62,7 +63,7 @@ class GeneralParserTest extends ParserTestBase\npublic function testFilenames()\n{\n$file = self::getBasePath() . 'bogus.yaml';\n- $generalParser = new GeneralParser($file);\n+ $generalParser = new GeneralParser($this->getProjectDir(), $file);\n$config = $generalParser->parse();\n$this->assertCount(2, $generalParser->getParsedFilenames());\n@@ -74,7 +75,7 @@ class GeneralParserTest extends ParserTestBase\npublic function testLocalOverridesParse(): void\n{\n$file = self::getBasePath() . 'bogus.yaml';\n- $generalParser = new GeneralParser($file);\n+ $generalParser = new GeneralParser($this->getProjectDir(), $file);\n$config = $generalParser->parse();\n$this->assertSame('OverBar', $config['foo']);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/MenuParserTest.php",
"new_path": "tests/php/Configuration/Parser/MenuParserTest.php",
"diff": "@@ -13,7 +13,7 @@ class MenuParserTest extends ParserTestBase\n{\npublic function testCanParse(): void\n{\n- $menuParser = new MenuParser();\n+ $menuParser = new MenuParser($this->getProjectDir());\n$config = $menuParser->parse();\n$this->assertInstanceOf(Collection::class, $config);\n@@ -22,7 +22,7 @@ class MenuParserTest extends ParserTestBase\npublic function testIgnoreNonsensicalFileParse(): void\n{\n$file = self::getBasePath() . 'bogus.yaml';\n- $menuParser = new MenuParser($file);\n+ $menuParser = new MenuParser($this->getProjectDir(), $file);\n$config = $menuParser->parse();\n$this->assertInstanceOf(Collection::class, $config);\n@@ -31,7 +31,7 @@ class MenuParserTest extends ParserTestBase\npublic function testBreakOnInvalidFileParse(): void\n{\n$file = self::getBasePath() . 'broken.yaml';\n- $menuParser = new MenuParser($file);\n+ $menuParser = new MenuParser($this->getProjectDir(), $file);\n$this->expectException(ParseException::class);\n@@ -40,7 +40,7 @@ class MenuParserTest extends ParserTestBase\npublic function testBreakOnMissingFileParse(): void\n{\n- $menuParser = new MenuParser('foo.yml');\n+ $menuParser = new MenuParser($this->getProjectDir(), 'foo.yml');\n$this->expectException(FileLocatorFileNotFoundException::class);\n@@ -50,7 +50,7 @@ class MenuParserTest extends ParserTestBase\npublic function testHasMenu(): void\n{\n- $menuParser = new MenuParser();\n+ $menuParser = new MenuParser($this->getProjectDir());\n$config = $menuParser->parse();\n$this->assertCount(2, $config);\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/ParserTestBase.php",
"new_path": "tests/php/Configuration/Parser/ParserTestBase.php",
"diff": "@@ -8,6 +8,10 @@ use PHPUnit\\Framework\\TestCase;\nabstract class ParserTestBase extends TestCase\n{\n+ public function getProjectDir()\n+ {\n+ return dirname(dirname(dirname(dirname(__DIR__))));\n+ }\npublic static function getBasePath(): string\n{\nreturn dirname(dirname(dirname(__DIR__))) . '/fixtures/config/';\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/TaxonomyParserTest.php",
"new_path": "tests/php/Configuration/Parser/TaxonomyParserTest.php",
"diff": "@@ -13,7 +13,7 @@ class TaxonomyParserTest extends ParserTestBase\n{\npublic function testCanParse(): void\n{\n- $taxonomyParser = new TaxonomyParser();\n+ $taxonomyParser = new TaxonomyParser($this->getProjectDir());\n$config = $taxonomyParser->parse();\n$this->assertInstanceOf(Collection::class, $config);\n@@ -22,7 +22,7 @@ class TaxonomyParserTest extends ParserTestBase\npublic function testBreakOnInvalidFileParse(): void\n{\n$file = self::getBasePath() . 'broken.yaml';\n- $taxonomyParser = new TaxonomyParser($file);\n+ $taxonomyParser = new TaxonomyParser($this->getProjectDir(), $file);\n$this->expectException(ParseException::class);\n@@ -31,7 +31,7 @@ class TaxonomyParserTest extends ParserTestBase\npublic function testBreakOnMissingFileParse(): void\n{\n- $taxonomyParser = new TaxonomyParser('foo.yml');\n+ $taxonomyParser = new TaxonomyParser($this->getProjectDir(), 'foo.yml');\n$this->expectException(FileLocatorFileNotFoundException::class);\n@@ -41,7 +41,7 @@ class TaxonomyParserTest extends ParserTestBase\npublic function testHasTaxonomies(): void\n{\n- $taxonomyParser = new TaxonomyParser();\n+ $taxonomyParser = new TaxonomyParser($this->getProjectDir());\n$config = $taxonomyParser->parse();\n$this->assertCount(3, $config);\n@@ -72,7 +72,7 @@ class TaxonomyParserTest extends ParserTestBase\npublic function testInferTaxonomyValues(): void\n{\n$file = self::getBasePath() . 'minimal_taxonomy.yaml';\n- $taxonomyParser = new TaxonomyParser($file);\n+ $taxonomyParser = new TaxonomyParser($this->getProjectDir(), $file);\n$config = $taxonomyParser->parse();\n$this->assertCount(2, $config);\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Update tests with non-hardcoded $projectDir
|
95,144 |
31.05.2019 15:38:36
| -7,200 |
383412df6969cea7a9a2c066f6d18f6022c1aede
|
Construct dummy contenttype on the fly
|
[
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Content/ContentType.php",
"new_path": "src/Configuration/Content/ContentType.php",
"diff": "@@ -20,7 +20,7 @@ class ContentType extends DeepCollection\nreturn new self($contentTypesConfig->get($name));\n}\n- return $contentTypesConfig\n+ $contentType = $contentTypesConfig\n->filter(function (Collection $contentTypeConfig) use ($name): bool {\nreturn $contentTypeConfig['singular_slug'] === $name;\n})\n@@ -28,6 +28,18 @@ class ContentType extends DeepCollection\nreturn new self($contentTypeConfig);\n})\n->first();\n+\n+ if ($contentType) {\n+ return $contentType;\n+ }\n+\n+ return new self([\n+ 'name' => $name,\n+ 'slug' => $name,\n+ 'singular_slug' => $name,\n+ 'singular_name' => $name,\n+ 'locales' => [],\n+ ]);\n}\npublic function getSlug(): string\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Construct dummy contenttype on the fly
|
95,144 |
31.05.2019 15:39:24
| -7,200 |
7e4ac50730a7d43d6be7309a783a59a8a2d5860f
|
Flawed logic: If it's not a Collection, we can't use a method from Collection on it
|
[
{
"change_type": "MODIFY",
"old_path": "src/Entity/ContentLocalizeTrait.php",
"new_path": "src/Entity/ContentLocalizeTrait.php",
"diff": "@@ -15,7 +15,7 @@ trait ContentLocalizeTrait\n{\n$locales = $this->getDefinition()->get('locales');\n- if ($locales->isEmpty()) {\n+ if (empty($locales)) {\nreturn new Collection(['']);\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Flawed logic: If it's not a Collection, we can't use a method from Collection on it
|
95,144 |
31.05.2019 15:40:08
| -7,200 |
95d7cc91606d5243060978f25e51c3b46d991daa
|
Don't break when trying to make links to missing ContentTypes
|
[
{
"change_type": "MODIFY",
"old_path": "src/Twig/ContentExtension.php",
"new_path": "src/Twig/ContentExtension.php",
"diff": "@@ -10,6 +10,7 @@ use Bolt\\Entity\\Field\\ImageField;\nuse Bolt\\Repository\\ContentRepository;\nuse Bolt\\Utils\\Excerpt;\nuse Bolt\\Utils\\Html;\n+use Symfony\\Component\\Routing\\Exception\\InvalidParameterException;\nuse Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;\nuse Symfony\\Component\\Security\\Csrf\\CsrfTokenManagerInterface;\nuse Tightenco\\Collect\\Support\\Collection;\n@@ -257,11 +258,19 @@ class ContentExtension extends AbstractExtension\nprivate function generateLink(string $route, array $params, $absolute = false): string\n{\n- return $this->urlGenerator->generate(\n+ try {\n+ $link = $this->urlGenerator->generate(\n$route,\n$params,\n$absolute ? UrlGeneratorInterface::ABSOLUTE_URL : UrlGeneratorInterface::ABSOLUTE_PATH\n);\n+ } catch (InvalidParameterException $e) {\n+ // @todo More graceful logging, tell user that (probably) the ContentType went missing.\n+ dump($e);\n+ $link = '';\n+ }\n+\n+ return $link;\n}\npublic function getTaxonomies(Content $content): Collection\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Don't break when trying to make links to missing ContentTypes
|
95,144 |
31.05.2019 16:23:15
| -7,200 |
49367e815152eac84b0d097b24f5348df8137bd2
|
Cast to string, if empty locales
|
[
{
"change_type": "MODIFY",
"old_path": "src/Entity/ContentLocalizeTrait.php",
"new_path": "src/Entity/ContentLocalizeTrait.php",
"diff": "@@ -24,6 +24,6 @@ trait ContentLocalizeTrait\npublic function getDefaultLocale(): string\n{\n- return $this->getLocales()->first();\n+ return (string) $this->getLocales()->first();\n}\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Cast to string, if empty locales
|
95,144 |
01.06.2019 08:21:06
| -7,200 |
af135610329213048b8bfd4032f3084a7c52e737
|
Allow for Carbon 2, alongside Carbon 1 (needed for Symfony 4 requirements)
|
[
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"league/glide-symfony\": \"^1.0\",\n\"miljar/php-exif\": \"^0.6.4\",\n\"nelmio/cors-bundle\": \"^1.5\",\n- \"nesbot/carbon\": \"^1.37\",\n+ \"nesbot/carbon\": \"^1.38 || ^2.19\",\n\"php-translation/symfony-bundle\": \"^0.8\",\n\"phpdocumentor/reflection-docblock\": \"^4.3\",\n\"psr/simple-cache\": \"^1.0\",\n\"symplify/easy-coding-standard\": \"^5.4.14\"\n},\n\"config\": {\n- \"platform\": {\n- \"php\": \"7.1.3\"\n- },\n\"preferred-install\": {\n\"*\": \"dist\"\n},\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Allow for Carbon 2, alongside Carbon 1 (needed for Symfony 4 requirements)
|
95,144 |
05.06.2019 17:43:27
| -7,200 |
a07318d4e835bcd191e8b43aaf9e257d8896fff2
|
Don't parse string-like fields in the backend.
|
[
{
"change_type": "MODIFY",
"old_path": "templates/_partials/fields/_base.html.twig",
"new_path": "templates/_partials/fields/_base.html.twig",
"diff": "{% if not value|default %}\n{% set value = field.value|default('') %}\n{% if value is iterable %}\n- {% set value = field.__toString() %}\n+ {% set value = value|first %}\n{% endif %}\n{% endif %}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Don't parse string-like fields in the backend.
|
95,144 |
06.06.2019 14:33:36
| -7,200 |
05197226a0316e7d658cfdd375d06e21148f10ad
|
Update Field if ContentType definition for a field changes
|
[
{
"change_type": "MODIFY",
"old_path": "config/bolt/config.yaml",
"new_path": "config/bolt/config.yaml",
"diff": "@@ -48,7 +48,7 @@ locale: nl_NL\n# The default template file can be found in /app/theme_defaults/ and overridden\n# with this option using your own theme.\n#\n-# Note: If youve changed the filename, and your changes do not show up on the\n+# Note: If you've changed the filename, and your changes do not show up on the\n# website, be sure to check for a config.yaml file in your themes folder.\n# If a template is set there, it will override the setting here.\nmaintenance_mode: false\n@@ -78,7 +78,7 @@ cron_hour: 3\n# records (like `entries`). In the chosen homepage_template, you will have\n# `record` or `records` at your disposal, depending on the homepage setting.\n#\n-# Note: If youve changed the filename, and your changes do not show up on\n+# Note: If you've changed the filename, and your changes do not show up on\n# the website, be sure to check for a theme.yml file in your themes\n# folder. If a template is set there, it will override the setting here.\nhomepage: homepage/1\n@@ -96,7 +96,7 @@ notfound: [ not-found.twig, block/404-not-found ]\n# Can be overridden for each content type and for each record, if it has a\n# templateselect field.\n#\n-# Note: If youve changed the filename, and your changes do not show up on the\n+# Note: If you've changed the filename, and your changes do not show up on the\n# website, be sure to check for a config.yaml file in your themes folder.\n# If a template is set there, it will override the setting here.\nrecord_template: record.twig\n@@ -111,11 +111,11 @@ record_template: record.twig\n# If you need sorting on those, make sure you display all the records on one\n# page.\n#\n-# Note 2: If youve changed the filename, and your changes do not show up on the\n+# Note 2: If you've changed the filename, and your changes do not show up on the\n# website, be sure to check for a config.yaml file in your themes\n# folder. If a template is set there, it will override the setting here.\nlisting_template: listing.twig\n-listing_records: 6\n+listing_records: 2\nlisting_sort: datepublish DESC\n# Because of limitations on how the underlying database queries work, there are\n@@ -126,7 +126,7 @@ taxonomy_sort: DESC\n# Template for showing the search results. If not defined, uses the settings for\n# listing_template and listing_records.\n#\n-# Note: If youve changed the filename, and your changes do not show up on the\n+# Note: If you've changed the filename, and your changes do not show up on the\n# website, be sure to check for a config.yaml file in your themes folder.\n# If a template is set there, it will override the setting here.\nsearch_results_template: search.twig\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/ContentEditController.php",
"new_path": "src/Controller/Backend/ContentEditController.php",
"diff": "@@ -284,21 +284,33 @@ class ContentEditController extends TwigAwareController implements BackendZone\nprivate function updateField(Content $content, string $fieldName, $value, ?string $locale): void\n{\n+ /** @var Field $field */\n+ $field = null;\n+\nif ($content->hasField($fieldName)) {\n$field = $content->getField($fieldName);\n- if ($field->getDefinition()->get('localize')) {\n- // load translated field\n- $field->setLocale($locale);\n- $this->em->refresh($field);\n}\n- } else {\n+\n+ // If the Field exists, but it has the wrong type, we'll remove the existing one.\n+ if (! $content->hasField($fieldName, true)) {\n+ $content->removeField($field);\n+ $this->em->remove($field);\n+ $this->em->flush();\n+ $field = null;\n+ }\n+\n+ // Perhaps create a new Field..\n+ if (! $field) {\n$fields = $content->getDefinition()->get('fields');\n$field = Field::factory($fields->get($fieldName), $fieldName);\n$field->setName($fieldName);\n+\n$content->addField($field);\n+ }\n+\nif ($field->getDefinition()->get('localize')) {\n$field->setLocale($locale);\n- }\n+ $this->em->refresh($field);\n}\n// If the value is an array that contains a string of JSON, parse it\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Entity/Content.php",
"new_path": "src/Entity/Content.php",
"diff": "@@ -357,9 +357,23 @@ class Content\nreturn $this->fields[$fieldName];\n}\n- public function hasField(string $fieldName): bool\n+ public function hasField(string $fieldName, $matchTypes = false): bool\n{\n- return isset($this->fields[$fieldName]);\n+ // If the field doesn't exist, we can bail here\n+ if (! isset($this->fields[$fieldName])) {\n+ return false;\n+ }\n+\n+ // If $matchTypes is `false`, we can state that we do have the field\n+ if (! $matchTypes) {\n+ return true;\n+ }\n+\n+ // Otherwise, we need to ensure the types are the same\n+ $fieldType = $this->fields[$fieldName]->getType();\n+ $definitionType = $this->contentTypeDefinition->get('fields')->get($fieldName)['type'] ?: 'undefined';\n+\n+ return $fieldType === $definitionType;\n}\npublic function hasFieldDefined(string $fieldName): bool\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Update Field if ContentType definition for a field changes
|
95,144 |
06.06.2019 16:19:11
| -7,200 |
9aa0ece6c3a58649600cabd82d17f7460dc66cfe
|
Some minor cleanup in templates / controllers
|
[
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/ClearCacheController.php",
"new_path": "src/Controller/Backend/ClearCacheController.php",
"diff": "@@ -47,6 +47,6 @@ class ClearCacheController extends AbstractController implements BackendZone\n'output' => $output->fetch(),\n];\n- return $this->render('clearcache/clearcache.html.twig', $twigvars);\n+ return $this->render('@bolt/pages/clearcache.html.twig', $twigvars);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/ContentLocalizationController.php",
"new_path": "src/Controller/Backend/ContentLocalizationController.php",
"diff": "@@ -23,7 +23,7 @@ class ContentLocalizationController extends TwigAwareController implements Backe\n{\n$content->getFields();\n- return $this->renderTemplate('content/view_locales.html.twig', [\n+ return $this->renderTemplate('@bolt/content/view_locales.html.twig', [\n'record' => $content,\n]);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/DashboardController.php",
"new_path": "src/Controller/Backend/DashboardController.php",
"diff": "@@ -24,7 +24,7 @@ class DashboardController extends TwigAwareController implements BackendZone\n/** @var Content $records */\n$records = $content->findLatest();\n- return $this->renderTemplate('@bolt/dashboard/dashboard.html.twig', [\n+ return $this->renderTemplate('@bolt/pages/dashboard.html.twig', [\n'records' => $records,\n]);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/FilemanagerController.php",
"new_path": "src/Controller/Backend/FilemanagerController.php",
"diff": "@@ -54,7 +54,7 @@ class FilemanagerController extends TwigAwareController implements BackendZone\n$parent = $path !== '/' ? Path::canonicalize($path . '/..') : '';\n- return $this->renderTemplate('finder/finder.html.twig', [\n+ return $this->renderTemplate('@bolt/finder/finder.html.twig', [\n'path' => $path,\n'name' => $location->getName(),\n'location' => $location->getKey(),\n"
},
{
"change_type": "RENAME",
"old_path": "src/Controller/Backend/EditMediaController.php",
"new_path": "src/Controller/Backend/MediaEditController.php",
"diff": "@@ -23,7 +23,7 @@ use Webmozart\\PathUtil\\Path;\n/**\n* @Security(\"has_role('ROLE_ADMIN')\")\n*/\n-class EditMediaController extends TwigAwareController implements BackendZone\n+class MediaEditController extends TwigAwareController implements BackendZone\n{\nuse CsrfTrait;\n@@ -63,7 +63,7 @@ class EditMediaController extends TwigAwareController implements BackendZone\n'media' => $media,\n];\n- return $this->renderTemplate('@bolt/editcontent/media_edit.html.twig', $context);\n+ return $this->renderTemplate('@bolt/media/edit.html.twig', $context);\n}\n/**\n"
},
{
"change_type": "DELETE",
"old_path": "src/Event/Subscriber/ControllerSubscriber.php",
"new_path": null,
"diff": "-<?php\n-\n-declare(strict_types=1);\n-\n-namespace Bolt\\Event\\Subscriber;\n-\n-use Bolt\\Twig\\SourceCodeExtension;\n-use Symfony\\Component\\EventDispatcher\\EventSubscriberInterface;\n-use Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent;\n-use Symfony\\Component\\HttpKernel\\KernelEvents;\n-\n-/**\n- * Defines the method that 'listens' to the 'kernel.controller' event, which is\n- * triggered whenever a controller is executed in the application.\n- *\n- * @author Ryan Weaver <weaverryan@gmail.com>\n- * @author Javier Eguiluz <javier.eguiluz@gmail.com>\n- */\n-class ControllerSubscriber implements EventSubscriberInterface\n-{\n- private $twigExtension;\n-\n- public function __construct(SourceCodeExtension $twigExtension)\n- {\n- $this->twigExtension = $twigExtension;\n- }\n-\n- public static function getSubscribedEvents(): array\n- {\n- return [\n- KernelEvents::CONTROLLER => 'registerCurrentController',\n- ];\n- }\n-\n- public function registerCurrentController(FilterControllerEvent $event): void\n- {\n- // this check is needed because in Symfony a request can perform any\n- // number of sub-requests. See\n- // https://symfony.com/doc/current/components/http_kernel/introduction.html#sub-requests\n- if ($event->isMasterRequest()) {\n- $this->twigExtension->setController($event->getController());\n- }\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "src/Twig/SourceCodeExtension.php",
"new_path": null,
"diff": "-<?php\n-\n-declare(strict_types=1);\n-\n-namespace Bolt\\Twig;\n-\n-use Twig\\Environment;\n-use Twig\\Extension\\AbstractExtension;\n-use Twig\\TemplateWrapper;\n-use Twig\\TwigFunction;\n-\n-/**\n- * CAUTION: this is an extremely advanced Twig extension. It's used to get the\n- * source code of the controller and the template used to render the current\n- * page. If you are starting with Symfony, don't look at this code and consider\n- * studying instead the code of the src/App/Twig/AppExtension.php extension.\n- *\n- * @author Ryan Weaver <weaverryan@gmail.com>\n- * @author Javier Eguiluz <javier.eguiluz@gmail.com>\n- */\n-class SourceCodeExtension extends AbstractExtension\n-{\n- private $controller;\n-\n- public function setController(?callable $controller): void\n- {\n- $this->controller = $controller;\n- }\n-\n- /**\n- * {@inheritdoc}\n- */\n- public function getFunctions(): array\n- {\n- return [\n- new TwigFunction('show_source_code', [$this, 'showSourceCode'], [\n- 'is_safe' => ['html'],\n- 'needs_environment' => true,\n- ]),\n- ];\n- }\n-\n- public function showSourceCode(Environment $twig, $template): string\n- {\n- return $twig->render('debug/source_code.html.twig', [\n- 'controller' => $this->getController(),\n- 'template' => $this->getTemplateSource($twig->resolveTemplate($template)),\n- ]);\n- }\n-\n- private function getController(): ?array\n- {\n- // this happens for example for exceptions (404 errors, etc.)\n- if ($this->controller === null) {\n- return null;\n- }\n-\n- $method = $this->getCallableReflector($this->controller);\n-\n- $classCode = file($method->getFileName());\n- $methodCode = \\array_slice($classCode, $method->getStartLine() - 1, $method->getEndLine() - $method->getStartLine() + 1);\n- $controllerCode = ' ' . $method->getDocComment() . \"\\n\" . implode('', $methodCode);\n-\n- return [\n- 'file_path' => $method->getFileName(),\n- 'starting_line' => $method->getStartLine(),\n- 'source_code' => $this->unindentCode($controllerCode),\n- ];\n- }\n-\n- /**\n- * Gets a reflector for a callable.\n- *\n- * This logic is copied from Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver::getArguments\n- */\n- private function getCallableReflector(callable $callable): \\ReflectionFunctionAbstract\n- {\n- if (\\is_array($callable)) {\n- return new \\ReflectionMethod($callable[0], $callable[1]);\n- }\n-\n- if (\\is_object($callable) && ! $callable instanceof \\Closure) {\n- $r = new \\ReflectionObject($callable);\n-\n- return $r->getMethod('__invoke');\n- }\n-\n- return new \\ReflectionFunction($callable);\n- }\n-\n- private function getTemplateSource(TemplateWrapper $template): array\n- {\n- $templateSource = $template->getSourceContext();\n-\n- return [\n- // Twig templates are not always stored in files (they can be stored\n- // in a database for example). However, for the needs of the Symfony\n- // Demo app, we consider that all templates are stored in files and\n- // that their file paths can be obtained through the source context.\n- 'file_path' => $templateSource->getPath(),\n- 'starting_line' => 1,\n- 'source_code' => $templateSource->getCode(),\n- ];\n- }\n-\n- /**\n- * Utility method that \"unindents\" the given $code when all its lines start\n- * with a tabulation of four white spaces.\n- */\n- private function unindentCode(string $code): string\n- {\n- $formattedCode = $code;\n- $codeLines = explode(\"\\n\", $code);\n-\n- $indentedLines = array_filter($codeLines, function ($lineOfCode) {\n- return $lineOfCode === '' || mb_strpos($lineOfCode, ' ') === 0;\n- });\n-\n- if (\\count($indentedLines) === \\count($codeLines)) {\n- $formattedCode = array_map(function ($lineOfCode) {\n- return mb_substr($lineOfCode, 4);\n- }, $codeLines);\n- $formattedCode = implode(\"\\n\", $formattedCode);\n- }\n-\n- return $formattedCode;\n- }\n-}\n"
},
{
"change_type": "DELETE",
"old_path": "templates/debug/source_code.html.twig",
"new_path": null,
"diff": "-<div class=\"section source-code\">\n- <p>\n- {{ 'help.show_code'|trans|raw }}\n- </p>\n-\n- <button type=\"button\" class=\"btn btn-default btn-lg btn-block\" data-toggle=\"modal\" data-target=\"#sourceCodeModal\">\n- <i class=\"fa fa-cogs\" aria-hidden=\"true\"></i> {{ 'action.show_code'|trans }}\n- </button>\n-\n- <div class=\"modal fade\" id=\"sourceCodeModal\" tabindex=\"-1\">\n- <div class=\"modal-dialog modal-lg\">\n- <div class=\"modal-content\">\n- <div class=\"modal-header\">\n- <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\">\n- <span aria-hidden=\"true\">×</span>\n- </button>\n- <h4 class=\"modal-title\"><i class=\"fa fa-code\" aria-hidden=\"true\"></i> {{ 'title.source_code'|trans }}</h4>\n- </div>\n-\n- <div class=\"modal-body\">\n- {% if controller %}\n- <h3><a href=\"https://symfony.com/doc/current/controller.html\" target=\"_blank\">{{ 'title.controller_code'|trans }}</a><small class=\"pull-right\">{{ controller.file_path|format_file(controller.starting_line) }}</small></h3>\n- <pre><code class=\"php\">{{ controller.source_code }}</code></pre>\n- {% else %}\n- <h3><a href=\"https://symfony.com/doc/current/controller.html\">{{ 'title.controller_code'|trans }}</a></h3>\n- <pre><code>{{ 'not_available'|trans }}</code></pre>\n- {% endif %}\n-\n- <h3><a href=\"https://symfony.com/doc/current/templating.html\" target=\"_blank\">{{ 'title.twig_template_code'|trans }}</a><small class=\"pull-right\">{{ template.file_path|format_file(template.starting_line) }}</small></h3>\n- <pre><code class=\"twig\">{{ template.source_code }}</code></pre>\n- </div>\n- </div>\n- </div>\n- </div>\n-</div>\n"
},
{
"change_type": "RENAME",
"old_path": "templates/editcontent/media_edit.html.twig",
"new_path": "templates/media/edit.html.twig",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "templates/clearcache/clearcache.html.twig",
"new_path": "templates/pages/clearcache.html.twig",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "templates/dashboard/dashboard.html.twig",
"new_path": "templates/pages/dashboard.html.twig",
"diff": ""
}
] |
PHP
|
MIT License
|
bolt/core
|
Some minor cleanup in templates / controllers
|
95,144 |
06.06.2019 16:49:51
| -7,200 |
b60b7c9ec167e1c5a67986376fb0641eec3e43b4
|
Don't need these for now.
|
[
{
"change_type": "DELETE",
"old_path": "templates/bundles/TwigBundle/Exception/error.html.twig",
"new_path": null,
"diff": "-{#\n- This template is used to render any error different from 403, 404 and 500.\n-\n- This is the simplest way to customize error pages in Symfony applications.\n- In case you need it, you can also hook into the internal exception handling\n- made by Symfony. This allows you to perform advanced tasks and even recover\n- your application from some errors.\n- See https://symfony.com/doc/current/cookbook/controller/error_pages.html\n-#}\n-{% extends '@bolt/_base/layout.html.twig' %}\n-\n-{% block body_id 'error' %}\n-\n-{% block main %}\n- <h1 class=\"text-danger\">{{ 'http_error.name'|trans({ '%status_code%': status_code }) }}</h1>\n-\n- <p class=\"lead\">\n- {{ 'http_error.description'|trans({ '%status_code%': status_code }) }}\n- </p>\n- <p>\n- {{ 'http_error.suggestion'|trans({ '%url%': path('homepage') })|raw }}\n- </p>\n-{% endblock %}\n-\n-{% block sidebar %}\n- {{ parent() }}\n-\n- {{ show_source_code(_self) }}\n-{% endblock %}\n"
},
{
"change_type": "DELETE",
"old_path": "templates/bundles/TwigBundle/Exception/error403.html.twig",
"new_path": null,
"diff": "-{#\n- This template is used to render errors of type HTTP 403 (Forbidden)\n-\n- This is the simplest way to customize error pages in Symfony applications.\n- In case you need it, you can also hook into the internal exception handling\n- made by Symfony. This allows you to perform advanced tasks and even recover\n- your application from some errors.\n- See https://symfony.com/doc/current/cookbook/controller/error_pages.html\n-#}\n-{% extends '@bolt/_base/layout.html.twig' %}\n-\n-{% block body_id 'error' %}\n-\n-{% block main %}\n- <h1 class=\"text-danger\"><i class=\"fa fa-unlock-alt\" aria-hidden=\"true\"></i> {{ 'http_error.name'|trans({ '%status_code%': 403 }) }}</h1>\n-\n- <p class=\"lead\">\n- {{ 'http_error_403.description'|trans }}\n- </p>\n- <p>\n- {{ 'http_error_403.suggestion'|trans }}\n- </p>\n-{% endblock %}\n-\n-{% block sidebar %}\n- {{ parent() }}\n-\n- {{ show_source_code(_self) }}\n-{% endblock %}\n"
},
{
"change_type": "DELETE",
"old_path": "templates/bundles/TwigBundle/Exception/error404.html.twig",
"new_path": null,
"diff": "-{#\n- This template is used to render errors of type HTTP 404 (Not Found)\n-\n- This is the simplest way to customize error pages in Symfony applications.\n- In case you need it, you can also hook into the internal exception handling\n- made by Symfony. This allows you to perform advanced tasks and even recover\n- your application from some errors.\n- See https://symfony.com/doc/current/cookbook/controller/error_pages.html\n-#}\n-{% extends '@bolt/_base/layout.html.twig' %}\n-\n-{% block body_id 'error' %}\n-\n-{% block main %}\n- <h1 class=\"text-danger\">{{ 'http_error.name'|trans({ '%status_code%': 404 }) }}</h1>\n-\n- <p class=\"lead\">\n- {{ 'http_error_404.description'|trans }}\n- </p>\n- <p>\n- {{ 'http_error_404.suggestion'|trans({ '%url%': path('homepage') })|raw }}\n- </p>\n-{% endblock %}\n-\n-{% block sidebar %}\n- {{ parent() }}\n-\n- {{ show_source_code(_self) }}\n-{% endblock %}\n"
},
{
"change_type": "DELETE",
"old_path": "templates/bundles/TwigBundle/Exception/error500.html.twig",
"new_path": null,
"diff": "-{#\n- This template is used to render errors of type HTTP 500 (Internal Server Error)\n-\n- This is the simplest way to customize error pages in Symfony applications.\n- In case you need it, you can also hook into the internal exception handling\n- made by Symfony. This allows you to perform advanced tasks and even recover\n- your application from some errors.\n- See https://symfony.com/doc/current/cookbook/controller/error_pages.html\n-#}\n-{% extends '@bolt/_base/layout.html.twig' %}\n-\n-{% block body_id 'error' %}\n-\n-{% block main %}\n- <h1 class=\"text-danger\">{{ 'http_error.name'|trans({ '%status_code%': 500 }) }}</h1>\n-\n- <p class=\"lead\">\n- {{ 'http_error_500.description'|trans }}\n- </p>\n- <p>\n- {{ 'http_error_500.suggestion'|trans({ '%url%': path('homepage') })|raw }}\n- </p>\n-{% endblock %}\n-\n-{% block sidebar %}\n- {{ parent() }}\n-\n- {{ show_source_code(_self) }}\n-{% endblock %}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Don't need these for now.
|
95,144 |
07.06.2019 14:15:09
| -7,200 |
ef63c93347194adf61057360cfd3baf81e3b3a34
|
Don't remove Fields that don't exist yet
|
[
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/ContentEditController.php",
"new_path": "src/Controller/Backend/ContentEditController.php",
"diff": "@@ -292,7 +292,7 @@ class ContentEditController extends TwigAwareController implements BackendZone\n}\n// If the Field exists, but it has the wrong type, we'll remove the existing one.\n- if (! $content->hasField($fieldName, true)) {\n+ if (($field !== null) && ! $content->hasField($fieldName, true)) {\n$content->removeField($field);\n$this->em->remove($field);\n$this->em->flush();\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Don't remove Fields that don't exist yet
|
95,144 |
08.06.2019 16:15:40
| -7,200 |
cc5abf109acd51a76a36482987710c0ec6355ea3
|
Use (local) Source Sans Variable instead of from Google Fonts
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "assets/scss/init/_fonts.scss",
"diff": "+@font-face{\n+ font-family: 'Source Sans Variable';\n+ font-weight: 200 900;\n+ font-style: normal;\n+ font-stretch: normal;\n+ src: url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Roman.ttf.woff2') format('woff2'),\n+ url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Roman.ttf.woff') format('woff'),\n+ url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Roman.ttf') format('truetype');\n+}\n+\n+@font-face{\n+ font-family: 'Source Sans Variable';\n+ font-weight: 200 900;\n+ font-style: italic;\n+ font-stretch: normal;\n+ src: url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Italic.ttf.woff2') format('woff2'),\n+ url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Italic.ttf.woff') format('woff'),\n+ url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Italic.ttf') format('truetype');\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/init/init.scss",
"new_path": "assets/scss/init/init.scss",
"diff": "@import '_variables';\n@import '_mixins';\n@import '_base';\n+@import '_fonts';\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/vendor/bootstrap/_overrides.scss",
"new_path": "assets/scss/vendor/bootstrap/_overrides.scss",
"diff": "// Typography\n$font-family-base: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n-$headings-font-family: 'Source Sans Pro', sans-serif;\n+$headings-font-family: 'Source Sans Variable', sans-serif;\n$font-size-base: 0.85rem;\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"popper.js\": \"^1.15.0\",\n\"register-service-worker\": \"^1.6.2\",\n\"simplemde\": \"^1.11.2\",\n+ \"source-sans-pro\": \"^2.45.0\",\n\"stylelint-config-recommended-scss\": \"^3.3.0\",\n\"stylelint-scss\": \"^3.8.0\",\n\"terser\": \"^4.0.0\",\n\"node-sass\": \"^4.12.0\",\n\"postcss-loader\": \"^3.0.0\",\n\"postcss-preset-env\": \"^6.6.0\",\n- \"prettier\": \"^1.17.1\",\n+ \"prettier\": \"^1.18.2\",\n\"regenerator-runtime\": \"^0.13.2\",\n\"sass-loader\": \"^7.1.0\",\n- \"stylelint\": \"^10.0.1\",\n+ \"stylelint\": \"^10.1.0\",\n\"stylelint-config-standard\": \"^18.3.0\",\n\"vue-jest\": \"^3.0.4\",\n\"vue-loader\": \"^15.7.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/_base/layout.html.twig",
"new_path": "templates/_base/layout.html.twig",
"diff": "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>{{ block('title')|striptags }}</title>\n{% block stylesheets %}\n- <link href=\"https://fonts.googleapis.com/css?family=Open+Sans:400,600|Source+Sans+Pro:300,400,600&subset=latin-ext\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.8.1/css/all.css\" integrity=\"sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf\" crossorigin=\"anonymous\">\n{% set theme = 'theme-' ~ user.backendTheme|default('default') %}\n{{ encore_entry_link_tags('bolt') }}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Use (local) Source Sans Variable instead of from Google Fonts
|
95,144 |
09.06.2019 11:17:48
| -7,200 |
c6094c7ea0fe5ccd4f98f9b4b83844f2aaa9a7b4
|
Add Font Awesome locally.
|
[
{
"change_type": "MODIFY",
"old_path": "assets/scss/init/init.scss",
"new_path": "assets/scss/init/init.scss",
"diff": "@import '_variables';\n@import '_mixins';\n@import '_base';\n+\n+// Source Sans Variable\n@import '_fonts';\n+\n+// Font Awesome\n+@import '../../node_modules/@fortawesome/fontawesome-free/css/all.css';\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"popper.js\": \"^1.15.0\",\n\"register-service-worker\": \"^1.6.2\",\n\"simplemde\": \"^1.11.2\",\n- \"source-sans-pro\": \"^2.45.0\",\n\"stylelint-config-recommended-scss\": \"^3.3.0\",\n\"stylelint-scss\": \"^3.8.0\",\n\"terser\": \"^4.0.0\",\n\"@babel/plugin-transform-runtime\": \"^7.4.4\",\n\"@babel/polyfill\": \"^7.4.4\",\n\"@babel/preset-env\": \"^7.4.5\",\n+ \"@fortawesome/fontawesome-free\": \"^5.9.0\",\n\"@symfony/webpack-encore\": \"^0.27.0\",\n\"@vue/test-utils\": \"^1.0.0-beta.29\",\n\"ajv-keywords\": \"^3.4.0\",\n\"prettier\": \"^1.18.2\",\n\"regenerator-runtime\": \"^0.13.2\",\n\"sass-loader\": \"^7.1.0\",\n+ \"source-sans-pro\": \"^2.45.0\",\n\"stylelint\": \"^10.1.0\",\n\"stylelint-config-standard\": \"^18.3.0\",\n\"vue-jest\": \"^3.0.4\",\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/_base/layout.html.twig",
"new_path": "templates/_base/layout.html.twig",
"diff": "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>{{ block('title')|striptags }}</title>\n{% block stylesheets %}\n- <link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.8.1/css/all.css\" integrity=\"sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf\" crossorigin=\"anonymous\">\n{% set theme = 'theme-' ~ user.backendTheme|default('default') %}\n{{ encore_entry_link_tags('bolt') }}\n{{ encore_entry_link_tags(theme) }}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Add Font Awesome locally.
|
95,144 |
09.06.2019 13:15:39
| -7,200 |
8cf9f0a4bdc65ffb7af870c9b3276b10f97bb412
|
Add Bootstrap's "Toast" notifications
|
[
{
"change_type": "DELETE",
"old_path": "assets/js/app/notifications/Components/Notification.vue",
"new_path": null,
"diff": "-<template>\n- <div class=\"admin__notification-message\">\n- <transition\n- name=\"notification\"\n- :duration=\"duration\"\n- @after-enter=\"show = false\"\n- >\n- <div\n- v-show=\"show\"\n- class=\"notification\"\n- :data-type=\"`is-${type}`\"\n- role=\"alert\"\n- >\n- <!-- eslint-disable-next-line vue/no-v-html -->\n- <div class=\"notification__message\" v-html=\"message\"></div>\n- <button\n- type=\"button\"\n- class=\"notification__close\"\n- aria-label=\"Close\"\n- @click=\"show = false\"\n- >\n- {{ closingLabel }}\n- </button>\n- </div>\n- </transition>\n- </div>\n-</template>\n-\n-<script>\n-import eventHub from '../eventhub';\n-\n-export default {\n- name: 'BoltNotification',\n-\n- props: {\n- message: {\n- type: String,\n- required: true,\n- default: '',\n- },\n- type: {\n- type: String,\n- required: true,\n- default: 'danger',\n- },\n- closingLabel: {\n- type: String,\n- required: true,\n- default: 'action.close_alert',\n- },\n- duration: {\n- type: String,\n- required: false,\n- default: '300',\n- },\n- },\n-\n- data: () => {\n- return {\n- show: false,\n- };\n- },\n-\n- mounted() {\n- this.show = true;\n- },\n-\n- created() {\n- const self = this;\n- eventHub.$on('showMessage', message => {\n- self.message = message.message;\n- self.type = message.type;\n- self.closingLabel = message.closingLabel;\n- self.duration = message.duration;\n- this.show = true;\n- });\n- },\n-};\n-</script>\n"
},
{
"change_type": "DELETE",
"old_path": "assets/js/app/notifications/eventhub.js",
"new_path": null,
"diff": "-import Vue from 'vue';\n-\n-export default new Vue();\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/js/app/notifications/index.js",
"new_path": "assets/js/app/notifications/index.js",
"diff": "-import Vue from 'vue';\n-import Notification from './Components/Notification';\n+import $ from 'jquery';\n-document.addEventListener('DOMContentLoaded', () => {\n- const notifications = Array.from(document.querySelectorAll('.notifications'));\n-\n- for (let notification of notifications) {\n- new Vue({\n- el: notification,\n- name: 'Notification',\n- components: {\n- Notification,\n- },\n-\n- data() {\n- const { dataset } = notification;\n- return {\n- type: dataset.type,\n- message: dataset.message,\n- label: dataset.closingLabel,\n- time: dataset.duration,\n- };\n- },\n-\n- render(createElement) {\n- return createElement('notification', {\n- props: {\n- type: this.type,\n- message: this.message,\n- closingLabel: this.label,\n- duration: this.time,\n- },\n- });\n- },\n- /*\n- Example for event-driven notifications\n- created() {\n- setTimeout(() => {\n- eventHub.$emit('showMessage', {\n- message: \"hello world\"\n- })\n- }, 4000)\n- }\n- */\n- });\n- }\n+$(document).ready(function() {\n+ $('.toast').toast('show');\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/base/_notification.scss",
"new_path": "assets/scss/modules/base/_notification.scss",
"diff": ".admin__notifications {\ndisplay: block;\n-webkit-backface-visibility: hidden;\n- z-index: 2000;\n+ z-index: $big-z-index + 100;\nposition: fixed;\n- bottom: $spacer * 2;\n+ bottom: $spacer * 3;\nright: $spacer * 2;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/listing/row/row.scss",
"new_path": "assets/scss/modules/listing/row/row.scss",
"diff": "@@ -8,7 +8,6 @@ $checkbox-row-width: 30px;\nborder-radius: $border-radius;\nmargin-bottom: $spacer / 1.25;\nmin-height: 50px;\n- z-index: 100;\ndisplay: flex;\nflex: auto;\njustify-content: space-between;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "assets/scss/vendor/bootstrap/_defaults.scss",
"diff": "+// Typography\n+$font-family-base: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n+$headings-font-family: 'Source Sans Variable', sans-serif;\n+\n+$font-size-base: 0.85rem;\n+\n+$font-weight-light: 300;\n+$font-weight-normal: 400;\n+$font-weight-semibold: 600;\n+$font-weight-bold: 700;\n+$headings-font-weight: 600;\n+\n+// Links\n+$link-color: var(--primary);\n+$link-hover-color: var(--primary-600);\n+\n+// Form controls\n+$border-radius: 0.15rem;\n+$component-active-bg: var(--primary);\n+$input-focus-border-color: var(--primary-400);\n+$custom-control-indicator-active-bg: var(--primary-400);\n+$custom-range-thumb-active-bg: var(--primary-400);\n+\n+$input-btn-focus-width: 0.15rem;\n+$input-btn-focus-box-shadow: 0 0 0 $input-btn-focus-width var(--primary-200);\n+\n+// Cards\n+$card-border-width: 0;\n+$card-border-radius: $border-radius;\n+$card-border-color: transparent;\n+$card-bg: var(--foreground);\n+\n+// Buttons\n+$btn-font-weight: 500;\n+\n+// Grid\n+$grid-breakpoints: (\n+ xs: 0,\n+ sm: 576px,\n+ md: 768px,\n+ lg: 992px,\n+ xl: 1200px\n+);\n+\n+// Modal Dialog spacing\n+$modal-dialog-margin-y-sm-up: 4rem;\n+\n+:root {\n+ @each $bp, $value in $grid-breakpoints {\n+ --breakpoint-#{$bp}: #{$value};\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/vendor/bootstrap/_overrides.scss",
"new_path": "assets/scss/vendor/bootstrap/_overrides.scss",
"diff": "-// Typography\n-$font-family-base: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n-$headings-font-family: 'Source Sans Variable', sans-serif;\n-\n-$font-size-base: 0.85rem;\n-\n-$font-weight-light: 300;\n-$font-weight-normal: 400;\n-$font-weight-semibold: 600;\n-$font-weight-bold: 700;\n-$headings-font-weight: 600;\n-\n-// Links\n-$link-color: var(--primary);\n-$link-hover-color: var(--primary-600);\n-\n-// Form controls\n-$border-radius: 0.15rem;\n-$component-active-bg: var(--primary);\n-$input-focus-border-color: var(--primary-400);\n-$custom-control-indicator-active-bg: var(--primary-400);\n-$custom-range-thumb-active-bg: var(--primary-400);\n-\n-$input-btn-focus-width: 0.15rem;\n-$input-btn-focus-box-shadow: 0 0 0 $input-btn-focus-width var(--primary-200);\n-\n-// Cards\n-$card-border-width: 0;\n-$card-border-radius: $border-radius;\n-$card-border-color: transparent;\n-$card-bg: var(--foreground);\n-\n-// Buttons\n-$btn-font-weight: 500;\n-\n-// Grid\n-$grid-breakpoints: (\n- xs: 0,\n- sm: 576px,\n- md: 768px,\n- lg: 992px,\n- xl: 1200px\n-);\n-\n-// Modal Dialog spacing\n-$modal-dialog-margin-y-sm-up: 4rem;\n-\n-:root {\n- @each $bp, $value in $grid-breakpoints {\n- --breakpoint-#{$bp}: #{$value};\n+@each $color, $value in $theme-colors {\n+ .alert-#{$color} {\n+ background-color: theme-color-level($color, $alert-bg-level) !important;\n+ //@include alert-variant(theme-color-level($color, $alert-bg-level), theme-color-level($color, $alert-border-level), theme-color-level($color, $alert-color-level));\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/vendor/bootstrap/bootstrap.scss",
"new_path": "assets/scss/vendor/bootstrap/bootstrap.scss",
"diff": "-//** Bootstrap\n+// Bolt Bootstrap defaults (see also overrides, below)\n+@import '_defaults.scss';\n-@import '_overrides.scss';\n+//** Bootstrap\n@import \"~bootstrap/scss/functions\";\n@import \"~bootstrap/scss/variables\";\n@import \"~bootstrap/scss/mixins\";\n@import \"~bootstrap/scss/progress\";\n@import \"~bootstrap/scss/nav\";\n@import \"~bootstrap/scss/tooltip\";\n+@import \"~bootstrap/scss/toasts\";\n@import \"~bootstrap/scss/utilities\";\n@import \"~bootstrap/scss/print\";\n+\n+// Bolt Bootstrap overrides\n+@import '_overrides.scss';\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/vendor/flatpickr/flatpickr.scss",
"new_path": "assets/scss/vendor/flatpickr/flatpickr.scss",
"diff": "&.open {\ndisplay: inline-block;\n- z-index: 99999;\n+ z-index: $big-z-index + 100;\n}\n&.animate.open {\ntop: calc(100% + 2px);\n&.open {\n- z-index: 999;\n+ z-index: $big-z-index;\ndisplay: block;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/_base/layout.html.twig",
"new_path": "templates/_base/layout.html.twig",
"diff": "{{ encore_entry_link_tags(theme) }}\n<link rel=\"icon\" type=\"image/png\" href=\"/favicon-32x32.png\" sizes=\"32x32\" />\n<link rel=\"icon\" type=\"image/png\" href=\"/favicon-16x16.png\" sizes=\"16x16\" />\n-\n{% endblock %}\n</head>\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/_partials/_flash_messages.html.twig",
"new_path": "templates/_partials/_flash_messages.html.twig",
"diff": "{% set labels = {'action.close_alert': 'action.close_alert'|trans } %}\n-\n{% for type, messages in app.flashes %}\n{% for message in messages %}\n- <div class=\"notifications\"\n- data-type=\"{{ type }}\"\n- data-message=\"{{ message|trans }}\"\n- data-closing-label=\"close\"\n- data-duration=\"3000\">\n+ <!-- Then put toasts within -->\n+ <div class=\"toast\" role=\"alert\" aria-live=\"assertive\" aria-atomic=\"true\" data-delay=\"50000\">\n+ <div class=\"alert-{{ type }} toast-header\">\n+ <strong class=\"mr-auto\">Notification </strong>\n+ <small>{{ type|trans }}</small>\n+ <button type=\"button\" class=\"ml-2 mb-1 close\" data-dismiss=\"toast\" aria-label=\"Close\">\n+ <span aria-hidden=\"true\">×</span>\n+ </button>\n+ </div>\n+ <div class=\"toast-body\">{{ message|trans|raw }}</div>\n</div>\n{% endfor %}\n{% endfor %}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Add Bootstrap's "Toast" notifications
|
95,144 |
09.06.2019 13:19:29
| -7,200 |
e10b34054ca76c8265270db766e1d9689264bd21
|
Remove old vue-notifications
|
[
{
"change_type": "DELETE",
"old_path": "assets/scss/modules/base/_notification.scss",
"new_path": null,
"diff": "-//** Base | Notification\n-.admin__notifications {\n- display: block;\n- -webkit-backface-visibility: hidden;\n- z-index: $big-z-index + 100;\n- position: fixed;\n- bottom: $spacer * 3;\n- right: $spacer * 2;\n-}\n-\n-.admin__notification-message {\n- display: flex !important;\n- align-items: center;\n-}\n-\n-.notification {\n- position: relative;\n- background: var(--body);\n- padding: $spacer $spacer;\n- margin-bottom: $spacer * 0.5;\n- border-radius: $border-radius;\n- box-shadow: $card-box-shadow;\n- color: var(--foreground);\n- font-weight: $font-weight-bold;\n-\n- & .notification__message {\n- float: left !important;\n- }\n-\n- &[data-type='is-success'] {\n- .notification__close {\n- color: var(--success);\n- }\n- }\n-\n- &[data-type='is-danger'] {\n- .notification__close {\n- color: var(--danger);\n- }\n- }\n-\n- p {\n- margin: 0;\n- flex: auto;\n- }\n-\n- &__close {\n- float: right !important;\n- background: transparent;\n- border: 0;\n- position: relative;\n- color: var(--foreground);\n- font-weight: $font-weight-bold;\n- right: -$spacer / 2;\n- letter-spacing: $letter-spacing;\n- text-transform: capitalize;\n-\n- &:focus {\n- outline: none;\n- }\n-\n- &:hover {\n- cursor: pointer;\n- }\n- }\n-}\n-\n-.notification-enter-active,\n-.notification-leave-active {\n- transition: all 0.35s;\n-}\n-\n-.notification-enter,\n-.notification-leave-to {\n- opacity: 0;\n- transform: translateY(40px);\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/base/base.scss",
"new_path": "assets/scss/modules/base/base.scss",
"diff": "@import '_status';\n@import '_pagination';\n-@import '_notification';\n@import '_badge';\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"vue\": \"^2.6.10\",\n\"vue-flatpickr-component\": \"^8.1.2\",\n\"vue-multiselect\": \"^2.1.6\",\n- \"vue-notification\": \"^1.3.16\",\n\"vue-simplemde\": \"^0.5.2\",\n\"vue-trumbowyg\": \"^3.4.2\",\n\"vuedraggable\": \"^2.21.0\",\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Remove old vue-notifications
|
95,144 |
09.06.2019 13:47:22
| -7,200 |
14b06a74d510f43295078e31e74feb163b6a5f0d
|
Remove test for non-existing component
|
[
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "@@ -64,7 +64,6 @@ e2e:\nfull-test:\nmake cscheck\nmake test\n- npm test\nmake behat\nmake e2e\n@@ -165,7 +164,6 @@ docker-full-test:\nmake docker-cache\nmake docker-cscheck\nmake docker-test\n- npm test\nmake docker-behat\nmake e2e\n"
},
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -141,11 +141,6 @@ To run PHP unit tests:\nmake test\n```\n-To run JS unit tests:\n-```\n-npm test\n-```\n-\nTo run E2E tests:\n```\nmake e2e\n"
},
{
"change_type": "DELETE",
"old_path": "tests/js/unit/notifications/components/Notification.spec.js",
"new_path": null,
"diff": "-import { mount } from '@vue/test-utils';\n-import Notification from '@/notifications/Components/Notification';\n-\n-describe('Notification', () => {\n- it('is a Vue instance', () => {\n- const wrapper = mount(Notification, {\n- propsData: {\n- message: 'Test-message',\n- type: 'danger',\n- closingLabel: 'close',\n- duration: '300',\n- },\n- });\n- expect(wrapper.isVueInstance()).toBeTruthy();\n- });\n- it('has a name called \"notification\"', () => {\n- const wrapper = mount(Notification, {\n- propsData: {\n- message: 'Test-message',\n- type: 'danger',\n- closingLabel: 'close',\n- duration: '300',\n- },\n- });\n- expect(wrapper.vm.$options.name).toBe('BoltNotification');\n- });\n-});\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Remove test for non-existing component
|
95,144 |
09.06.2019 15:02:34
| -7,200 |
a3e7e05ee5a5fafd66d5073f5f8ce6588575c1b0
|
Fix "records_per_page" configuration setting
|
[
{
"change_type": "MODIFY",
"old_path": "config/bolt/config.yaml",
"new_path": "config/bolt/config.yaml",
"diff": "@@ -134,7 +134,7 @@ search_results_records: 10\n# The default amount of records to show on overview pages. Can be overridden\n# for each content type.\n-recordsperpage: 10\n+records_per_page: 8\n# Settings for caching in parts of Bolt.\n# - config: Caches the parsed .yml files from /app/config. Its updated\n"
},
{
"change_type": "MODIFY",
"old_path": "config/bolt/contenttypes.yaml",
"new_path": "config/bolt/contenttypes.yaml",
"diff": "@@ -93,7 +93,6 @@ pages:\ntype: templateselect\nfilter: '*.twig'\ntaxonomy: [ groups ]\n- recordsperpage: 5\n# Entries can be used for things like 'news' or 'blogpostings'. They have a\n@@ -141,7 +140,7 @@ entries:\nlisting_records: 6\ndefault_status: published\nsort: -publishedAt\n- records_per_page: 3\n+ records_per_page: 10\nicon_many: \"fa:file-alt\"\nicon_one: \"fa:file-alt\"\n@@ -292,7 +291,6 @@ blocks:\nicon_many: \"fa:cubes\"\nicon_one: \"fa:cube\"\n-\n# This contenttype is here to use for (automated) tests.\ntests:\nname: Tests\n@@ -339,7 +337,6 @@ tests:\nlisting_template: listing.twig\nlisting_records: 10\n-\n# Possible field types:\n#\n# text - varchar(256) - input type text.\n@@ -398,7 +395,7 @@ tests:\n# extensions: [ gif, jpg, png ]\n# <<: *template_defaults\n# taxonomy: [ chapters ]\n-# recordsperpage: 10\n+# records_per_page: 10\n#\n# Alternatively, or additionally, you then can then create a ContentType with\n# default fields, and a 'select' field, and a different 'templateselect' option.\n@@ -414,4 +411,4 @@ tests:\n# type: templateselect\n# filter: '*_xyz.twig'\n# taxonomy: [ tags ]\n-# recordsperpage: 20\n+# records_per_page: 20\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/ContentOverviewController.php",
"new_path": "src/Controller/Backend/ContentOverviewController.php",
"diff": "@@ -25,7 +25,7 @@ class ContentOverviewController extends TwigAwareController implements BackendZo\n$contentType = ContentType::factory($contentType, $this->config->get('contenttypes'));\n$page = (int) $request->query->get('page', 1);\n- $amountPerPage = $contentType->get('listing_records');\n+ $amountPerPage = $contentType->get('records_per_page', 10);\n$records = $contentRepository->findForListing($page, $amountPerPage, $contentType, false);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Controller/Backend/DashboardController.php",
"new_path": "src/Controller/Backend/DashboardController.php",
"diff": "@@ -21,8 +21,10 @@ class DashboardController extends TwigAwareController implements BackendZone\n*/\npublic function index(ContentRepository $content): Response\n{\n+ $amount = $this->config->get('general/records_per_page', 10);\n+\n/** @var Content $records */\n- $records = $content->findLatest();\n+ $records = $content->findLatest(null, $amount);\nreturn $this->renderTemplate('@bolt/pages/dashboard.html.twig', [\n'records' => $records,\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Fix "records_per_page" configuration setting
|
95,144 |
09.06.2019 16:55:53
| -7,200 |
6b22ef7089202da4cde7f710d01409685c22cfab
|
Good catch, PHPStan.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Config.php",
"new_path": "src/Configuration/Config.php",
"diff": "@@ -144,7 +144,7 @@ class Config\n* For example:\n* $var = $config->get('general/wysiwyg/ck/contentsCss');\n*\n- * @param string|array|bool $default\n+ * @param string|array|bool|int $default\n*/\npublic function get(string $path, $default = null)\n{\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Good catch, PHPStan.
|
95,144 |
09.06.2019 16:56:28
| -7,200 |
e284c4c48f48c36ee0cd64b4871541d59399744f
|
Tweaking test.
|
[
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"new_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"diff": "@@ -114,7 +114,7 @@ class ContentTypesParserTest extends ParserTestBase\n$this->assertSame('bar', $config['foo']['singular_slug']);\n$this->assertSame('bar', $config['foo']['singular_slug']);\n$this->assertSame(6, $config['foo']['listing_records']);\n- $this->assertSame(10, $config['foo']['records_per_page']);\n+ $this->assertSame(8, $config['foo']['records_per_page']);\n$this->assertIsIterable($config['foo']['fields']);\n$this->assertIsIterable($config['foo']['locales']);\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Tweaking test.
|
95,144 |
10.06.2019 14:39:25
| -7,200 |
140c80e0dafe336b5646ab91db4a3a525308c739
|
Using local Codemirror and a few other things
|
[
{
"change_type": "MODIFY",
"old_path": "assets/js/bolt.js",
"new_path": "assets/js/bolt.js",
"diff": "@@ -13,6 +13,7 @@ import $ from 'jquery';\nwindow.jQuery = $;\nwindow.$ = $;\n+import './codemirror';\nimport './filters';\nimport './app';\nimport '../scss/bolt.scss';\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "assets/js/codemirror.js",
"diff": "+import Codemirror from 'codemirror';\n+\n+import 'codemirror/mode/javascript/javascript.js';\n+import 'codemirror/mode/yaml/yaml.js';\n+import 'codemirror/mode/htmlmixed/htmlmixed.js';\n+import 'codemirror/mode/php/php.js';\n+\n+window.CodeMirror = Codemirror;\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/layout/_admin.scss",
"new_path": "assets/scss/layout/_admin.scss",
"diff": "//** Layout | Admin\n+// Note: Override for \"Wide content\" is below\n+\n$admin-toolbar-height: 36px;\n$admin-sidebar-width: 200px;\n$admin-aside-width: 320px;\n@@ -104,3 +106,13 @@ $admin-header-height: 70px;\n}\n}\n}\n+\n+.widecontent {\n+\n+ .admin__body--container {\n+ display: grid;\n+ grid-template-columns: auto 0;\n+ grid-template-areas: \"main\";\n+ padding: $spacer * 2;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/admin/_header.scss",
"new_path": "assets/scss/modules/admin/_header.scss",
"diff": ".admin__header {\n&--title {\nfont-weight: $font-weight-normal;\n- font-size: $h2-font-size;\n+ font-size: $h1-font-size;\ni {\ncolor: var(--boltblue);\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/vendor/bootstrap/_defaults.scss",
"new_path": "assets/scss/vendor/bootstrap/_defaults.scss",
"diff": "@@ -4,6 +4,13 @@ $headings-font-family: 'Source Sans Variable', sans-serif;\n$font-size-base: 0.85rem;\n+$h1-font-size: $font-size-base * 2.5 !default;\n+$h2-font-size: $font-size-base * 2 !default;\n+$h3-font-size: $font-size-base * 1.75 !default;\n+$h4-font-size: $font-size-base * 1.5 !default;\n+$h5-font-size: $font-size-base * 1.25 !default;\n+$h6-font-size: $font-size-base !default;\n+\n$font-weight-light: 300;\n$font-weight-normal: 400;\n$font-weight-semibold: 600;\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "assets/scss/vendor/codemirror.scss",
"diff": "+@import '~codemirror/lib/codemirror.css';\n+\n+.CodeMirror.cm-s-default {\n+ border: 1px solid #DDD;\n+ border-radius: 4px;\n+ padding: 0;\n+ height: calc(100vh - 300px);\n+ line-height: 1.4rem;\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/vendor/vendor.scss",
"new_path": "assets/scss/vendor/vendor.scss",
"diff": "@import './flagkit/flagkit';\n@import './api-platform/api-platform';\n@import './simplemde/simplemde';\n+@import './codemirror';\n+\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/finder/editfile.html.twig",
"new_path": "templates/finder/editfile.html.twig",
"diff": "{% endblock %}\n-\n-{% block stylesheets %}\n-{{ parent() }}\n-<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/codemirror.min.css\">\n-<style>\n- .CodeMirror.cm-s-default {\n- border: 1px solid #DDD;\n- border-radius: 4px;\n- height: calc(100vh - 280px);\n- width: calc(100vw - 300px);\n- }\n-</style>\n-{% endblock %}\n-\n{% block javascripts %}\n{{ parent() }}\n-<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/codemirror.min.js\"></script>\n-<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/mode/yaml/yaml.min.js\"></script>\n-<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/mode/html/html.min.js\"></script>\n-<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/mode/htmlmixed/htmlmixed.min.js\"></script>\n-<script src=\"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.40.2/mode/php/php.min.js\"></script>\n<script>\nvar myCodeMirror = CodeMirror.fromTextArea(editfile_textarea,{\nlineNumbers: true,\nmode: 'yaml'\n});\n-\n</script>\n{% endblock %}\n\\ No newline at end of file\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Using local Codemirror and a few other things
|
95,144 |
13.06.2019 17:13:40
| -7,200 |
e28064b574a96c62ee9438cf1b5fd8dadc1983ba
|
Exclude api-platform 2.4.4, see
|
[
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"white-october/pagerfanta-bundle\": \"^1.2\"\n},\n\"conflict\": {\n- \"symfony/symfony\": \"*\"\n+ \"symfony/symfony\": \"*\",\n+ \"api-platform/core\": \"2.4.4\"\n},\n\"require-dev\": {\n\"ext-curl\": \"*\",\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Exclude api-platform 2.4.4, see #470
|
95,144 |
13.06.2019 15:52:57
| -7,200 |
47f99fbe756d02aa41622532c84e8cd44e28e18e
|
Use 'andWhere' instead of 'where'
|
[
{
"change_type": "MODIFY",
"old_path": "src/Storage/Query/SelectQuery.php",
"new_path": "src/Storage/Query/SelectQuery.php",
"diff": "@@ -207,7 +207,7 @@ class SelectQuery implements ContentQueryInterface\n{\n$query = $this->qb;\nif ($this->getWhereExpression()) {\n- $query->where($this->getWhereExpression());\n+ $query->andWhere($this->getWhereExpression());\n}\nforeach ($this->getWhereParameters() as $key => $param) {\n$query->setParameter($key, $param, ParameterTypeInferer::inferType($param));\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Use 'andWhere' instead of 'where'
|
95,144 |
18.06.2019 17:26:04
| -7,200 |
76cf85ccdb8a909ed6016b3c31d9a08442b5d0b9
|
Use wttr.in for weather instead
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -19,67 +19,26 @@ class WeatherWidget extends BaseWidget implements TwigAware, CacheAware, Stopwat\nprotected $priority = 200;\nprotected $template = '@bolt/widgets/weather.twig';\nprotected $zone = RequestZone::BACKEND;\n- protected $cacheDuration = 3600;\n-\n- /** @var string Open API key, don't use more than once per second */\n- public const KEY = '0acbdeea56dfafe244ac87707c5fdcb2';\n+ protected $cacheDuration = 0;\npublic function run(array $params = []): string\n{\n- $ip = $this->getIP();\n-\n- $location = $this->getLocation($ip);\n+// $location = $this->getLocation($ip);\n- $weather = $this->getWeather($location);\n+ $weather = $this->getWeather();\n- $context = [\n- 'location' => $location,\n- 'weather' => $weather,\n- ];\n+ $context = ['weather' => $weather];\nreturn parent::run($context);\n}\n- private function getIP(): string\n- {\n- try {\n- $client = new Client(['base_uri' => 'http://checkip.dyndns.com/']);\n- $dnsResponse = $client->request('GET', '/')->getBody()->getContents();\n- } catch (RequestException $e) {\n- $dnsResponse = 'Just assume we are at 127.0.0.1';\n- }\n-\n- preg_match('/(\\d{1,3}\\.){3}\\d{1,3}/', $dnsResponse, $matches);\n-\n- return $matches[0];\n- }\n-\n- private function getLocation(string $ip): array\n+ private function getWeather(): array\n{\n- try {\n- $client = new Client(['base_uri' => \"http://ipinfo.io/{$ip}\"]);\n- $details = json_decode($client->request('GET', '/')->getBody()->getContents(), true);\n- } catch (RequestException $e) {\n- $details = [];\n- }\n-\n- return $details;\n- }\n-\n- private function getWeather(array $location): array\n- {\n- [$lat, $lon] = explode(',', $location['loc']);\n-\n- $url = sprintf(\n- 'https://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&appid=%s&units=metric',\n- $lat,\n- $lon,\n- $this::KEY\n- );\n+ $url = 'wttr.in/?format=%c|%C|%h|%t|%w|%l|%m|%M|%p|%P';\ntry {\n$client = new Client();\n- $details = json_decode($client->request('GET', $url)->getBody()->getContents(), true);\n+ $details = explode('|', trim($client->request('GET', $url)->getBody()->getContents()));\n} catch (RequestException $e) {\n$details = [];\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/widgets/weather.twig",
"new_path": "templates/widgets/weather.twig",
"diff": "<div class=\"card mb-4\">\n<div class=\"image card-img-top\"\n- style=\"background-image: url(https://source.unsplash.com/400x240/?{{ location.city|url_encode }},{{ location.region|url_encode }},{{ location.country|url_encode }}); height: 200px; padding-top: 60px;\">\n+ style=\"background-image: url(https://source.unsplash.com/400x240/?{{ weather.5|url_encode }}); height: 200px; padding-top: 60px;\">\n<center style='text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6); color: #FFF;'>\n- <span style=\"font-size: 125%;\">{{ weather.weather|first['description']|capitalize }} in {{ weather.name }}, {{ location.country }}</span><br>\n- <span style=\"font-size: 200%;\">\n- <img src='http://openweathermap.org/img/w/{{ weather.weather|first['icon'] }}.png'>\n- {{ weather.main.temp|number_format(1) }} ° C</span><br>\n+ <span style=\"font-size: 200%;\">{{ weather.0 }} {{ weather.1 }} {{ weather.3 }}</span><br>\n+ <span style=\"font-size: 100%; margin-top: 0.5rem;\">\n+ {{ weather.5 }}<br>\n+ {{ weather.6 }} / {{ weather.8 }} / {{ weather.2 }} / {{ weather.9 }}\n+ </span>\n</center>\n</div>\n<div class=\"card-body\">\n<a>\n<i class=\"fa fa-socks\"></i>\n- Current weather, by OpenWeatherMap\n+ Current weather by Wttr.in\n</a>\n</div>\n</div>\n\\ No newline at end of file\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Use wttr.in for weather instead
|
95,144 |
18.06.2019 17:28:00
| -7,200 |
e652daad443c17d5915243bc633ebb484a4a9aa7
|
Still cache it, though
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -19,7 +19,7 @@ class WeatherWidget extends BaseWidget implements TwigAware, CacheAware, Stopwat\nprotected $priority = 200;\nprotected $template = '@bolt/widgets/weather.twig';\nprotected $zone = RequestZone::BACKEND;\n- protected $cacheDuration = 0;\n+ protected $cacheDuration = 3600;\npublic function run(array $params = []): string\n{\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Still cache it, though
|
95,144 |
19.06.2019 10:11:55
| -7,200 |
997c6da9b8e3656edd25fc136c346f832cc99171
|
Allow widgets to return `null` if they fail, and the results shouldn't be cached.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/BaseWidget.php",
"new_path": "src/Widget/BaseWidget.php",
"diff": "@@ -87,7 +87,7 @@ abstract class BaseWidget implements WidgetInterface\n* Method to 'invoke' the widget. Simple wrapper around the 'run' method,\n* which can be overridden in a custom Widget or trait\n*/\n- public function __invoke(array $params = []): string\n+ public function __invoke(array $params = []): ?string\n{\nreturn $this->run($params);\n}\n@@ -96,7 +96,7 @@ abstract class BaseWidget implements WidgetInterface\n* Actual method that 'runs' the widget and returns the output. For reasons\n* of extensibility: Do not call directly, but call `$widget()` to invoke.\n*/\n- protected function run(array $params = []): string\n+ protected function run(array $params = []): ?string\n{\nif (array_key_exists('template', $params)) {\n$this->setTemplate($params['template']);\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/BoltHeaderWidget.php",
"new_path": "src/Widget/BoltHeaderWidget.php",
"diff": "@@ -11,11 +11,11 @@ class BoltHeaderWidget implements WidgetInterface, ResponseAware\n{\nuse ResponseTrait;\n- public function __invoke(array $params = []): string\n+ public function __invoke(array $params = []): ?string\n{\n$this->getResponse()->headers->set('X-Powered-By', 'Bolt', false);\n- return '';\n+ return null;\n}\npublic function getName(): string\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/CacheTrait.php",
"new_path": "src/Widget/CacheTrait.php",
"diff": "@@ -21,7 +21,7 @@ trait CacheTrait\n$this->key = $this->createKey();\n}\n- public function __invoke(array $params = []): string\n+ public function __invoke(array $params = []): ?string\n{\nif (! $this->cache instanceof CacheInterface) {\nthrow new WidgetException('Widget of class ' . self::class . ' is not initialised properly. Make sure the Widget `implements CacheAware`.');\n@@ -33,7 +33,9 @@ trait CacheTrait\n$output = $this->run($params);\n+ if ($output !== null) {\n$this->setToCache($output);\n+ }\nreturn $output;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -24,7 +24,7 @@ class NewsWidget extends BaseWidget implements TwigAware, RequestAware, CacheAwa\nprotected $zone = RequestZone::BACKEND;\nprotected $cacheDuration = 3600;\n- protected function run(array $params = []): string\n+ protected function run(array $params = []): ?string\n{\n$news = $this->getNews();\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/SnippetWidget.php",
"new_path": "src/Widget/SnippetWidget.php",
"diff": "@@ -27,7 +27,7 @@ class SnippetWidget extends BaseWidget\n$this->zone = $zone;\n}\n- protected function run(array $params = []): string\n+ protected function run(array $params = []): ?string\n{\nreturn $this->getTemplate();\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -19,13 +19,17 @@ class WeatherWidget extends BaseWidget implements TwigAware, CacheAware, Stopwat\nprotected $priority = 200;\nprotected $template = '@bolt/widgets/weather.twig';\nprotected $zone = RequestZone::BACKEND;\n- protected $cacheDuration = 3600;\n+ protected $cacheDuration = 1800;\n- public function run(array $params = []): string\n+ public function run(array $params = []): ?string\n{\n- $context = ['weather' => $this->getWeather()];\n+ $weather = $this->getWeather();\n- return parent::run($context);\n+ if (empty($weather)) {\n+ return null;\n+ }\n+\n+ return parent::run(['weather' => $weather]);\n}\nprivate function getWeather(): array\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widget/WidgetInterface.php",
"new_path": "src/Widget/WidgetInterface.php",
"diff": "@@ -23,5 +23,5 @@ interface WidgetInterface\n*/\npublic function getZone(): string;\n- public function __invoke(array $params = []): string;\n+ public function __invoke(array $params = []): ?string;\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Widgets.php",
"new_path": "src/Widgets.php",
"diff": "@@ -94,7 +94,7 @@ class Widgets\nreturn $output;\n}\n- private function invokeWidget(WidgetInterface $widget, array $params = []): string\n+ private function invokeWidget(WidgetInterface $widget, array $params = []): ?string\n{\nif ($widget instanceof StopwatchAware) {\n$widget->startStopwatch($this->stopwatch);\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/widgets/weather.twig",
"new_path": "templates/widgets/weather.twig",
"diff": "<div class=\"image card-img-top\"\nstyle=\"background-image: url(https://source.unsplash.com/400x240/?{{ weather.5|url_encode }}); height: 200px; padding-top: 60px;\">\n<center style='text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.6); color: #FFF;'>\n- <span style=\"font-size: 200%;\">{{ weather.0 }} {{ weather.1 }} {{ weather.3 }}</span><br>\n- <span style=\"font-size: 100%; margin-top: 0.5rem;\">\n+ <span style=\"font-size: 175%; line-height: 1.75rem;\">{{ weather.0 }} {{ weather.1 }} {{ weather.3 }}</span><br>\n+ <span style=\"font-size: 100%;\">\n{{ weather.5 }}<br>\n{{ weather.6 }} / {{ weather.8 }} / {{ weather.2 }} / {{ weather.9 }}\n</span>\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Allow widgets to return `null` if they fail, and the results shouldn't be cached.
|
95,144 |
19.06.2019 16:30:53
| -7,200 |
227ae6d57cdb4e5fb07b567d7eeb2132c53d7580
|
Update _fonts.scss
|
[
{
"change_type": "MODIFY",
"old_path": "assets/scss/init/_fonts.scss",
"new_path": "assets/scss/init/_fonts.scss",
"diff": "font-weight: 200 900;\nfont-style: normal;\nfont-stretch: normal;\n- src: url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Roman.ttf.woff2') format('woff2'),\n- url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Roman.ttf.woff') format('woff'),\n- url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Roman.ttf') format('truetype');\n+ src: url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Roman.ttf.woff2') format('woff2');\n}\n@font-face{\nfont-weight: 200 900;\nfont-style: italic;\nfont-stretch: normal;\n- src: url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Italic.ttf.woff2') format('woff2'),\n- url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Italic.ttf.woff') format('woff'),\n- url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Italic.ttf') format('truetype');\n+ src: url('../../../node_modules/source-sans-pro/VAR/SourceSansVariable-Italic.ttf.woff2') format('woff2');\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Update _fonts.scss
|
95,144 |
21.06.2019 08:35:37
| -7,200 |
8ea1d4d55d3cac672c8ac9a6ee776056f8e459a9
|
Return error when News couldn't be fetched
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/NewsWidget.php",
"new_path": "src/Widget/NewsWidget.php",
"diff": "@@ -28,14 +28,18 @@ class NewsWidget extends BaseWidget implements TwigAware, RequestAware, CacheAwa\n{\n$news = $this->getNews();\n+ if (isset($news['information'])) {\n$currentItem = $news['information'];\n+ } else {\n+ $currentItem = $news['error'];\n+ }\n$context = [\n'title' => $currentItem['title'],\n'news' => $currentItem['teaser'],\n'link' => $currentItem['link'],\n'datechanged' => $currentItem['datechanged'],\n- 'datefetched' => '2019-04-04 07:25:00',\n+ 'datefetched' => date('Y-m-d H:i:s'),\n];\nreturn parent::run($context);\n@@ -60,6 +64,8 @@ class NewsWidget extends BaseWidget implements TwigAware, RequestAware, CacheAwa\n'type' => 'error',\n'title' => 'Unable to fetch news!',\n'teaser' => \"<p>Unable to connect to ${source}</p>\",\n+ 'link' => null,\n+ 'datechanged' => '0000-01-01 00:00:00'\n],\n];\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Return error when News couldn't be fetched
|
95,187 |
21.06.2019 14:30:02
| -7,200 |
e30e14c22b3dd48dd70fbe6d74ef3c92903a0ae2
|
Rewrite button macros
|
[
{
"change_type": "MODIFY",
"old_path": "templates/_macro/_macro.html.twig",
"new_path": "templates/_macro/_macro.html.twig",
"diff": "{# Button Macro #}\n-{% macro button(label, icon, class, type, form) %}{% spaceless %}\n+{% macro button(label, icon, class, attr) %}{% spaceless %}\n{% set label = label|default('button')|trans %}\n{% set icon = icon|replace({'fa-': ''})|default('question-circle') %}\n{% set class = class|replace({'btn-': ''})|default('info') %}\n- {% set type = type|default('submit') %}\n- {% set form = form|default('') %}\n+ {% set attr = attr|default([]) %}\n- <button type=\"{{ type }}\" class=\"btn btn-{{ class }} mb-3\" {% if form %}form=\"{{ form }}\"{% endif %}>\n+ <button class=\"btn btn-{{ class }} mb-3\"\n+ {% for key,value in attr %} {{ key }}=\"{{value}}\"{% endfor %}>\n<i class=\"fas fa-{{ icon }} mr-2\"></i>\n{{- label -}}\n</button>\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/content/_buttons.html.twig",
"new_path": "templates/content/_buttons.html.twig",
"diff": "{% if record.id %}\n \n- <button type=\"submit\" class=\"btn btn-primary mb-3\" form=\"editcontent\"\n- formaction=\"{{ path('bolt_content_edit_preview', {'id': record.id }) }}\" formtarget=\"_blank\">\n- <i class=\"fas fa-external-link-square-alt mr-2\"></i>\n- {{ 'action.preview'|trans }}\n- </button>\n+ {# same button in macro. Not sure this will make anyone happy.. #}\n+ {{ macro.button('action.preview', 'fa-external-link-square-alt', 'primary', {'type': 'submit', 'form': 'editcontent', 'formtarget': '_blank', 'formaction': path('bolt_content_edit_preview', {'id': record.id }) }) }}\n{% if record.status == \"published\" %}\n<button type=\"button\" class=\"btn btn-primary dropdown-toggle dropdown-toggle-split mb-3\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/pages/placeholder.html.twig",
"new_path": "templates/pages/placeholder.html.twig",
"diff": "<section class=\"buttons\">\n<h1>Buttons</h1>\n- {{ macro.button('action.save', 'fa-save', 'primary', 'button', '') }}\n- {{ macro.button('action.save', 'fa-save', 'secondary', 'button', '') }}\n- {{ macro.button('action.save', 'fa-save', 'tertiary', 'button', '') }}\n- {{ macro.button('action.save', 'fa-save', 'success', 'button', '') }}\n- {{ macro.button('action.save', 'fa-save', 'danger', 'button', '') }}\n- {{ macro.button('action.save', 'fa-save', 'warning', 'button', '') }}\n- {{ macro.button('action.save', 'fa-save', 'info', 'button', '') }}\n- {{ macro.button('action.save', 'fa-save', 'light', 'button', '') }}\n- {{ macro.button('action.save', 'fa-save', 'dark', 'button', '') }}\n- {{ macro.button('action.save', 'fa-save', 'link', 'button', '') }}\n+ {{ macro.button('action.save', 'fa-save', 'primary', {'type': 'button'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'secondary', {'type': 'button'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'tertiary', {'type': 'button'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'success', {'type': 'button'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'danger', {'type': 'button'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'warning', {'type': 'button'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'light', {'type': 'button'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'link', {'type': 'button'}) }}\n<hr>\n+ <h2>Disabled buttons </h2>\n+ {{ macro.button('action.save', 'fa-save', 'primary', {disabled : 'disabled'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'secondary', {disabled : 'disabled'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'tertiary', {disabled : 'disabled'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'success', {disabled : 'disabled'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'danger', {disabled : 'disabled'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'warning', {disabled : 'disabled'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'light', {disabled : 'disabled'}) }}\n+ {{ macro.button('action.save', 'fa-save', 'link', {disabled : 'disabled'}) }}\n+\n</section>\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Rewrite button macros
|
95,144 |
21.06.2019 15:07:20
| -7,200 |
98dc5b3cb0d83ef38c60eac598124cf275252fbd
|
Correctly get first element from a select element.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Entity/Field/SelectField.php",
"new_path": "src/Entity/Field/SelectField.php",
"diff": "@@ -21,10 +21,10 @@ class SelectField extends Field implements FieldInterface\npublic function getValue(): ?array\n{\nif (empty($this->value)) {\n- $options = (array) $this->getDefinition()->get('values');\n+ $options = $this->getDefinition()->get('values');\n- // Pick the first key from array, or the full value as string, like `entries/id,title`\n- $this->value = [key($options)];\n+ // Pick the first key from Collection, or the full value as string, like `entries/id,title`\n+ $this->value = [$options->keys()->first()];\n}\nreturn $this->value;\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Correctly get first element from a select element.
|
95,144 |
21.06.2019 15:42:47
| -7,200 |
1fe95466bf7998047271ea23d546d6d5c1bf9cf7
|
Don't include easy-log-handler
|
[
{
"change_type": "MODIFY",
"old_path": "composer.json",
"new_path": "composer.json",
"diff": "\"doctrine/doctrine-bundle\": \"^1.11\",\n\"doctrine/doctrine-cache-bundle\": \"^1.3.1\",\n\"doctrine/orm\": \"^2.6\",\n- \"easycorp/easy-log-handler\": \"^1.0.7\",\n\"embed/embed\": \"^3.3\",\n\"erusev/parsedown\": \"^1.7\",\n\"ezyang/htmlpurifier\": \"^4.10\",\n"
},
{
"change_type": "DELETE",
"old_path": "config/packages/dev/easy_log_handler.yaml",
"new_path": null,
"diff": "-services:\n- EasyCorp\\EasyLog\\EasyLogHandler:\n- public: false\n- arguments: ['%kernel.logs_dir%/%kernel.environment%.log']\n-\n-#// FIXME: How to add this configuration automatically without messing up with the monolog configuration?\n-#monolog:\n-# handlers:\n-# buffered:\n-# type: buffer\n-# handler: easylog\n-# channels: ['!event']\n-# level: debug\n-# easylog:\n-# type: service\n-# id: EasyCorp\\EasyLog\\EasyLogHandler\n"
},
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "},\n\"minimist\": {\n\"version\": \"1.2.0\",\n- \"resolved\": \"http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n\"integrity\": \"sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=\",\n\"dev\": true\n},\n},\n\"@types/strip-bom\": {\n\"version\": \"3.0.0\",\n- \"resolved\": \"http://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz\",\n\"integrity\": \"sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I=\",\n\"dev\": true\n},\n}\n},\n\"electron-to-chromium\": {\n- \"version\": \"1.3.165\",\n- \"resolved\": \"https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.165.tgz\",\n- \"integrity\": \"sha512-iIS8axR524EAnvUtWUNnREnYjQrS0zUvutIKYgTVuN3MzcjrV31EuJYKw7DGOtFO9DQw+JiXeaVDPQWMskG1wQ==\"\n+ \"version\": \"1.3.166\",\n+ \"resolved\": \"https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.166.tgz\",\n+ \"integrity\": \"sha512-7XwtJz81H/PBnkmQ/07oVPOGTkBZs6ibZN8OqXNUrxjRPzR0Xj+MFcMmRZEXGilEg1Pm+97V8BZVI63qnBX1hQ==\"\n},\n\"express\": {\n\"version\": \"4.17.1\",\n},\n\"array-equal\": {\n\"version\": \"1.0.0\",\n- \"resolved\": \"http://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz\",\n\"integrity\": \"sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=\",\n\"dev\": true\n},\n},\n\"babel-plugin-syntax-object-rest-spread\": {\n\"version\": \"6.13.0\",\n- \"resolved\": \"http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz\",\n\"integrity\": \"sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=\",\n\"dev\": true\n},\n\"integrity\": \"sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=\"\n},\n\"codemirror\": {\n- \"version\": \"5.47.0\",\n- \"resolved\": \"https://registry.npmjs.org/codemirror/-/codemirror-5.47.0.tgz\",\n- \"integrity\": \"sha512-kV49Fr+NGFHFc/Imsx6g180hSlkGhuHxTSDDmDHOuyln0MQYFLixDY4+bFkBVeCEiepYfDimAF/e++9jPJk4QA==\"\n+ \"version\": \"5.48.0\",\n+ \"resolved\": \"https://registry.npmjs.org/codemirror/-/codemirror-5.48.0.tgz\",\n+ \"integrity\": \"sha512-3Ter+tYtRlTNtxtYdYNPxGxBL/b3cMcvPdPm70gvmcOO2Rauv/fUEewWa0tT596Hosv6ea2mtpx28OXBy1mQCg==\"\n},\n\"codemirror-spell-checker\": {\n\"version\": \"1.1.2\",\n},\n\"load-json-file\": {\n\"version\": \"1.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz\",\n\"integrity\": \"sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=\",\n\"dev\": true,\n\"requires\": {\n},\n\"minimist\": {\n\"version\": \"1.2.0\",\n- \"resolved\": \"https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n\"integrity\": \"sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=\",\n\"dev\": true\n},\n\"dependencies\": {\n\"semver\": {\n\"version\": \"5.3.0\",\n- \"resolved\": \"https://registry.npmjs.org/semver/-/semver-5.3.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/semver/-/semver-5.3.0.tgz\",\n\"integrity\": \"sha1-myzl094C0XxgEq0yaqa00M9U+U8=\",\n\"dev\": true\n}\n},\n\"js-yaml\": {\n\"version\": \"3.12.0\",\n- \"resolved\": \"\",\n+ \"resolved\": \"https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz\",\n+ \"integrity\": \"sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==\",\n\"requires\": {\n\"argparse\": \"^1.0.7\",\n\"esprima\": \"^4.0.0\"\n\"dependencies\": {\n\"minimist\": {\n\"version\": \"1.2.0\",\n- \"resolved\": \"http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n\"integrity\": \"sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=\",\n\"dev\": true\n}\n},\n\"load-json-file\": {\n\"version\": \"1.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz\",\n\"integrity\": \"sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=\",\n\"dev\": true,\n\"requires\": {\n},\n\"os-locale\": {\n\"version\": \"1.4.0\",\n- \"resolved\": \"https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz\",\n\"integrity\": \"sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=\",\n\"dev\": true,\n\"requires\": {\n},\n\"through\": {\n\"version\": \"2.3.8\",\n- \"resolved\": \"http://registry.npmjs.org/through/-/through-2.3.8.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/through/-/through-2.3.8.tgz\",\n\"integrity\": \"sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=\",\n\"dev\": true\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"baguettebox.js\": \"^1.11.0\",\n\"bootbox\": \"^5.1.3\",\n\"bootstrap\": \"^4.3.1\",\n- \"codemirror\": \"^5.47.0\",\n+ \"codemirror\": \"^5.48.0\",\n\"flagpack\": \"^1.0.3\",\n\"jquery\": \"^3.4.1\",\n\"luxon\": \"^1.16.0\",\n"
},
{
"change_type": "MODIFY",
"old_path": "symfony.lock",
"new_path": "symfony.lock",
"diff": "\"doctrine/reflection\": {\n\"version\": \"v1.0.0\"\n},\n- \"easycorp/easy-log-handler\": {\n- \"version\": \"1.0\",\n- \"recipe\": {\n- \"repo\": \"github.com/symfony/recipes\",\n- \"branch\": \"master\",\n- \"version\": \"1.0\",\n- \"ref\": \"70062abc2cd58794d2a90274502f81b55cd9951b\"\n- }\n- },\n\"egulias/email-validator\": {\n\"version\": \"2.1.2\"\n},\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Don't include easy-log-handler
|
95,144 |
22.06.2019 12:42:31
| -7,200 |
28d7a794a03da1445ac8fbb0636a0ff6f4df18e0
|
Add HTML Sanitiser for fields
|
[
{
"change_type": "MODIFY",
"old_path": "config/bolt/contenttypes.yaml",
"new_path": "config/bolt/contenttypes.yaml",
"diff": "@@ -85,7 +85,7 @@ pages:\ncontent:\ntype: html\nheight: 300px\n- allowtwig: true\n+ allow_twig: true\ncheckbox:\ntype: checkbox\nlabel: \"This is a checkbox\"\n"
},
{
"change_type": "MODIFY",
"old_path": "public/theme/skeleton/partials/_sub_field_blocks.twig",
"new_path": "public/theme/skeleton/partials/_sub_field_blocks.twig",
"diff": "{# Sub-block for 'text' field such as 'text', 'textarea', or 'html' #}\n{% block text_field %}\n- <div data-bolt-field=\"{{ value.name }}\">\n+ <div data-bolt-field=\"{{ field.name }}\">\n{%- autoescape false -%}\n- {# If 'allowtwig' is true for this field, we'll need to parse it as Twig here. #}\n- {#{% if allowtwig %}#}\n- {#{{ include(template_from_string(value)) }}#}\n- {#{% else %}#}\n- {{ value }}\n- {#{% endif -%}#}\n+ {{ field.twigValue() }}\n{%- endautoescape -%}\n</div>\n{% endblock %}\n{# Sub-block for Markdown fields #}\n{% block markdown_field %}\n- <div data-bolt-field=\"{{ value.name }}\">\n- {{ value|markdown }}\n+ <div data-bolt-field=\"{{ field.name }}\">\n+ {{ field.twigValue() }}\n</div>\n{% endblock %}\n{# Sub-block for 'imagelist' fields #}\n{% block imagelist_field %}\n<div class=\"bolt-imagelist\">\n- {% for image in value %}\n+ {% for image in field %}\n<div class=\"bolt-imageholder\">\n{{ popup(image.filename, 200, 0) }}\n</div>\n{% block common_fields %}\n{# HTML, Textarea, Text fields #}\n- {% if fieldtype in ['html', 'textarea', 'text'] %}\n- {% set tag = (value.name in ['title', 'name', 'caption', 'subject', 'heading']) ? 'h3' : 'p' %}\n+ {% if type in ['html', 'textarea', 'text'] %}\n+ {% set tag = (field.name in ['title', 'name', 'caption', 'subject', 'heading']) ? 'h3' : 'p' %}\n<{{tag}}>{{ block('text_field') }}</{{tag}}>\n{% endif %}\n{# Markdown fields #}\n- {% if fieldtype == 'markdown' %}\n+ {% if type == 'markdown' %}\n{{ block('markdown_field') }}\n{% endif %}\n{# Image fields #}\n- {% if fieldtype == \"image\" and value is not empty %}\n- {{ value|showimage('684') }}\n+ {% if type == \"image\" and field is not empty %}\n+ {{ field|showimage('684') }}\n{% endif %}\n{# Video fields #}\n- {% if fieldtype == \"video\" and value.responsive|default is not empty %}\n- <div class=\"flex-video {{ value.ratio|default(1) > 1.5 ? 'widescreen' }}\">\n- {{ value.responsive }}\n+ {% if type == \"video\" and field.responsive|default is not empty %}\n+ <div class=\"flex-video {{ field.ratio|default(1) > 1.5 ? 'widescreen' }}\">\n+ {{ field.responsive }}\n</div>\n{% endif %}\n{% block extended_fields %}\n{# Geolocation field #}\n- {% if fieldtype == \"geolocation\" and value.latitude|default is not empty %}\n- <img src=\"http://maps.googleapis.com/maps/api/staticmap?center={{ value.latitude }},{{ value.longitude }}&zoom=14&size=617x300&sensor=false&markers={{ value.latitude }},{{ value.longitude }}\">\n+ {% if type == \"geolocation\" and field.latitude|default is not empty %}\n+ <img src=\"http://maps.googleapis.com/maps/api/staticmap?center={{ field.latitude }},{{ field.longitude }}&zoom=14&size=617x300&sensor=false&markers={{ field.latitude }},{{ field.longitude }}\">\n{% endif %}\n- {# Special case for 'select' fields: if it's a multiple select, the value is an array. #}\n- {% if fieldtype == \"select\" and value is not empty %}\n- <p><strong>{{ value.definition.label|default(value.name) }}: </strong>\n- {{ dump(value) }}\n+ {# Special case for 'select' fields: if it's a multiple select, the field is an array. #}\n+ {% if type == \"select\" and field is not empty %}\n+ <p><strong>{{ field.definition.label|default(field.name) }}: </strong>\n+ {{ dump(field) }}\n</p>\n{% endif %}\n{# Checkbox fields #}\n- {% if fieldtype == \"checkbox\" %}\n- <p><strong>{{ value.definition.label|default(value.name) }}</strong>: {{ value ? \"checked\" : \"not checked\" }}</p>\n+ {% if type == \"checkbox\" %}\n+ <p><strong>{{ field.definition.label|default(field.name) }}</strong>: {{ field ? \"checked\" : \"not checked\" }}</p>\n{% endif %}\n{# Imagelist fields #}\n- {% if fieldtype == \"imagelist\" and value is not empty %}\n+ {% if type == \"imagelist\" and field is not empty %}\n{{ block('imagelist_field') }}\n{% endif %}\n{# No special case defined for this type of field. We just output them, if it's\na simple scalar, and 'dump' them otherwise. #}\n- {% if fieldtype in [ 'filelist', 'datetime', 'date', 'integer', 'float' ] and value is not empty %}\n- <p><strong>{{ value.definition.label|default(value.name) }}: </strong>\n- {% if value is iterable %}\n- {{ dump(value) }}\n+ {% if type in [ 'filelist', 'datetime', 'date', 'integer', 'float' ] and field is not empty %}\n+ <p><strong>{{ field.definition.label|default(field.name) }}: </strong>\n+ {% if field is iterable %}\n+ {{ dump(field) }}\n{% else %}\n- {{ value }}\n+ {{ field }}\n{% endif %}\n</p>\n{% endif %}\n"
},
{
"change_type": "MODIFY",
"old_path": "public/theme/skeleton/partials/_sub_fields.twig",
"new_path": "public/theme/skeleton/partials/_sub_fields.twig",
"diff": "functionality: https://docs.bolt.cm/templating\nFor more information on using blocks, see the Twig documentation at:\n- - https://twig.sensiolabs.org/doc/1.x/tags/block.html\n- - https://twig.sensiolabs.org/doc/1.x/functions/block.html\n+ - https://twig.sensiolabs.org/doc/2.x/tags/block.html\n+ - https://twig.sensiolabs.org/doc/2.x/functions/block.html\n#}\n{% use 'partials/_sub_field_blocks.twig' %}\n{% endif %}\n{% endspaceless -%}\n- {#{{ dump(record.fields) }}#}\n-\n{# SECTION 2: LOOPING AND ITERATION - The actual looping is done here. #}\n- {% for value in record.fields if (value.name not in omittedkeys) %}\n-\n- {# Set the type #}\n- {% set fieldtype = value.definition.type %}\n+ {% for field in record.fields if (field.name not in omittedkeys) %}\n- {# Is the field allowed to contain Twig functions? #}\n- {% set allowtwig = value.definition.allowtwig %}\n+ {% set type = field.definition.type %}\n{# Fields that are considered 'common': 'html', 'markdown', 'textarea',\n'text', 'image', 'video' and 'imagelist' #}\n- {% if common|default(true) and (value.name not in exclude|default([])) %}\n+ {% if common|default(true) and (type not in exclude|default([])) %}\n{{ block('common_fields') }}\n{% endif %}\n- {# The rest of the built-in fieldtypes #}\n- {% if extended|default(false) and (value.name not in exclude|default([])) %}\n+ {# The rest of the built-in types #}\n+ {% if extended|default(false) and (type not in exclude|default([])) %}\n{{ block('extended_fields') }}\n{% endif %}\n{# Finally, the repeaters and blocks #}\n- {#{% if (repeaters|default(false) == true and record.fieldtype(key) == \"repeater\") or#}\n- {#(blocks|default(false) == true and record.fieldtype(key) == \"block\") %}#}\n+ {#{% if (repeaters|default(false) == true and record.type(key) == \"repeater\") or#}\n+ {#(blocks|default(false) == true and record.type(key) == \"block\") %}#}\n{#{% if (global.request.get('_route') != \"preview\") %}#}\n- {#{% for repeater in value %}#}\n+ {#{% for repeater in field %}#}\n{#{% for key, repeaterfield in repeater %}#}\n- {#{% set fieldtype = repeaterfield.fieldtype() %}#}\n- {#{% set value = repeaterfield.value() %}#}\n+ {#{% set type = repeaterfield.type() %}#}\n+ {#{% set field = repeaterfield.field() %}#}\n{#{{ block('common_fields') }}#}\n{#{{ block('extended_fields') }}#}\ncontent type for the templatefields should know about the types of fields. #}\n{% set templatefields_field_types = attribute(record.contentType.templatefields.first, 'fields') %}\n- {% for key, value in record.templateFields if (key not in omittedkeys) %}\n+ {% for key, field in record.templateFields if (key not in omittedkeys) %}\n- {% set fieldtype = attribute(attribute(templatefields_field_types, key), 'type') %}\n+ {% set type = attribute(attribute(templatefields_field_types, key), 'type') %}\n{{ block('common_fields') }}\n{{ block('extended_fields') }}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Content/FieldType.php",
"new_path": "src/Configuration/Content/FieldType.php",
"diff": "@@ -28,7 +28,9 @@ class FieldType extends Collection\n'placeholder' => '',\n'sort' => '',\n'default' => '',\n- 'allowtwig' => false,\n+ 'allow_twig' => false,\n+ 'allow_html' => false,\n+ 'sanitise' => false,\n]);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/ContentTypesParser.php",
"new_path": "src/Configuration/Parser/ContentTypesParser.php",
"diff": "@@ -215,10 +215,18 @@ class ContentTypesParser extends BaseParser\n$hasGroups = true;\n}\n- if (isset($field['allow_html']) === false) {\n+ if (isset($field['allow_twig']) === false) {\n$field['allow_html'] = in_array($field['type'], ['html', 'markdown'], true);\n}\n+ if (isset($field['allow_twig']) === false) {\n+ $field['allow_twig'] = false;\n+ }\n+\n+ if (isset($field['sanitise']) === false) {\n+ $field['sanitise'] = in_array($field['type'], ['text', 'textarea', 'html', 'markdown'], true);\n+ }\n+\n// Make sure we have these keys and every field has a group set.\n$field = array_replace(\n[\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Entity/Field.php",
"new_path": "src/Entity/Field.php",
"diff": "@@ -6,6 +6,7 @@ namespace Bolt\\Entity;\nuse ApiPlatform\\Core\\Annotation\\ApiResource;\nuse Bolt\\Configuration\\Content\\FieldType;\n+use Bolt\\Utils\\Sanitiser;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Gedmo\\Mapping\\Annotation as Gedmo;\nuse Symfony\\Component\\Serializer\\Annotation\\Groups;\n@@ -182,6 +183,11 @@ class Field implements Translatable, FieldInterface\n{\n$value = $this->getParsedValue();\n+ if (is_string($value) && $this->getDefinition()->get('sanitise')) {\n+ $sanitiser = new Sanitiser();\n+ $value = $sanitiser->clean($value);\n+ }\n+\nif (is_string($value) && $this->getDefinition()->get('allow_html')) {\n$value = new Markup($value, 'UTF-8');\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Entity/Field/MarkdownField.php",
"new_path": "src/Entity/Field/MarkdownField.php",
"diff": "@@ -24,7 +24,7 @@ class MarkdownField extends Field implements Excerptable, FieldInterface\n$markdown = new Markdown();\n$value = $this->getValue();\n- return $markdown->toHtml(reset($value));\n+ return $markdown->parse(reset($value));\n}\npublic function getParsedValue(): string\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Entity/Field/SelectField.php",
"new_path": "src/Entity/Field/SelectField.php",
"diff": "@@ -7,6 +7,7 @@ namespace Bolt\\Entity\\Field;\nuse Bolt\\Entity\\Field;\nuse Bolt\\Entity\\FieldInterface;\nuse Doctrine\\ORM\\Mapping as ORM;\n+use Tightenco\\Collect\\Support\\Collection;\n/**\n* @ORM\\Entity\n@@ -21,12 +22,14 @@ class SelectField extends Field implements FieldInterface\npublic function getValue(): ?array\n{\nif (empty($this->value)) {\n- $options = $this->getDefinition()->get('values');\n+ $this->value = $this->getDefinition()->get('values');\n// Pick the first key from Collection, or the full value as string, like `entries/id,title`\n- $this->value = [$options->keys()->first()];\n+ if ($this->value instanceof Collection) {\n+ $this->value = $this->value->keys()->first();\n+ }\n}\n- return $this->value;\n+ return (array) $this->value;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Twig/HtmlExtension.php",
"new_path": "src/Twig/HtmlExtension.php",
"diff": "@@ -14,11 +14,11 @@ use Twig\\TwigFunction;\n*/\nclass HtmlExtension extends AbstractExtension\n{\n- private $parser;\n+ private $markdown;\n- public function __construct(Markdown $parser)\n+ public function __construct(Markdown $markdown)\n{\n- $this->parser = $parser;\n+ $this->markdown = $markdown;\n}\n/**\n@@ -50,6 +50,6 @@ class HtmlExtension extends AbstractExtension\n*/\npublic function markdown(string $content): string\n{\n- return $this->parser->toHtml($content);\n+ return $this->markdown->parse($content);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Utils/Markdown.php",
"new_path": "src/Utils/Markdown.php",
"diff": "@@ -4,32 +4,17 @@ declare(strict_types=1);\nnamespace Bolt\\Utils;\n-/**\n- * This class is a light interface between an external Markdown parser library\n- * and the application. It's generally recommended to create these light interfaces\n- * to decouple your application from the implementation details of the third-party library.\n- *\n- * @author Ryan Weaver <weaverryan@gmail.com>\n- * @author Javier Eguiluz <javier.eguiluz@gmail.com>\n- */\nclass Markdown\n{\nprivate $parser;\n- private $purifier;\npublic function __construct()\n{\n$this->parser = new \\Parsedown();\n-\n- $purifierConfig = \\HTMLPurifier_Config::create([\n- 'Cache.DefinitionImpl' => null, // Disable caching\n- ]);\n- $this->purifier = new \\HTMLPurifier($purifierConfig);\n}\n- public function toHtml(string $text): string\n+ public function parse(string $text): string\n{\n- $html = $this->parser->text($text);\n- return $this->purifier->purify($html);\n+ return $this->parser->text($text);\n}\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Utils/Sanitiser.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Utils;\n+\n+class Sanitiser\n+{\n+ private $purifier;\n+\n+ public function __construct()\n+ {\n+ $purifierConfig = \\HTMLPurifier_Config::create([\n+ 'Cache.DefinitionImpl' => null, // Disable caching\n+ ]);\n+ $this->purifier = new \\HTMLPurifier($purifierConfig);\n+ }\n+\n+ public function clean(string $html): string\n+ {\n+ return $this->purifier->purify($html);\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"new_path": "tests/php/Configuration/Parser/ContentTypesParserTest.php",
"diff": "@@ -72,7 +72,7 @@ class ContentTypesParserTest extends ParserTestBase\n$this->assertSame('Homepage', $config['homepage']['name']);\n$this->assertSame('Homepage', $config['homepage']['singular_name']);\n$this->assertCount(6, $config['homepage']['fields']);\n- $this->assertCount(9, $config['homepage']['fields']['title']);\n+ $this->assertCount(11, $config['homepage']['fields']['title']);\n$this->assertSame('Title', $config['homepage']['fields']['title']['label']);\n$this->assertSame('text', $config['homepage']['fields']['title']['type']);\n$this->assertTrue($config['homepage']['fields']['title']['localize']);\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Add HTML Sanitiser for fields
|
95,144 |
22.06.2019 12:48:40
| -7,200 |
a89951709420d1d1c9173c42f5404f11c20e7ba3
|
remove unneeded dumps
|
[
{
"change_type": "MODIFY",
"old_path": "src/Controller/Frontend/DetailController.php",
"new_path": "src/Controller/Frontend/DetailController.php",
"diff": "@@ -71,9 +71,6 @@ class DetailController extends TwigAwareController implements FrontendZone\n$recordSlug => $record,\n];\n- dump($record);\n- dump($record->getFieldValues());\n-\n$templates = $this->templateChooser->forRecord($record);\nreturn $this->renderTemplate($templates, $context);\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
remove unneeded dumps
|
95,144 |
22.06.2019 14:19:25
| -7,200 |
e703f96fc9a4d1b2e998b4d2d1af69e64c25c24b
|
Adding some e2e-tests for Sanitiser
|
[
{
"change_type": "MODIFY",
"old_path": "config/bolt/contenttypes.yaml",
"new_path": "config/bolt/contenttypes.yaml",
"diff": "@@ -309,6 +309,12 @@ tests:\ntext_plain:\ntype: text\nallow_html: false\n+ text_not_sanitised:\n+ type: text\n+ sanitise: false\n+ text_sanitised:\n+ type: text\n+ sanitise: true\nhtml_field:\ntype: html\nimage:\n"
},
{
"change_type": "MODIFY",
"old_path": "public/theme/skeleton/test.twig",
"new_path": "public/theme/skeleton/test.twig",
"diff": "<div class=\"box text_textarea\">{{ record.textarea_field }}</div><br>\n</p>\n+ <h2>Testing output with `sanitise`</h2>\n+\n+ <p>\n+ Default output with <code>sanitise: {{ record.field('text_not_sanitised').definition.sanitise ? 'true' : 'false' }}</code>:<br>\n+ <div class=\"box text_sanitise_a\">{{ record.text_not_sanitised }}</div><br>\n+\n+ Default output with <code>sanitise: {{ record.field('text_sanitised').definition.sanitise ? 'true' : 'false' }}</code>:<br>\n+ <div class=\"box text_sanitise_b\">{{ record.text_sanitised }}</div><br>\n+\n+ </p>\n+\n+ <hr>\n+\n<h2>Testing output for images</h2>\n{% if record.image %}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Configuration/Parser/ContentTypesParser.php",
"new_path": "src/Configuration/Parser/ContentTypesParser.php",
"diff": "@@ -215,7 +215,7 @@ class ContentTypesParser extends BaseParser\n$hasGroups = true;\n}\n- if (isset($field['allow_twig']) === false) {\n+ if (isset($field['allow_html']) === false) {\n$field['allow_html'] = in_array($field['type'], ['html', 'markdown'], true);\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/e2e/features/display_record_test.feature",
"new_path": "tests/e2e/features/display_record_test.feature",
"diff": "@@ -17,3 +17,6 @@ Feature: Test field output\nAnd there is element \"html_field\" with text \"HTML field with simple HTML in it.\"\nAnd there is element \"markdown_field\" with text \"Markdown field with simple Markdown in it.\"\nAnd there is element \"textarea_field\" with text \"Textarea field with <em>simple</em> HTML in it.\"\n+\n+ And there is element \"text_sanitise_a\" with text \"Text field with <strong>markup</strong>, including <script>console.log('hoi')</script>. The end.\"\n+ And there is element \"text_sanitise_b\" with text \"Text field with <strong>markup</strong>, including . The end.\"\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/e2e/pages/single_test.js",
"new_path": "tests/e2e/pages/single_test.js",
"diff": "@@ -17,6 +17,9 @@ class SingleTestPage extends BasePage {\nthis.text_plain_b = $('.text_plain_b');\nthis.text_plain_c = $('.text_plain_c');\n+ this.text_sanitise_a = $('.text_sanitise_a');\n+ this.text_sanitise_b = $('.text_sanitise_b');\n+\nthis.textarea_field = $('.text_textarea');\nthis.html_field = $('.text_html');\nthis.markdown_field = $('.text_markdown');\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Adding some e2e-tests for Sanitiser
|
95,144 |
22.06.2019 15:19:30
| -7,200 |
89b281cd4653ef51d1eb177f3579532401d74210
|
Make sure multiple selects keep all values
|
[
{
"change_type": "MODIFY",
"old_path": "templates/_partials/fields/_base.html.twig",
"new_path": "templates/_partials/fields/_base.html.twig",
"diff": "{# Set the value #}\n{% if not value|default %}\n{% set value = field.value|default('') %}\n- {% if value is iterable %}\n+ {% if value is iterable and field.definition.type != \"select\" %}\n{% set value = value|first %}\n{% endif %}\n{% endif %}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Make sure multiple selects keep all values
|
95,144 |
22.06.2019 16:55:36
| -7,200 |
85b30b858bdde5f30accd67077e6c872d1c0b921
|
Bumping NPM dependencies
|
[
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "}\n},\n\"eslint\": {\n- \"version\": \"5.16.0\",\n- \"resolved\": \"https://registry.npmjs.org/eslint/-/eslint-5.16.0.tgz\",\n- \"integrity\": \"sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==\",\n+ \"version\": \"6.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/eslint/-/eslint-6.0.0.tgz\",\n+ \"integrity\": \"sha512-SrrIfcd4tOgsspOKTSwamuTOAMZOUigHQhVMrzNjz4/B9Za6SHQDIocMIyIDfwDgx6MhS15nS6HC8kumCV2qBQ==\",\n\"dev\": true,\n\"requires\": {\n\"@babel/code-frame\": \"^7.0.0\",\n- \"ajv\": \"^6.9.1\",\n+ \"ajv\": \"^6.10.0\",\n\"chalk\": \"^2.1.0\",\n\"cross-spawn\": \"^6.0.5\",\n\"debug\": \"^4.0.1\",\n\"eslint-scope\": \"^4.0.3\",\n\"eslint-utils\": \"^1.3.1\",\n\"eslint-visitor-keys\": \"^1.0.0\",\n- \"espree\": \"^5.0.1\",\n+ \"espree\": \"^6.0.0\",\n\"esquery\": \"^1.0.1\",\n\"esutils\": \"^2.0.2\",\n\"file-entry-cache\": \"^5.0.1\",\n\"functional-red-black-tree\": \"^1.0.1\",\n- \"glob\": \"^7.1.2\",\n+ \"glob-parent\": \"^3.1.0\",\n\"globals\": \"^11.7.0\",\n\"ignore\": \"^4.0.6\",\n\"import-fresh\": \"^3.0.0\",\n\"imurmurhash\": \"^0.1.4\",\n\"inquirer\": \"^6.2.2\",\n- \"js-yaml\": \"^3.13.0\",\n+ \"is-glob\": \"^4.0.0\",\n+ \"js-yaml\": \"^3.13.1\",\n\"json-stable-stringify-without-jsonify\": \"^1.0.1\",\n\"levn\": \"^0.3.0\",\n\"lodash\": \"^4.17.11\",\n\"mkdirp\": \"^0.5.1\",\n\"natural-compare\": \"^1.4.0\",\n\"optionator\": \"^0.8.2\",\n- \"path-is-inside\": \"^1.0.2\",\n\"progress\": \"^2.0.0\",\n\"regexpp\": \"^2.0.1\",\n\"semver\": \"^5.5.1\",\n\"dev\": true\n},\n\"ms\": {\n- \"version\": \"2.1.1\",\n- \"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.1.1.tgz\",\n- \"integrity\": \"sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==\",\n+ \"version\": \"2.1.2\",\n+ \"resolved\": \"https://registry.npmjs.org/ms/-/ms-2.1.2.tgz\",\n+ \"integrity\": \"sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==\",\n\"dev\": true\n},\n\"resolve-from\": {\n\"integrity\": \"sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==\",\n\"dev\": true\n},\n- \"slice-ansi\": {\n- \"version\": \"2.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz\",\n- \"integrity\": \"sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==\",\n- \"dev\": true,\n- \"requires\": {\n- \"ansi-styles\": \"^3.2.0\",\n- \"astral-regex\": \"^1.0.0\",\n- \"is-fullwidth-code-point\": \"^2.0.0\"\n- }\n- },\n- \"string-width\": {\n- \"version\": \"3.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz\",\n- \"integrity\": \"sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==\",\n- \"dev\": true,\n- \"requires\": {\n- \"emoji-regex\": \"^7.0.1\",\n- \"is-fullwidth-code-point\": \"^2.0.0\",\n- \"strip-ansi\": \"^5.1.0\"\n- },\n- \"dependencies\": {\n- \"ansi-regex\": {\n- \"version\": \"4.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz\",\n- \"integrity\": \"sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==\",\n- \"dev\": true\n- },\n- \"strip-ansi\": {\n- \"version\": \"5.2.0\",\n- \"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz\",\n- \"integrity\": \"sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==\",\n- \"dev\": true,\n- \"requires\": {\n- \"ansi-regex\": \"^4.1.0\"\n- }\n- }\n- }\n- },\n\"strip-ansi\": {\n\"version\": \"4.0.0\",\n\"resolved\": \"https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz\",\n\"requires\": {\n\"has-flag\": \"^3.0.0\"\n}\n- },\n- \"table\": {\n- \"version\": \"5.2.3\",\n- \"resolved\": \"https://registry.npmjs.org/table/-/table-5.2.3.tgz\",\n- \"integrity\": \"sha512-N2RsDAMvDLvYwFcwbPyF3VmVSSkuF+G1e+8inhBLtHpvwXGw4QRPEZhihQNeEN0i1up6/f6ObCJXNdlRG3YVyQ==\",\n- \"dev\": true,\n- \"requires\": {\n- \"ajv\": \"^6.9.1\",\n- \"lodash\": \"^4.17.11\",\n- \"slice-ansi\": \"^2.1.0\",\n- \"string-width\": \"^3.0.0\"\n- }\n}\n}\n},\n\"dev\": true\n},\n\"espree\": {\n- \"version\": \"5.0.1\",\n- \"resolved\": \"https://registry.npmjs.org/espree/-/espree-5.0.1.tgz\",\n- \"integrity\": \"sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A==\",\n+ \"version\": \"6.0.0\",\n+ \"resolved\": \"https://registry.npmjs.org/espree/-/espree-6.0.0.tgz\",\n+ \"integrity\": \"sha512-lJvCS6YbCn3ImT3yKkPe0+tJ+mH6ljhGNjHQH9mRtiO6gjhVAOhVXW1yjnwqGwTkK3bGbye+hb00nFNmu0l/1Q==\",\n\"dev\": true,\n\"requires\": {\n\"acorn\": \"^6.0.7\",\n\"dev\": true\n},\n\"inquirer\": {\n- \"version\": \"6.2.2\",\n- \"resolved\": \"https://registry.npmjs.org/inquirer/-/inquirer-6.2.2.tgz\",\n- \"integrity\": \"sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA==\",\n+ \"version\": \"6.4.1\",\n+ \"resolved\": \"https://registry.npmjs.org/inquirer/-/inquirer-6.4.1.tgz\",\n+ \"integrity\": \"sha512-/Jw+qPZx4EDYsaT6uz7F4GJRNFMRdKNeUZw3ZnKV8lyuUgz/YWRCSUAJMZSVhSq4Ec0R2oYnyi6b3d4JXcL5Nw==\",\n\"dev\": true,\n\"requires\": {\n\"ansi-escapes\": \"^3.2.0\",\n\"run-async\": \"^2.2.0\",\n\"rxjs\": \"^6.4.0\",\n\"string-width\": \"^2.1.0\",\n- \"strip-ansi\": \"^5.0.0\",\n+ \"strip-ansi\": \"^5.1.0\",\n\"through\": \"^2.3.6\"\n},\n\"dependencies\": {\n- \"ansi-escapes\": {\n- \"version\": \"3.2.0\",\n- \"resolved\": \"https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.2.0.tgz\",\n- \"integrity\": \"sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==\",\n- \"dev\": true\n- },\n\"ansi-regex\": {\n\"version\": \"4.1.0\",\n\"resolved\": \"https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz\",\n},\n\"dependencies\": {\n\"callsites\": {\n- \"version\": \"3.0.0\",\n- \"resolved\": \"https://registry.npmjs.org/callsites/-/callsites-3.0.0.tgz\",\n- \"integrity\": \"sha512-tWnkwu9YEq2uzlBDI4RcLn8jrFvF9AOi8PxDNU3hZZjJcjkcRAq3vCI+vZcg1SuxISDYe86k9VZFwAxDiJGoAw==\",\n+ \"version\": \"3.1.0\",\n+ \"resolved\": \"https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz\",\n+ \"integrity\": \"sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==\",\n\"dev\": true\n}\n}\n}\n},\n\"rxjs\": {\n- \"version\": \"6.4.0\",\n- \"resolved\": \"https://registry.npmjs.org/rxjs/-/rxjs-6.4.0.tgz\",\n- \"integrity\": \"sha512-Z9Yfa11F6B9Sg/BK9MnqnQ+aQYicPLtilXBp2yUtDt2JRCE0h26d33EnfO3ZxoNxG0T92OUucP3Ct7cpfkdFfw==\",\n+ \"version\": \"6.5.2\",\n+ \"resolved\": \"https://registry.npmjs.org/rxjs/-/rxjs-6.5.2.tgz\",\n+ \"integrity\": \"sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg==\",\n\"dev\": true,\n\"requires\": {\n\"tslib\": \"^1.9.0\"\n"
},
{
"change_type": "MODIFY",
"old_path": "package.json",
"new_path": "package.json",
"diff": "\"babel-core\": \"^7.0.0-bridge.0\",\n\"babel-eslint\": \"^10.0.2\",\n\"babel-jest\": \"^24.8.0\",\n- \"eslint\": \"^5.16.0\",\n+ \"eslint\": \"^6.0.0\",\n\"eslint-config-prettier\": \"^5.0.0\",\n\"eslint-plugin-prettier\": \"^3.1.0\",\n\"eslint-plugin-standard\": \"^4.0.0\",\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Bumping NPM dependencies
|
95,192 |
24.06.2019 15:06:26
| -7,200 |
2607a7b8be0cadcad197bd051738992e41473a30
|
Readme refinements
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -17,13 +17,13 @@ Follow the progress on Bolt 4, at the following locations\n- Bolt 4 roadmap: https://roadmap.bolt.cm\n- Slack: https://boltcms.slack.com/messages/C0NJEK631 (open for all, requires Slack account)\n-Install\n--------\n+1 Install\n+---------\nTo install Bolt 4 (for now):\n- - Check out the git repo\n- - Then:\n+ - Check out this git repository\n+ - Then run:\n```bash\ncomposer install\n@@ -34,13 +34,12 @@ Alternatively, run `make install`, on a UNIX-like system.\nIt's on the roadmap for Beta 1 to provide a `composer create-project` install.\n-Use with Docker\n----------------\n+### Or install with Docker\nTo install Bolt 4 with Docker (for now, on a UNIX-like system):\n- Check out the git repo\n- - Then:\n+ - Then run:\n```bash\nmake docker-install\n@@ -48,15 +47,15 @@ make docker-install\nActually, just add `docker-` prefix to any Make command and that's it!\n-In your browser, go to `http://0.0.0.0:8088/` for the frontend, and to\n+When installed with Docker, in your browser go to `http://0.0.0.0:8088/` for the frontend, and to\n`http://0.0.0.0:8088/bolt` for the Admin Panel.\n-Set up Database\n----------------\n+2 Set up Database\n+-----------------\n- - Configure the database connection in `.env`. Or stick with the default\n- SQLite. It ought to work out of the box.\n- - Then:\n+ - Configure the database connection in `.env` or stick with the default\n+ SQLite, which should work out of the box.\n+ - Then run:\n```bash\nbin/console doctrine:database:create\n@@ -66,12 +65,12 @@ bin/console doctrine:fixtures:load -n\nAlternatively, run `make db-create`, on a UNIX-like system.\n-Re-set the Database\n--------------------\n+3 Re-set the Database\n+---------------------\n-This is a prototype in flux. Shit will break, and you might want to reset it to\n-the \"factory settings\". To Re-set a database to the latest, with fresh\n-dummy-content use this:\n+This is a Bolt prototype in flux, so stuff can break, and you might want to reset the database to\n+the \"factory settings\". To re-set a database to the latest, with fresh\n+dummy-content run the following:\n```\nbin/console doctrine:schema:drop --force\n@@ -81,10 +80,11 @@ bin/console doctrine:fixtures:load -n\nAlternatively, run `make db-reset`, on a UNIX-like system.\n-Run the prototype\n------------------\n+4 Run the prototype\n+-------------------\n- Run `bin/console server:start`\n+ (if running `bin/console server:start`does not work because you don't have the pcntl extension, run `bin/console server:run`)\nIn your browser, go to `http://127.0.0.1:8000/` for the frontend, and to\n`http://127.0.0.1:8000/bolt` for the Admin Panel.\n@@ -94,8 +94,8 @@ You can log on, using the default user & pass:\n- user: `admin`\n- pass: `admin%1`\n-Build assets\n-------------\n+How to build assets\n+-------------------\nTo set up initially, run `npm install` to get the required dependencies /\n`node_modules`. Then:\n@@ -104,7 +104,7 @@ To set up initially, run `npm install` to get the required dependencies /\nSee the other options by running `npm run`.\n-Code Style / Static Analysis\n+Code Style checking / Static Analysis\n----------------------------\nRun the following commands with `make`, to perform Code Style checking and\n@@ -128,7 +128,7 @@ vendor/bin/phpstan.bat analyse -c phpstan.neon src\n```\nTesting\n----\n+-------\nBolt uses several testing frameworks for [different test layers][fowler]:\n- unit: PHPSpec, PHPUnit, Jest\n@@ -147,7 +147,7 @@ make e2e\n```\nFixing IDE issues\n-----\n+-----------------\n- PHPStorm does not see `@bolt` Twig namespace.\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Readme refinements
|
95,192 |
24.06.2019 15:12:57
| -7,200 |
6490c25b7db4865e9940ae7b35901a58d4161662
|
Extra info about the following install steps
|
[
{
"change_type": "MODIFY",
"old_path": "README.md",
"new_path": "README.md",
"diff": "@@ -17,6 +17,9 @@ Follow the progress on Bolt 4, at the following locations\n- Bolt 4 roadmap: https://roadmap.bolt.cm\n- Slack: https://boltcms.slack.com/messages/C0NJEK631 (open for all, requires Slack account)\n+\n+To set up a running environment of Bolt 4 please perform the following steps 1 to 4:\n+\n1 Install\n---------\n@@ -94,6 +97,7 @@ You can log on, using the default user & pass:\n- user: `admin`\n- pass: `admin%1`\n+\nHow to build assets\n-------------------\n@@ -104,6 +108,7 @@ To set up initially, run `npm install` to get the required dependencies /\nSee the other options by running `npm run`.\n+\nCode Style checking / Static Analysis\n----------------------------\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Extra info about the following install steps
|
95,187 |
25.06.2019 15:36:46
| -7,200 |
ac8df78d7e37ffd6c14748d44a2f32c329f6589d
|
Better disabled buttons, improved defaults in button macro
|
[
{
"change_type": "MODIFY",
"old_path": "assets/scss/init/_variables.scss",
"new_path": "assets/scss/init/_variables.scss",
"diff": "@@ -33,6 +33,9 @@ $headings-font-weight: 600;\n$link-color: var(--primary);\n$link-hover-color: var(--primary-600);\n+//buttons\n+$btn-disabled-opacity: 1;\n+\n// Form controls\n$border-radius: 0.15rem;\n$component-active-bg: var(--primary);\n@@ -55,13 +58,14 @@ $btn-font-weight: 500;\n$primary: #1863AF;\n$secondary: #5DA1AC;\n-$tertiary: #E5C870;\n+$tertiary: #56696D;\n$success: #61A31F;\n$info: #17A2B8;\n$warning: #FFC107;\n$danger: #DB2427;\n$light: #E8E8E8;\n$dark: #333;\n+$disabled: #C8C8C8;\n// Grid\n$grid-breakpoints: (\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/vendor/bootstrap/_overrides.scss",
"new_path": "assets/scss/vendor/bootstrap/_overrides.scss",
"diff": "@@ -24,3 +24,24 @@ $theme-colors: (\n@include button-outline-variant($value);\n}\n}\n+\n+//set disabled buttons to grey\n+\n+.btn {\n+ &.disabled,\n+ &:disabled {\n+ opacity: $btn-disabled-opacity;\n+ @include box-shadow(none);\n+ background: $disabled;\n+ color: darken($disabled, 30%);\n+ border: $btn-border-width solid transparent;\n+ }\n+}\n+\n+.btn-link {\n+ &:disabled,\n+ &.disabled {\n+ color: darken($disabled, 30%);\n+ background: transparent;\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/_macro/_macro.html.twig",
"new_path": "templates/_macro/_macro.html.twig",
"diff": "-{# Button Macro #}\n-{% macro button(label, icon, class, attr) %}{% spaceless %}\n+{# Button Macro with defaults #}\n- {% set label = label|default('button')|trans %}\n- {% set icon = icon|replace({'fa-': ''})|default('question-circle') %}\n- {% set class = class|replace({'btn-': ''})|default('info') %}\n- {% set attr = attr|default([]) %}\n+{% macro button(label = 'Button', icon = 'question-circle', class = 'tertiary', attr = []) %}{% spaceless %}\n+\n+ {% set label = label|trans %}\n+ {% set icon = icon|replace({'fa-': ''}) %}\n+ {% set class = class|replace({'btn-': ''}) %}\n+ {% set attr = attr %}\n<button class=\"btn btn-{{ class }} mb-3\"\n{% for key,value in attr %} {{ key }}=\"{{value}}\"{% endfor %}>\n- <i class=\"fas fa-{{ icon }} mr-2\"></i>\n+ <i class=\"fas fa-fw fa-{{ icon }} mr-2\"></i>\n{{- label -}}\n</button>\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/pages/kitchensink.html.twig",
"new_path": "templates/pages/kitchensink.html.twig",
"diff": "{% set icons = ['fa-heart', 'fa-wind', 'fa-beer', 'fa-book', 'fa-dove', 'fa-calendar', 'fa-clock', 'fa-code', 'fa-compress', 'fa-exclamation-circle', 'fa-exclamation-triangle', 'fa-expand', 'fa-external-link-square-alt', 'fa-file', 'fa-folder', 'fa-folder-open', 'fa-github', 'fa-image', 'fa-language', 'fa-lock', 'fa-newspaper', 'fa-ring', 'fa-save', 'fa-sign-in-alt', 'fa-socks', 'fa-tachometer-alt', 'fa-tags'] %}\n+ <label>Default</label>\n+ <p>\n+ {{ macro.button() }}\n+ </p>\n+\n<label>Primary, Secondary, Tertiary</label>\n<p>\n- {{ macro.button('action.do_something', random(icons), 'primary', 'button', '') }}\n- {{ macro.button('action.do_something', random(icons), 'secondary', 'button', '') }}\n- {{ macro.button('action.do_something', random(icons), 'tertiary', 'button', '') }}\n+ {{ macro.button('action.do_something', random(icons), 'primary', {'type': 'button'}) }}\n+ {{ macro.button('action.do_something', random(icons), 'secondary', {'type': 'button'}) }}\n+ {{ macro.button('action.do_something', random(icons), 'tertiary', {'type': 'button'}) }}\n+ </p>\n+\n+ <p>\n+ {{ macro.button('action.do_something', random(icons), 'primary', {'type': 'button', 'disabled': 'disabled' }) }}\n+ {{ macro.button('action.do_something', random(icons), 'secondary', {'type': 'button', 'disabled': 'disabled' }) }}\n+ {{ macro.button('action.do_something', random(icons), 'tertiary', {'type': 'button', 'disabled': 'disabled' }) }}\n</p>\n- <label>Success, Warning, Danger</label>\n+\n+ <label>Info, Success, Warning, Danger</label>\n<p>\n- {{ macro.button('action.do_something', random(icons), 'success', 'button', '') }}\n- {{ macro.button('action.do_something', random(icons), 'warning', 'button', '') }}\n- {{ macro.button('action.do_something', random(icons), 'danger', 'button', '') }}\n+ {{ macro.button('action.do_something', random(icons), 'success', {'type': 'button'}) }}\n+ {{ macro.button('action.do_something', random(icons), 'warning', {'type': 'button'}) }}\n+ {{ macro.button('action.do_something', random(icons), 'danger', {'type': 'button'}) }}\n</p>\n- <label>Light, Dark, Link and \"Boltblue\"</label>\n<p>\n- {{ macro.button('action.do_something', random(icons), 'light', 'button', '') }}\n- {{ macro.button('action.do_something', random(icons), 'dark', 'button', '') }}\n- {{ macro.button('action.do_something', random(icons), 'link', 'button', '') }}\n- {{ macro.button('action.do_something', random(icons), 'boltblue', 'button', '') }}\n+ {{ macro.button('action.do_something', random(icons), 'success', {'type': 'button', 'disabled': 'disabled' }) }}\n+ {{ macro.button('action.do_something', random(icons), 'warning', {'type': 'button', 'disabled': 'disabled' }) }}\n+ {{ macro.button('action.do_something', random(icons), 'danger', {'type': 'button', 'disabled': 'disabled' }) }}\n+ </p>\n+\n+\n+ <label>Link and \"Boltblue\"</label>\n+ <p>\n+ {{ macro.button('action.do_something', random(icons), 'link', {'type': 'button'}) }}\n+ {{ macro.button('action.do_something', random(icons), 'boltblue', {'type': 'button'}) }}\n+ </p>\n+\n+ <p>\n+ {{ macro.button('action.do_something', random(icons), 'link', {'type': 'button', 'disabled': 'disabled' }) }}\n+ {{ macro.button('action.do_something', random(icons), 'boltblue', {'type': 'button', 'disabled': 'disabled' }) }}\n+ </p>\n<hr>\n</section>\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Better disabled buttons, improved defaults in button macro
|
95,187 |
25.06.2019 16:12:55
| -7,200 |
4ee722f77eb0f8e71d56930a8d2dd71b246542b8
|
rewrite save-button to new macro (failed test earlier)
|
[
{
"change_type": "MODIFY",
"old_path": "templates/content/_buttons.html.twig",
"new_path": "templates/content/_buttons.html.twig",
"diff": "{% import '@bolt/_macro/_macro.html.twig' as macro %}\n<div class=\"btn-group\">\n-{{ macro.button('action.save', 'fa-save', 'success', 'submit', 'editcontent') }}\n+{{ macro.button('action.save', 'fa-save', 'success', {'type': 'submit', 'form': 'editcontent'}) }}\n{% if record.id %}\n \n"
}
] |
PHP
|
MIT License
|
bolt/core
|
rewrite save-button to new macro (failed test earlier)
|
95,187 |
25.06.2019 16:40:23
| -7,200 |
e94aa6a49d0cfaa4ac40673789367bb3c61e2a9a
|
update test + put disabled defaut button in kitchensink
|
[
{
"change_type": "MODIFY",
"old_path": "templates/pages/kitchensink.html.twig",
"new_path": "templates/pages/kitchensink.html.twig",
"diff": "<label>Default</label>\n<p>\n{{ macro.button() }}\n+ {{ macro.button('Button', 'fa-question-circle', 'tertiary', {'disabled': 'disabled' }) }}\n</p>\n<label>Primary, Secondary, Tertiary</label>\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/e2e/features/kitchensink.feature",
"new_path": "tests/e2e/features/kitchensink.feature",
"diff": "@@ -7,7 +7,7 @@ Feature: Visiting the Kitchensink\nAnd there is element \"title\" with text \"Kitchensink\"\nAnd there is element \"subtitle\" with text \"different things\"\n- And there are \"equal 10\" \"buttons\" elements\n+ And there are \"equal 18\" \"buttons\" elements\nAnd there is element \"field\" with text \"FooBar\"\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
update test + put disabled defaut button in kitchensink
|
95,187 |
28.06.2019 11:01:56
| -7,200 |
a93b8ca3ce6330f2281f71381ff3e110bbfad77f
|
Weather widget should not break Bolt when giving an error
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -25,7 +25,8 @@ class WeatherWidget extends BaseWidget implements TwigAware, CacheAware, Stopwat\n{\n$weather = $this->getWeather();\n- if (empty($weather)) {\n+ if (count($weather)<=1) {\n+ // weather is not empty when it reurns an error!\nreturn null;\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Weather widget should not break Bolt when giving an error
|
95,144 |
28.06.2019 13:03:46
| -7,200 |
87c363e8162c0dd592ed90cd2441216223f1e729
|
Cast output to string, in case widget fails.
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widgets.php",
"new_path": "src/Widgets.php",
"diff": "@@ -73,7 +73,7 @@ class Widgets\n})->first();\nif ($widget) {\n- return $this->invokeWidget($widget, $params);\n+ return (string) $this->invokeWidget($widget, $params);\n}\n}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Cast output to string, in case widget fails.
|
95,144 |
28.06.2019 13:05:33
| -7,200 |
bcd3683252b983a9963ffdc28cbb806eb7c5a1ca
|
Slightly different way to handle error from wttr.in response
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -25,8 +25,7 @@ class WeatherWidget extends BaseWidget implements TwigAware, CacheAware, Stopwat\n{\n$weather = $this->getWeather();\n- if (count($weather)<=1) {\n- // weather is not empty when it reurns an error!\n+ if (empty($weather)) {\nreturn null;\n}\n@@ -37,11 +36,16 @@ class WeatherWidget extends BaseWidget implements TwigAware, CacheAware, Stopwat\n{\n$url = 'wttr.in/?format=%c|%C|%h|%t|%w|%l|%m|%M|%p|%P';\n+ $details = [];\n+\ntry {\n$client = new Client();\n- $details = explode('|', trim($client->request('GET', $url)->getBody()->getContents()));\n+ $result = $client->request('GET', $url)->getBody()->getContents();\n+ if (substr_count($result, '|') === 9) {\n+ $details = explode('|', trim($result));\n+ }\n} catch (RequestException $e) {\n- $details = [];\n+ // Do nothing, fall through to empty array\n}\nreturn $details;\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Slightly different way to handle error from wttr.in response
|
95,144 |
28.06.2019 13:17:48
| -7,200 |
557425bf12deb4b51c27222e71e8b0d3c06f04b2
|
Herp, Derp, multibyte..
|
[
{
"change_type": "MODIFY",
"old_path": "src/Widget/WeatherWidget.php",
"new_path": "src/Widget/WeatherWidget.php",
"diff": "@@ -41,7 +41,7 @@ class WeatherWidget extends BaseWidget implements TwigAware, CacheAware, Stopwat\ntry {\n$client = new Client();\n$result = $client->request('GET', $url)->getBody()->getContents();\n- if (substr_count($result, '|') === 9) {\n+ if (mb_substr_count($result, '|') === 9) {\n$details = explode('|', trim($result));\n}\n} catch (RequestException $e) {\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Herp, Derp, multibyte..
|
95,187 |
28.06.2019 14:39:59
| -7,200 |
3acadba5eebcdf282e52773096242b052e455337
|
Adds hidden-danger class
|
[
{
"change_type": "MODIFY",
"old_path": "assets/scss/init/_variables.scss",
"new_path": "assets/scss/init/_variables.scss",
"diff": "@@ -84,6 +84,11 @@ $grid-breakpoints: (\n// Modal Dialog spacing\n$modal-dialog-margin-y-sm-up: 4rem;\n+// This number determines of a button has white or black text (a11y)\n+// 150: about equal to 3.0 color contrast ( WCAG2 for bold and texts above 18pts).\n+// 117: for 4.5 color contrast (WCAG2 for normal text) (see ~bootstrap/_functions.scss for use in function)\n+$yiq-contrasted-threshold: 150;\n+\n.admin__sidebar {\nbackground: rgb(42,57,70);\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "assets/scss/modules/base/_buttons.scss",
"diff": "+\n+// Hidden warning button- acts like tertiary, hover is like danger.\n+// Uses 'button-variant' mixin from core bootstrap with fixed colors.\n+\n+.btn-hidden-danger {\n+ @include button-variant($tertiary, $tertiary, darken($danger, 7.5%), darken($danger, 10%), darken($danger, 10%), darken($danger, 12.5%));\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/base/base.scss",
"new_path": "assets/scss/modules/base/base.scss",
"diff": "@import '_status';\n@import '_pagination';\n@import '_notification';\n+@import '_buttons';\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/pages/kitchensink.html.twig",
"new_path": "templates/pages/kitchensink.html.twig",
"diff": "</p>\n- <label>Info, Success, Warning, Danger</label>\n+ <label>Success, Warning, Danger, Hidden danger</label>\n<p>\n{{ macro.button('action.do_something', random(icons), 'success', {'type': 'button'}) }}\n{{ macro.button('action.do_something', random(icons), 'warning', {'type': 'button'}) }}\n{{ macro.button('action.do_something', random(icons), 'danger', {'type': 'button'}) }}\n+ {{ macro.button('action.do_something', random(icons), 'hidden-danger', {'type': 'button'}) }}\n</p>\n<p>\n{{ macro.button('action.do_something', random(icons), 'success', {'type': 'button', 'disabled': 'disabled' }) }}\n{{ macro.button('action.do_something', random(icons), 'warning', {'type': 'button', 'disabled': 'disabled' }) }}\n{{ macro.button('action.do_something', random(icons), 'danger', {'type': 'button', 'disabled': 'disabled' }) }}\n+ {{ macro.button('action.do_something', random(icons), 'hidden-danger', {'type': 'button', 'disabled': 'disabled' }) }}\n</p>\n"
},
{
"change_type": "MODIFY",
"old_path": "tests/e2e/features/kitchensink.feature",
"new_path": "tests/e2e/features/kitchensink.feature",
"diff": "@@ -7,7 +7,7 @@ Feature: Visiting the Kitchensink\nAnd there is element \"title\" with text \"Kitchensink\"\nAnd there is element \"subtitle\" with text \"different things\"\n- And there are \"equal 18\" \"buttons\" elements\n+ And there are \"equal 20\" \"buttons\" elements\nAnd there is element \"field\" with text \"FooBar\"\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Adds hidden-danger class - #493
|
95,192 |
28.06.2019 16:16:32
| -7,200 |
5e989b17d502e751f3bf44318dbb8efcf4ff3ba4
|
redo of layout backend, making it responsive and mobile first. MVP for now
|
[
{
"change_type": "MODIFY",
"old_path": "assets/js/app/notifications/index.js",
"new_path": "assets/js/app/notifications/index.js",
"diff": "@@ -2,4 +2,19 @@ import $ from 'jquery';\n$(document).ready(function() {\n$('.toast').toast('show');\n+ // add a js class to indicate we have JS enabled. Needs a change to either modernizr or something custom @bobdenotter\n+ $('html').addClass('js');\n+\n+ $('.admin__sidebar').addClass('admin__sidebar--is-collapsed');\n+\n+ $('.admin-sidebar-toggler').click(function() {\n+ if ($('.admin__sidebar').hasClass('admin__sidebar--is-collapsed')) {\n+ $('.admin__sidebar').addClass('admin__sidebar--is-expanded').removeClass('admin__sidebar--is-collapsed');\n+ $(this).toggleClass('is-active');\n+ } else {\n+ $('.admin__sidebar').addClass('admin__sidebar--is-collapsed').removeClass('admin__sidebar--is-expanded');\n+ $(this).toggleClass('is-active');\n+ }\n+ });\n+\n});\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/js/app/toolbar/Components/Toolbar.vue",
"new_path": "assets/js/app/toolbar/Components/Toolbar.vue",
"diff": ":class=\"contrast ? 'is-light' : 'is-dark'\"\nrole=\"toolbar\"\n>\n- <div class=\"toolbar--item is-brand\">\n+ <div class=\"toolbar-item toolbar-item__brand\">\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 91 79\">\n<g fill-rule=\"evenodd\">\n<path\n/>\n</g>\n</svg>\n- <ul class=\"toolbar--menu\">\n+ <ul class=\"toolbar-menu\">\n<li><a href=\"https://bolt.cm/\" target=\"_blank\">Visit Bolt.cm</a></li>\n<li>\n<a href=\"https://docs.bolt.cm/\" target=\"_blank\">{{\n</li>\n</ul>\n</div>\n- <div class=\"toolbar--item is-new\">\n+ <div class=\"toolbar-item toolbar-item__site\">\n+ <a href=\"/\" target=\"_blank\">\n+ <i class=\"fas fa-globe-americas mr-2\"></i>{{ labels['action.visit_site'] }}\n+ </a>\n+ </div>\n+ <div class=\"toolbar-item toolbar-item__new\">\n<i class=\"fas fa-magic mr-2\"></i>{{ labels['action.create_new'] }}\n- <ul class=\"toolbar--menu\">\n+ <ul class=\"toolbar-menu\">\n<li v-for=\"(item, index) in createMenu\" :key=\"index\">\n<a :href=\"item.link_new\">{{ item.singular_name }}</a>\n</li>\n</ul>\n</div>\n- <div class=\"toolbar--item is-site\">\n- <a href=\"/\" target=\"_blank\">\n- <i class=\"fas fa-globe-americas mr-2\"></i>{{ labels['action.visit_site'] }}: {{ siteName }}\n- </a>\n- </div>\n- <div class=\"toolbar--item is-profile\">\n+ <div class=\"toolbar-item toolbar-item__profile\">\n<i class=\"fas fa-user mr-2\"></i>{{ labels['general.greeting'] }}\n- <ul class=\"toolbar--menu\">\n+ <ul class=\"toolbar-menu\">\n<li>\n<a :href=\"backend_prefix + 'profile-edit'\">{{ labels['action.edit_profile'] }}</a>\n</li>\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/init/_variables.scss",
"new_path": "assets/scss/init/_variables.scss",
"diff": "@@ -14,7 +14,7 @@ $big-z-index: 1000;\n$font-family-base: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n$headings-font-family: 'Source Sans Variable', sans-serif;\n-$font-size-base: 0.9rem;\n+$font-size-base: 1rem;\n$h1-font-size: $font-size-base * 2.5;\n$h2-font-size: $font-size-base * 2;\n@@ -78,18 +78,13 @@ $grid-breakpoints: (\nsm: 576px,\nmd: 768px,\nlg: 992px,\n- xl: 1200px\n+ xl: 1200px,\n+ wd: 1400px\n);\n// Modal Dialog spacing\n$modal-dialog-margin-y-sm-up: 4rem;\n-\n-.admin__sidebar {\n- background: rgb(42,57,70);\n- background: linear-gradient(-70deg, rgba(47,62,77,1) 50%, rgba(42,57,70,1) 50.5%);\n-}\n-\n:root {\n--background: #f3f5f7;\n--foreground: #FFF;\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/layout/_admin.scss",
"new_path": "assets/scss/layout/_admin.scss",
"diff": "// Note: Override for \"Wide content\" is below\n-$admin-toolbar-height: 36px;\n+$admin-toolbar-height: 40px;\n$admin-sidebar-width: 200px;\n+$admin-sidebar-width-wide: 250px;\n$admin-aside-width: 320px;\n$admin-header-height: 70px;\n@@ -13,28 +14,6 @@ $admin-header-height: 70px;\nmargin-top: $admin-toolbar-height;\nmin-height: inherit;\n- // Flexbox Fallback\n- display: flex;\n- flex-wrap: wrap;\n-\n- // Grid\n- /* stylelint-disable declaration-block-no-duplicate-properties */\n- display: grid;\n- /* stylelint-enable */\n- grid-template-rows: auto 1fr auto;\n- grid-template-columns: $admin-sidebar-width 1fr;\n- grid-template-areas:\n- \"sidebar header\"\n- \"sidebar body\";\n- // Slim Sidebar\n- &.is-slim {\n- grid-template-columns: $admin-sidebar-width / 3 1fr;\n-\n- &__sidebar {\n- flex: 0 0 $admin-sidebar-width / 3;\n- }\n- }\n-\n&__toolbar {\n-webkit-backface-visibility: hidden;\nposition: fixed;\n@@ -42,77 +21,82 @@ $admin-header-height: 70px;\nleft: 0;\nheight: $admin-toolbar-height;\nwidth: 100vw;\n- z-index: $big-z-index + 40;\n+ z-index: 5;\n}\n&__header {\n- display: flex;\n- grid-area: header;\n- position: relative;\n- padding: 1.5rem 0 0 0;\n-\n- .container {\npadding: 0;\n-\n- @include media-breakpoint-up(xl) {\n- max-width: 1240px;\n+ @include media-breakpoint-up(lg) {\n+ margin-left: $admin-sidebar-width;\n}\n+ @include media-breakpoint-up(wd) {\n+ margin-left: $admin-sidebar-width-wide;\n+ max-width: 100rem;\n}\n}\n&__sidebar {\n- flex: 0 0 $admin-sidebar-width;\n- grid-area: sidebar;\n+ position: absolute;\n+ z-index: 2;\n+ top: $admin-toolbar-height;\n+ left: 0;\n+ transition: all 200ms;\n+ width: auto;\n+ // the sidebar comes into view on larger screens\n+ @include media-breakpoint-up(lg) {\n+ left: 0;\n+ width: $admin-sidebar-width;\n}\n-\n- &__body {\n- flex: 1;\n- grid-area: body;\n- padding-top: 0;\n-\n- &.is-wide {\n- .admin__body--container {\n- grid-template-columns: auto;\n- grid-template-areas:\n- \"main\"\n- \"aside\";\n+ @include media-breakpoint-up(wd) {\n+ width: $admin-sidebar-width-wide;\n+ }\n+ &--is-collapsed {\n+ left: -100%;\n+ // the sidebar comes into view on larger screens, even on initially on smaller screens collapsed sidebar\n+ @include media-breakpoint-up(lg) {\n+ left: 0;\n+ }\n+ }\n+ &--is-expanded {\n+ left: 0;\n}\n}\n- > .container {\n- padding: 0;\n-\n- @include media-breakpoint-up(xl) {\n- max-width: 1240px;\n+ &__body {\n+ padding-top: 0;\n+ position: relative;\n+ z-index: 1;\n+ @include media-breakpoint-up(lg) {\n+ margin-left: $admin-sidebar-width;\n}\n+ @include media-breakpoint-up(wd) {\n+ margin-left: $admin-sidebar-width-wide;\n+ max-width: 100rem;\n}\n&--container {\n+ padding: $spacer;\ndisplay: grid;\n- grid-template-columns: auto $admin-aside-width;\n- grid-template-areas: \"main aside\";\n- padding: $spacer * 2;\n+ grid-template-columns: repeat(12, 1fr);\n+ grid-template-rows: auto;\n+ grid-column-gap: 1.25rem;\n+ @include media-breakpoint-up(wd) {\n+ grid-column-gap: 1.5rem;\n+ padding: $spacer $spacer*1.5;\n+ }\n+ * {\n+ grid-column: 1/-1;\n+ }\n}\n-\n&--main {\n- grid-area: main;\n- min-width: 0;\n- padding-right: $spacer * 2;\n+ @include media-breakpoint-up(xl) {\n+ grid-column: 1/9;\n}\n-\n- &--aside {\n- grid-area: aside;\n- width: $admin-aside-width;\n}\n+ &--aside {\n+ @include media-breakpoint-up(xl) {\n+ grid-column: 9/13;\n}\n}\n-\n-.widecontent {\n-\n- .admin__body--container {\n- display: grid;\n- grid-template-columns: auto 0;\n- grid-template-areas: \"main\";\n- padding: $spacer * 2;\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/admin/_header.scss",
"new_path": "assets/scss/modules/admin/_header.scss",
"diff": "justify-content: space-between;\nalign-items: center;\nheight: 100%;\n- padding: 0 $spacer * 2;\n+ padding: $spacer;\n+ position: relative;\n+ }\n+ &--togglebar {\n+ padding: $spacer;\n+ position: relative;\n+ }\n+}\n+\n+.admin-sidebar-toggler {\n+ position: absolute;\n+ z-index: 4;\n+ width: auto;\n+ top: 1.625rem;\n+ right: 1rem;\n+ border: 1px solid var(--primary);\n+ padding: 0.25rem 0.625rem;\n+ color: $white;\n+ background-color: var(--primary);\n+ @include media-breakpoint-up(lg) {\n+ display: none;\n+ }\n+ &:hover, &:active, &:focus {\n+ background-color: var(--background);\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/admin/_sidebar.scss",
"new_path": "assets/scss/modules/admin/_sidebar.scss",
"diff": "//** Admin | Sidebar\n.admin__sidebar {\n- position: relative;\n- z-index: $big-z-index + 10;\nbackground: var(--admin-sidebar);\ncolor: var(--admin-sidebar-text);\nheight: 100%;\n- // box-shadow: 0 0 40px 0 rgba(0,0,0, 0.07);\n+\n+ a {\n+ font-size: 0.9375rem;\n+ }\n+\n&--separator {\npadding: 0 $spacer;\nmargin: $spacer / 2 0;\n&--link {\nposition: relative;\nwidth: 100%;\n- padding: $spacer / 1.75 $spacer;\n+ padding: $spacer/1.75 $spacer*1.5 $spacer/1.75 $spacer;\ndisplay: block;\nfont-weight: $font-weight-semibold;\nletter-spacing: $letter-spacing;\ncolor: var(--admin-sidebar-text);\n- font-size: 95%;\n&:hover {\n@include darken(--admin-sidebar, 0.02);\nlist-style: none;\nvisibility: hidden;\n+ // display only on larger screens\n+ display: none;\n+ @media (min-width: 768px) {\n+ display: block;\n+ }\n+\nli {\n&.link--create {\nborder-bottom: dashed 1px rgba(0, 0, 0, 0.1);\n"
},
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/admin/_toolbar.scss",
"new_path": "assets/scss/modules/admin/_toolbar.scss",
"diff": "height: 100%;\nwidth: 100%;\ndisplay: flex;\n- font-size: 90%;\n- padding: 0 1rem 0 0;\n+ padding: 0;\n+ @include media-breakpoint-up(lg) {\n+ padding-right: 1rem;\n+ }\n&.is-dark {\ncolor: var(--admin-toolbar-text-light);\ncolor: var(--admin-toolbar-text-light);\n}\n- .toolbar--item.is-brand svg g {\n+ .toolbar-item__brand svg g {\nfill: var(--admin-toolbar-text-light);\n}\n}\ncolor: var(--admin-toolbar-text-dark);\n}\n- .toolbar--item.is-brand svg g {\n+ .toolbar-item__brand svg g {\nfill: var(--admin-toolbar-text-dark);\n}\n}\n}\n- .toolbar--item {\n+ .toolbar-item {\nposition: relative;\nheight: inherit;\ndisplay: flex;\nalign-items: center;\njustify-content: center;\n- padding: 0 $spacer;\n- opacity: 0.75;\n-\n- i {\n- font-size: 120%;\n- }\n+ padding: $spacer*0.8125 $spacer;\n+ font-size: 0.875rem;\na:hover {\ntext-decoration: none;\n}\n- &.is-brand {\n+ &__brand {\nsvg {\nheight: $admin-toolbar-height / 1.5;\nwidth: auto;\n}\n}\n- &.is-new,\n- &.is-profile {\n- .toolbar--menu {\n- left: auto;\n- right: 0;\n- }\n- }\n-\n- &.is-new {\n+ &__profile {\nmargin-left: auto;\n}\n- &.is-profile {\n- padding: 0 $spacer;\n+ &__new {\n+ display: none;\n+ @media screen and (min-width: 440px) {\n+ display: flex;\n+ }\n}\n&:hover {\n@include darken(--admin-toolbar, 0.2);\n- > .toolbar--menu {\n+ > .toolbar-menu {\nvisibility: visible;\nheight: auto;\n}\n}\n}\n- .toolbar--menu {\n+ .toolbar-menu {\n@include darken(--admin-toolbar, 0.2);\nfont-weight: $font-weight-normal;\n}\n}\n}\n+ .toolbar-item__profile {\n+ .toolbar-menu {\n+ left: auto;\n+ right: 0;\n+ }\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/_base/layout.html.twig",
"new_path": "templates/_base/layout.html.twig",
"diff": "<!-- Admin Header -->\n<header class=\"admin__header\">\n- <div class=\"container\">\n- <nav class=\"admin__header--topbar\">\n+ <div class=\"admin__header--topbar\">\n<h1 class=\"admin__header--title\">{{ block('title') }}</h1>\n- </nav>\n+ <button class=\"admin-sidebar-toggler btn btn-md\"><span class=\"sr-only\">Toggle </span>menu</button>\n</div>\n</header>\n<!-- End Admin Header -->\n<!-- Admin Main -->\n<div class=\"admin__body {% block container %}{% endblock %}\">\n- <div class=\"container\">\n{% block topsection %}\n{# insert stuff here that should _not_ be part of the\n</div>\n</div>\n</div>\n- </div>\n<!-- End Admin Main -->\n</div>\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/pages/dashboard.html.twig",
"new_path": "templates/pages/dashboard.html.twig",
"diff": "{% extends '@bolt/_base/layout.html.twig' %}\n{% block title %}\n- <i class='fas mr-2 fa-tachometer-alt'></i><strong>{{ 'caption.dashboard'|trans }}</strong>\n+ <i class='fas mr-2 fa-tachometer-alt'></i>{{ 'caption.dashboard'|trans }}\n{% endblock title %}\n{# This 'topsection' gets output _before_ the main form, allowing `dump()`, without breaking Vue #}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
redo of layout backend, making it responsive and mobile first. MVP for now
|
95,144 |
29.06.2019 16:49:29
| -7,200 |
4963fd8f35508c19ed9aeab520f54ab5db177603
|
Adding simple "menu" pages, for mobile
|
[
{
"change_type": "MODIFY",
"old_path": "assets/scss/init/_variables.scss",
"new_path": "assets/scss/init/_variables.scss",
"diff": "@@ -68,7 +68,7 @@ $success: #61A31F;\n$info: #17A2B8;\n$warning: #FFC107;\n$danger: #DB2427;\n-$light: #E8E8E8;\n+$light: #E0E0E0;\n$dark: #333;\n$disabled: #C8C8C8;\n"
},
{
"change_type": "MODIFY",
"old_path": "package-lock.json",
"new_path": "package-lock.json",
"diff": "},\n\"minimist\": {\n\"version\": \"1.2.0\",\n- \"resolved\": \"http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n\"integrity\": \"sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=\",\n\"dev\": true\n},\n},\n\"@types/strip-bom\": {\n\"version\": \"3.0.0\",\n- \"resolved\": \"http://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz\",\n\"integrity\": \"sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I=\",\n\"dev\": true\n},\n},\n\"array-equal\": {\n\"version\": \"1.0.0\",\n- \"resolved\": \"http://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz\",\n\"integrity\": \"sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=\",\n\"dev\": true\n},\n},\n\"babel-plugin-syntax-object-rest-spread\": {\n\"version\": \"6.13.0\",\n- \"resolved\": \"http://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz\",\n\"integrity\": \"sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=\",\n\"dev\": true\n},\n},\n\"load-json-file\": {\n\"version\": \"1.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz\",\n\"integrity\": \"sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=\",\n\"dev\": true,\n\"requires\": {\n},\n\"minimist\": {\n\"version\": \"1.2.0\",\n- \"resolved\": \"https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n\"integrity\": \"sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=\",\n\"dev\": true\n},\n\"dependencies\": {\n\"semver\": {\n\"version\": \"5.3.0\",\n- \"resolved\": \"https://registry.npmjs.org/semver/-/semver-5.3.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/semver/-/semver-5.3.0.tgz\",\n\"integrity\": \"sha1-myzl094C0XxgEq0yaqa00M9U+U8=\",\n\"dev\": true\n}\n\"dependencies\": {\n\"minimist\": {\n\"version\": \"1.2.0\",\n- \"resolved\": \"http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz\",\n\"integrity\": \"sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=\",\n\"dev\": true\n}\n},\n\"load-json-file\": {\n\"version\": \"1.1.0\",\n- \"resolved\": \"https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz\",\n\"integrity\": \"sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=\",\n\"dev\": true,\n\"requires\": {\n},\n\"os-locale\": {\n\"version\": \"1.4.0\",\n- \"resolved\": \"https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz\",\n+ \"resolved\": \"http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz\",\n\"integrity\": \"sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=\",\n\"dev\": true,\n\"requires\": {\n},\n\"through\": {\n\"version\": \"2.3.8\",\n- \"resolved\": \"http://registry.npmjs.org/through/-/through-2.3.8.tgz\",\n+ \"resolved\": \"https://registry.npmjs.org/through/-/through-2.3.8.tgz\",\n\"integrity\": \"sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=\",\n\"dev\": true\n},\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "src/Controller/Backend/MenuPageController.php",
"diff": "+<?php\n+\n+declare(strict_types=1);\n+\n+namespace Bolt\\Controller\\Backend;\n+\n+use Bolt\\Controller\\TwigAwareController;\n+use Sensio\\Bundle\\FrameworkExtraBundle\\Configuration\\Security;\n+use Symfony\\Component\\HttpFoundation\\Response;\n+use Symfony\\Component\\Routing\\Annotation\\Route;\n+\n+/**\n+ * @Security(\"has_role('ROLE_ADMIN')\")\n+ */\n+class MenuPageController extends TwigAwareController implements BackendZone\n+{\n+ /**\n+ * @Route(\"/menu/{slug}\", name=\"bolt_menupage\", methods={\"GET\"})\n+ */\n+ public function menuPage(string $slug): Response\n+ {\n+ $twigVars = [\n+ 'title' => ucfirst($slug),\n+ 'slug' => $slug,\n+ 'subtitle' => 'To show a number of different things, on one page',\n+ ];\n+\n+ return $this->renderTemplate('@bolt/pages/menupage.html.twig', $twigVars);\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "src/Menu/BackendMenuBuilder.php",
"new_path": "src/Menu/BackendMenuBuilder.php",
"diff": "@@ -99,10 +99,16 @@ final class BackendMenuBuilder implements BackendMenuBuilderInterface\n// Configuration submenu\n- $menu->addChild('Configuration', ['extras' => [\n+ $menu->addChild('Configuration', [\n+ 'uri' => $this->urlGenerator->generate('bolt_menupage', [\n+ 'slug' => 'configuration',\n+ ]),\n+ 'extras' => [\n'name' => $t->trans('caption.configuration'),\n'icon' => 'fa-sliders-h',\n- ]]);\n+ 'slug' => 'configuration',\n+ ],\n+ ]);\n$menu->getChild('Configuration')->addChild('Users & Permissions', [\n'uri' => $this->urlGenerator->generate('bolt_users'),\n@@ -178,10 +184,16 @@ final class BackendMenuBuilder implements BackendMenuBuilderInterface\n// Maintenance submenu\n- $menu->addChild('Maintenance', ['extras' => [\n+ $menu->addChild('Maintenance', [\n+ 'uri' => $this->urlGenerator->generate('bolt_menupage', [\n+ 'slug' => 'maintenance',\n+ ]),\n+ 'extras' => [\n'name' => $t->trans('caption.maintenance'),\n'icon' => 'fa-tools',\n- ]]);\n+ 'slug' => 'maintenance',\n+ ],\n+ ]);\n$menu->getChild('Maintenance')->addChild('Bolt API', [\n'uri' => $this->urlGenerator->generate('api_entrypoint'),\n@@ -258,10 +270,16 @@ final class BackendMenuBuilder implements BackendMenuBuilderInterface\n// File Management submenu\n- $menu->addChild('File Management', ['extras' => [\n+ $menu->addChild('File Management', [\n+ 'uri' => $this->urlGenerator->generate('bolt_menupage', [\n+ 'slug' => 'filemanagement',\n+ ]),\n+ 'extras' => [\n'name' => $t->trans('caption.file_management'),\n'icon' => 'fa-folder-open',\n- ]]);\n+ 'slug' => 'filemanagement',\n+ ],\n+ ]);\n$menu->getChild('File Management')->addChild('Uploaded files', [\n'uri' => $this->urlGenerator->generate('bolt_filemanager', ['location' => 'files']),\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/_macro/_macro.html.twig",
"new_path": "templates/_macro/_macro.html.twig",
"diff": "</button>\n{% endspaceless %}{% endmacro %}\n+\n+{% macro buttonlink(label = 'Button', link = '', icon = 'question-circle', class = 'tertiary', attr = []) %}{% spaceless %}\n+\n+ {% set label = label|trans %}\n+ {% set icon = icon|replace({'fa-': ''}) %}\n+ {% set class = class|replace({'btn-': ''}) %}\n+ {% set attr = attr %}\n+\n+ <a href=\"{{ link }}\" class=\"btn btn-{{ class }} mb-3\"\n+ {% for key,value in attr %} {{ key }}=\"{{value}}\"{% endfor %}>\n+ <i class=\"fas fa-fw fa-{{ icon }} mr-2\"></i>\n+ {{- label -}}\n+ </a>\n+\n+{% endspaceless %}{% endmacro %}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "templates/pages/menupage.html.twig",
"diff": "+{% extends '@bolt/_base/layout.html.twig' %}\n+{% import '@bolt/_macro/_macro.html.twig' as macro %}\n+\n+{% set menu = [] %}\n+{% for item in admin_menu() %}\n+ {% if item.slug == slug %}\n+ {% set menu = item %}\n+ {% endif %}\n+{% endfor %}\n+\n+{% block title %} <strong>{{ menu.name }}</strong>\n+{% endblock title %}\n+\n+{% block main %}\n+\n+ <p>\n+ {% for sub in menu.submenu %}\n+ {{ macro.buttonlink(sub.name, sub.editLink, sub.icon, 'light', {'style': 'width: 20em;'}) }} <br>\n+ {% endfor %}\n+ </p>\n+\n+{% endblock main %}\n+\n+{% block aside %}\n+\n+{% endblock %}\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Adding simple "menu" pages, for mobile
|
95,187 |
01.07.2019 18:08:28
| -7,200 |
4b80e2db46b77ec4d4cfeeb8c65d6b497592d2c5
|
Styling dropzone
|
[
{
"change_type": "MODIFY",
"old_path": "assets/scss/modules/editor/fields/_image.scss",
"new_path": "assets/scss/modules/editor/fields/_image.scss",
"diff": "width: 100%;\n}\n}\n+ &--dropzone {\n+ width: 100%;\n+ height: 100%;\n+ padding: 1rem;\n+ display: flex;\n+ align-items: center;\n+ justify-content: center;\n+ flex-direction: column;\n+ color: var(--primary);\n+ font-weight: bolder;\n+\n+ i {\n+ font-size: 3.5rem;\n+ margin: 2rem 0;\n+ color: transparentize($primary, 0.7);\n+ }\n+\n+ &.dz-drag-hover {\n+ background: transparentize($secondary, 0.15);\n+ color: var(--admin-toolbar-text-light);\n+\n+ i {\n+ color: var(--admin-toolbar-text-light);\n+ }\n+ }\n+\n+ }\n}\n.fade-enter-active,\n.fade-leave-to /* .fade-leave-active below version 2.1.8 */ {\nopacity: 0;\n}\n+\n"
},
{
"change_type": "MODIFY",
"old_path": "templates/finder/_uploader.html.twig",
"new_path": "templates/finder/_uploader.html.twig",
"diff": "<div class=\"card mb-4\">\n<div class=\"card-header\">{{ 'caption.file_uploader'|trans }}</div>\n- <form action=\"{{ path('bolt_async_upload', {'location': location, 'path': path}) }}\" method=\"POST\" class=\"dropzone\" style=\"width:200px; height:200px; border:1px dashed crimson\">\n+ <form action=\"{{ path('bolt_async_upload', {'location': location, 'path': path}) }}\" method=\"POST\" class=\"dropzone editor__image--dropzone\">\n+ <i class=\"fas fa-upload\"></i>\n<input type=\"hidden\" name=\"_csrf_token\" value=\"{{ csrf_token('upload') }}\">\n<div class=\"fallback\">\n<input name=\"file\" type=\"file\" multiple />\n"
}
] |
PHP
|
MIT License
|
bolt/core
|
Styling dropzone #463
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.