Support from Acquia helps fund testing for Drupal Acquia logo

Comments

casey created an issue. See original summary.

casey’s picture

Status: Active » Needs review
FileSize
1.71 KB
johnchque’s picture

Issue tags: +Needs tests

We will need tests for this.

miro_dietiker’s picture

Priority: Normal » Major
Status: Needs review » Needs work

Funny thing, i also thought that we should hide this...

But if we hide that button, we should also disable the drag handles. Either disallow both or none.
For current UX consistency, it makes sense to maximally reduce the UI while translating.

miro_dietiker’s picture

miro_dietiker’s picture

Issue tags: +Novice

This is now simply first about checking $this->allowReferenceChanges() instead isTranslating.

To hide the drag handlers of the table rows completely i opened #2932334: Hide drag handler while translating

Berdir’s picture

Issue tags: -Novice

I don't think it's Novice, the order problem of when we initialize translation stuff remains, also needs a test. Maybe we can change allowReferenceChanges() to automatically initialize isTranslating if not.

johnchque’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
6.3 KB

Adding tests. :)

Status: Needs review » Needs work

The last submitted patch, 8: hide_drag_drop-2918713-8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Berdir’s picture

+++ b/src/Plugin/Field/FieldWidget/ParagraphsWidget.php
@@ -936,25 +936,6 @@ class ParagraphsWidget extends WidgetBase {
-
-    if (!empty($field_state['dragdrop'])) {
-      $elements['#attached']['library'][] = 'paragraphs/paragraphs-dragdrop';
-      //$elements['dragdrop_mode']['#button_type'] = 'primary';
-      $elements['dragdrop'] = $this->buildNestedParagraphsFoDragDrop($form_state, NULL, []);
-      return $elements;
-    }

don't move this part, this needs to be done first. that might already be enough to fix the problem.

if header actions also return the complete button, then we need to move that out of that function into the part that must stay on top.

johnchque’s picture

Status: Needs work » Needs review
FileSize
9.04 KB
5.53 KB

Hmm finally got it working, not sure if this is the best way, gonna see what happens with testbot. :)

Status: Needs review » Needs work

The last submitted patch, 11: hide_drag_drop-2918713-11.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Berdir’s picture

Assigned: Unassigned » Berdir
Berdir’s picture

Status: Needs work » Needs review
FileSize
7.8 KB

This is what I was thinking. We separate the two cases, which allows us to remove a lot of conditional code.

Haven't tried the tests yet.

Berdir’s picture

Assigned: Berdir » Unassigned
johnchque’s picture

Wow looks nice, always wondered why both buttons where built in the same place. :)

Improved tests and added allowReferenceChanges to both buttons. Also added test only patch.

The last submitted patch, 16: hide_drag_drop-2918713-16-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Berdir’s picture

> added allowReferenceChanges to both buttons

I removed that on purpose from the complete button. You can only enter drag and drop mode if references have been allowed, it is not necessary to check that again then. but yes, needed for the other one, looks like I dropped that when refactoring.

miro_dietiker’s picture

Status: Needs review » Needs work
johnchque’s picture

Status: Needs work » Needs review
FileSize
7.89 KB
486 bytes

Right, it makes sense. Thank you.

miro_dietiker’s picture

Status: Needs review » Fixed

Thx, committed. Now ALL buttons are gone while translating. :-)

(Just the regular table drag handles remaining...)

Status: Fixed » Closed (fixed)

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