Description
Implement the Publish component according to the design specifications from T270304
What we call "Publish component" includes the page "Publish" button (visible in all edit/create pages) as well as the dialog that is shown before finally submitting the ZObject to the backend. It controls the save/edit flow and also displays error/warning messages to the user if necessary.
This task includes the creation of the Publish component as well as its incorporation into the Function edit and ZObject edit pages, and removal of current components used for this purpose.
Desired behavior/Acceptance criteria
- The publish component/button/flow should be the same in all create/edit pages in Wikifunctions (ZObject and Function editor)
- A "Publish" button should be always visible on top of every edit/create page
- The global state should track whether any changes have been made in the page that need saving, so that:
- The "Publish" button states in a disabled state when there are no changes in the page
- If the user tries to exit a create/edit page without saving their changes, a dialog should warn them
- On clicking the page "Publish" button, a dialog should be shown, with the following features:
- Should be able to show warning and error messages (see Clarification 1)
- Should have an input text message for the user to write their save summary (see Clarification 2)
- Should show the required legal texts (see Clarification 3)
- Should have an always enabled "Publish" button, that will trigger the call to the wikilambda_edit API and wait for its return:
- On Success: navigate to the view page
- On Error: show the error in the space allocated for it in the Publish dialog (see Clarification 4)
Clarifications:
- For now, show error/warning messages stored in a variable, this will be a temporal state until we finish T315099 and we can incorporate our global error state handling system into this component.
- For now, create a simple text input field. We will take suggestions or automatically generated edit summary to a future task.
- The texts approved by legal are:
- For now, save the returned error locally. This will be temporal until we finish the global error state handling task (T315099) and we can incorporate its flow to this component.
Devices and Design (URLs or screenshots)
- Desktop: ...
- Small screens/mobile: ...
Completion checklist
- Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Front-end_Task/Bug_Completion_Checklist