edx/edx-platform — pull request #2724 by wedaly (2014-02-25 22:23:16+00:00)
Title: Native XBlock Studio Save UI

Part of the work for integrating the Tim XBlock into Studio.

This is somewhat difficult, because, on the one hand, we want XBlocks to handle their own persistence rather than rely on Studio. On the other hand, we want to present the user with a consistent user interface for saving (closing the modal dialog on cancel, showing/hiding the "Saving..." notification, etc.)

After consulting with @cpennington and @andy-armstrong, I've adopted the following approach:

1) For native XBlocks, the Save/Cancel buttons are not rendered.
2) On the client side, the Studio runtime now has a `notify()` method. This allows the XBlock to notify Studio when certain events occur that might require a UI change (in this case, start/end of a save and cancel).
3) The Studio JS runtime implements `notify()`, updating the UI in response to start/end of a save (show/hide the Saving... notification) and canceling an edit (close the modal dialog).

Disadvantages of this approach: duplication of some UI logic (although surprisingly not too much) and the Tim XBlock will need to duplicate Studio styles for its buttons. Given the tradeoffs and tight deadline, I think this is reasonable.

Suggested reviewers:
@cpennington @andy-armstrong

https://edx-wiki.atlassian.net/browse/TIM-201