1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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 += "/"; pathname += "/";
} }
var callback = encodeURIComponent(location.protocol+"//"+location.hostname+":"+location.port+pathname+"twitter-credentials/"+twitterConfigNodeId+"/auth/callback"); var callback = encodeURIComponent(location.protocol+"//"+location.hostname+":"+location.port+pathname+"twitter-credentials/"+twitterConfigNodeId+"/auth/callback");
$("#node-config-dialog-ok").button("disable");
$("#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-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() { $("#node-config-twitter-start").click(function() {
twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000); twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000);
}); });
@ -45,6 +45,7 @@
if (data.screen_name) { if (data.screen_name) {
updateTwitterScreenName(data.screen_name); updateTwitterScreenName(data.screen_name);
twitterConfigNodeIntervalId = null; twitterConfigNodeIntervalId = null;
$("#node-config-dialog-ok").button("enable");
} else { } else {
twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000); twitterConfigNodeIntervalId = window.setTimeout(pollTwitterCredentials,2000);
} }

View File

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