Problem/Motivation

When the data items of a JobItem are in preliminary state we should show a message to the user explaining the situation.
The data items should not be writable or savable and we need a specific icon for the status, Or also we could allow the user to make changes, but managing it well with the new updates that the translator can send us.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

edurenye created an issue. See original summary.

edurenye’s picture

Title: Show preview instead of JobItemForm when the state is preliminary » Now with the preliminary state we should add a message
Issue summary: View changes
miro_dietiker’s picture

Title: Now with the preliminary state we should add a message » Job item review in preliminary state should display a message

This is for the review form.

mbovan’s picture

Status: Active » Needs review
StatusFileSize
new1013 bytes
new167.12 KB

I added a warning message in case job item is in Active/Review state and explaining the situation.

I think we should allow the administrator/user to change translation, especially when there is option to "Revert changes", which is a kind of hack to accept received ones.

The screenshot
Only local images are allowed.

Not related to this issue, but revision messages can be easily too long because we display full text in it... Maybe we can put it in a (one more?!) details tab...

mbovan’s picture

Updated the state condition and the message:

edurenye’s picture

Status: Needs review » Needs work

If we let the user edit it, we ought inform him that his changes can be overwrite by the translation, not just that his changes will override the translation.
Although, another option also could be to not let the user edit the translation at all.
I think, we agreed with @miro_dietiker, that the second, it's the best option.

mbovan’s picture

Hm, I never managed to do this: "If we let the user edit it, we ought inform him that his changes can be overwriten by the translation"

We can change to "disabled" for a user as well.
In case translator is too lazy we can't do anything with a job/translation except waiting or abort/delete it?

berdir’s picture

We should probably wait with this task until we have preview support in the local translator that will use this. Then we will be able to properly test this manually. Right now, the patch isn't really doing what we mean.

edurenye’s picture

Status: Needs work » Postponed
Related issues: +#2682337: Add the preview feature to translator local

Postponed until this issue is fixed #2682337: Add the preview feature to translator local

mbovan’s picture

Status: Postponed » Active

#2682337: Add the preview feature to translator local was fixed so we can work on this one.

mbovan’s picture

Status: Active » Needs review
StatusFileSize
new40.23 KB
new3.78 KB
new4.34 KB

Updated the patch to disable translation fields and data items actions.

No tests yet. Is the message too technical?

berdir’s picture

Status: Needs review » Needs work
  1. +++ b/src/Form/JobItemForm.php
    @@ -36,6 +36,15 @@ class JobItemForm extends TmgmtFormBase {
    +      '#type' => 'container',
    +      '#markup' => $this->t('The data items below are in preliminary state and changes in translations are now allowed.'),
    +      '#attributes' => array(
    

    not sure if we use data items in the UI elsewhere. Maybe miro has an idea on the label?

    We could go just this job item, it doesn't really matter if it's just part or everything for the user.

  2. +++ b/src/Form/JobItemForm.php
    @@ -371,11 +381,13 @@ class JobItemForm extends TmgmtFormBase {
        */
    -  function reviewFormElement(FormStateInterface $form_state, $data, JobItemInterface $job_item, &$zebra, $parent_key) {
    +  function reviewFormElement(FormStateInterface $form_state, $data, JobItemInterface $job_item, &$zebra, $parent_key, &$has_preliminary_items) {
    

    We could use $form_state get/set to avoid adding another argument here. we will do that too in the format/permission issue.

miro_dietiker’s picture

+++ b/src/Form/JobItemForm.php
@@ -36,6 +36,15 @@ class JobItemForm extends TmgmtFormBase {
+      '#markup' => $this->t('The data items below are in preliminary state and changes in translations are now allowed.'),
...
+      '#access' => FALSE,

To add a form element always and hide it with #access is a good practice for extensibility.
However, adding arbitrary messages and hiding them with #access is strange. It should only be added if needed.

miro_dietiker’s picture

data items below are in preliminary

I would simply refer to "translations". ;-)

edurenye’s picture

Status: Needs work » Needs review
StatusFileSize
new4.31 KB

Rebased and did those changes.

johnchque’s picture

Status: Needs review » Needs work
+++ b/src/Form/JobItemForm.php
@@ -135,7 +136,18 @@ class JobItemForm extends TmgmtFormBase {
+        '#markup' => $this->t('The translations below are in preliminary state and changes in them are now allowed.'),

Missing statement is: As a result, you can not accept the item while preliminary...

Also the user should have awareness that posting a change will be overwritten by the user with any future update. (Sure, we have revisions..)

edurenye’s picture

Status: Needs work » Needs review
StatusFileSize
new7.4 KB
new4.34 KB

Added tests and removed the "Save" button also if all the data items are in preliminary state.

We discussed about last comment and we don't need to change the texts as it's not possible to accept or change anything in this state.

berdir’s picture

Status: Needs review » Fixed

Thanks, committed with the following change:

diff --git a/src/Form/JobItemForm.php b/src/Form/JobItemForm.php
index 67b2d0e..9914e5e 100644
--- a/src/Form/JobItemForm.php
+++ b/src/Form/JobItemForm.php
@@ -140,9 +140,9 @@ class JobItemForm extends TmgmtFormBase {
     if ($form_state->get('has_preliminary_items')) {
       $form['translation_changes'] = array(
         '#type' => 'container',
-        '#markup' => $this->t('The translations below are in preliminary state and changes in them are now allowed.'),
+        '#markup' => $this->t('The translations below are in preliminary state and can not be changed.'),
         '#attributes' => array(
-          'class' => array('messages messages--warning'),
+          'class' => array('messages', 'messages--warning'),
         ),
         '#weight' => -50,
       );

  • Berdir committed b026e86 on 8.x-1.x authored by edurenye
    Issue #2674190 by mbovan, edurenye: Job item review in preliminary state...

  • Berdir committed 3093dcd on 8.x-1.x
    Issue #2674190 by Berdir: Fixed expected message in test
    

Status: Fixed » Closed (fixed)

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