Skip to content

Commit

Permalink
Merge pull request #1649 from acquia/ACMS-1989
Browse files Browse the repository at this point in the history
ACMS-1989: Update admin theme in Acquia CMS to Gin.
  • Loading branch information
chandan-singh7929 authored Oct 19, 2023
2 parents 59786a3 + 7fcb19e commit 72f3cb4
Show file tree
Hide file tree
Showing 13 changed files with 180 additions and 96 deletions.
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
}
],
"require": {
"acquia/acquia-cms-starterkit": "^1.0",
"drupal/acquia_claro": "^1.3",
"acquia/acquia-cms-starterkit": "^1",
"drupal/acquia_cms_audio": "dev-develop",
"drupal/acquia_cms_component": "dev-develop",
"drupal/acquia_cms_dam": "dev-develop",
Expand All @@ -28,6 +27,7 @@
"drupal/acquia_cms_toolbar": "dev-develop",
"drupal/acquia_cms_tour": "dev-develop",
"drupal/consumer_image_styles": "^4.0",
"drupal/gin": "^3.0@RC",
"drupal/google_analytics": "^4.0",
"drupal/google_tag": "^2.0",
"drupal/honeypot": "^2.1",
Expand Down Expand Up @@ -129,6 +129,9 @@
"drupal/core": "-p2"
},
"patches": {
"acquia/acquia-cms-starterkit": {
"ACMS-1988 - Update admin theme in starterkit to Gin": "https://github.com/acquia/acquia-cms-starterkit/compare/develop...feature/admin-gin-theme.patch"
},
"acquia/cohesion": {
"ACO-2515 - Fix schema type mismatch error for global js settings": "https://gist.githubusercontent.com/rajeshreeputra/5648d31dafbf66d8a1895bb6964ed99a/raw/f5860cbfb7e5886bc7c0652c102cab337cb59e5a/sitestudio-7.3.1-schema-errors-for-cohesion.frontend.globaljs_setting.patch"
},
Expand Down
196 changes: 133 additions & 63 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions modules/acquia_cms_common/acquia_cms_common.install
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ function acquia_cms_common_install($is_syncing) {
'view media',
]);

// Enable acquia_claro theme.
$themesList = \Drupal::service('extension.list.theme')->getList();
$themesInstall = ["olivero"];
if (isset($themesList['acquia_claro'])) {
$themesInstall[] = "acquia_claro";
}
\Drupal::service('theme_installer')->install($themesInstall);
\Drupal::configFactory()->getEditable('system.theme')->set('default', 'olivero')->save();
if (in_array("acquia_claro", $themesInstall)) {
\Drupal::configFactory()->getEditable('system.theme')->set('admin', "acquia_claro")->save();
// Enable gin theme.
$themes_list = \Drupal::service('extension.list.theme')->getList();
$theme_installer = \Drupal::service('theme_installer');
$theme_installer->install(["olivero"]);
$system_theme_config = \Drupal::configFactory()->getEditable('system.theme');
$system_theme_config->set('default', 'olivero')->save();
if (isset($themes_list['gin'])) {
$theme_installer->install(["gin"]);
$system_theme_config->set('admin', "gin")->save();
}

// Re-write the content and media view on module install,
Expand Down
1 change: 0 additions & 1 deletion modules/acquia_cms_common/acquia_cms_common.module
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ function acquia_cms_common_modules_installed($modules, $is_syncing) {
* @see template_preprocess_maintenance_page()
*/
function acquia_cms_common_preprocess_maintenance_page(array &$variables) {
$variables['#attached']['library'][] = 'acquia_claro/install-page';
$acquia_cms_path = \Drupal::service('extension.list.module')->getPath('acquia_cms_common');
$variables['install_page_logo_path'] = '/' . $acquia_cms_path . '/acquia_cms.png';
}
Expand Down
6 changes: 3 additions & 3 deletions modules/acquia_cms_common/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
"enable-patching": true,
"patches": {
"drupal/core": {
"3301692 - Passing null to parameter to mb_strtolower() is deprecated with PHP 8.1": "https://git.drupalcode.org/project/drupal/-/merge_requests/2598.patch",
"296693 - Restrict access to empty top level administration pages": "https://www.drupal.org/files/issues/2023-08-31/296693-10.1.x_0.patch",
"3371005 - Toolbar does not indicate active menu trail for pages not included in Toolbar": "https://git.drupalcode.org/project/drupal/-/commit/3165269bb01a5a8e5f53c1f369135b967c9d5924.patch",
"3301692 - Passing null to parameter to mb_strtolower() is deprecated with PHP 8.1": "https://git.drupalcode.org/project/drupal/-/merge_requests/2598.patch",
"3347291: - Combine field storage and field instance forms": "https://www.drupal.org/files/issues/2023-09-13/10.1-3347291-combine-mega-e.patch",
"3370946 - Page title should contextualize the local navigation": "https://www.drupal.org/files/issues/2023-09-11/3370946-page-title-backport-10-1-x.patch",
"3347291: - Combine field storage and field instance forms": "https://www.drupal.org/files/issues/2023-09-13/10.1-3347291-combine-mega-e.patch"
"3371005 - Toolbar does not indicate active menu trail for pages not included in Toolbar": "https://git.drupalcode.org/project/drupal/-/commit/3165269bb01a5a8e5f53c1f369135b967c9d5924.patch"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@ public function deleteHeadlessUiPaths() {
*/
public function updateHeadlessUiConfig(bool $isEnabled = TRUE) {
if ($isEnabled) {
// Reset default theme to acquia_claro.
if ($this->themeHandler->themeExists('acquia_claro')) {
// Reset default theme to gin.
if ($this->themeHandler->themeExists('gin')) {
$this->configFactory
->getEditable('system.theme')
->set('default', 'acquia_claro')
->set('default', 'gin')
->save();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ public function testContentAdmin(): void {
// Node edit page.
$path = "node/$nid/edit";
$this->drupalGet($path);
$this->assertSession()->pageTextContains('Edit Test Headless Test Page');
$this->assertSession()->linkNotExists('View');
/** @var \Drupal\FunctionalJavascriptTests\JSWebAssert $assertSession */
$assertSession = $this->assertSession();
$assertSession->pageTextContains('Edit Test Headless Test Page');
$assertSession->linkNotExists('View');
$nodePageMenus = [
'API' => '/jsonapi/node/test/' . $node->uuid(),
'Edit' => '/node/' . $nid . '/edit',
'Preview' => '/node/' . $nid . '/site-preview',
'Delete' => '/node/' . $nid . '/delete',
'Revisions' => '/node/' . $nid . '/revisions',
'Clone' => '/entity_clone/node/' . $nid,
];
Expand All @@ -107,12 +108,19 @@ public function testContentAdmin(): void {
$this->assertCount(6, $menuList);
$menuOrder = [];
foreach ($menuList as $menu) {
$menuOrder[] = str_replace(' (active tab)', '', $menu->getText());
$tabTitle = str_replace(' (active tab)', '', $menu->getText());
if ($tabTitle) {
$menuOrder[] = $tabTitle;
}
}
// Assertion for menu order.
$this->assertEquals($menuOrder, array_keys($nodePageMenus));
// Assertion test for tabs of node page.
$this->assertTabMenus($nodePageMenus, $path);
// Assert delete buton.
$deleteButton = $assertSession->waitForElementVisible("css", "#edit-advanced #edit-gin-sidebar .form-actions a");
$this->assertEquals('Delete', $deleteButton->getText());
$this->assertEquals('/node/' . $nid . '/delete', $deleteButton->getAttribute('href'));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ public function testAcmsWizardMenu(): void {
$this->assertEquals('Headless dashboard', $headlessDashboard->getText());

// Test Enable headless mode checkbox functionality.
$headlessForm = $assertSession->elementExists('css', '#acquia-cms-headless-form');
$headlessForm = $assertSession->waitForElementVisible('css', '#acquia-cms-headless-form');
$assertSession->elementExists('css', '.claro-details__summary', $headlessForm)->press();
$assertSession->waitForElementVisible('css', '#acquia-cms-headless-form #edit-headless-mode');
$headlessForm->checkField('Enable Headless mode');
$headlessForm->pressButton('Save');

Expand Down
Loading

0 comments on commit 72f3cb4

Please sign in to comment.