Permalink
Browse files

Merge branch 'master' of https://github.com/fengb/tilde

  • Loading branch information...
2 parents be36735 + 55e0f62 commit 542910136f74d4bd4a7c6d250b71c3bb11cb54fe @jmmastey jmmastey committed Apr 20, 2012
Showing with 15 additions and 1 deletion.
  1. +13 −1 app/assets/javascripts/application.js
  2. +1 −0 app/controllers/tilde_controller.rb
  3. +1 −0 app/views/home/index.html.erb
@@ -7,7 +7,19 @@ $(function () {
var jqconsole = $('#console').jqconsole('', '>> ');
var startPrompt = function () {
jqconsole.Prompt(true, function (input) {
- jqconsole.Write(input + '\n', 'jqconsole-output');
+ $.ajax({
+ headers: {
+ 'X-Transaction': 'POST Example',
+ 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
+ },
+ data: { command: input, commit: 'Execute' },
+ url: '/tilde/command',
+ type: 'post',
+ dataType: 'json',
+ success: function(e) {
+ jqconsole.Write(e.response + '\n', 'jqconsole-output');
+ }
+ });
startPrompt();
});
};
@@ -6,6 +6,7 @@ def command
@response = communicate(port, params[:command])
@command = params[:command]
+ render :json => { "response" => @response }
end
end
@@ -0,0 +1 @@
+<div id="console"></div>

0 comments on commit 5429101

Please sign in to comment.