From 4a1582b1ce59a9d8ca1d88a9b7b3e1a10c6c3773 Mon Sep 17 00:00:00 2001 From: Jonathan Curran Date: Mon, 21 May 2018 09:03:48 -0600 Subject: [PATCH] Disable editing of title if app exists --- rsconnect/static/connect.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rsconnect/static/connect.js b/rsconnect/static/connect.js index 8b2c6759..67a8ae2f 100644 --- a/rsconnect/static/connect.js +++ b/rsconnect/static/connect.js @@ -449,6 +449,7 @@ define([ if ($this.hasClass("active")) { selectedEntryId = id; btnPublish.removeClass("disabled"); + maybeDisableTitle(); } else { selectedEntryId = null; btnPublish.addClass("disabled"); @@ -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 @@ -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]");