Class: CPEE::ConsoleUI

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

Overview

}}}

Instance Method Summary collapse

Instance Method Details

#responseObject

{{{



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/cpee/implementation.rb', line 197

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