Skip to content

Commit 6040553

Browse files
chore: Release v1.0.0
1 parent ae9edf1 commit 6040553

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4061
-6
lines changed

dist/jq-quiz.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
//- ! jqQuiz | (c) Davinchi | https://github.com/davinchi-finsi/jq-quiz/blob/master/LICENSE
22
//- This file only exposes the mixins
3-
include assets/pug/_jq-quiz
3+
include pug/_jq-quiz

dist/jquery.quiz.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
(factory());
1010
}(this, (function () { 'use strict';
1111

12-
/*! jqQuiz | (c) Davinchi | https://github.com/davinchi-finsi/jq-quiz/blob/master/LICENSE */
1312
$.widget("ui.jqQuiz", {
1413
NAMESPACE: "jqQuiz",
1514
QUERY_HEADER: "[data-jq-quiz-header]",
@@ -35,7 +34,9 @@ $.widget("ui.jqQuiz", {
3534
ATTR_FEEDBACK: "data-jq-quiz-feedback",
3635
ATTR_POINTS_FOR_FAIL: "data-points-for-fail",
3736
ON_QUESTION_HIDE: "jqQuiz:questionHide",
37+
ON_QUESTION_HIDDEN: "jqQuiz:questionHidden",
3838
ON_QUESTION_SHOW: "jqQuiz:questionShow",
39+
ON_QUESTION_SHOWN: "jqQuiz:questionShow",
3940
ON_HEADER_HIDE: "jqQuiz:headerHide",
4041
ON_HEADER_SHOW: "jqQuiz:headerShow",
4142
ON_BODY_HIDE: "jqQuiz:bodyHide",

dist/jquery.quiz.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pug/_jq-quiz.pug

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
//- ! jqQuiz | (c) Davinchi | https://github.com/davinchi-finsi/jq-quiz/blob/master/LICENSE
2+
include ./common/_globalStructure/_globalStructure
3+
//- header mixins
4+
include header/_jq-quiz__header
5+
include header/_jq-quiz__title
6+
include header/_jq-quiz__description
7+
include header/_jq-quiz__property
8+
include header/_jq-quiz__properties
9+
//- end header mixins
10+
//- body mixins
11+
include body/_jq-quiz__body
12+
include body/_jq-quiz__feedback
13+
include body/questions/_jq-quiz__question
14+
include body/questions/_jq-quiz__questions
15+
include body/questions/_jq-quiz__option
16+
include body/questions/_jq-quiz__options
17+
//- end body mixins
18+
//- action mixins
19+
include actions/_jq-quiz__actions
20+
include actions/_jq-quiz__action
21+
//- end action mixins
22+
//- result mixins
23+
include result/_jq-quiz__result
24+
include result/_jq-quiz__result-item
25+
//- end result mixins
26+
//- @pugdoc
27+
@function jq-quiz
28+
@description Mixin to create the scope of the quiz.
29+
@param {Object} [params] Parameters
30+
@param {String} [params.tag=div] Tag to render
31+
@param {String} [params.cssClass] Css classes to add to the element.
32+
@param {Object} [params.attributes] Key-value attributes to add to the element
33+
@param {Object} [params.header] If is provided, invokes jq-quiz__header
34+
@param {Object} [params.body] If is provided, invokes jq-quiz__body
35+
@param {Object} [params.result] If is provided, invokes jq-quiz__result
36+
@see jq-quiz__header
37+
@see jq-quiz__body
38+
@see jq-quiz__result
39+
@example
40+
+jq-quiz
41+
+jq-quiz__header
42+
+jq-quiz__title
43+
span Some title
44+
+jq-quiz__description
45+
span Some description
46+
+jq-quiz__properties
47+
+jq-quiz__property({
48+
type: "cutOfMark",
49+
content: "Cut of mark"
50+
})
51+
+jq-quiz__actions
52+
+jq-quiz__action({
53+
type:"start",
54+
content:"Start"
55+
})
56+
+jq-quiz__body
57+
+jq-quiz__questions
58+
+jq-quiz__question
59+
+jq-quiz__statement
60+
span Some question
61+
+jq-quiz__options
62+
+jq-quiz__option({
63+
name:"q1",
64+
isCorrect:false,
65+
content:"Some option 1"
66+
})
67+
+jq-quiz__option({
68+
name:"q1",
69+
isCorrect:true,
70+
content:"Some option 2"
71+
})
72+
+jq-quiz__feedback({
73+
type:"success ? Success feedback : Fail feedback"
74+
})
75+
+jq-quiz__actions
76+
+jq-quiz__action({
77+
type:"end",
78+
content:"End quiz"
79+
})
80+
+jq-quiz__result
81+
+jq-quiz__result-item({
82+
type:"score",
83+
content:"Score"
84+
})
85+
@example
86+
+jq-quiz({
87+
header: {
88+
title: "Quiz options example",
89+
properties: {
90+
items: [
91+
{
92+
type: "cutOfMark",
93+
content: "Cut of mark"
94+
}
95+
]
96+
},
97+
actions: [
98+
{
99+
type: "start",
100+
content: "Start the quiz"
101+
}
102+
]
103+
},
104+
body: {
105+
questions: [
106+
{
107+
content: "Some question",
108+
options: [
109+
{
110+
name:"q1",
111+
content:"Some option 1",
112+
isCorrect:false
113+
},
114+
{
115+
name:"q1",
116+
content:"Some option 2",
117+
isCorrect:true
118+
}
119+
],
120+
feedback:[
121+
{
122+
type:"success ? Success feedback : Fail feedback",
123+
content:"Feedback"
124+
}
125+
]
126+
}
127+
],
128+
actions: [
129+
{
130+
type: "end",
131+
content: "End the quiz"
132+
}
133+
]
134+
},
135+
result: {
136+
items: [
137+
{
138+
type:"score",
139+
content:"Score"
140+
}
141+
]
142+
}
143+
})
144+
mixin jq-quiz(params)
145+
//Quiz
146+
- params = params || {};
147+
- params.tag = params.tag || "section";
148+
+_mod-baseContent({
149+
internalParams: {
150+
cssClass: "jq-quiz"
151+
},
152+
externalParams: params
153+
})&attributes(attributes)
154+
form.jq-quiz__form(data-jq-quiz-wrapper)
155+
if(params.header)
156+
+jq-quiz__header(params.header)
157+
if(params.body)
158+
+jq-quiz__body(params.body)
159+
if(params.result)
160+
+jq-quiz__result(params.result)
161+
block
162+
//End quiz

dist/pug/actions/_jq-quiz__action.pug

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//- ! jqQuiz | (c) Davinchi | https://github.com/davinchi-finsi/jq-quiz/blob/master/LICENSE
2+
include ../common/_globalStructure/_globalStructure
3+
//- @pugdoc
4+
@function jq-quiz__action
5+
@description Mixin to create an action
6+
@param {Object} [params] Parameters
7+
@param {String} [params.tag=button] Tag to render
8+
@param {String} [params.cssClass] Class to add to the element.
9+
@param {Object} [params.attributes] Key-value attributes to add to the element
10+
@param {String} params.type The type of the action. Could be: start,end,next or prev.
11+
@param {String} [params.content] Text for the element.
12+
@example
13+
+jq-quiz__action({
14+
type:"end",
15+
content:"End the quiz"
16+
})
17+
@example
18+
+jq-quiz__action({
19+
type:"end"
20+
})
21+
//- This content will be appended into the button
22+
span
23+
i.fa.fa-stop
24+
span End the quiz
25+
mixin jq-quiz__action(params)
26+
-params = params ||{};
27+
-params.tag = params.tag || "button";
28+
-var internalAttributes = {};
29+
-internalAttributes["data-jq-quiz-"+params.type]="";
30+
//Quiz actions
31+
+_mod-baseContent__action({
32+
internalParams: {
33+
cssClass: "jq-quiz__action",
34+
attributes: internalAttributes
35+
},
36+
externalParams: params
37+
})&attributes(attributes)
38+
block
39+
//End quiz actions
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//- ! jqQuiz | (c) Davinchi | https://github.com/davinchi-finsi/jq-quiz/blob/master/LICENSE
2+
include ../common/_globalStructure/_globalStructure
3+
include _jq-quiz__action
4+
//- @pugdoc
5+
@function jq-quiz__actions
6+
@description Mixin to create the scope for actions.
7+
@param {Object} [params] Parameters
8+
@param {String} [params.tag=div] Tag to render
9+
@param {String} [params.cssClass] Class to add to the element.
10+
@param {Object} [params.attributes] Key-value attributes to add to the element
11+
@param {Object[]} [params.actions] If is provided, invokes jq-quiz__action with each item.
12+
@see jq-quiz__action
13+
@example
14+
+jq-quiz__actions({
15+
actions:[
16+
{
17+
type:"end",
18+
cssClass:"fa fa-stop",
19+
content:"End the quiz"
20+
}
21+
]
22+
})
23+
@example
24+
+jq-quiz__actions
25+
+jq-quiz__action({
26+
type: "end",
27+
cssClass: "fa fa-stop",
28+
content: "End the quiz"
29+
})
30+
mixin jq-quiz__actions(params)
31+
-
32+
params = params || {};
33+
//Quiz actions
34+
+_mod-baseContent({
35+
internalParams: {
36+
cssClass: "jq-quiz__actions",
37+
attributes: {
38+
"data-jq-quiz-actions": ""
39+
}
40+
},
41+
externalParams: params
42+
})&attributes(attributes)
43+
if(params.actions)
44+
each action in params.actions
45+
+jq-quiz__action(action)
46+
block
47+
//End quiz actions

0 commit comments

Comments
 (0)