Uploaded image for project: 'Nuxeo Elements'
  1. Nuxeo Elements
  2. ELEMENTS-834

nuxeo-user-suggestion does not load user in edit mode

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 2.2.0
    • Fix Version/s: None
    • Component/s: UI
    • Tags:
    • Backlog priority:
      500
    • Sprint:
      nxGang Sprint 11.1.6
    • Story Points:
      0

      Description

      Studio-side

      1. in Studio create a custom document type with a custom schema.
      2. add a custom property referencing a user/group directory (see schema1.png and schema2.png)
      3. in Designer generate forms for the document type
      4. replace the content of the edit form with the following:
        <!--
        `nuxeo-testdoc-edit-layout`
        @group Nuxeo UI
        @element nuxeo-testdoc-edit-layout
        -->
        <dom-module id="nuxeo-testdoc-edit-layout">
          <template>
            <style>
              *[role=widget] {
                padding: 5px;
              }
            </style>
            <nuxeo-input role="widget" value="{{document.properties.dc:title}}" label="Title" type="text"></nuxeo-input>
        
            <nuxeo-user-suggestion role="widget" value="{{document.properties.testdoc:userChose}}" label="Test" search-type="USER_GROUP_TYPE" selection-formatter="{{_selectionFormatter_user}}" ></nuxeo-user-suggestion>
        
          </template>
        
          <script>
          Polymer({
            is: 'nuxeo-testdoc-edit-layout',
            behaviors: [Nuxeo.LayoutBehavior],
            properties: {
        
              /**
                   * @doctype TestDoc
                   */
              document: {
                type: Object,
              },
        
            },
            _selectionFormatter_user(user)  {             
              console.log(user);
              var texte = '<iron-icon icon="nuxeo:user" class="avatar"></iron-icon>' + user.firstName + ' ' + user.lastName + ' (' + user.company + ')';
              console.log('_selectionFormatter_objContact : ' + user.username + '//' + user);
              console.log(texte);
              return texte;
            }
          });
          </script>
        </dom-module>
        

      Server-side

      1. synch the project
      2. log in
      3. create a user
      4. create a workspace
      5. create a document of custom type (see Studio part)
      6. select the user previously created
      7. observe the format is the custom one (see selectFormat.png)
      8. save the document
      9. edit the document again
      10. observe the value is not formatted as expected (see unformattedSelect.png)

      This should work without any additional development.

        Attachments

        1. unformattedSelect.png
          unformattedSelect.png
          39 kB
        2. selectFormat.png
          selectFormat.png
          53 kB
        3. schema2.png
          schema2.png
          147 kB
        4. schema1.png
          schema1.png
          104 kB

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h