Class: CPEE::ConsoleUI

Inherits:
Riddl::Implementation
  • Object
show all
Defined in:
lib/cpee/implementation.rb

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# File 'lib/cpee/implementation.rb', line 229

def response
  controller = @a[0]
  id = @r[0].to_i
  unless controller[id]
    @status = 400
    return
  end
  Riddl::Parameter::Complex.new("res","text/html") do
    <<-END
      <!DOCTYPE html>
      <html>
        <head>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
          <title>Instance Web Console</title>
          <style type="text/css">
            [contenteditable] { display: inline; }
            [contenteditable]:focus { outline: 0px solid transparent; }
            body{ font-family: Courier,Courier New,Monospace}
          </style>
          <script type="text/javascript" src="//#{controller[id].host}/js_libs/jquery.min.js"></script>
          <script type="text/javascript" src="//#{controller[id].host}/js_libs/ansi_up.js"></script>
          <script type="text/javascript" src="//#{controller[id].host}/js_libs/console.js"></script>
        </head>
        <body>
          <p>Instance Web Console. Type "help" to get started.</p>
          <div class="console-line" id="console-template" style="display: none">
            <strong>console$&nbsp;</strong><div class='edit' contenteditable="true" ></div>
          </div>
          <div class="console-line">
            <strong>console$&nbsp;</strong><div class='edit' contenteditable="true"></div>
          </div>
        </body>
      </html>
    END
  end
end