summaryrefslogtreecommitdiffstats
path: root/js/views/sidebarview.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/views/sidebarview.js')
-rw-r--r--js/views/sidebarview.js51
1 files changed, 37 insertions, 14 deletions
diff --git a/js/views/sidebarview.js b/js/views/sidebarview.js
index 614230ec8..b6203e08f 100644
--- a/js/views/sidebarview.js
+++ b/js/views/sidebarview.js
@@ -46,23 +46,24 @@
* The right sidebar is an area that can be shown or hidden from the right
* border of the document. It contains a view intended to provide details of
* the current call at the top and a TabView to which different sections can
- * be added as needed. The call details view can be set through
- * "setCallInfoView()" while new tabs can be added through "addTab()".
+ * be added and removed as needed. The call details view can be set through
+ * "setCallInfoView()" while new tabs can be added through "addTab()" and
+ * removed through "removeTab()".
*
- * The SidebarView can be shown or hidden programatically using "show()" and
- * "hide()". It will delegate on "OC.Apps.showAppSidebar()" and
+ * The SidebarView can be opened or closed programatically using "open()"
+ * and "close()". It will delegate on "OC.Apps.showAppSidebar()" and
* "OC.Apps.hideAppSidebar()", so it must be used along an "#app-content"
* that takes into account the "with-app-sidebar" CSS class.
*
- * In order for the user to be able to show the sidebar when it is hidden,
+ * In order for the user to be able to open the sidebar when it is closed,
* the SidebarView shows a small icon ("#app-sidebar-trigger") on the right
- * border of the document that shows the sidebar when clicked. When the
- * sidebar is shown the icon is hidden.
+ * border of the document that opens the sidebar when clicked. When the
+ * sidebar is open the icon is hidden.
*
- * By default the sidebar is disabled, that is, it is hidden and can not be
- * shown, neither by the user nor programatically. Calling "enable()" will
- * make possible for the sidebar to be shown, and calling "disable()" will
- * prevent it again (also hidden it if it was shown).
+ * By default the sidebar is disabled, that is, it is closed and can not be
+ * opened, neither by the user nor programatically. Calling "enable()" will
+ * make possible for the sidebar to be opened, and calling "disable()" will
+ * prevent it again (also closing it if it was open).
*/
var SidebarView = Marionette.View.extend({
@@ -142,7 +143,7 @@
/**
* Sets a new call info view.
*
- * Once set, the Sidebar takes ownership of the view, and it will
+ * Once set, the SidebarView takes ownership of the view, and it will
* destroy it if a new one is set.
*
* @param Marionette.View callInfoView the view to set.
@@ -167,8 +168,9 @@
* can provide an 'onRender' function to extend the default rendering of
* the header).
*
- * The Sidebar takes ownership of the given content view, and it will
- * destroy it when the Sidebar is destroyed.
+ * The SidebarView takes ownership of the given content view, and it
+ * will destroy it when the SidebarView is destroyed, except if the
+ * content view is removed first.
*
* @param string tabId the ID of the tab.
* @param Object tabHeaderOptions the options for the constructor of the
@@ -180,6 +182,27 @@
this._tabView.addTab(tabId, tabHeaderOptions, tabContentView);
},
+ /**
+ * Removes the tab for the given tabId.
+ *
+ * If the tab to be removed is the one currently selected and there are
+ * other tabs the next one (in priority and then insertion order) is
+ * automatically selected; if the tab to be removed is the last one,
+ * then the previous one is selected instead. If there are no other tabs
+ * then the TabView is simply emptied.
+ *
+ * In any case the content view given when the tab was added is
+ * returned; this SidebarView will no longer have ownership of the
+ * content view, and thus the content view must be explicitly destroyed
+ * when no longer needed.
+ *
+ * @param string tabId the ID of the tab to remove.
+ * @return Marionette.View the content view of the removed tab.
+ */
+ removeTab: function(tabId) {
+ return this._tabView.removeTab(tabId);
+ }
+
});
OCA.SpreedMe.Views.SidebarView = SidebarView;