From 2df41ea2db5b3954f3efc7795f729d09db706003 Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Tue, 7 Sep 2021 11:27:49 +0200 Subject: [PATCH 01/11] OEL-453: New submodule oe_whitelabel_authentication. --- composer.json | 1 + .../oe_whitelabel_authentication.info.yml | 7 +++++++ runner.yml.dist | 1 + 3 files changed, 9 insertions(+) create mode 100644 modules/oe_whitelabel_authentication/oe_whitelabel_authentication.info.yml diff --git a/composer.json b/composer.json index 514f5b71..6a378eba 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,7 @@ "drupal/ui_patterns": "^1.0", "drupal/ui_patterns_settings": "^1.0", "openeuropa/oe_bootstrap_theme": "1.x-dev", + "openeuropa/oe_authentication": "^1.4", "php": ">=7.3" }, "require-dev": { diff --git a/modules/oe_whitelabel_authentication/oe_whitelabel_authentication.info.yml b/modules/oe_whitelabel_authentication/oe_whitelabel_authentication.info.yml new file mode 100644 index 00000000..c65f4f11 --- /dev/null +++ b/modules/oe_whitelabel_authentication/oe_whitelabel_authentication.info.yml @@ -0,0 +1,7 @@ +name: OpenEuropa Whitelabel Authentication +type: module +description: The OpenEuropa Whitelabel autentication integration. +package: OpenEuropa Whitelabel Theme +core_version_requirement: ^8.9 || ^9.1 +dependencies: + - openeuropa:oe_authentication diff --git a/runner.yml.dist b/runner.yml.dist index bcd124d0..457b7903 100644 --- a/runner.yml.dist +++ b/runner.yml.dist @@ -14,6 +14,7 @@ drupal: # Prepare the instance. - "./vendor/bin/drush en ui_patterns ui_patterns_library ui_patterns_settings components -y" - "./vendor/bin/drush en field_ui -y" + - "./vendor/bin/drush en oe_whitelabel_authentication -y" - "./vendor/bin/drush en toolbar -y" - "./vendor/bin/drush theme:enable oe_whitelabel -y" - "./vendor/bin/drush theme:enable seven -y" -- GitLab From f70332deadfc98d522305bdb2183fb005f3a4b4e Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Tue, 7 Sep 2021 16:45:32 +0200 Subject: [PATCH 02/11] OEL-453: Updating node working folder to point to oe_bootstrap_theme. --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 5f4a4fa9..93ad2689 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,7 @@ services: - NODE_ENV=${NODE_ENV} - SHELL=bash volumes: - - ./:/home/node/app + - ./build/themes/contrib/oe_bootstrap_theme:/home/node/app command: "sleep infinity" #### Mac users: uncomment the "volumes" key to enable the NFS file sharing. You can find more information about Docker for Mac here: https://github.com/openeuropa/openeuropa/blob/master/docs/starting/tooling.md#using-docker-on-macos -- GitLab From 932667d6b82748cb1d209b73961f1149981b54d3 Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Tue, 7 Sep 2021 16:53:17 +0200 Subject: [PATCH 03/11] OEL-453: Updating npm at README. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c2c3afad..116ccb36 100644 --- a/README.md +++ b/README.md @@ -108,10 +108,10 @@ docker-compose up -d Then: ```bash -docker-compose exec -u node node npm install -docker-compose exec -u node node npm run build docker-compose exec web composer install docker-compose exec web ./vendor/bin/run drupal:site-install +docker-compose exec -u node node npm install +docker-compose exec -u node node npm run production ``` Using default configuration, the development site files should be available in the `build` directory and the development site should be available at: [http://127.0.0.1:8080/build](http://127.0.0.1:8080/build). -- GitLab From 2f3a615834cf1e5c467af8b34b14e77af2b1d910 Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Tue, 7 Sep 2021 23:41:51 +0200 Subject: [PATCH 04/11] OEL-453: Revert modify node image volumes to get assets. --- README.md | 4 ++-- docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 116ccb36..c2c3afad 100644 --- a/README.md +++ b/README.md @@ -108,10 +108,10 @@ docker-compose up -d Then: ```bash +docker-compose exec -u node node npm install +docker-compose exec -u node node npm run build docker-compose exec web composer install docker-compose exec web ./vendor/bin/run drupal:site-install -docker-compose exec -u node node npm install -docker-compose exec -u node node npm run production ``` Using default configuration, the development site files should be available in the `build` directory and the development site should be available at: [http://127.0.0.1:8080/build](http://127.0.0.1:8080/build). diff --git a/docker-compose.yml b/docker-compose.yml index 93ad2689..5f4a4fa9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,7 @@ services: - NODE_ENV=${NODE_ENV} - SHELL=bash volumes: - - ./build/themes/contrib/oe_bootstrap_theme:/home/node/app + - ./:/home/node/app command: "sleep infinity" #### Mac users: uncomment the "volumes" key to enable the NFS file sharing. You can find more information about Docker for Mac here: https://github.com/openeuropa/openeuropa/blob/master/docs/starting/tooling.md#using-docker-on-macos -- GitLab From fc91e9ff6cca3f77abfb3f8767b82c855ef48d3a Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Tue, 7 Sep 2021 23:42:29 +0200 Subject: [PATCH 05/11] OEL-453: Login block overriden. Missing icon pattern. --- .../navigation/block--oe-authentication-login_block.html.twig | 1 + 1 file changed, 1 insertion(+) create mode 100644 templates/overrides/navigation/block--oe-authentication-login_block.html.twig diff --git a/templates/overrides/navigation/block--oe-authentication-login_block.html.twig b/templates/overrides/navigation/block--oe-authentication-login_block.html.twig new file mode 100644 index 00000000..fbf9f117 --- /dev/null +++ b/templates/overrides/navigation/block--oe-authentication-login_block.html.twig @@ -0,0 +1 @@ +icon {{ content }} -- GitLab From 22dbbd4f847e7597820e69596244745561428bfb Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Wed, 8 Sep 2021 12:37:54 +0200 Subject: [PATCH 06/11] OEL-453: Login block with icon. --- .../block--oe-authentication-login_block.html.twig | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/templates/overrides/navigation/block--oe-authentication-login_block.html.twig b/templates/overrides/navigation/block--oe-authentication-login_block.html.twig index fbf9f117..021a33f0 100644 --- a/templates/overrides/navigation/block--oe-authentication-login_block.html.twig +++ b/templates/overrides/navigation/block--oe-authentication-login_block.html.twig @@ -1 +1,11 @@ -icon {{ content }} +{# +/** + * @file + * icon. + */ +#} +{% include '@oe-bcl/bcl-icon/icon.html.twig' with { + 'name': 'person-fill', + 'path': bcl_icon_path, + 'size': 'm', +} %} {{ content }} -- GitLab From 28913cc60ce4b33eaa47b469377b85a25f6ad7a1 Mon Sep 17 00:00:00 2001 From: escuriola <escuriola@gmail.com> Date: Wed, 8 Sep 2021 16:57:42 +0200 Subject: [PATCH 07/11] OEL-453: Authentication Block Test. --- tests/src/Kernel/AuthenticationBlockTest.php | 75 ++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 tests/src/Kernel/AuthenticationBlockTest.php diff --git a/tests/src/Kernel/AuthenticationBlockTest.php b/tests/src/Kernel/AuthenticationBlockTest.php new file mode 100644 index 00000000..1d3731db --- /dev/null +++ b/tests/src/Kernel/AuthenticationBlockTest.php @@ -0,0 +1,75 @@ +<?php + +declare(strict_types = 1); + +namespace Drupal\Tests\oe_whitelabel\Kernel; + +use Drupal\KernelTests\KernelTestBase; +use Symfony\Component\DomCrawler\Crawler; + +/** + * Tests the Site Branding Block rendering. + */ +class AuthenticationBlockTest extends KernelTestBase { + + /** + * {@inheritdoc} + */ + protected static $modules = [ + 'block', + 'cas', + 'components', + 'externalauth', + 'oe_authentication', + 'ui_patterns', + 'ui_patterns_library', + 'user', + 'system', + ]; + + /** + * {@inheritdoc} + */ + protected function setUp(): void { + parent::setUp(); + /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */ + \Drupal::service('theme_installer')->install(['oe_whitelabel']); + + \Drupal::configFactory() + ->getEditable('system.theme') + ->set('default', 'oe_whitelabel') + ->save(); + $this->container->set('theme.registry', NULL); + + $this->container->get('cache.render')->deleteAll(); + } + + /** + * Tests the rendering of blocks. + */ + public function testBlockRendering(): void { + $entity_type_manager = $this->container + ->get('entity_type.manager') + ->getStorage('block'); + $entity = $entity_type_manager->create([ + 'id' => 'euloginlinkblock', + 'theme' => 'oe_whitelabel', + 'plugin' => 'oe_authentication_login_block', + 'settings' => [ + 'id' => 'oe_authentication_login_block', + 'label' => 'EU Login Link Block', + 'provider' => 'oe_authentication', + 'label_display' => '0', + ], + ]); + $entity->save(); + $builder = \Drupal::entityTypeManager()->getViewBuilder('block'); + $build = $builder->view($entity, 'block'); + $render = $this->container->get('renderer')->renderRoot($build); + $crawler = new Crawler($render->__toString()); + + $actual = $crawler->filter('#block-euloginlinkblock'); + $this->assertCount(1, $actual); + } + +} -- GitLab From 06b2313182b24326f5f71aec46bb8e41fbf1edf3 Mon Sep 17 00:00:00 2001 From: drishu <aszilagyi@live.com> Date: Fri, 10 Sep 2021 08:03:23 +0000 Subject: [PATCH 08/11] OEL-453: Check more markup in test. --- .../oe_whitelabel_authentication.info.yml | 7 ------- tests/src/Kernel/AuthenticationBlockTest.php | 11 +++++++++-- 2 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 modules/oe_whitelabel_authentication/oe_whitelabel_authentication.info.yml diff --git a/modules/oe_whitelabel_authentication/oe_whitelabel_authentication.info.yml b/modules/oe_whitelabel_authentication/oe_whitelabel_authentication.info.yml deleted file mode 100644 index c65f4f11..00000000 --- a/modules/oe_whitelabel_authentication/oe_whitelabel_authentication.info.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: OpenEuropa Whitelabel Authentication -type: module -description: The OpenEuropa Whitelabel autentication integration. -package: OpenEuropa Whitelabel Theme -core_version_requirement: ^8.9 || ^9.1 -dependencies: - - openeuropa:oe_authentication diff --git a/tests/src/Kernel/AuthenticationBlockTest.php b/tests/src/Kernel/AuthenticationBlockTest.php index 1d3731db..c5368076 100644 --- a/tests/src/Kernel/AuthenticationBlockTest.php +++ b/tests/src/Kernel/AuthenticationBlockTest.php @@ -8,7 +8,7 @@ use Drupal\KernelTests\KernelTestBase; use Symfony\Component\DomCrawler\Crawler; /** - * Tests the Site Branding Block rendering. + * Tests the OE Authentication LoginBlock rendering. */ class AuthenticationBlockTest extends KernelTestBase { @@ -39,8 +39,8 @@ class AuthenticationBlockTest extends KernelTestBase { ->getEditable('system.theme') ->set('default', 'oe_whitelabel') ->save(); - $this->container->set('theme.registry', NULL); + $this->container->set('theme.registry', NULL); $this->container->get('cache.render')->deleteAll(); } @@ -70,6 +70,13 @@ class AuthenticationBlockTest extends KernelTestBase { $actual = $crawler->filter('#block-euloginlinkblock'); $this->assertCount(1, $actual); + $icon = $actual->filter('svg'); + $this->assertSame('bi icon--m', $icon->attr('class')); + $use = $icon->filter('use'); + $expected = '/themes/contrib/oe_bootstrap_theme/assets/icons/bootstrap-icons.svg#person-fill'; + $this->assertSame($expected, $use->attr('xlink:href')); + $link = $crawler->filter('a'); + $this->assertSame('Log in', $link->text()); } } -- GitLab From 26b522a5aba8e078e2b644e725882965c9240c70 Mon Sep 17 00:00:00 2001 From: drishu <aszilagyi@live.com> Date: Fri, 10 Sep 2021 15:27:38 +0000 Subject: [PATCH 09/11] OEL-453: Enable helper and add auth as dependency. --- modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml | 2 ++ runner.yml.dist | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml b/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml index eaccccff..bcbfac25 100644 --- a/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml +++ b/modules/oe_whitelabel_helper/oe_whitelabel_helper.info.yml @@ -3,3 +3,5 @@ type: module description: OpenEuropa Whitelabel Theme helpers and tools. package: OpenEuropa Whitelabel Theme core_version_requirement: ^8.9 || ^9.1 +dependencies: + - openeuropa:oe_authentication diff --git a/runner.yml.dist b/runner.yml.dist index 457b7903..8e145100 100644 --- a/runner.yml.dist +++ b/runner.yml.dist @@ -14,9 +14,9 @@ drupal: # Prepare the instance. - "./vendor/bin/drush en ui_patterns ui_patterns_library ui_patterns_settings components -y" - "./vendor/bin/drush en field_ui -y" - - "./vendor/bin/drush en oe_whitelabel_authentication -y" - "./vendor/bin/drush en toolbar -y" - "./vendor/bin/drush theme:enable oe_whitelabel -y" + - "./vendor/bin/drush en oe_whitelabel_helper -y" - "./vendor/bin/drush theme:enable seven -y" - "./vendor/bin/drush config-set system.theme default oe_whitelabel -y" - "./vendor/bin/drush config-set system.theme admin seven -y" -- GitLab From 154d2211e49a0dd7cdf1b20599f5c065b7d2243c Mon Sep 17 00:00:00 2001 From: drishu <aszilagyi@live.com> Date: Fri, 10 Sep 2021 15:41:53 +0000 Subject: [PATCH 10/11] OEL-453: Use static string for filepath. --- tests/src/Kernel/SiteBrandingBlockTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Kernel/SiteBrandingBlockTest.php b/tests/src/Kernel/SiteBrandingBlockTest.php index 2cddf783..c606ac93 100644 --- a/tests/src/Kernel/SiteBrandingBlockTest.php +++ b/tests/src/Kernel/SiteBrandingBlockTest.php @@ -81,7 +81,7 @@ class SiteBrandingBlockTest extends KernelTestBase { $this->assertCount(1, $actual); $logo = $actual->filter('img'); $this->assertCount(1, $logo); - $expected = '/' . drupal_get_path('theme', 'oe_whitelabel') . '/logo.svg'; + $expected = '/themes/custom/oe_whitelabel/logo.svg'; $this->assertSame($expected, $logo->attr('src')); } -- GitLab From c37d24b5b30150de48a385fcb2bb159da254eb7c Mon Sep 17 00:00:00 2001 From: drishu <aszilagyi@live.com> Date: Fri, 10 Sep 2021 15:51:26 +0000 Subject: [PATCH 11/11] OEL-453: Use relesae to have bcl components loaded. --- composer.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6a378eba..8d3b0471 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "drupal/core": "^8.9 || ^9.1", "drupal/ui_patterns": "^1.0", "drupal/ui_patterns_settings": "^1.0", - "openeuropa/oe_bootstrap_theme": "1.x-dev", + "openeuropa/oe_bootstrap_theme": "0.100920211846", "openeuropa/oe_authentication": "^1.4", "php": ">=7.3" }, @@ -21,6 +21,7 @@ "drupal/drupal-extension": "~4.1", "drush/drush": "^10.3", "openeuropa/code-review": "1.6", + "openeuropa/composer-artifacts": "~0.1", "openeuropa/drupal-core-require-dev": "^8.9 || ^9.1", "openeuropa/task-runner-drupal-project-symlink": "^1.0", "phpspec/prophecy-phpunit": "^1 || ^2" @@ -38,6 +39,14 @@ "extra": { "composer-exit-on-patch-failure": true, "enable-patching": true, + "artifacts": { + "openeuropa/oe_bootstrap_theme": { + "dist": { + "url": "https://github.com/{name}/releases/download/{pretty-version}/{project-name}-{pretty-version}.tar.gz", + "type": "tar" + } + } + }, "drupal-scaffold": { "locations": { "web-root": "./build" -- GitLab