Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-6799

Improve internal Drag n Drop

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4.2-RC1, 5.4.2
    • Component/s: None

      Description

      Internal Drag and Drop is managed via Prototype and Seam remoting.
      It works rather well since 5.0.

      The only real problem is about how HTML elements are declared to be Draggable or a Droptarget.
      Currently, we let the xhtml (widget or template) generate small scripts (inline in the page) that declare the HTML elemnst to prototype.

      Typically we have things like that :
      <script type="text/javascript">
      <h:outputText
      value="new Draggable('docRef:#

      {row.data.ref}', {revert:true});"/>
      <h:outputText rendered="#{row.data.folder}"
      value="Droppables.add('docRefTarget:#{row.data.ref}

      ', {accept:'cell', onDrop:function(element){moveElement(element,'docRef:#

      {row.data.ref}

      ')}, hoverclass:'dropInto'});"/>
      </script>

      This approach has several issues :

      • it's ugly
      • it can slow down the browser
      • it's not easy to maintain

      Rather that changing the whole system (and having compat problems), the idea is to continue use Prototype and the same JS infrastructure, but remove the inline scripts that declare the zones.
      So, we will replace the inline scripts by one JQuery call that will gather the required elements and initialize DnD on it.

      => This will remove inline scripts
      => Code will be cleaner and faster
      => We don't break any compat

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: