datadryad/dryad-repo — pull request #647 by rnathanday (2014-07-10 20:28:45+00:00)
Title: Trello 71: FEAT: Add/remove and reorder authors

This pull request adds improved editing of the author list on the "Describe Publication" page encountered upon starting a new submission, per the functionality and design indicated on the whiteboard card.

The updates included here have been hand-tested in Firefox, Chrome, Safari and Opera. The updates have been tested with the added automated test using Selenium, but only against Firefox.

The user interface changes affect only the "Authors" section of the Publication Metadata region and affect the following:

Add Button
No change in user input. Newly added author is appended to the table below the Add button.

Edit Button
Newly added. When the Edit button for an author entry is clicked, the text area and select input for that entry are enabled, allowing the user to modify the text or order in a standard HTML input manner. Once an author entry is modified (keyup event or change event raised on either the Select or Textarea items in an author entry), the Update button is enabled, which is meant to signal to the user that the changes in the browser are not auto-committed server-side.

Order Select widget
Newly added. After the Edit button is pressed for an author entry, the select widget for that author is enabled. If the user changes the author's order in the table, the display of the authors is automatically updated in the browser. However, the Update button must be pressed before a request is sent to the server to commit the updated ordering.

Remove Button
Newly added. The Remove button is always enabled, and removes an author entry from the table. The removal request is sent to the server immediately.

Update Button
Newly added. The Update button is disabled until the user (a) clicks the Edit button, and (b) modifies the contents of one of the fields. Clicking the Update button submits the changes to the server for committing, and will trigger a refresh of the form depending on the server's response.

This commit also includes a client-side update (Javascript) to prevent a full-page reload whenever a form item has been modified (Add, Edit, Remove, Update actions). Instead, the form-submit event is trapped and its results are handled by a partial-page reload, which improves user experience. The Save and Continue items still reload a page.

While most changes in this request were done in the Mirage theme's JS/XSL/CSS files, some factoring, cleanup, and il8n was done in the shared file 'webapp/themes/dri2xhtml-alt/core/forms.xsl'. The factoring was done to facilitate development and debugging of the Describe Publication form in the Mirage/../forms.xsl file, which calls into it extensively.

The commit also includes updates in the repo's Selenium testing directory:

- added test file selenium/src/test/java/DescribePublicationAJAXTest.java to exercise adding/modifying authors on the Describe Publication page
- added selenium/bin/chromedriver binary file to enable the Selenium tests to run against Chrome. This has been tested provisionally against Chrome on osx, but results have proven to be erratic
- updated the selenium-java library version number in selenium/pom.xml. This update appears to bring Firefox support up to date with the most recent version of Firefox, but not always Chrome