Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ngocketit’s picture

Assigned: Unassigned » ngocketit
ngocketit’s picture

Assigned: ngocketit » Unassigned
Status: Active » Needs review
FileSize
1.7 KB

Patch added.

Status: Needs review » Needs work
ngocketit’s picture

Assigned: Unassigned » ngocketit
ngocketit’s picture

Assigned: ngocketit » Unassigned
Status: Needs work » Needs review
FileSize
1.71 KB

Re-rolled.

LewisNyman’s picture

Status: Needs review » Needs work
FileSize
490.6 KB
489.75 KB

Thanks, one small thing. We don't actually need the layout-container class here. It indents everything slightly:

BEFORE:

AFTER:

ngocketit’s picture

Status: Needs work » Needs review
FileSize
1.69 KB

Thanks @LewisNyman for pointing that out! I attached a new patch which fixes that.

LewisNyman’s picture

Looks perfect! A tiny shift in layout now but that's consistency for you ;-)

BEFORE:

AFTER:

LewisNyman’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

Status: Needs work » Needs review
herom’s picture

Status: Needs review » Reviewed & tested by the community

HEAD was broken. back to rtbc.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

But this means that the help screen only looks good in seven since the quarter class only exists in seven's layout.css

LewisNyman’s picture

@alexpott Ok thanks, if that's the aim then we can move forward on #2298821: Move generic layout styling into system.admin.css

LewisNyman’s picture

Status: Needs work » Reviewed & tested by the community
webchick’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs manual testing

Since this is changing module CSS, can we also get testing in e.g. Stark/Bartik in addition to Seven?

Status: Needs review » Needs work
jhodgdon’s picture

This patch is going to conflict with #2351991: Add a config entity for a configurable, topic-based help system, and on that patch, I was asked to use an inline template... maybe we should combine forces?

jhodgdon’s picture

jhodgdon’s picture

The other issue #2351991: Add a config entity for a configurable, topic-based help system has been postponed to 8.1.x. So we should move forward with this one ASAP.

So... The other thing is that on #2351991: Add a config entity for a configurable, topic-based help system I was asked for that patch (which I did) to use an inline template for building the help page. Should we combine that idea with this issue? It affects the same area of the code. Or, we could use a real template for it, which would probably be even better?

The part of the patch on that issue that does this is in HelpController::helpMain()... We would need to do something like this:

-      '#markup' => '<h2>' . $this->t('Help topics') . '</h2><p>' . $this->t('Help is available on the following items:') . '</p>' . $this->helpLinksAsList(),
     );
+
+    $template = '<h2>{{ title }}</h2><p>{{ header }}</p>{{ links }}';
+
+    $output['modules'] = array(
+      '#type' => 'inline_template',
+      '#template' => $template,
+      '#context' => array(
+        'title' => $this->t('Help topics'),
+        'header' => $this->t('Help is available for the following modules:'),
+        'links' => array('#markup' => $this->helpLinksAsList()),
+      ),
+    );

And then in helpLinksAsList() we would need to do something like this:

-        $modules[$module] = $module_info[$module]->info['name'];
+        $modules[$module] = array(
+          'title' => $module_info[$module]->info['name'],
+          'url' => new Url('help.page', array('name' => $module)),
+        );
       }

and then one other section below:

-    foreach ($modules as $module => $name) {
-      $output .= '<li>' . $this->l($name, new Url('help.page', array('name' => $module))) . '</li>';
+    foreach ($modules as $info) {
+      $output .= '<li>' . $this->l($info['title'], $info['url']) . '</li>';

This seems related to "making the help page more standardized" but if you think it should be a separate issue, we can do that too.

LewisNyman’s picture

Issue tags: +Needs reroll

@jhodgdon I'm happy to merge efforts here, but #2351991: Add a config entity for a configurable, topic-based help system looks like a big patch. It might be better to keep these objectives separate to make it them more achievable. The current patch in this issue is dead simple. Happy to reroll either issue.

jhodgdon’s picture

Yeah the other issue got postponed, and it does a lot more.

So... Let's step back a bit. The Help page (with or without the new topic entities) has a section that makes a 4-column list (on wide browsers, which hopefully degrades smoothly to a two-column then one-column list in narrower browsers; I think that works).

It is currently doing that in HelpController::helpLinksAsList() by making straight markup: it outputs

<div class="clearfix"><div class="help-items"><ul>

then iterates through the list of modules, outputting a <li></li> for each one, and after each 25% of the list is over, it outputs

</ul></div><div class="help-items-2"><ul>

(changing that div class to help-items-3 and help-items-last for the other two columns). And then it closes the UL and DIVs at the end.

So. This is bad -- a Controller should be returning render arrays, not HTML. As one step towards making it slightly better, as one small part of the patch on #2351991: Add a config entity for a configurable, topic-based help system, I was asked to use an in-line template, which I did (see comment #20 above on this issue).

IMO a better fix would be to define something like a "four-column-item-list" #theme or #type, and use that, rather than just moving the CSS to something more generic like what this patch does. This patch doesn't change the fact that the Help Controller is outputting its own HTML and the theme cannot change it in any way.

Thoughts? If that is too out of scope, then this change seems like a fine idea, but ... it just doesn't go very far towards fixing the underlying badness of the Help module's rendering here.

And don't worry about any rerolls on the other issue. It's been moved to a contrib module for the time being and if we do something here I'll apply the changes there.

LewisNyman’s picture

hmm we could do that, I guess we should create a #type for item list? I still think we should use the generic admin CSS, we don't want core or contrib modules to have to manage their own layout CSS, it would be a pain to keep them consistent.

jhodgdon’s picture

Hm. We have a type for item list. Maybe it can have an added option for 4-column?

LewisNyman’s picture

I think the scope of the issue may of got a little overloaded. How about we move the inline markup vs template into a a follow up issue? It's easy for me to write CSS and add classes, this issue can be a quicker win.

jhodgdon’s picture

Issue summary: View changes

What CSS fix are you advocating? Could we at least make each of the 4 columns into a render array with #theme = 'item-list' instead of having the code output literally the UL and LI tags, which is horrible?

idebr’s picture

@jhodgdon I agree with you a new '#type' => 'columns' render element would be ideal, but I think you will agree that is out of scope for this issue :). Basically this issue is just a followup for #2017257: Create generic layout classes to apply the generic css classes to the Help module. Let's keep this issue focused on that target to make the css in core more maintainable.

I took at a look at your patch in #110 of #2351991: Add a config entity for a configurable, topic-based help system and there is indeed an of overlap in HelpController::helpLinksAsList() and HelpController::helpMain(). I rewrote the hard coded html to a renderable array, albeit not a very pretty one, that should be easy to merge into #2351991: Add a config entity for a configurable, topic-based help system. I'll go have a look around to see if there is any effort going to create a 'columns' type of element to make this type of display easier to create in the future.

LewisNyman’s picture

Status: Needs review » Needs work
FileSize
773.14 KB

Basically this issue is just a followup for #2017257: Create generic layout classes to apply the generic css classes to the Help module. Let's keep this issue focused on that target to make the css in core more maintainable.

Yep. Exactly. I'm not saying that we shouldn't fix the way the markup is generated but I think we should split them.

I noticed that a class of just an underscore is being added to the li's. This doesn't happen in HEAD.

jhodgdon’s picture

I don't get it. I was suggesting that the code to generate the link list be changed to at least use theme item list or something like that, was told it's out of scope, but that's what this patch does. Thanks! It's at least not so horrible as it was. :)

idebr’s picture

What can I say, I aim to please :)

I'm not sure on the way forward regarding the <li class="_"> @LewisNyman mentioned in #28. I expected different markup from the renderable array. I opened a new issue at #2402165: #theme => 'links' renders <li class="_"> when the #links array is not associative to see what is up.

jhodgdon’s picture

Yeah. Good job reporting that other issue... will comment there. But according to template_preprocess_links(), #links is supposed to be an associative array, so probably we should make it one.

idebr’s picture

Status: Needs work » Needs review
FileSize
1.14 KB
2.61 KB

I swapped '#theme' => 'links' with '#theme' => 'item_list' for now, since it generates less markup. Quite ironic since the reason #theme => links was invented in the first place was to reduce markup..

jhodgdon’s picture

Well, that's at least no worse than the current code it is replacing!

I haven't tried it out to see if the classes/markup are OK.

LewisNyman’s picture

Issue tags: -Needs manual testing
FileSize
527.79 KB
1.07 KB
2.97 KB

The markup looks good to me. I noticed that we are deleting all the CSS which means we can remove the file and the libraries.yml. We should be good to go.

Status: Needs review » Needs work

The last submitted patch, 34: 2337317-34.patch, failed testing.

LewisNyman’s picture

Status: Needs work » Needs review
FileSize
1.02 KB
3.99 KB

Status: Needs review » Needs work

The last submitted patch, 36: 2337317-36.patch, failed testing.

Status: Needs work » Needs review

LewisNyman queued 36: 2337317-36.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 36: 2337317-36.patch, failed testing.

LewisNyman’s picture

FileSize
916 bytes
4.12 KB

I think i removed too much.

LewisNyman’s picture

Status: Needs work » Needs review
jhodgdon’s picture

Code looks good... Has someone verified that this still works on different-width browsers?

LewisNyman’s picture

Yep, the layout classes are responsive:

jhodgdon’s picture

Thanks! It looks like this satisfies the goals of the issue, and the code is at least no worse than what is currently in help.module. I think we should commit it. But before we do we need a Beta Evaluation added to the issue summary.
https://www.drupal.org/contribute/core/beta-changes

LewisNyman’s picture

Issue summary: View changes

Done

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Great! Should be ready to go then.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed f6c5660 and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation to the issue summary.

  • alexpott committed f6c5660 on
    Issue #2337317 by LewisNyman, idebr, ngocketit: Replace help page layout...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.