From b305debf9730bb93b5a230cb8ee50dee3fa4fa07 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 27 Apr 2013 16:35:59 +0100 Subject: [PATCH] Add a close all tiddlers button For @pmario --- core/modules/widgets/navigator.js | 9 +++++++++ core/styles/base.tid | 4 ++-- core/templates/SideBar.tid | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/modules/widgets/navigator.js b/core/modules/widgets/navigator.js index b6517bc03..4f157cba4 100644 --- a/core/modules/widgets/navigator.js +++ b/core/modules/widgets/navigator.js @@ -36,6 +36,7 @@ NavigatorWidget.prototype.generate = function() { {name: "tw-save-tiddler", handlerObject: this, handlerMethod: "handleSaveTiddlerEvent"}, {name: "tw-cancel-tiddler", handlerObject: this, handlerMethod: "handleCancelTiddlerEvent"}, {name: "tw-close-tiddler", handlerObject: this, handlerMethod: "handleCloseTiddlerEvent"}, + {name: "tw-close-all-tiddlers", handlerObject: this, handlerMethod: "handleCloseAllTiddlersEvent"}, {name: "tw-new-tiddler", handlerObject: this, handlerMethod: "handleNewTiddlerEvent"} ]; }; @@ -114,6 +115,14 @@ NavigatorWidget.prototype.handleCloseTiddlerEvent = function(event) { return false; }; +// Close all tiddlers +NavigatorWidget.prototype.handleCloseAllTiddlersEvent = function(event) { + this.storyList = []; + this.saveStoryList(); + event.stopPropagation(); + return false; +}; + // Place a tiddler in edit mode NavigatorWidget.prototype.handleEditTiddlerEvent = function(event) { this.getStoryList(); diff --git a/core/styles/base.tid b/core/styles/base.tid index 4a4fbaf32..46cbb4009 100644 --- a/core/styles/base.tid +++ b/core/styles/base.tid @@ -195,11 +195,11 @@ a.tw-tiddlylink-missing { border: none; } -.tw-menu-list-item .btn-mini-close { +.btn-mini { color: #e0e0e0; } -.tw-menu-list-item:hover .btn-mini-close { +.btn-mini:hover { color: #444; } diff --git a/core/templates/SideBar.tid b/core/templates/SideBar.tid index 0ccb9e3f2..85bc741ae 100644 --- a/core/templates/SideBar.tid +++ b/core/templates/SideBar.tid @@ -26,8 +26,9 @@ title: $:/templates/SideBar
<$reveal type="match" state="$:/state/sideBarTabSet" text="openTab" qualifyTiddlerTitles="yes"> <$list filter="[list[$:/StoryList]]" history="$:/HistoryList" itemClass="tw-menu-list-item"> -<$button message="tw-close-tiddler" class="btn-invisible btn-mini-close">× <$view field="title" format="link"/> +<$button message="tw-close-tiddler" class="btn-invisible btn-mini">× <$view field="title" format="link"/> +<$button message="tw-close-all-tiddlers" class="btn-invisible btn-mini">close all <$reveal type="match" state="$:/state/sideBarTabSet" text="allTab" qualifyTiddlerTitles="yes"> <$list filter="[!is[system]sort[title]]" itemClass="tw-menu-list-item"/>