Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 4c7b775

Browse files
committed
Merge pull request #1717 from jbalsas/statusbar
Statusbar for Brackets
2 parents 238f3ec + f5d977a commit 4c7b775

7 files changed

Lines changed: 325 additions & 7 deletions

File tree

src/brackets.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ define(function (require, exports, module) {
9090
UpdateNotification = require("utils/UpdateNotification"),
9191
UrlParams = require("utils/UrlParams").UrlParams,
9292
NativeFileSystem = require("file/NativeFileSystem").NativeFileSystem,
93-
PreferencesManager = require("preferences/PreferencesManager");
93+
PreferencesManager = require("preferences/PreferencesManager"),
94+
StatusBar = require("widgets/Statusbar");
9495

9596
// Local variables
9697
var params = new UrlParams(),

src/htmlContent/main-view.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@
108108
</div>
109109
<div class="table-container"></div>
110110
</div>
111+
112+
<div id="status-bar" class="statusbar">
113+
<ul id="status-info" class="info" >
114+
<span id="status-cursor"></span>
115+
<span id="status-file"></span>
116+
<span id="status-mode"></span>
117+
<span id="status-tab"></span>
118+
</ul>
119+
<div id="busy-indicator">&#9719;</div>
120+
<ul id="status-indicators" class="indicators">
121+
</ul>
122+
</div>
111123
</div>
112124

113125
<!-- Hack to ensure that the code editor's web font is loaded early. -->

src/language/JSLintUtils.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ define(function (require, exports, module) {
4444
EditorManager = require("editor/EditorManager"),
4545
PreferencesManager = require("preferences/PreferencesManager"),
4646
PerfUtils = require("utils/PerfUtils"),
47-
Strings = require("strings");
47+
Strings = require("strings"),
48+
StringUtils = require("utils/StringUtils"),
49+
AppInit = require("utils/AppInit"),
50+
StatusBar = require("widgets/StatusBar");
4851

4952
/**
5053
* @private
@@ -136,9 +139,15 @@ define(function (require, exports, module) {
136139
.append($errorTable);
137140
$lintResults.show();
138141
$goldStar.hide();
142+
if (JSLINT.errors.length === 1) {
143+
StatusBar.updateIndicator(module.id, true, "jslint-errors", Strings.JSLINT_ERROR_INFORMATION);
144+
} else {
145+
StatusBar.updateIndicator(module.id, true, "jslint-errors", StringUtils.format(Strings.JSLINT_ERRORS_INFORMATION, JSLINT.errors.length));
146+
}
139147
} else {
140148
$lintResults.hide();
141149
$goldStar.show();
150+
StatusBar.updateIndicator(module.id, true, "jslint-valid", Strings.JSLINT_NO_ERRORS);
142151
}
143152

144153
PerfUtils.addMeasurement(perfTimerDOM);
@@ -148,6 +157,7 @@ define(function (require, exports, module) {
148157
// both the results and the gold star
149158
$lintResults.hide();
150159
$goldStar.hide();
160+
StatusBar.updateIndicator(module.id, true, "jslint-disabled", Strings.JSLINT_DISABLED);
151161
}
152162

153163
EditorManager.resizeEditor();
@@ -208,6 +218,12 @@ define(function (require, exports, module) {
208218
_prefs = PreferencesManager.getPreferenceStorage(module.id, { enabled: !!brackets.config.enable_jslint });
209219
_setEnabled(_prefs.getValue("enabled"));
210220

221+
// Init StatusBar indicator
222+
AppInit.htmlReady(function () {
223+
StatusBar.addIndicator(module.id, $("#gold-star"), false);
224+
});
225+
226+
211227
// Define public API
212228
exports.run = run;
213229
exports.getEnabled = getEnabled;

src/nls/root/strings.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ define({
132132
"KEYBOARD_CTRL" : "Ctrl",
133133
"KEYBOARD_SHIFT" : "Shift",
134134
"KEYBOARD_SPACE" : "Space",
135+
136+
/**
137+
* StatusBar strings
138+
*/
139+
"STATUSBAR_CURSOR_POSITION" : "Line {0}, Column {1}",
140+
"STATUSBAR_TAB_SIZE" : "Tab Size {0}",
141+
"STATUSBAR_LINE_COUNT" : "{0} Lines",
135142

136143
/**
137144
* Command Name Constants
@@ -209,7 +216,10 @@ define({
209216
// Strings for main-view.html
210217
"EXPERIMENTAL_BUILD" : "Experimental Build",
211218
"JSLINT_ERRORS" : "JSLint Errors",
219+
"JSLINT_ERROR_INFORMATION" : "1 JSLint Error",
220+
"JSLINT_ERRORS_INFORMATION" : "{0} JSLint Errors",
212221
"JSLINT_NO_ERRORS" : "No JSLint errors - good job!",
222+
"JSLINT_DISABLED" : "JSLint disabled or not working for the current file",
213223
"SEARCH_RESULTS" : "Search Results",
214224
"OK" : "OK",
215225
"DONT_SAVE" : "Don't Save",

src/search/FindInFiles.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ define(function (require, exports, module) {
5050
DocumentManager = require("document/DocumentManager"),
5151
EditorManager = require("editor/EditorManager"),
5252
FileIndexManager = require("project/FileIndexManager"),
53-
KeyEvent = require("utils/KeyEvent");
53+
KeyEvent = require("utils/KeyEvent"),
54+
StatusBar = require("widgets/StatusBar");
5455

5556

5657
var FIND_IN_FILES_MAX = 100;
@@ -297,6 +298,7 @@ define(function (require, exports, module) {
297298
dialog.showDialog(initialString)
298299
.done(function (query) {
299300
if (query) {
301+
StatusBar.showBusyIndicator(true);
300302
var queryExpr = _getQueryRegExp(query);
301303
FileIndexManager.getFileInfoList("all")
302304
.done(function (fileListResult) {
@@ -325,9 +327,11 @@ define(function (require, exports, module) {
325327
})
326328
.done(function () {
327329
_showSearchResults(searchResults, query);
330+
StatusBar.hideBusyIndicator();
328331
})
329332
.fail(function () {
330333
console.log("find in files failed.");
334+
StatusBar.hideBusyIndicator();
331335
});
332336
});
333337
}

src/styles/brackets.less

Lines changed: 58 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,51 @@ a, img {
9494
z-index: @z-index-brackets-toolbar;
9595
}
9696

97+
.busyCursor {
98+
cursor: wait !important;
99+
}
100+
101+
.statusbar {
102+
height: 19px;
103+
overflow: hidden;
104+
background-color: lighten(@bc-grey, @bc-color-step-size*4);
105+
106+
.info {
107+
float: left;
108+
margin-left: 8px;
109+
margin-top: 3px;
110+
111+
span {
112+
color: @bc-grey;
113+
padding-right: 15px;
114+
vertical-align: middle;
115+
}
116+
}
117+
118+
.indicators {
119+
overflow: hidden;
120+
display: block;
121+
float:right;
122+
position: absolute;
123+
right: 24px;
124+
margin: 1px 0px 1px 0px;
125+
126+
.indicator {
127+
margin-right: 2px;
128+
margin-left: 2px;
129+
color: @bc-grey;
130+
}
131+
}
132+
}
133+
134+
#busy-indicator {
135+
color: @bc-grey;
136+
font-size: 1.4em;
137+
display: inline-block;
138+
float: right;
139+
margin: 0px 8px 0px 0px;
140+
}
141+
97142
#editor-holder {
98143
.vbox;
99144
.box-flex(1);
@@ -161,10 +206,19 @@ a, img {
161206
display:none;
162207
}
163208

164-
#gold-star {
165-
display: none;
166-
font-size: 1.2em;
167-
color: #ffe13b;
209+
.jslint-disabled {
210+
font-size: 1em;
211+
color: @bc-grey;
212+
}
213+
214+
.jslint-errors {
215+
font-size: 1em;
216+
color: @bc-red;
217+
}
218+
219+
.jslint-valid {
220+
font-size: 1em;
221+
color: lighten(@bc-yellow, @bc-color-step-size*2);
168222
}
169223

170224
#toolbar-go-live {

0 commit comments

Comments
 (0)