Skip to content

Commit

Permalink
v0.5.11 - show/hide close button option
Browse files Browse the repository at this point in the history
  • Loading branch information
dnbard committed Feb 15, 2015
1 parent d487e06 commit 1174c7e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "Documents Toolbar",
"description": "Adds toolbar with tabs of open documents on the top of the editor. Now with split view support!",
"homepage": "https://github.com/dnbard/brackets-documents-toolbar",
"version": "0.5.10",
"version": "0.5.11",
"author": "Alex Bardanov",
"license": "MIT",
"engines": {
Expand Down
3 changes: 2 additions & 1 deletion services/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ define(function(require, exports){
close_left: false,
workingFiles: true,
brackets_font: true,
grayscaleIcons: false
grayscaleIcons: false,
showCloseButton: true
};

exports.init = function(){
Expand Down
2 changes: 1 addition & 1 deletion templates/holder.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<span class="document-holder brFont" data-bind="foreach: documents">
<span class="document" data-bind="style:{background: $parent.getDocumentBackground($data), color: $parent.getDocumentNameColor($data)}, css:{selected: $data._path === $parent.selectedPath(), changed: $parent.isChanged($data), modified: $parent.isModified($data)}, click: $parent.onDocumentClick, event:{mouseover: $parent.onDocumentMouseIn, mouseleave: $parent.onDocumentMouseLeave, contextmenu: $parent.onDocumentContextMenu, mousedown: $parent.onDocumentMouseDown}, attr:{title: $data._path}, drag: true">
<span data-bind="html: $parent.getDocumentView($data)"></span>
<span class="document-close" data-bind="click: $parent.onDocumentClose, style:{color: $parent.getDocumentNameColor($data)}, visible: !$parent.isCloseOnLeft()">
<span class="document-close" data-bind="click: $parent.onDocumentClose, style:{color: $parent.getDocumentNameColor($data)}, visible: $parent.isShowCloseButtonOnTabs">
<i class="fa fa-times-circle"></i>
</span>
</span>
Expand Down
18 changes: 7 additions & 11 deletions templates/modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ <h1 class="dialog-title">Documents toolbar settings</h1>
<input type="checkbox" data-bind="checked: showWorkingFiles" />
<span>Show Working Files panel</span>
</div>
<div style="display: none;">
<input type="checkbox" data-bind="checked: showIcons" />
<span>Show Icons</span>
</div>
<div style="display: none;">
<input type="checkbox" data-bind="checked: smallIcons" />
<span>Small Icons</span>
</div>
<div style="display: none;">
<input type="checkbox" data-bind="checked: grayscaleIcons" />
<span>Grayscale Icons</span>
<div>
<input type="checkbox" data-bind="checked: showCloseButton" />
<span>Show </span>
<span class="fa fa-times-circle"></span>
<span class="muted"> close button </span>
<span>on tab</span>
<span class="muted" data-bind="visible: !showCloseButton()">[use middle mouse button to close tabs]</span>
</div>
<div>
<input type="checkbox" data-bind="checked: useBracketsFont" />
Expand Down
4 changes: 4 additions & 0 deletions viewmodels/documents.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ define(function(require, exports, module){
self.fontEnabled(value);
});

this.isShowCloseButtonOnTabs = ko.observable(!!prefs.get('showCloseButton'));

this.onDocumentClick = function(model, event){
CommandManager.execute('file.open', {
fullPath: model._path
Expand Down Expand Up @@ -134,6 +136,8 @@ define(function(require, exports, module){

var hoveredDocument = null;
this.onDocumentMouseIn = function(document, event){
self.isShowCloseButtonOnTabs(!!prefs.get('showCloseButton'));

if (!prefs.get('tooltip')){
return;
}
Expand Down
6 changes: 6 additions & 0 deletions viewmodels/generalOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,17 @@ define(function(require, exports, module){
prefs.set('smallIcons', value);
});

this.showCloseButton = ko.observable();
this.showCloseButton.subscribe(function(value){
prefs.set('showCloseButton', value);
});

this.showWorkingFiles(prefs.get('workingFiles'));
this.showIcons(prefs.get('icons'));
this.useBracketsFont(prefs.get('brackets_font'));
this.grayscaleIcons(prefs.get('grayscaleIcons'));
this.smallIcons(prefs.get('smallIcons'));
this.showCloseButton(prefs.get('showCloseButton'));
}

module.exports = GeneralOptions;
Expand Down

0 comments on commit 1174c7e

Please sign in to comment.