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

fix dirty dot layout #1219

Merged
merged 1 commit into from
Jul 9, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/document/DocumentCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ define(function (require, exports, module) {

/** @type {jQueryObject} Container for label shown above editor; must be an inline element */
var _$title = null;
/** @type {jQueryObject} Container for dirty dot; must be an inline element */
var _$dirtydot = null;
/** @type {jQueryObject} Container for _$title; need not be an inline element */
var _$titleWrapper = null;
/** @type {string} Label shown above editor for current document: filename and potentially some of its path */
Expand All @@ -62,19 +64,17 @@ define(function (require, exports, module) {
/** @type {Number} Last known height of _$titleContainerToolbar */
var _lastToolbarHeight = null;

var DIRTY_INDICATOR = " <span class='dirty-dot'>\u2022</span>";

function updateTitle() {
var currentDoc = DocumentManager.getCurrentDocument();
if (currentDoc) {
_$title.text(_currentTitlePath);
_$title.attr("title", currentDoc.file.fullPath);
if (currentDoc.isDirty) {
_$title.append(DIRTY_INDICATOR);
}
// dirty dot is always in DOM so layout doesn't change, and visibility is toggled
_$dirtydot.css("visibility", (currentDoc.isDirty) ? "visible" : "hidden");
} else {
_$title.text("");
_$title.attr("title", "");
_$dirtydot.css("visibility", "hidden");
}

// Set _$titleWrapper to a fixed width just large enough to accomodate _$title. This seems equivalent to what
Expand Down Expand Up @@ -749,6 +749,7 @@ define(function (require, exports, module) {
_$titleContainerToolbar = $titleContainerToolbar;
_$titleWrapper = $(".title-wrapper", _$titleContainerToolbar);
_$title = $(".title", _$titleWrapper);
_$dirtydot = $(".dirty-dot", _$titleWrapper);

// Register global commands
CommandManager.register(Strings.CMD_FILE_OPEN, Commands.FILE_OPEN, handleFileOpen);
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@

<!-- Filename label -->
<div class="title-wrapper">
<span class="title"></span>
<span class="title"></span>&nbsp;<span class='dirty-dot' style="visibility:hidden;">•</span>
</div>
</div>

Expand Down