Prevent adding empty twitter creds

Closes #372
This commit is contained in:
Nick O'Leary 2014-09-08 14:41:39 +01:00
parent b3fa866385
commit 3e3b388ca7
2 changed files with 7 additions and 2 deletions

View File

@ -30,8 +30,8 @@
pathname += "/";
}
var callback = encodeURIComponent(location.protocol+"//"+location.hostname+":"+location.port+pathname+"twitter-credentials/"+twitterConfigNodeId+"/auth/callback");
$("#node-config-twitter-row").html('Click <a id="node-config-twitter-start" href="twitter-credentials/'+twitterConfigNodeId+'/auth?callback='+callback+'" target="_blank"><b>here</b></a> to authenticate with Twitter.');
$("#node-config-dialog-ok").button("disable");
$("#node-config-twitter-row").html('<div style="text-align: center; margin-top: 20px; "><a class="btn" id="node-config-twitter-start" href="twitter-credentials/'+twitterConfigNodeId+'/auth?callback='+callback+'" target="_blank">Click here to authenticate with Twitter.</a></div>');
$("#node-config-twitter-start").click(function() {
twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000);
});
@ -45,6 +45,7 @@
if (data.screen_name) {
updateTwitterScreenName(data.screen_name);
twitterConfigNodeIntervalId = null;
$("#node-config-dialog-ok").button("enable");
} else {
twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000);
}

View File

@ -122,6 +122,7 @@ RED.editor = (function() {
width: 500,
buttons: [
{
id: "node-dialog-ok",
text: "Ok",
click: function() {
if (editing_node) {
@ -237,6 +238,7 @@ RED.editor = (function() {
}
},
{
id: "node-dialog-cancel",
text: "Cancel",
click: function() {
$( this ).dialog( "close" );
@ -562,6 +564,7 @@ RED.editor = (function() {
closeOnEscape: false,
buttons: [
{
id: "node-config-dialog-ok",
text: "Ok",
click: function() {
var configProperty = $(this).dialog('option','node-property');
@ -611,6 +614,7 @@ RED.editor = (function() {
}
},
{
id: "node-config-dialog-cancel",
text: "Cancel",
click: function() {
var configType = $(this).dialog('option','node-type');