aladdin 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/aladdin/app.rb +5 -23
- data/lib/aladdin/constants.rb +1 -1
- data/lib/aladdin/render/html.rb +5 -3
- data/lib/aladdin/render/templates/problem.rb +1 -1
- data/lib/aladdin/render/templates/template.rb +1 -1
- data/lib/aladdin/submission.rb +6 -6
- data/lib/aladdin/version.rb +1 -1
- data/views/haml/layout.haml +24 -24
- data/views/haml/multi.haml +1 -3
- data/views/haml/short.haml +1 -3
- data/views/haml/table.haml +1 -3
- metadata +3 -49
- data/assets/__font/general_foundicons.eot +0 -0
- data/assets/__font/general_foundicons.svg +0 -15
- data/assets/__font/general_foundicons.ttf +0 -0
- data/assets/__font/general_foundicons.woff +0 -0
- data/assets/__img/graphic.png +0 -0
- data/assets/__img/no_gravatar.gif +0 -0
- data/assets/__js/app.js +0 -76
- data/assets/__js/foundation/app.js +0 -38
- data/assets/__js/foundation/jquery.cookie.js +0 -72
- data/assets/__js/foundation/jquery.event.move.js +0 -580
- data/assets/__js/foundation/jquery.event.swipe.js +0 -130
- data/assets/__js/foundation/jquery.foundation.accordion.js +0 -34
- data/assets/__js/foundation/jquery.foundation.alerts.js +0 -20
- data/assets/__js/foundation/jquery.foundation.buttons.js +0 -74
- data/assets/__js/foundation/jquery.foundation.clearing.js +0 -468
- data/assets/__js/foundation/jquery.foundation.forms.js +0 -486
- data/assets/__js/foundation/jquery.foundation.joyride.js +0 -639
- data/assets/__js/foundation/jquery.foundation.magellan.js +0 -85
- data/assets/__js/foundation/jquery.foundation.mediaQueryToggle.js +0 -27
- data/assets/__js/foundation/jquery.foundation.navigation.js +0 -55
- data/assets/__js/foundation/jquery.foundation.orbit.js +0 -897
- data/assets/__js/foundation/jquery.foundation.reveal.js +0 -794
- data/assets/__js/foundation/jquery.foundation.tabs.js +0 -43
- data/assets/__js/foundation/jquery.foundation.tooltips.js +0 -193
- data/assets/__js/foundation/jquery.foundation.topbar.js +0 -152
- data/assets/__js/foundation/jquery.js +0 -9440
- data/assets/__js/foundation/jquery.offcanvas.js +0 -50
- data/assets/__js/foundation/jquery.placeholder.js +0 -157
- data/assets/__js/foundation/modernizr.foundation.js +0 -4
- data/assets/favicon.ico +0 -0
data/lib/aladdin/app.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# ~*~ encoding: utf-8 ~*~
|
2
2
|
require 'sinatra'
|
3
|
-
require 'zurb-foundation'
|
4
3
|
require 'aladdin/submission'
|
5
4
|
|
6
5
|
module Aladdin
|
@@ -8,7 +7,6 @@ module Aladdin
|
|
8
7
|
# Sinatra app that serves the tutorial. Should be able to use this in a
|
9
8
|
# config.ru file or as middleware. Authors should launch the app using the
|
10
9
|
# +bin/aladdin+ executable.
|
11
|
-
# Adapted from https://github.com/jerodsanto/sinatra-foundation-skeleton/
|
12
10
|
class App < Sinatra::Base
|
13
11
|
extend Support::OneOfPattern
|
14
12
|
|
@@ -40,26 +38,17 @@ module Aladdin
|
|
40
38
|
# Configures path to static assets in the public folder.
|
41
39
|
# @return [void]
|
42
40
|
def configure_assets
|
43
|
-
|
41
|
+
puts Aladdin::PATHS.public
|
42
|
+
set :public_folder, Aladdin::PATHS.public
|
44
43
|
set :static_paths, Proc.new { Aladdin.config[:static_paths] }
|
45
44
|
end
|
46
45
|
|
47
|
-
# Configures ZURB's compass to compile aladdin's scss assets.
|
48
|
-
# @return [void]
|
49
|
-
def configure_compass
|
50
|
-
Compass.configuration do |config|
|
51
|
-
config.http_path = '/'
|
52
|
-
config.http_images_path = '/__img'
|
53
|
-
end
|
54
|
-
set :scss, Compass.sass_engine_options
|
55
|
-
end
|
56
|
-
|
57
46
|
# Registers redcarpet2 and configures aladdin's markdown renderer.
|
58
47
|
# @return [void]
|
59
48
|
def configure_markdown
|
60
49
|
Tilt.register Tilt::RedcarpetTemplate::Redcarpet2, *%w(markdown mkd md)
|
61
50
|
set :markdown, MARKDOWN_OPTIONS
|
62
|
-
set :haml, escape_html: true
|
51
|
+
set :haml, escape_html: true, format: :html5
|
63
52
|
end
|
64
53
|
|
65
54
|
end
|
@@ -77,21 +66,14 @@ module Aladdin
|
|
77
66
|
enable :logging
|
78
67
|
configure_views
|
79
68
|
configure_markdown
|
80
|
-
|
81
|
-
configure :development, :test do
|
82
|
-
configure_assets
|
83
|
-
configure_compass
|
84
|
-
end
|
85
|
-
|
86
|
-
get '/__css/*.css' do |path|
|
87
|
-
render_or_pass { scss path.to_sym }
|
88
|
-
end
|
69
|
+
configure_assets
|
89
70
|
|
90
71
|
get one_of(settings.static_paths) do |path|
|
91
72
|
send_file File.join(settings.root, path)
|
92
73
|
end
|
93
74
|
|
94
75
|
get '/*' do |path|
|
76
|
+
pass if path.starts_with? '__sinatra__'
|
95
77
|
path = path.empty? ? INDEX : path.to_sym
|
96
78
|
render_or_pass do
|
97
79
|
markdown(path, locals: Aladdin.config)
|
data/lib/aladdin/constants.rb
CHANGED
data/lib/aladdin/render/html.rb
CHANGED
@@ -26,15 +26,16 @@ module Aladdin
|
|
26
26
|
|
27
27
|
# Paragraphs that start and end with braces are treated as JSON blocks
|
28
28
|
# and are parsed for questions/answers.
|
29
|
-
PROBLEM_REGEX =
|
29
|
+
PROBLEM_REGEX = /\A\s*{.+\z/m
|
30
30
|
|
31
31
|
# Paragraphs that only contain images are rendered differently.
|
32
|
-
IMAGE_REGEX =
|
32
|
+
IMAGE_REGEX = /\A\s*<img[^<>]+>\s*\z/m
|
33
33
|
|
34
34
|
# Renderer configuration options.
|
35
35
|
CONFIGURATION = {
|
36
36
|
hard_wrap: true,
|
37
37
|
no_styles: true,
|
38
|
+
name: 'untitled'
|
38
39
|
}
|
39
40
|
|
40
41
|
# Creates a new HTML renderer.
|
@@ -42,6 +43,7 @@ module Aladdin
|
|
42
43
|
def initialize(options = {})
|
43
44
|
super options.merge(CONFIGURATION)
|
44
45
|
exe_template = File.join(Aladdin::VIEWS[:haml], 'exe.haml')
|
46
|
+
@name = options[:name]
|
45
47
|
@exe = Haml::Engine.new(File.read exe_template)
|
46
48
|
@nav, @headers = Navigation.new, Headers.new
|
47
49
|
@prob, @img = 0, 0 # indices for Problem #, Figure #
|
@@ -104,7 +106,7 @@ module Aladdin
|
|
104
106
|
def problem(json)
|
105
107
|
b = '\\' # unescape backslashes
|
106
108
|
problem = Problem.parse(HTML.entities.decode(json).gsub(b, b * 4))
|
107
|
-
problem.save! and problem.render(index: @prob += 1)
|
109
|
+
problem.save! @name and problem.render(index: @prob += 1)
|
108
110
|
end
|
109
111
|
|
110
112
|
# Prepares a block image. Raises {RenderError} or {ParseError} if the
|
@@ -76,7 +76,7 @@ module Aladdin
|
|
76
76
|
# Saves the answer to a file on disk.
|
77
77
|
# @todo TODO should probably show some error message in the preview,
|
78
78
|
# so that the author doesn't have to read the logs.
|
79
|
-
def save!
|
79
|
+
def save!(name)
|
80
80
|
raise RenderError.new('Invalid problem.') unless valid?
|
81
81
|
solution = File.join(Aladdin::DATA_DIR, id + Aladdin::SOLUTION_EXT)
|
82
82
|
File.open(solution, 'wb+') { |file| Marshal.dump answer, file }
|
data/lib/aladdin/submission.rb
CHANGED
@@ -17,7 +17,7 @@ module Aladdin
|
|
17
17
|
|
18
18
|
# Creates a new student submission.
|
19
19
|
# @param [String] id exercise ID
|
20
|
-
# @param [Type] type
|
20
|
+
# @param [Type] type problem or code
|
21
21
|
# @param [Hash] params form values
|
22
22
|
# @param [String] input student input
|
23
23
|
def initialize(id, type, params, input)
|
@@ -28,16 +28,16 @@ module Aladdin
|
|
28
28
|
def verify
|
29
29
|
case @type
|
30
30
|
when Type::CODE then verify_code
|
31
|
-
when Type::
|
31
|
+
when Type::PROBLEM then verify_problem
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
# Verifies
|
37
|
+
# Verifies problem answers by comparing the submitted answer against the
|
38
38
|
# answer in the solution file.
|
39
39
|
# @return [String] (json-encoded) true iff the submitted answer is correct.
|
40
|
-
def
|
40
|
+
def verify_problem
|
41
41
|
id = @id.gsub File::SEPARATOR, '' # protect against directory attacks
|
42
42
|
solution = File.expand_path id + Aladdin::SOLUTION_EXT, Aladdin::DATA_DIR
|
43
43
|
File.open(solution, 'rb') { |f| same? @params['answer'], Marshal.restore(f) }.to_json
|
@@ -81,8 +81,8 @@ module Aladdin
|
|
81
81
|
|
82
82
|
# Submission Type, for use as enum.
|
83
83
|
module Type
|
84
|
-
#
|
85
|
-
|
84
|
+
# Problem Type
|
85
|
+
PROBLEM = 'problem'
|
86
86
|
# Code Type
|
87
87
|
CODE = 'code'
|
88
88
|
end
|
data/lib/aladdin/version.rb
CHANGED
data/views/haml/layout.haml
CHANGED
@@ -12,12 +12,12 @@
|
|
12
12
|
%meta{name: 'viewport', content: 'width=device-width'}
|
13
13
|
|
14
14
|
%title= title
|
15
|
-
%link{rel: 'stylesheet', href:'
|
16
|
-
%link{rel: 'stylesheet', href:'
|
15
|
+
%link{rel: 'stylesheet', href:'/assets/application.css'}
|
16
|
+
%link{rel: 'stylesheet', href:'/assets/general_foundicons.css'}
|
17
17
|
/[if lt IE 8]
|
18
|
-
%link{rel: 'stylesheet', href:'
|
18
|
+
%link{rel: 'stylesheet', href:'/assets/general_foundicons_ie7.css'}
|
19
19
|
|
20
|
-
%script{src: '
|
20
|
+
%script{src: '/assets/foundation/modernizr.foundation.js'}
|
21
21
|
|
22
22
|
%body
|
23
23
|
|
@@ -29,7 +29,7 @@
|
|
29
29
|
%h1= title
|
30
30
|
%h4
|
31
31
|
<!-- TODO: user gravatar -->
|
32
|
-
%img{src: '
|
32
|
+
%img{src: '/assets/no_gravatar.gif', width: 20, height: 20, alt: 'John Doe'}
|
33
33
|
<!-- TOOD: user name -->
|
34
34
|
%small John Doe
|
35
35
|
%h4.subheader= description
|
@@ -43,7 +43,7 @@
|
|
43
43
|
%h1
|
44
44
|
%a.th.hero{href: '#'}
|
45
45
|
<!-- TODO: graphic from user's repo -->
|
46
|
-
%img{src: '
|
46
|
+
%img{src: '/assets/graphic.png'}
|
47
47
|
|
48
48
|
%hr/
|
49
49
|
%section{role: 'lesson'}
|
@@ -61,27 +61,27 @@
|
|
61
61
|
%span <!-- TODO: score goes here -->
|
62
62
|
|
63
63
|
-# foundation
|
64
|
-
%script{src: '
|
65
|
-
%script{src: '
|
66
|
-
%script{src: '
|
67
|
-
%script{src: '
|
68
|
-
%script{src: '
|
69
|
-
%script{src: '
|
70
|
-
%script{src: '
|
71
|
-
%script{src: '
|
72
|
-
%script{src: '
|
73
|
-
%script{src: '
|
74
|
-
%script{src: '
|
75
|
-
%script{src: '
|
76
|
-
%script{src: '
|
77
|
-
%script{src: '
|
78
|
-
%script{src: '
|
79
|
-
%script{src: '
|
80
|
-
%script{src: '
|
64
|
+
%script{src: 'assets/foundation/jquery.js'}
|
65
|
+
%script{src: 'assets/foundation/jquery.cookie.js'}
|
66
|
+
%script{src: 'assets/foundation/jquery.event.move.js'}
|
67
|
+
%script{src: 'assets/foundation/jquery.event.swipe.js'}
|
68
|
+
%script{src: 'assets/foundation/jquery.foundation.accordion.js'}
|
69
|
+
%script{src: 'assets/foundation/jquery.foundation.alerts.js'}
|
70
|
+
%script{src: 'assets/foundation/jquery.foundation.buttons.js'}
|
71
|
+
%script{src: 'assets/foundation/jquery.foundation.clearing.js'}
|
72
|
+
%script{src: 'assets/foundation/jquery.foundation.forms.js'}
|
73
|
+
%script{src: 'assets/foundation/jquery.foundation.magellan.js'}
|
74
|
+
%script{src: 'assets/foundation/jquery.foundation.mediaQueryToggle.js'}
|
75
|
+
%script{src: 'assets/foundation/jquery.foundation.navigation.js'}
|
76
|
+
%script{src: 'assets/foundation/jquery.foundation.tabs.js'}
|
77
|
+
%script{src: 'assets/foundation/jquery.foundation.tooltips.js'}
|
78
|
+
%script{src: 'assets/foundation/jquery.foundation.topbar.js'}
|
79
|
+
%script{src: 'assets/foundation/jquery.placeholder.js'}
|
80
|
+
%script{src: 'assets/foundation/app.js'}
|
81
81
|
|
82
82
|
-# mathjax
|
83
83
|
%script{src: 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'}
|
84
|
-
%script{src: '
|
84
|
+
%script{src: 'assets/app.min.js'}
|
85
85
|
|
86
86
|
:plain
|
87
87
|
</html>
|
data/views/haml/multi.haml
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
-# coding: UTF-8
|
2
|
-
%form.
|
2
|
+
%form.problem{action: 'verify/problem/' + id, 'accept-charset' => 'UTF-8', id: "problem_#{id}", method: 'post'}
|
3
3
|
%fieldset
|
4
4
|
|
5
5
|
%legend Problem #{index}
|
6
|
-
%input.q-id{type: 'hidden', value: id}
|
7
|
-
|
8
6
|
%p= question
|
9
7
|
|
10
8
|
.row.collapse
|
data/views/haml/short.haml
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
-# coding: UTF-8
|
2
|
-
%form.
|
2
|
+
%form.problem{action: 'verify/problem/' + id, 'accept-charset' => 'UTF-8', id: "problem_#{id}", method: 'post'}
|
3
3
|
%fieldset
|
4
4
|
|
5
5
|
%legend Problem #{index}
|
6
|
-
%input.q-id{type: 'hidden', value: id}
|
7
|
-
|
8
6
|
%p= question
|
9
7
|
|
10
8
|
.row.collapse
|
data/views/haml/table.haml
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
-# coding: UTF-8
|
2
|
-
%form.
|
2
|
+
%form.problem{action: 'verify/problem/' + id, 'accept-charset' => 'UTF-8', id: "problem_#{id}", method: 'post'}
|
3
3
|
%fieldset
|
4
4
|
|
5
5
|
%legend Problem #{index}
|
6
|
-
%input.q-id{type: 'hidden', value: id}
|
7
|
-
|
8
6
|
%p= question
|
9
7
|
|
10
8
|
.row
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aladdin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '1.3'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: zurb-foundation
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 3.2.3
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 3.2.3
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: haml
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -258,36 +242,6 @@ files:
|
|
258
242
|
- lib/aladdin/support.rb
|
259
243
|
- lib/aladdin/version.rb
|
260
244
|
- lib/aladdin.rb
|
261
|
-
- assets/__font/general_foundicons.eot
|
262
|
-
- assets/__font/general_foundicons.svg
|
263
|
-
- assets/__font/general_foundicons.ttf
|
264
|
-
- assets/__font/general_foundicons.woff
|
265
|
-
- assets/__img/graphic.png
|
266
|
-
- assets/__img/no_gravatar.gif
|
267
|
-
- assets/__js/app.js
|
268
|
-
- assets/__js/foundation/app.js
|
269
|
-
- assets/__js/foundation/jquery.cookie.js
|
270
|
-
- assets/__js/foundation/jquery.event.move.js
|
271
|
-
- assets/__js/foundation/jquery.event.swipe.js
|
272
|
-
- assets/__js/foundation/jquery.foundation.accordion.js
|
273
|
-
- assets/__js/foundation/jquery.foundation.alerts.js
|
274
|
-
- assets/__js/foundation/jquery.foundation.buttons.js
|
275
|
-
- assets/__js/foundation/jquery.foundation.clearing.js
|
276
|
-
- assets/__js/foundation/jquery.foundation.forms.js
|
277
|
-
- assets/__js/foundation/jquery.foundation.joyride.js
|
278
|
-
- assets/__js/foundation/jquery.foundation.magellan.js
|
279
|
-
- assets/__js/foundation/jquery.foundation.mediaQueryToggle.js
|
280
|
-
- assets/__js/foundation/jquery.foundation.navigation.js
|
281
|
-
- assets/__js/foundation/jquery.foundation.orbit.js
|
282
|
-
- assets/__js/foundation/jquery.foundation.reveal.js
|
283
|
-
- assets/__js/foundation/jquery.foundation.tabs.js
|
284
|
-
- assets/__js/foundation/jquery.foundation.tooltips.js
|
285
|
-
- assets/__js/foundation/jquery.foundation.topbar.js
|
286
|
-
- assets/__js/foundation/jquery.js
|
287
|
-
- assets/__js/foundation/jquery.offcanvas.js
|
288
|
-
- assets/__js/foundation/jquery.placeholder.js
|
289
|
-
- assets/__js/foundation/modernizr.foundation.js
|
290
|
-
- assets/favicon.ico
|
291
245
|
- views/haml/exe.haml
|
292
246
|
- views/haml/header.haml
|
293
247
|
- views/haml/img.haml
|
@@ -331,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
285
|
version: '0'
|
332
286
|
segments:
|
333
287
|
- 0
|
334
|
-
hash:
|
288
|
+
hash: -57149837415841268
|
335
289
|
requirements:
|
336
290
|
- pygments, python's syntax highlighter
|
337
291
|
rubyforge_project:
|
Binary file
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" > <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
|
2
|
-
<defs >
|
3
|
-
<font id="generalfoundicons" horiz-adv-x="955" ><font-face
|
4
|
-
font-family="General Foundicons"
|
5
|
-
units-per-em="1000"
|
6
|
-
panose-1="0 0 0 0 0 0 0 0 0 0"
|
7
|
-
ascent="1000"
|
8
|
-
descent="0"
|
9
|
-
alphabetic="0" />
|
10
|
-
<missing-glyph horiz-adv-x="250" />
|
11
|
-
<glyph unicode=" " glyph-name="space" horiz-adv-x="250" />
|
12
|
-
<glyph unicode="~" glyph-name="asciitilde" horiz-adv-x="1000" />
|
13
|
-
</font>
|
14
|
-
</defs>
|
15
|
-
</svg>
|
Binary file
|
Binary file
|
data/assets/__img/graphic.png
DELETED
Binary file
|
Binary file
|
data/assets/__js/app.js
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
/* ========================================================================
|
2
|
-
* app.js
|
3
|
-
* http://github.com/jimjh/aladdin
|
4
|
-
* ========================================================================
|
5
|
-
* Copyright (c) 2012 Carnegie Mellon University
|
6
|
-
* License: https://raw.github.com/jimjh/aladdin/master/LICENSE
|
7
|
-
* ========================================================================
|
8
|
-
*/
|
9
|
-
/*jshint strict:true unused:true*/
|
10
|
-
/*global $*/
|
11
|
-
|
12
|
-
;(function () {
|
13
|
-
'use strict';
|
14
|
-
|
15
|
-
// TODO: refactor
|
16
|
-
|
17
|
-
// Shows results of last submission at the given button and form.
|
18
|
-
var showResult = function(form) {
|
19
|
-
return function(result) {
|
20
|
-
switch(result) {
|
21
|
-
case true:
|
22
|
-
form.removeClass('error');
|
23
|
-
form.addClass('success');
|
24
|
-
break;
|
25
|
-
case false:
|
26
|
-
form.removeClass('success');
|
27
|
-
form.addClass('error');
|
28
|
-
break;
|
29
|
-
default:
|
30
|
-
$.each(result, function(i, row) {
|
31
|
-
$.each(row, function(j, cell) {
|
32
|
-
var input = form.find("input[name='answer["+i+"]["+j+"]']");
|
33
|
-
showResult(input)(cell);
|
34
|
-
});
|
35
|
-
});
|
36
|
-
}
|
37
|
-
};
|
38
|
-
};
|
39
|
-
|
40
|
-
// Adds click listeners to the submit buttons.
|
41
|
-
var observeSubmitButton = function() {
|
42
|
-
|
43
|
-
$('a.button.submit').click(function(e) {
|
44
|
-
var button = $(e.target);
|
45
|
-
var form = button.parents('form');
|
46
|
-
var id = form.find('input.q-id').val();
|
47
|
-
$.post('/verify/quiz/' + id, form.serialize(), showResult(form));
|
48
|
-
return false;
|
49
|
-
});
|
50
|
-
|
51
|
-
};
|
52
|
-
|
53
|
-
// Adds click listeners to the run buttons.
|
54
|
-
// var run = function() {
|
55
|
-
// $('a.button.run').click(function(e){
|
56
|
-
// var form = $(e.target).parents('form');
|
57
|
-
// var raw = form.find('.ex-raw').val();
|
58
|
-
// var id = form.find('.ex-id').val();
|
59
|
-
// $.post('/verify/code/' + id, raw,
|
60
|
-
// function(data) { console.log(data); }
|
61
|
-
// );
|
62
|
-
// return false;
|
63
|
-
// });
|
64
|
-
// };
|
65
|
-
|
66
|
-
var genie = {
|
67
|
-
|
68
|
-
launch: function() {
|
69
|
-
observeSubmitButton();
|
70
|
-
}
|
71
|
-
|
72
|
-
};
|
73
|
-
|
74
|
-
$(genie.launch());
|
75
|
-
|
76
|
-
})();
|