Problem/Motivation

At admin/config/content/diff/fields a user can configure field plugins.

However our proposed visual inline plugin doesn't care about it.
That's intentional, but the user needs to understand it.

Proposed resolution

The plugins could get some description beside their label at admin/config/content/diff/general
The field settings need some better intro.

User interface changes

Explanations in UI, making configuration clear.

Before:
settings_before

After:
settings_layout_descr_after

Comments

miro_dietiker created an issue. See original summary.

tduong’s picture

Assigned: Unassigned » tduong
tduong’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.09 KB
new4 KB
new93.87 KB
new125.1 KB

Added description to the diff plugins and displayed them on the settings page. I guess that the description after the "Layout" table (marked in red in the screenshot) now could be removed since then it is kinda repeating the description provided for each of these rows.

Anyway, any improvements about the descriptions ?

The last submitted patch, 3: explain_fields_config-2810871-3-test_only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 3: explain_fields_config-2810871-3.patch, failed testing.

johnchque’s picture

  1. +++ b/src/Form/GeneralSettingsForm.php
    @@ -121,6 +121,7 @@ class GeneralSettingsForm extends ConfigFormBase {
    +        '#description' => $this->diffLayoutManager->getDefinition($id)['description'],
    

    I like this approach but I think it might be better to fallback in something when the description is not defined.

  2. +++ b/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php
    @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
    + *   description = @Translation("Split fields plugin compares revisions side by side. This plugin is configurable."),
    
    +++ b/src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php
    @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
    + *   description = @Translation("Unified fields plugin compares revisions based on the GitHub layout. This plugin is configurable."),
    
    +++ b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
    @@ -21,6 +21,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
    + *   description = @Translation("Visual Inline plugin uses external libraries to compare revisions, based on the HTML Diff module. This plugin is not configurable."),
    

    And if we gonna add this, it's better to add it in diff/src/Annotation/DiffLayoutBuilder. :)

+++ b/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php
@@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
+ *   description = @Translation("Split fields plugin compares revisions side by side. This plugin is configurable."),

+++ b/src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php
@@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
+ *   description = @Translation("Unified fields plugin compares revisions based on the GitHub layout. This plugin is configurable."),

+++ b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
@@ -21,6 +21,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
+ *   description = @Translation("Visual Inline plugin uses external libraries to compare revisions, based on the HTML Diff module. This plugin is not configurable."),

I don't think is needed to add the plugin name in the description.

Instead of "This plugin is configurable" IMHO could be better to write "Field plugin settings are applied to this layout."

miro_dietiker’s picture

Almost all list builder of config entities / plugins i know of look like this:
admin/structure/types
So a separate column with the description.

tduong’s picture

Status: Needs work » Needs review
StatusFileSize
new1.95 KB
new5.72 KB
new126.87 KB

Added a "Description" column. I don't get how we will use the property created in diff/src/Annotation/DiffLayoutBuilder. About the descriptions, I've used a similar template like in \Drupal\sharemessage\Form\ShareMessageForm::form() unsing the Drupal\sharemessage\Plugin\sharemessage\Addthis/OGHeaders/Sharrre plugins, where the plugin name appears again in the description. Do you still want to remove it ?

Status: Needs review » Needs work

The last submitted patch, 8: explain_fields_config-2810871-8.patch, failed testing.

johnchque’s picture

+++ b/src/Tests/AdminFormsTest.php
@@ -30,6 +30,19 @@ class AdminFormsTest extends DiffTestBase {
+    $this->assertText('Visual Inline plugin uses external libraries to compare revisions, based on the HTML Diff module. This plugin is not configurable.');

Since Visual layout cannot be installed in testbot, this line should go away.

tduong’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new782 bytes
new5.57 KB

Removed that line, not sure how to make the test to run/detect the implementation from a hook_help().

And I'm still wondering if we still need to keep that description below the table.

Status: Needs review » Needs work

The last submitted patch, 11: explain_fields_config-2810871-11.patch, failed testing.

miro_dietiker’s picture

@tduong See help.module's HelpBlock.php

  1. +++ b/diff.module
    @@ -78,6 +78,9 @@ function diff_help($route_name, RouteMatchInterface $route_match) {
    +      return '<p>' . t('This page provides the configurations about the revision comparison functionality and diff layout plugins.') . '</p>';
    

    "This page provides the configurations about the" => "Configurations for the"

  2. +++ b/src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php
    @@ -17,6 +17,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
    + *   description = @Translation("Unified fields plugin compares revisions based on the GitHub layout. This plugin is configurable."),
    
    +++ b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
    @@ -25,6 +25,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
    + *   description = @Translation("Visual Inline plugin uses external libraries to compare revisions, based on the HTML Diff module. This plugin is not configurable."),
    

    The plugins don't offer a configuration form on their own. But indeed the second has a setting (what theme to use) so i would skip the "This plugin is [not] configurable".

    I thought both split fields and unified are as much like GitHub.

tduong’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new4.83 KB
new6.19 KB
new124.9 KB

Added help_block in the test, edited the descriptions.
Not sure if it is fine as it is right now, how would you warn the user which layout plugins he/she can configure per field at admin/config/content/diff/fields otherwise ?

johnchque’s picture

Status: Needs review » Needs work
  1. +++ b/diff.module
    @@ -79,7 +79,7 @@
    +      return '<p>' . t('Configurations for the revision comparison functionality and diff layout plugins.') . '</p>';
    

    "Configuration" might fit better.

  2. +++ b/src/Form/GeneralSettingsForm.php
    @@ -103,7 +103,7 @@
    +      '#suffix' => '<div class="description">' . $this->t('The layout plugins that are enabled to display the diff comparison.') .'</div>',
    

    We want to avoid the diff word in the UI, better to change this to: "The layout plugins that are enabled to display the revision comparison."

  3. +++ b/src/Plugin/diff/Layout/SplitFieldsDiffLayout.php
    @@ -17,7 +17,7 @@
    + *   description = @Translation("This configurable field plugin compares revisions as side by side mode."),
    
    +++ b/src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php
    @@ -17,7 +17,7 @@
    + *   description = @Translation("This configurable field plugin compares revisions as line by line mode."),
    
    +++ b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
    @@ -25,7 +25,7 @@
    + *   description = @Translation("This field plugin uses external libraries to compare revisions. It is not configurable per field."),
    

    This area layout plugins, So change it to This configurable layout plugin... or "This layout plugin uses...

tduong’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new3.3 KB
new6.2 KB
new122.24 KB

1. I think "Configurations" is fine, since there are more than one. Miro's comment at #13 suggest it as well.

2-3. done

johnchque’s picture

Status: Needs review » Reviewed & tested by the community

OK, then.

miro_dietiker’s picture

Status: Reviewed & tested by the community » Needs work

IMHO the help at admin/config/content/diff/fields is not yet satisfying. It should mention that it affects the two (unified, split) field plugins

miro_dietiker’s picture

I also just realised that the "Leading/Trailing context lines" only apply for the split/unified fields.

Should we apply some Fieldset around plugin specific settings?
- Field based plugin settings.
- Visual Inline plugin settings.

The plugins description could refer to being "field based". Or we instead mention both in the fieldset.

johnchque’s picture

Status: Needs work » Needs review
StatusFileSize
new10.41 KB
new7.22 KB
new60.23 KB

Changed a bit the comments, Also added changed the settings screen to be like:

Not sure if the wording is good enough.

tduong’s picture

Status: Needs review » Needs work

Yeah, these "per category settings details-wrappings" could be easier for the end user/self-explaining, but then for the visual_inline_theme aren't the label "VISUAL INLINE LAYOUT SETTINGS" and the description "Theme used for Visual inline layout when comparing revisions." too much/repetitive ?
Not sure, but imo, if we would keep it like this, I'd suggest removing the description (or at least saying something more "useful", like the Leading/Trailing examples ?)

About "Leading context lines", "Trailing context lines" and their descriptions, not sure which better wording we can use to not repeat things. Maybe just "Leading" and "Trailing" as select labels and keep the descriptions (?)

More:

  1. +++ b/diff.module
    @@ -78,11 +78,14 @@ function diff_help($route_name, RouteMatchInterface $route_match) {
    +      return '<p>' . t('This table provides a summary of the field support found on the system. For every field a diff plugin can be selected and configured. This settings are applied to Unified and Split fields layouts.') . '</p>';
    

    As you said once "We want to avoid the diff word in the UI" (comment #15.2), how can we change this "For every field, a diff plugin can be selected and configured." ?

    Also imo this new help text is too long, but if it is fine, then: "This" --> "These".

  2. +++ b/src/Form/GeneralSettingsForm.php
    @@ -98,11 +82,12 @@ class GeneralSettingsForm extends ConfigFormBase {
    +
    

    Unnecessary new line.

  3. +++ b/src/Form/GeneralSettingsForm.php
    @@ -137,9 +127,49 @@ class GeneralSettingsForm extends ConfigFormBase {
    +    $context_lines = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
    ...
    +    $form['field_based_settings']['context_lines_leading'] = array(
    ...
    +    $form['field_based_settings']['context_lines_trailing'] = array(
    

    If you change/add new line/block like these kind of lines, you can directly edit the array syntax to avoid later cleanup issues and the possible "resulting conflicts".

  4. +++ b/src/Plugin/diff/Layout/VisualInlineDiffLayout.php
    @@ -25,6 +25,7 @@ use Symfony\Component\HttpFoundation\RequestStack;
    + *   description = @Translation("Visual layout, revision comparison is made as the content is rendered for the user."),
    

    Not sure what you mean by "made as the content is rendered for the user".

miro_dietiker’s picture

Committed on cross post. Happy to receive another update here.

tduong’s picture

Status: Needs work » Fixed
Related issues: +#2817159: Provide better description wording for the Diff settings UI

Created followup to discuss about the wording stuff: #2817159: Provide better description wording for the Diff settings UI

Set back to "Fixed".

Status: Fixed » Closed (fixed)

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