Follow up for #238 in #1833022-238: Only display interface language detection options to customize more granularity

Problem/Motivation

On: admin/config/regional/language/detection

@Dries

I think we can improve the section titles and whitespace to make things look more like sections. For example, the title 'Content language detection' is kinda small-ish and doesn't help me understand the structure of the page. I can't really put my finger on it, but there is something about the design/layout/style that still doesn't make it 100% intuitive and clear

Steps to test

Try it with and without content translation enabled.

  1. Navigate to the modules page
  2. Enable the 'Content Translation' and 'Interface Translation' modules
  3. Navigate to 'admin/config/regional/language/detection'

Proposed resolution

Add more spacing below each section (except the last one). @Bojhan et. al. discussed (in person in Prague) making the titles bigger, but that is a pattern *not* used elsewhere and would have looked out of place.

Remaining tasks

Commit.

User interface changes

API changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jeanfei’s picture

I've take screenshots of the detection an selection admin page.

1. Without content translation enabled

2033959-without-content-translation.jpg

2. With content translation enabled

2033959-with-content-translation.jpg

3. With content translation enabled - 'Customize Content language' option checked

2033959-with-content-translation-2.jpg

borisbaldinger’s picture

Assigned: Unassigned » borisbaldinger
Status: Active » Needs review
FileSize
1.85 KB

After i talked to Gabor and Boyan, i just added a margin at the bottom of the table-group.
For the last element I had to add a "last"-class to remove the margin bottom right before the save button.
This one needs now a usability review.

seutje’s picture

Issue tags: -JavaScript

No javamascripts to review...

seutje’s picture

No JavamaScripts to review...

Gábor Hojtsy’s picture

Status: Needs review » Needs work
Issue tags: +JavaScript
  1. +++ b/core/modules/language/language.admin.inc
    @@ -176,9 +176,14 @@ function language_negotiation_configure_form_table(&$form, $type) {
    +  $lastitem = end($form['#language_types']);
    ...
    +    if ($type === $lastitem) {
    

    We don't usually do naming like this. We instead usually write words separately. So $last_item.

  2. +++ b/core/modules/language/language.admin.inc
    @@ -176,9 +176,14 @@ function language_negotiation_configure_form_table(&$form, $type) {
    +    $last = "";
    ...
    +      $last = " last";
    
    @@ -225,7 +230,7 @@ function theme_language_negotiation_configure_form($variables) {
    +    $output .= '<div class="form-item table-language-group table-' . $type . '-wrapper' . $last . '">' . $title . $description . $table . '</div>';
    

    IMHO instead of having a separate 'last' variable, have a $classes variable and initialize it above with the string that is already here, and append the 'last' class as needed. That keeps all classes together nicely?

Also needs screenshots (again :) about the solution now.

Gábor Hojtsy’s picture

Issue tags: -JavaScript

Cross-post.

borisbaldinger’s picture

borisbaldinger’s picture

Changed the code as proposed.

Screenshots redone also.

1. With Content Translation enabled and checkbox checked
With Content Translation and checkbox checked

2. With Content Translation enabled
With Content Translation enabled

3. Without Content Translation
Without content translation

borisbaldinger’s picture

Added Patch from #8 because it was ignored in the post before.

borisbaldinger’s picture

Status: Needs work » Needs review
FileSize
1.88 KB

Added the same patch from #8 again because there it was ignored....

Gábor Hojtsy’s picture

Looks almost perfect. Only one thing:

+++ b/core/modules/language/language.admin.inc
@@ -225,7 +230,7 @@ function theme_language_negotiation_configure_form($variables) {
+    $output .= '<div class="' . implode(' ',$classes) . '">' . $title . $description . $table . '</div>';

Coding style issue there :) Add a space after the comma.

No need to update screenshots for this, just the patch :)

Gábor Hojtsy’s picture

Issue tags: +sprint
borisbaldinger’s picture

Fixed the coding standard issue.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

This was @Bojhan approved [TM] in person, and otherwise looks good as well, so let's get it in :)

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/language/language.admin.inc
@@ -176,9 +176,14 @@ function language_negotiation_configure_form_table(&$form, $type) {
+    $classes = array("form-item table-language-group", "table-' . $type . '-wrapper");

This isn't quite right. It is resulting in css like <div class="form-item table-language-group table-' . language_content . '-wrapper last">. It should be $classes = array('form-item table-language-group', 'table-' . $type . '-wrapper'); - just replace the all the double quotes with single quotes.

+++ b/core/themes/seven/style.css
@@ -1856,3 +1856,12 @@ details.fieldset-no-legend {
+/* Admin specific theming */

This comment is way too vague... a lot of the css in this file is admin specific theming! Let's embrace the pattern set by the other sections and call this /* Language UI */ or /* Language Admin UI */.

Also whilst reviewing the patch I was wondering if there was a way to do this only with css selectors and no php.

borisbaldinger’s picture

I can do the codechanges with doubleqoutes and single quotes and the Comment.
But i think the PHP is needed because every module has the possibility to add another table. And in order to support older browsers we need a specific identificator for the last item.

Gábor Hojtsy’s picture

+++ b/core/modules/language/language.admin.inc
@@ -176,9 +176,14 @@ function language_negotiation_configure_form_table(&$form, $type) {
+    $classes = array("form-item table-language-group", "table-' . $type . '-wrapper");

Use single quotes for all the strings, then the concatenation will fix itself :)

As for the PHP-less solution, https://drupal.org/node/61509 is not yet updated to Drupal 8 browser support. I'm not sure if we support older browsers anymore that need a class and cannot do with :last children selector? Should check with a frontender :)

Gábor Hojtsy’s picture

nod_’s picture

Issue tags: +ie8

IE9+, so :last is totally good. http://caniuse.com/#feat=css-sel3

Only tagging for possible port to the ie8 module.

Gábor Hojtsy’s picture

Ok, then let's skip the PHP part and apply the selector to CSS :)

Gábor Hojtsy’s picture

Assigned: borisbaldinger » Unassigned
Status: Needs work » Needs review
FileSize
565 bytes

So looks like this would be as simple as the attached. (Also unassigned boris since he is not working on this looks like).

borisbaldinger’s picture

Sorry, had a lot of work to cover in the last weeks. :-/ Thx for adapting the patch.

Gábor Hojtsy’s picture

Issue tags: +frontend

So apparently last-child does not work the way I thought it would. It will not apply, because the element is not the last child of its parent, although it is the last child *that has this class*. What am I doing wrong? Frontend help needed :)

Gábor Hojtsy’s picture

Status: Needs review » Needs work
thamas’s picture

Status: Needs work » Needs review
FileSize
541 bytes

We clould try to use :nth-last-child(), but if I understand right the submit button always will be the last element and before that we always will have a .table-language-group div. If that is the case we can simpy apply a negative top margin to the submit button.

Gábor Hojtsy’s picture

Yeah well, that assumes some things about the form :D But it is true the bottom margin did too. Those who want to alter this form can adjust the styling as well in overrides.

Gábor Hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Tested manually. Looks good as it can.

thamas’s picture

Status: Reviewed & tested by the community » Needs review

If there would be a reason to stick to a css :last solution, this works too:

.page-admin-config-regional-language-detection .table-language-group:nth-last-of-type(2) {
  margin-bottom: 0;
}

:)

thamas’s picture

Status: Needs review » Reviewed & tested by the community

Oops!

YesCT’s picture

Status: Reviewed & tested by the community » Needs work

needs work for quick screenshots of latest patch (before and after)
in a few browsers

Please embed them in the issue summary.

Instructions: https://drupal.org/contributor-tasks/add-screenshots

Gábor Hojtsy’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
199.1 KB

Before/after in one picture. Putting into summary.

ursula’s picture

Issue tags: -Needs screenshots

Removed needs screenshot tag - the really nice screenshot is already in the issue summary.

webchick’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +Needs screenshots

Wow, there are a lot of comments in this issue for the change. :) It looked intimidating, but looks like it's a very simple fix.

So!

Committed and pushed to 8.x. Thanks!

Gábor Hojtsy’s picture

Issue tags: -sprint

Yay, thanks!

nod_’s picture

Title: Improve design of language detection and selection settings page » Follow-up: Improve design of language detection and selection settings page
Status: Fixed » Needs review
FileSize
1.07 KB

Simplification since #type item has been fixed for #states.

nod_’s picture

Issue summary: View changes

Updated issue summary.

nod_’s picture

Issue summary: View changes
Status: Needs review » Fixed
nod_’s picture

Title: Follow-up: Improve design of language detection and selection settings page » Improve design of language detection and selection settings page

Status: Fixed » Closed (fixed)

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

LewisNyman’s picture

Hi, can someone involved in this issue review #2194807: Remove obsolete CSS for language admin form please?