Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show binding changes #263

Merged
merged 13 commits into from
Jun 11, 2018
3 changes: 2 additions & 1 deletion lib/web_console/templates/_inner_console_markup.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class='console-actions'>
<div class='close-button button' title='close'>x</div>
</div>
<div class='console-inner'></div>
<div class='console-inner'>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may drop this diff change as well, e.g. leave it as before:

<div class='console-inner'></div>

</div>
</div>
<input class='clipboard' type='text'>
19 changes: 15 additions & 4 deletions lib/web_console/templates/console.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -595,13 +595,19 @@ REPLConsole.prototype.writeOutput = function(output) {
this.inner.appendChild(consoleMessage);
this.newPromptBox();
return consoleMessage;
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one too, leave the };, so we don't have this one pop-up in the diff.


REPLConsole.prototype.writeError = function(output) {
var consoleMessage = this.writeOutput(output);
addClass(consoleMessage, "error-message");
return consoleMessage;
};
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


REPLConsole.prototype.writeNotification = function(output) {
var consoleMessage = this.writeOutput(output);
addClass(consoleMessage, "notification-message");
return consoleMessage;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.


REPLConsole.prototype.onEnterKey = function() {
var input = this._input;
Expand Down Expand Up @@ -864,11 +870,16 @@ REPLConsole.prototype.scrollToBottom = function() {
this.outer.scrollTop = this.outer.scrollHeight;
};

// Change the binding of the console
// Change the binding of the console.
REPLConsole.prototype.switchBindingTo = function(frameId, callback) {
var url = this.getSessionUrl('trace');
var params = "frame_id=" + encodeURIComponent(frameId);
postRequest(url, params, callback);

var _this = this;
postRequest(url, params, function() {
var text = "Context has changed to: " + callback();
_this.writeNotification(text);
});
};

/**
Expand Down
8 changes: 3 additions & 5 deletions lib/web_console/templates/error_page.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@ for (var i = 0; i < traceFrames.length; i++) {

// Change the binding of the console.
changeBinding(frameId, function() {
if (selectedFrame) {
selectedFrame.className = selectedFrame.className.replace("selected", "");
}

target.className += " selected";
// Rails already handles toggling the select class
selectedFrame = target;
return target.innerHTML;
});

// Change the extracted source code
changeSourceExtract(frameId);
});
}

// Change the binding of the current session and prompt the user.
function changeBinding(frameId, callback) {
REPLConsole.currentSession.switchBindingTo(frameId, callback);
}
Expand Down
7 changes: 4 additions & 3 deletions lib/web_console/templates/style.css.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
.console .console-inner { font-family: monospace; font-size: 11px; width: 100%; height: 100%; overflow: none; background: #333; }
.console .console-prompt-box { color: #FFF; }
.console .console-message { color: #1AD027; margin: 0; border: 0; white-space: pre-wrap; background-color: #333; padding: 0; }
.console .console-message.error-message { color: #fc9; }
.console .console-message.error-message { color: #FC9; }
.console .console-message.notification-message { color: #99F; }
.console .console-message.auto-complete { word-break: break-all; }
.console .console-message.auto-complete .keyword { margin-right: 11px; }
.console .console-message.auto-complete .keyword.selected { background: #FFF; color: #000; }
Expand All @@ -21,8 +22,8 @@
.console .resizer { background: #333; width: 100%; height: 4px; cursor: ns-resize; }
.console .console-actions { padding-right: 3px; }
.console .console-actions .button { float: left; }
.console .button { cursor: pointer; border-radius: 1px; font-family: monospace; font-size: 13px; width: 14px; height: 14px; line-height: 14px; text-align: center; color: #ccc; }
.console .button:hover { background: #666; color: #fff; }
.console .button { cursor: pointer; border-radius: 1px; font-family: monospace; font-size: 13px; width: 14px; height: 14px; line-height: 14px; text-align: center; color: #CCC; }
.console .button:hover { background: #666; color: #FFF; }
.console .button.close-button:hover { background: #966; }
.console .clipboard { height: 0px; padding: 0px; margin: 0px; width: 0px; margin-left: -1000px; }
.console .console-prompt-label { display: inline; color: #FFF; background: none repeat scroll 0% 0% #333; border: 0; padding: 0; }
Expand Down