Skip to content

Commit 2e55313

Browse files
committed
Remove tryruby answer
1 parent 4021f5a commit 2e55313

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

source/index.html.markdown

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ description: Learn to program in Ruby in 30 minutes
2929
</div>
3030

3131
<select id="tryruby-index" class="form-control"></select>
32-
32+
3333
<div id="tryruby-explanation">
3434

3535
<h2 id="tryruby-title">Got 30 minutes? Give Ruby a shot right now!</h2>
@@ -38,7 +38,7 @@ description: Learn to program in Ruby in 30 minutes
3838
<p>Ruby is a programming language from Japan which is revolutionizing software development.</p>
3939
<p>The beauty of Ruby is found in its balance between simplicity and power.</p>
4040
<p>You can type some Ruby code in the editor and use these buttons to navigate:</p>
41-
41+
4242
<ul>
4343
<li><strong>Run</strong> &rarr; Executes the code in the editor</li>
4444
<li><strong>Copy</strong> &rarr; Copies the example code to the editor</li>
@@ -49,9 +49,6 @@ description: Learn to program in Ruby in 30 minutes
4949

5050
<h3>Click on <strong>Next</strong> to start learning.</h3>
5151
</div>
52-
53-
<div id="tryruby-answer" style="display:none"></div>
54-
5552
</div>
5653
</div>
5754

source/javascripts/try_ruby.js.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
require 'promise'
66
require 'browser/setup/full'
77
require 'browser/cookies'
8+
require 'browser/form_data'
89

910
# Container for individual lessons
1011
class TryRubyItem
@@ -334,9 +335,10 @@ def do_change_lang
334335

335336
# Playground methods
336337
def get_code_from_url
337-
hash = $$.decodeURIComponent($$[:location][:hash].gsub('+', ' '))
338+
hash = $document.location.fragment.to_s
339+
hash = Browser::FormData.decode(hash.gsub('+', ' '))
338340

339-
hash['#code='.size..-1] if hash.start_with?('#code=')
341+
hash.delete_prefix("#code=") if hash.start_with?('#code=')
340342
end
341343

342344
def do_copy_url
@@ -381,7 +383,6 @@ def update_screen(item)
381383
@updating = true
382384
title_element.inner_html = item.title
383385
$document.at_css('#tryruby-content').inner_html = item.text
384-
$document.at_css('#tryruby-answer').inner_html = item.answer
385386
@editor.value = item.saved_editor if @editor
386387
@output.value = item.saved_output if @output
387388
@current_copycode = get_code_fragment(item.text)

0 commit comments

Comments
 (0)