Commit f6c56608 authored by alexpott's avatar alexpott

Issue #2337317 by LewisNyman, idebr, ngocketit: Replace help page layout CSS...

Issue #2337317 by LewisNyman, idebr, ngocketit: Replace help page layout CSS with reuseable layout classes
parent a24a858f
.help-items {
float: left; /* LTR */
width: 22%;
margin-right: 3%; /* LTR */
}
[dir="rtl"] .help-items {
float: right;
margin-right: 0;
margin-left: 3%;
}
.help-items-last {
margin-right: 0; /* LTR */
}
[dir="rtl"] .help-items-last {
margin-right: 0;
margin-left: 0;
}
/**
* Avoid text overlapping on a narrow viewport.
*/
@media screen and (max-width: 480px) {
.help-items {
float: none;
width: 100%;
margin: 0;
}
}
help:
version: VERSION
css:
component:
css/help.module.css: {}
...@@ -53,10 +53,8 @@ public static function create(ContainerInterface $container) { ...@@ -53,10 +53,8 @@ public static function create(ContainerInterface $container) {
*/ */
public function helpMain() { public function helpMain() {
$output = array( $output = array(
'#attached' => array( '#markup' => '<h2>' . $this->t('Help topics') . '</h2><p>' . $this->t('Help is available on the following items:') . '</p>',
'library' => ['help/help'], 'links' => $this->helpLinksAsList(),
),
'#markup' => '<h2>' . $this->t('Help topics') . '</h2><p>' . $this->t('Help is available on the following items:') . '</p>' . $this->helpLinksAsList(),
); );
return $output; return $output;
} }
...@@ -81,16 +79,27 @@ protected function helpLinksAsList() { ...@@ -81,16 +79,27 @@ protected function helpLinksAsList() {
// Output pretty four-column list. // Output pretty four-column list.
$count = count($modules); $count = count($modules);
$break = ceil($count / 4); $break = ceil($count / 4);
$output = '<div class="clearfix"><div class="help-items"><ul>'; $column = array(
'#type' => 'container',
'links' => array('#theme' => 'item_list'),
'#attributes' => array('class' => array('layout-column', 'quarter')),
);
$output = array(
'#prefix' => '<div class="clearfix">',
'#suffix' => '</div>',
0 => $column,
);
$i = 0; $i = 0;
$current_column = 0;
foreach ($modules as $module => $name) { foreach ($modules as $module => $name) {
$output .= '<li>' . $this->l($name, new Url('help.page', array('name' => $module))) . '</li>'; $output[$current_column]['links']['#items'][] = $this->l($name, new Url('help.page', array('name' => $module)));
if (($i + 1) % $break == 0 && ($i + 1) != $count) { if (($i + 1) % $break == 0 && ($i + 1) != $count) {
$output .= '</ul></div><div class="help-items' . ($i + 1 == $break * 3 ? ' help-items-last' : '') . '"><ul>'; $current_column++;
$output[$current_column] = $column;
} }
$i++; $i++;
} }
$output .= '</ul></div></div>';
return $output; return $output;
} }
......
...@@ -58,12 +58,9 @@ public function testHelp() { ...@@ -58,12 +58,9 @@ public function testHelp() {
$this->drupalLogin($this->anyUser); $this->drupalLogin($this->anyUser);
$this->verifyHelp(403); $this->verifyHelp(403);
// Check for css on admin/help. // Verify that introductory help text exists, goes for 100% module coverage.
$this->drupalLogin($this->adminUser); $this->drupalLogin($this->adminUser);
$this->drupalGet('admin/help'); $this->drupalGet('admin/help');
$this->assertRaw('help.module.css', 'The help.module.css file is present in the HTML.');
// Verify that introductory help text exists, goes for 100% module coverage.
$this->assertRaw(t('For more information, refer to the subjects listed in the Help Topics section or to the <a href="!docs">online documentation</a> and <a href="!support">support</a> pages at <a href="!drupal">drupal.org</a>.', array('!docs' => 'https://drupal.org/documentation', '!support' => 'https://drupal.org/support', '!drupal' => 'https://drupal.org')), 'Help intro text correctly appears.'); $this->assertRaw(t('For more information, refer to the subjects listed in the Help Topics section or to the <a href="!docs">online documentation</a> and <a href="!support">support</a> pages at <a href="!drupal">drupal.org</a>.', array('!docs' => 'https://drupal.org/documentation', '!support' => 'https://drupal.org/support', '!drupal' => 'https://drupal.org')), 'Help intro text correctly appears.');
// Verify that help topics text appears. // Verify that help topics text appears.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment