kbase/narrative — pull request #82 by briehl (2014-12-23 20:56:39+00:00)
Title: Slideout refactor

This pull request refactors how the side panel slideout works, since there were heaps of code copying and some misplaced functionality.

Now, the slideout toggle event takes in a panel as an input - if this panel is different from the panel being currently shown, then it gets replaced. Otherwise, it just gets closed. There are three events that can be triggered.

1. $.trigger('showSidePanelOverlay.Narrative', panel)
This displays the overlay panel. If panel is undefined, then it just uses the previously shown panel.
2. $.trigger('hideSidePanelOverlay.Narrative')
This hides the overlay panel.
3. $.trigger('toggleSidePanelOverlay.Narrative', panel)
This toggles the panel - if it's out, it gets pushed in, and if it's in, it gets pulled out. The difference here is that if the provided panel is different from the panel currently being displayed, it replaces it.

Since the panel isn't destroyed on toggling, the widget that creates it will still maintain its state.

I took the liberty of migrating code around that was either duplicated or not really in the right place. The code that managed the data panel overlay was moved to kbaseNarrativeDataPanel.js. The overlay panel code in kbaseNarrativeMethodPanel.js was squeezed down to leave enough to instantiate the Method Gallery widget.