dta_rapid 0.3.1 → 0.3.2
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.
- checksums.yaml +4 -4
- data/_sass/_colors.scss +2 -0
- data/_sass/components/_multiple-choice.scss +11 -1
- data/assets/js/bundle.js +39 -36
- data/assets/js/questions.js +8 -15
- data/assets/js/scroll-form.js +22 -30
- data/assets/js/scrolling.js +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5978e5c97c42b5d46574d00aca2151aab0ace14
|
4
|
+
data.tar.gz: 3d75be102a9d6f16fb5ba785557940c055bfb75c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52f356c1b3bd91988f556cc437b8f447cdcd0eb3fdfe74be0bf535ca0426df0c63b626986b11229b19b1a8ef7929e79c32a852970836b804f3e3b1586bbfa71a
|
7
|
+
data.tar.gz: 8cb2b7164d458d7f2175e82ec1f4f5942acf962411588925989be8ac8dc1149a9951235985da3953596bbd85ead3db65c6ff230b455fecc8079297faff27462a
|
data/_sass/_colors.scss
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
.multiple-choice {
|
2
|
-
|
2
|
+
|
3
|
+
}
|
4
|
+
|
5
|
+
.multiple-choice__label {
|
6
|
+
font-size: $large-font-size;
|
7
|
+
font-weight: 600;
|
8
|
+
line-height: $base-heading-leading;
|
9
|
+
}
|
10
|
+
|
11
|
+
.multiple-choice__hint {
|
12
|
+
color: $body-text-color--secondary;
|
3
13
|
}
|
4
14
|
|
5
15
|
.multiple-choice__list {
|
data/assets/js/bundle.js
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.technologic = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
2
|
+
'use strict';
|
3
|
+
|
2
4
|
var scrollForm = require('./scroll-form');
|
3
5
|
|
4
6
|
scrollForm.init();
|
@@ -6,78 +8,79 @@ scrollForm.init();
|
|
6
8
|
module.exports = scrollForm;
|
7
9
|
|
8
10
|
},{"./scroll-form":3}],2:[function(require,module,exports){
|
9
|
-
|
11
|
+
"use strict";
|
12
|
+
|
13
|
+
var questions = function questions() {
|
10
14
|
|
11
|
-
var CONTAINER_ID = "container"
|
12
|
-
|
13
|
-
|
15
|
+
var CONTAINER_ID = "container";
|
16
|
+
var CLASS_NAME = "scroll-form__questionset";
|
17
|
+
var ACTIVE_CLASS = "scroll-form__questionset--active";
|
14
18
|
|
15
19
|
return {
|
16
|
-
getContainer: function () {
|
17
|
-
|
20
|
+
getContainer: function getContainer() {
|
21
|
+
return document.getElementById(CONTAINER_ID);
|
22
|
+
},
|
23
|
+
getQuestion: function getQuestion(index) {
|
18
24
|
return document.getElementsByClassName(CLASS_NAME)[index];
|
19
25
|
},
|
20
|
-
setActiveQuestion: function(index) {
|
26
|
+
setActiveQuestion: function setActiveQuestion(index) {
|
21
27
|
var questionList = [].slice.call(document.getElementsByClassName(CLASS_NAME));
|
22
|
-
|
23
|
-
|
24
|
-
elm.classList.remove(ACTIVE_CLASS);
|
28
|
+
questionList.forEach(function (elm) {
|
29
|
+
return elm.classList.remove(ACTIVE_CLASS);
|
25
30
|
});
|
26
|
-
|
27
31
|
this.getQuestion(index).classList.add(ACTIVE_CLASS);
|
28
32
|
}
|
29
33
|
};
|
30
|
-
|
31
34
|
};
|
32
35
|
|
33
36
|
module.exports = questions();
|
34
37
|
|
35
38
|
},{}],3:[function(require,module,exports){
|
39
|
+
'use strict';
|
40
|
+
|
36
41
|
var scrolling = require('./scrolling');
|
37
42
|
var questions = require('./questions');
|
38
43
|
|
39
|
-
var scrollForm = function () {
|
44
|
+
var scrollForm = function scrollForm() {
|
40
45
|
|
41
46
|
// TODO index() = function () {}
|
42
|
-
// TODO: Can haz ES6?
|
43
47
|
|
44
|
-
var scroller
|
45
|
-
|
46
|
-
speed = 400;
|
48
|
+
var scroller = void 0;
|
49
|
+
var currentPosition = 0;
|
47
50
|
|
48
|
-
var
|
51
|
+
var speed = 400;
|
52
|
+
|
53
|
+
var init = function init() {
|
49
54
|
var container = questions.getContainer();
|
50
55
|
var firstQuestion = questions.getQuestion(0);
|
51
56
|
|
52
|
-
scroller = scrolling.createScroller(container, 0, 0)
|
57
|
+
scroller = scrolling.createScroller(container, 0, 0);
|
53
58
|
|
54
|
-
scrolling.scrollTo(scroller, firstQuestion, speed, function() {
|
55
|
-
questions.setActiveQuestion(0);
|
59
|
+
scrolling.scrollTo(scroller, firstQuestion, speed, function () {
|
60
|
+
return questions.setActiveQuestion(0);
|
56
61
|
});
|
57
62
|
};
|
58
63
|
|
59
|
-
var next = function () {
|
64
|
+
var next = function next() {
|
60
65
|
var nextPosition = currentPosition + 1;
|
61
66
|
var newTarget = questions.getQuestion(nextPosition);
|
62
67
|
|
63
68
|
if (newTarget) {
|
64
|
-
scrolling.scrollTo(scroller, newTarget, speed, function() {
|
65
|
-
questions.setActiveQuestion(nextPosition);
|
69
|
+
scrolling.scrollTo(scroller, newTarget, speed, function () {
|
70
|
+
return questions.setActiveQuestion(nextPosition);
|
66
71
|
});
|
67
|
-
|
68
72
|
currentPosition += 1;
|
69
73
|
}
|
70
74
|
};
|
71
75
|
|
72
|
-
var prev = function () {
|
76
|
+
var prev = function prev() {
|
73
77
|
var prevPosition = currentPosition - 1;
|
74
78
|
var newTarget = questions.getQuestion(prevPosition);
|
75
79
|
|
76
80
|
if (newTarget) {
|
77
|
-
scrolling.scrollTo(scroller, newTarget, speed, function() {
|
78
|
-
questions.setActiveQuestion(prevPosition);
|
81
|
+
scrolling.scrollTo(scroller, newTarget, speed, function () {
|
82
|
+
return questions.setActiveQuestion(prevPosition);
|
79
83
|
});
|
80
|
-
|
81
84
|
currentPosition -= 1;
|
82
85
|
}
|
83
86
|
};
|
@@ -87,29 +90,29 @@ var scrollForm = function () {
|
|
87
90
|
next: next,
|
88
91
|
prev: prev
|
89
92
|
};
|
90
|
-
|
91
93
|
};
|
92
94
|
|
93
95
|
module.exports = scrollForm();
|
94
96
|
|
95
97
|
},{"./questions":2,"./scrolling":4}],4:[function(require,module,exports){
|
98
|
+
'use strict';
|
99
|
+
|
96
100
|
var zenscroll = require('zenscroll');
|
97
101
|
|
98
|
-
var scrolling = function () {
|
102
|
+
var scrolling = function scrolling() {
|
99
103
|
|
100
|
-
var createScroller = function (container, speed, offset) {
|
104
|
+
var createScroller = function createScroller(container, speed, offset) {
|
101
105
|
return zenscroll.createScroller(container, speed, offset);
|
102
|
-
}
|
106
|
+
};
|
103
107
|
|
104
|
-
var scrollTo = function(scroller, element, speed, callback) {
|
105
|
-
scroller.center(element, speed, 0, callback)
|
108
|
+
var scrollTo = function scrollTo(scroller, element, speed, callback) {
|
109
|
+
scroller.center(element, speed, 0, callback);
|
106
110
|
};
|
107
111
|
|
108
112
|
return {
|
109
113
|
scrollTo: scrollTo,
|
110
114
|
createScroller: createScroller
|
111
115
|
};
|
112
|
-
|
113
116
|
};
|
114
117
|
|
115
118
|
module.exports = scrolling();
|
data/assets/js/questions.js
CHANGED
@@ -1,25 +1,18 @@
|
|
1
|
-
|
1
|
+
const questions = () => {
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
const CONTAINER_ID = "container";
|
4
|
+
const CLASS_NAME = "scroll-form__questionset";
|
5
|
+
const ACTIVE_CLASS = "scroll-form__questionset--active";
|
6
6
|
|
7
7
|
return {
|
8
|
-
getContainer:
|
9
|
-
getQuestion:
|
10
|
-
return document.getElementsByClassName(CLASS_NAME)[index];
|
11
|
-
},
|
8
|
+
getContainer: () => document.getElementById(CONTAINER_ID),
|
9
|
+
getQuestion: (index) => document.getElementsByClassName(CLASS_NAME)[index],
|
12
10
|
setActiveQuestion: function(index) {
|
13
|
-
|
14
|
-
|
15
|
-
questionList.forEach(function(elm) {
|
16
|
-
elm.classList.remove(ACTIVE_CLASS);
|
17
|
-
});
|
18
|
-
|
11
|
+
const questionList = [].slice.call(document.getElementsByClassName(CLASS_NAME));
|
12
|
+
questionList.forEach((elm) => elm.classList.remove(ACTIVE_CLASS));
|
19
13
|
this.getQuestion(index).classList.add(ACTIVE_CLASS);
|
20
14
|
}
|
21
15
|
};
|
22
|
-
|
23
16
|
};
|
24
17
|
|
25
18
|
module.exports = questions();
|
data/assets/js/scroll-form.js
CHANGED
@@ -1,56 +1,48 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
const scrolling = require('./scrolling');
|
2
|
+
const questions = require('./questions');
|
3
3
|
|
4
|
-
|
4
|
+
const scrollForm = () => {
|
5
5
|
|
6
6
|
// TODO index() = function () {}
|
7
|
-
// TODO: Can haz ES6?
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
speed = 400;
|
8
|
+
let scroller;
|
9
|
+
let currentPosition = 0;
|
12
10
|
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
const speed = 400;
|
12
|
+
|
13
|
+
const init = () => {
|
14
|
+
const container = questions.getContainer();
|
15
|
+
const firstQuestion = questions.getQuestion(0);
|
16
16
|
|
17
17
|
scroller = scrolling.createScroller(container, 0, 0)
|
18
18
|
|
19
|
-
scrolling.scrollTo(scroller, firstQuestion, speed,
|
20
|
-
questions.setActiveQuestion(0);
|
21
|
-
});
|
19
|
+
scrolling.scrollTo(scroller, firstQuestion, speed, () => questions.setActiveQuestion(0));
|
22
20
|
};
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
const next = () => {
|
23
|
+
const nextPosition = currentPosition + 1;
|
24
|
+
const newTarget = questions.getQuestion(nextPosition);
|
27
25
|
|
28
26
|
if (newTarget) {
|
29
|
-
scrolling.scrollTo(scroller, newTarget, speed,
|
30
|
-
questions.setActiveQuestion(nextPosition);
|
31
|
-
});
|
32
|
-
|
27
|
+
scrolling.scrollTo(scroller, newTarget, speed, () => questions.setActiveQuestion(nextPosition));
|
33
28
|
currentPosition += 1;
|
34
29
|
}
|
35
30
|
};
|
36
31
|
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
const prev = () => {
|
33
|
+
const prevPosition = currentPosition - 1;
|
34
|
+
const newTarget = questions.getQuestion(prevPosition);
|
40
35
|
|
41
36
|
if (newTarget) {
|
42
|
-
scrolling.scrollTo(scroller, newTarget, speed,
|
43
|
-
questions.setActiveQuestion(prevPosition);
|
44
|
-
});
|
45
|
-
|
37
|
+
scrolling.scrollTo(scroller, newTarget, speed, () => questions.setActiveQuestion(prevPosition));
|
46
38
|
currentPosition -= 1;
|
47
39
|
}
|
48
40
|
};
|
49
41
|
|
50
42
|
return {
|
51
|
-
init
|
52
|
-
next
|
53
|
-
prev
|
43
|
+
init,
|
44
|
+
next,
|
45
|
+
prev,
|
54
46
|
};
|
55
47
|
|
56
48
|
};
|
data/assets/js/scrolling.js
CHANGED
@@ -1,18 +1,18 @@
|
|
1
|
-
|
1
|
+
const zenscroll = require('zenscroll');
|
2
2
|
|
3
|
-
|
3
|
+
let scrolling = () => {
|
4
4
|
|
5
|
-
|
5
|
+
let createScroller = (container, speed, offset) => {
|
6
6
|
return zenscroll.createScroller(container, speed, offset);
|
7
|
-
}
|
7
|
+
};
|
8
8
|
|
9
|
-
|
9
|
+
let scrollTo = (scroller, element, speed, callback) => {
|
10
10
|
scroller.center(element, speed, 0, callback)
|
11
11
|
};
|
12
12
|
|
13
13
|
return {
|
14
|
-
scrollTo
|
15
|
-
createScroller
|
14
|
+
scrollTo,
|
15
|
+
createScroller,
|
16
16
|
};
|
17
17
|
|
18
18
|
};
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dta_rapid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gareth Rogers
|
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
233
|
version: '0'
|
234
234
|
requirements: []
|
235
235
|
rubyforge_project:
|
236
|
-
rubygems_version: 2.6.
|
236
|
+
rubygems_version: 2.6.10
|
237
237
|
signing_key:
|
238
238
|
specification_version: 4
|
239
239
|
summary: Converting the DTA UI kit (see https://github.com/AusDTO/gov-au-ui-kit) into
|