Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Code review fixes. Extracted project settings and update dialogs as w…

…ell.
  • Loading branch information...
commit 5ffa518cee4c6f0bc36479b91036adc5ae305d2c 1 parent ad9c1b9
@njx njx authored
View
2  src/help/HelpCommandHandlers.js
@@ -61,7 +61,7 @@ define(function (require, exports, module) {
APP_NAME_ABOUT_BOX : brackets.config.app_name_about
}, Strings);
- var $template = Mustache.render(AboutDialogTemplate, templateVars);
+ var $template = $(Mustache.render(AboutDialogTemplate, templateVars));
if (buildInfo) {
$("#about-build-number", $template).text(" (" + buildInfo + ")");
}
View
2  src/htmlContent/about-dialog.html
@@ -1,4 +1,4 @@
-<div class="about-dialog template modal hide">
+<div class="about-dialog modal">
<div class="modal-header">
<h1 class="dialog-title">{{ABOUT}}</h1>
</div>
View
31 src/htmlContent/main-view.html
@@ -180,37 +180,6 @@ <h1 class="dialog-title">Title goes here</h1>
<a href="#" class="dialog-button btn primary" data-button-id="ok">{{RELAUNCH_CHROME}}</a>
</div>
</div>
- <div class="update-dialog template modal hide">
- <div class="modal-header">
- <h1 class="dialog-title">{{UPDATE_AVAILABLE_TITLE}}</h1>
- </div>
- <div class="modal-body">
- <img class="update-icon" src="styles/images/update_large_icon.svg">
- <div class="update-text">
- <p class="dialog-message">{{UPDATE_MESSAGE}}</p>
- <div class="update-info">
- </div>
- </div>
- </div>
- <div class="modal-footer">
- <a href="#" class="dialog-button btn left" data-button-id="cancel">{{CANCEL}}</a>
- <a href="#" class="dialog-button btn primary" data-button-id="download">{{GET_IT_NOW}}</a>
- </div>
- </div>
- <div class="project-settings-dialog template modal hide">
- <div class="modal-header">
- <h1 class="dialog-title"></h1>
- </div>
- <div class="modal-body">
- <div class="settings-list">
- <label>{{PROJECT_SETTING_BASE_URL}}: <input type="text" placeholder="{{PROJECT_SETTING_BASE_URL_HINT}}" class="base-url" /></label>
- </div>
- </div>
- <div class="modal-footer">
- <a href="#" class="dialog-button btn left" data-button-id="cancel">{{CANCEL}}</a>
- <a href="#" class="dialog-button btn primary" data-button-id="ok">{{OK}}</a>
- </div>
- </div>
<div id="context-menu-bar">
<ul data-dropdown="dropdown"></ul>
</div>
View
14 src/htmlContent/project-settings-dialog.html
@@ -0,0 +1,14 @@
+<div class="project-settings-dialog modal">
+ <div class="modal-header">
+ <h1 class="dialog-title"></h1>
+ </div>
+ <div class="modal-body">
+ <div class="settings-list">
+ <label>{{PROJECT_SETTING_BASE_URL}}: <input type="text" placeholder="{{PROJECT_SETTING_BASE_URL_HINT}}" class="base-url" /></label>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <a href="#" class="dialog-button btn left" data-button-id="cancel">{{CANCEL}}</a>
+ <a href="#" class="dialog-button btn primary" data-button-id="ok">{{OK}}</a>
+ </div>
+</div>
View
17 src/htmlContent/update-dialog.html
@@ -0,0 +1,17 @@
+<div class="update-dialog modal">
+ <div class="modal-header">
+ <h1 class="dialog-title">{{UPDATE_AVAILABLE_TITLE}}</h1>
+ </div>
+ <div class="modal-body">
+ <img class="update-icon" src="styles/images/update_large_icon.svg">
+ <div class="update-text">
+ <p class="dialog-message">{{UPDATE_MESSAGE}}</p>
+ <div class="update-info">
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <a href="#" class="dialog-button btn left" data-button-id="cancel">{{CANCEL}}</a>
+ <a href="#" class="dialog-button btn primary" data-button-id="download">{{GET_IT_NOW}}</a>
+ </div>
+</div>
View
15 src/preferences/PreferencesDialogs.js
@@ -23,7 +23,7 @@
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
-/*global define, $, PathUtils */
+/*global define, $, PathUtils, Mustache */
/**
* PreferencesDialogs
@@ -34,11 +34,12 @@ define(function (require, exports, module) {
require("thirdparty/path-utils/path-utils.min");
- var Dialogs = require("widgets/Dialogs"),
- PreferencesManager = require("preferences/PreferencesManager"),
- ProjectManager = require("project/ProjectManager"),
- StringUtils = require("utils/StringUtils"),
- Strings = require("strings");
+ var Dialogs = require("widgets/Dialogs"),
+ PreferencesManager = require("preferences/PreferencesManager"),
+ ProjectManager = require("project/ProjectManager"),
+ StringUtils = require("utils/StringUtils"),
+ Strings = require("strings"),
+ SettingsDialogTemplate = require("text!htmlContent/project-settings-dialog.html");
/**
* Validate that text string is a valid base url which should map to a server folder
@@ -85,7 +86,7 @@ define(function (require, exports, module) {
$baseUrlControl,
promise;
- promise = Dialogs.showModalDialog(Dialogs.DIALOG_ID_PROJECT_SETTINGS)
+ promise = Dialogs.showModalDialogUsingTemplate(Mustache.render(SettingsDialogTemplate, Strings))
.done(function (id) {
if (id === Dialogs.DIALOG_BTN_OK) {
var baseUrlValue = $baseUrlControl.val();
View
15 src/utils/UpdateNotification.js
@@ -31,12 +31,13 @@
define(function (require, exports, module) {
"use strict";
- var Dialogs = require("widgets/Dialogs"),
- NativeApp = require("utils/NativeApp"),
- PreferencesManager = require("preferences/PreferencesManager"),
- Strings = require("strings"),
- StringUtils = require("utils/StringUtils"),
- Global = require("utils/Global");
+ var Dialogs = require("widgets/Dialogs"),
+ NativeApp = require("utils/NativeApp"),
+ PreferencesManager = require("preferences/PreferencesManager"),
+ Strings = require("strings"),
+ StringUtils = require("utils/StringUtils"),
+ Global = require("utils/Global"),
+ UpdateDialogTemplate = require("text!htmlContent/update-dialog.html");
// Extract current build number from package.json version field 0.0.0-0
var _buildNumber = Number(/-([0-9]+)/.exec(brackets.metadata.version)[1]);
@@ -186,7 +187,7 @@ define(function (require, exports, module) {
* Show a dialog that shows the update
*/
function _showUpdateNotificationDialog(updates) {
- Dialogs.showModalDialog(Dialogs.DIALOG_ID_UPDATE)
+ Dialogs.showModalDialogUsingTemplate(Mustache.render(UpdateDialogTemplate, Strings))
.done(function (id) {
if (id === Dialogs.DIALOG_BTN_DOWNLOAD) {
// The first entry in the updates array has the latest download link
View
11 src/widgets/Dialogs.js
@@ -50,9 +50,7 @@ define(function (require, exports, module) {
DIALOG_ID_SAVE_CLOSE = "save-close-dialog",
DIALOG_ID_EXT_CHANGED = "ext-changed-dialog",
DIALOG_ID_EXT_DELETED = "ext-deleted-dialog",
- DIALOG_ID_LIVE_DEVELOPMENT = "live-development-error-dialog",
- DIALOG_ID_UPDATE = "update-dialog",
- DIALOG_ID_PROJECT_SETTINGS = "project-settings-dialog";
+ DIALOG_ID_LIVE_DEVELOPMENT = "live-development-error-dialog";
function _dismissDialog(dlg, buttonId) {
dlg.data("buttonId", buttonId);
@@ -130,7 +128,6 @@ define(function (require, exports, module) {
promise = result.promise();
var $dlg = $(template)
- .removeClass("template")
.addClass("instance")
.appendTo(window.document.body);
@@ -222,7 +219,9 @@ define(function (require, exports, module) {
// type happen to show up, they can appear at the same time. (This is an edge case that
// shouldn't happen often, but we can't prevent it from happening since everything is
// asynchronous.)
- var $template = $("." + dlgClass + ".template").clone();
+ var $template = $("." + dlgClass + ".template")
+ .clone()
+ .removeClass("template");
if ($template.length === 0) {
throw new Error("Dialog id " + dlgClass + " does not exist");
}
@@ -253,8 +252,6 @@ define(function (require, exports, module) {
exports.DIALOG_ID_EXT_CHANGED = DIALOG_ID_EXT_CHANGED;
exports.DIALOG_ID_EXT_DELETED = DIALOG_ID_EXT_DELETED;
exports.DIALOG_ID_LIVE_DEVELOPMENT = DIALOG_ID_LIVE_DEVELOPMENT;
- exports.DIALOG_ID_UPDATE = DIALOG_ID_UPDATE;
- exports.DIALOG_ID_PROJECT_SETTINGS = DIALOG_ID_PROJECT_SETTINGS;
exports.showModalDialog = showModalDialog;
exports.showModalDialogUsingTemplate = showModalDialogUsingTemplate;
Please sign in to comment.
Something went wrong with that request. Please try again.