Skip to content

Commit

Permalink
Disable editing of title if app exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Curran committed May 21, 2018
1 parent 5d397c5 commit 4a1582b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions rsconnect/static/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ define([
if ($this.hasClass("active")) {
selectedEntryId = id;
btnPublish.removeClass("disabled");
maybeDisableTitle();
} else {
selectedEntryId = null;
btnPublish.addClass("disabled");
Expand All @@ -462,6 +463,16 @@ define([
var txtApiKey = null;
var txtTitle = null;

var maybeDisableTitle = function() {
var entry = config.servers[selectedEntryId];
// if title was already set for this notebook
if (entry && entry.notebookTitle) {
txtTitle.val(entry.notebookTitle).attr("disabled", "");
} else {
txtTitle.removeAttr("disabled");
}
};

var publishModal = Dialog.modal({
// pass the existing keyboard manager so all shortcuts are disabled while
// modal is active
Expand Down Expand Up @@ -526,6 +537,7 @@ define([
// add default title
txtTitle = publishModal.find("[name=title]");
txtTitle.val(config.getNotebookTitle(selectedEntryId));
maybeDisableTitle();

txtApiKey = publishModal.find("[name=api-key]");

Expand Down

0 comments on commit 4a1582b

Please sign in to comment.