Skip to content

Commit 2bcce62

Browse files
committed
add asq-highlight and asq-base
1 parent 9fa3dda commit 2bcce62

File tree

8 files changed

+93
-38
lines changed

8 files changed

+93
-38
lines changed

Diff for: .bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory" : "../"
3+
}

Diff for: TODO

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
PARSING
2+
1) we need to parse the questions and inject them to the db
3+
4+
SUBMISSION
5+
1) viewer script should have an event listener for asq-exercise submit events
6+
* asq-exercise will emit an event after it has gathered all the submissions from the children
7+
2) the viewer is going to submit this to the server
8+
3) The server needs to know how to store the data of a question
9+
10+
FEEDBACK
11+
1) we need to show to a student if his/her submission was correct (maybe this will introduce new elements like <asq-hint></asq-hint>)
12+
2) stats
13+
14+
WHAT THE ABOVE MEAN FOR THE ELEMENTS
15+
1) each element should have a schema definition
16+
2) method to store a submission to the database
17+
3) npm install asq-elements should install the server side code needed
18+
19+
20+
viewer.js
21+
//connect to the socket
22+
23+
// have an event listener for asq-exercise
24+
document.addEventListener('asq-submit', function(evt, detail, sender){
25+
submission = detail.submision;
26+
socket.emit({submission: submission })
27+
});

Diff for: asq-elements.html

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
<link rel="import" href="../asq-exercise/asq-exercise.html">
1+
<!-- These SHOULD BE in dependency order -->
22
<link rel="import" href="../asq-option/asq-option.html">
3-
<link rel="import" href="../asq-multi-choice/asq-multi-choice.html">
43
<link rel="import" href="../asq-stem/asq-stem.html">
5-
<link rel="import" href="../asq-text-input/asq-text-input.html">
4+
<link rel="import" href="../asq-welcome/asq-welcome.html">
65
<link rel="import" href="../asq-code/asq-code.html">
76
<link rel="import" href="../asq-css-select/asq-css-select.html">
7+
<link rel="import" href="../asq-exercise/asq-exercise.html">
88
<link rel="import" href="../asq-js-function-body/asq-js-function-body.html">
9+
<link rel="import" href="../asq-multi-choice/asq-multi-choice.html">
10+
<link rel="import" href="../asq-text-input/asq-text-input.html">
11+
<link rel="import" href="../asq-highlight/asq-highlight.html">

Diff for: bower.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@
2828
"ace-element": "PolymerLabs/ace-element",
2929
"jquery": "~2.1.1",
3030
"code-mirror": "PolymerLabs/code-mirror",
31+
"asq-base": "ASQ-USI/asq-base#master",
3132
"asq-code": "ASQ-USI/asq-code#master",
3233
"asq-css-select": "ASQ-USI/asq-css-select#master",
33-
"asq-element-common": "ASQ-USI/asq-element-common#master",
3434
"asq-exercise": "ASQ-USI/asq-exercise#master",
35+
"asq-highlight": "ASQ-USI/asq-highlight#master",
3536
"asq-js-function-body": "ASQ-USI/asq-js-function-body#master",
3637
"asq-multi-choice": "ASQ-USI/asq-multi-choice#master",
3738
"asq-option": "ASQ-USI/asq-option#master",
3839
"asq-stem": "ASQ-USI/asq-stem#master",
39-
"asq-text-input": "ASQ-USI/asq-text-input#master"
40+
"asq-text-input": "ASQ-USI/asq-text-input#master",
41+
"asq-welcome": "ASQ-USI/asq-welcome#master"
4042
},
4143
"resolutions": {
4244
"paper-shadow": "master",

Diff for: demo.html

+9-6
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,24 @@
99
<body unresolved>
1010

1111
<kitchen-sink label="ASQ Elements">
12-
<core-item label="asq-js-function-body" url="../asq-js-function-body/demo.html" horizontal center layout ></core-item>
13-
14-
<core-item label="asq-multi-choice" url="../asq-multi-choice/demo.html" horizontal center layout ></core-item>
1512

16-
<core-item label="asq-text-input" url="../asq-text-input/demo.html" horizontal center layout ></core-item>
13+
<core-item label="asq-code" url="../asq-code/demo.html" horizontal center layout ></core-item>
1714

1815
<core-item label="asq-css-select" url="../asq-css-select/demo.html" horizontal center layout ></core-item>
1916

2017
<core-item label="asq-exercise" url="../asq-exercise/demo.html" horizontal center layout ></core-item>
2118

19+
<core-item label="asq-highlight" url="../asq-highlight/demo.html" horizontal center layout ></core-item>
20+
21+
<core-item label="asq-js-function-body" url="../asq-js-function-body/demo.html" horizontal center layout ></core-item>
22+
23+
<core-item label="asq-multi-choice" url="../asq-multi-choice/demo.html" horizontal center layout ></core-item>
24+
2225
<core-item label="asq-option" url="../asq-option/demo.html" horizontal center layout ></core-item>
2326

2427
<core-item label="asq-stem" url="../asq-stem/demo.html" horizontal center layout ></core-item>
25-
<core-item label="asq-code" url="../asq-code/demo.html" horizontal center layout ></core-item>
26-
28+
29+
<core-item label="asq-text-input" url="../asq-text-input/demo.html" horizontal center layout ></core-item>
2730

2831
</kitchen-sink>
2932
</body>

Diff for: examples/SamplePresentation/index.html

+30-12
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<link href="css/bootstrap.min.css" type="text/css" rel="stylesheet">
1515
<link href="css/ASQBasicImpress.css" type="text/css" rel="stylesheet"/>
1616
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
17-
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
17+
<script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
1818
<link rel="import" href="bower_components/asq-elements/asq-elements.html">
1919

2020
</head>
2121

22-
<body class="impress-not-supported">
22+
<body class="impress-not-supported" data-asq-role="presenter">
2323

2424
<div class="fallback-message">
2525
<p>
@@ -36,7 +36,7 @@
3636
<h1>This is a sample ASQ presentation</h1>
3737
<h3>Here goes a subheadline</h3>
3838
<hr />
39-
<article class="asq-welcome-screen"></article>
39+
<asq-welcome></asq-welcome>
4040
</section>
4141

4242
<div class="step" id="slide02" data-x="1500" data-y="0" data-z="500">
@@ -91,18 +91,36 @@ <h5>Please answer!</h5>
9191
</section>
9292

9393
<section class="step" id="slide07" data-x="9000" data-y="0" data-z="1000">
94-
<asq-exercise exerciseid="ex0" class="exercise">
94+
<asq-exercise exerciseid="ex5" class="exercise">
9595
<asq-stem><h2>Exercise 0</h2></asq-stem>
96-
<asq-code mode="htmlmixed" tabSize="2" value="<polymer-element name='my-element'>
97-
<template></template>
98-
<script>
99-
Polymer('my-element', {});
100-
</script>
101-
</polymer-element>">
102-
103-
</asq-code>
96+
<asq-code mode="java" tabSize="2" fontSize="0.85em" style="height:500px">
97+
<asq-stem><h4>Implement a for loop in Java</h4></asq-stem>
98+
<code>public class C {
99+
public void m() {
100+
int i = i + 5 + ((int)5.0) + ((int)5f);
101+
}
102+
}</code>
103+
</asq-code>
104104
</asq-exercise>
105105
</section>
106+
107+
<section class="step" id="slide08" data-x="10500" data-y="0" data-z="1000">
108+
<asq-exercise exerciseid="ex6" class="exercise">
109+
<asq-highlight theme="textmate" mode="java" style="height:700px">
110+
<asq-solution>{"d9534f":[{"start":{"row":0,"column":0},"end":{"row":0,"column":6},"id":8},{"start":{"row":1,"column":1},"end":{"row":1,"column":7},"id":15}],"428bca":[{"start":{"row":2,"column":3},"end":{"row":2,"column":6},"id":21}],"f0ad4e":[{"start":{"row":0,"column":7},"end":{"row":0,"column":12},"id":30},{"start":{"row":1,"column":8},"end":{"row":1,"column":12},"id":37},{"start":{"row":2,"column":21},"end":{"row":2,"column":24},"id":44},{"start":{"row":2,"column":34},"end":{"row":2,"column":37},"id":50}]}
111+
</asq-solution>
112+
<asq-stem><h3>Highlight with the appropriate color the following:</h3></asq-stem>
113+
<asq-hl-color-task color="d9534f" colorName="visibility">Visibility Modifiers</asq-hl-color-task>
114+
<asq-hl-color-task color="428bca" colorName="var_declarations">Variable declarations</asq-hl-color-task>
115+
<asq-hl-color-task color="f0ad4e" colorName="other">Other keywords</asq-hl-color-task>
116+
<code>public class C {
117+
public void m() {
118+
int i = i + 5 + ((int)5.0) + ((int)5f);
119+
}
120+
}</code>
121+
</asq-highlight>
122+
</asq-exercise>
123+
</section>
106124

107125

108126
</div>

Diff for: examples/SamplePresentation/js/init.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
function init() {
2-
var roleNode = document.querySelector("body").getAttributeNode("data-asq-role");
3-
if ( typeof roleNode == undefined ) {
4-
setRole("viewer");
5-
} else {
6-
setRole(roleNode.value);
7-
}
2+
var role = document.querySelector("body").dataset.asqRole;
3+
var role = role || 'viewer'
4+
setRole(role);
85
}
96

107
function setRole(role) {
@@ -22,8 +19,8 @@ function getASQElements() {
2219
});
2320

2421
return allAsqElements;
22+
}
2523

26-
function isASQEl(el) {
27-
return el.localName.indexOf('asq-') != -1;
28-
}
24+
function isASQEl(el) {
25+
return (el.isASQQuestionTypeElement === true)
2926
}

Diff for: metadata.html

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
<link rel="import" href="../asq-stem/metadata.html">
2-
<link rel="import" href="../asq-text-input/metadata.html">
3-
<link rel="import" href="../asq-multi-choice/metadata.html">
4-
<link rel="import" href="../asq-option/metadata.html">
1+
<link rel="import" href="../asq-code/metadata.html">
52
<link rel="import" href="../asq-css-select/metadata.html">
6-
<link rel="import" href="../asq-js-function-body/metadata.html">
73
<link rel="import" href="../asq-exercise/metadata.html">
8-
<link rel="import" href="../asq-code/metadata.html">
4+
<link rel="import" href="../asq-highlight/metadata.html">
5+
<link rel="import" href="../asq-js-function-body/metadata.html">
6+
<link rel="import" href="../asq-multi-choice/metadata.html">
7+
<link rel="import" href="../asq-option/metadata.html">
8+
<link rel="import" href="../asq-stem/metadata.html">
9+
<link rel="import" href="../asq-text-input/metadata.html">
10+
<link rel="import" href="../asq-welcome/metadata.html">

0 commit comments

Comments
 (0)