dta_rapid 0.7.0 → 0.7.1
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/_includes/forms/control-input.html +1 -0
 - data/_layouts/default.html +1 -0
 - data/assets/js/vendor/main.js +78 -0
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 75511b2be2280c78eca20b3791fb20b96996fb34
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 966b1c45267fdd60c400a1c09da8a26415cc9a95
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 860eda072684ccc4063c63623229c25ceb22bc4e07a6c79337210a013c48a3ef4806e57b8fab0e4589dfe31670873ba8f58f1cc346d5de4bd45e604ec9871264
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c1e7c2e22036ba899428686726f8d58dc7a1c3fbec5a0c5036060ef73af5590627da7a801a2b6baecf213e9e20c9cf4fcfc688ecdad65d18b75536e8bec6987c
         
     | 
| 
         @@ -18,6 +18,7 @@ 
     | 
|
| 
       18 
18 
     | 
    
         
             
                    type="{{ include.type | default: 'radio' }}"
         
     | 
| 
       19 
19 
     | 
    
         
             
                    data-parsley-errors-container="#control-input__{{ question_slug }}"
         
     | 
| 
       20 
20 
     | 
    
         
             
                    data-parsley-error-message="{{ include.validation_message }}"
         
     | 
| 
      
 21 
     | 
    
         
            +
                    data-value="{{ option }}"
         
     | 
| 
       21 
22 
     | 
    
         
             
                    value="{{ question_slug }}__{{ option_slug }}">
         
     | 
| 
       22 
23 
     | 
    
         
             
                    <span class="uikit-control-input__text">{{ option }}</span>
         
     | 
| 
       23 
24 
     | 
    
         
             
                  </label>
         
     | 
    
        data/_layouts/default.html
    CHANGED
    
    
| 
         @@ -0,0 +1,78 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            let radioSaver = elm => elm.checked ? 1 : 0;
         
     | 
| 
      
 3 
     | 
    
         
            +
            let textSaver = elm => elm.value;
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            let saver = function(selector, key, savingFunction) {
         
     | 
| 
      
 6 
     | 
    
         
            +
            	let elements = document.querySelectorAll(selector);
         
     | 
| 
      
 7 
     | 
    
         
            +
            	let values = Array.prototype.map.call(elements, savingFunction);
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            	localStorage.setItem(key, JSON.stringify(values));
         
     | 
| 
      
 10 
     | 
    
         
            +
            };
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            let radioLoader = elements => (val, ind) => elements[ind].checked = val === 1 ? true : false;
         
     | 
| 
      
 13 
     | 
    
         
            +
            let textLoader = elements => (val, ind) => elements[ind].value = val;
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            let loader = function(selector, localKey, loadingFunction) {
         
     | 
| 
      
 16 
     | 
    
         
            +
            	let elements = document.querySelectorAll(selector);
         
     | 
| 
      
 17 
     | 
    
         
            +
            	let stringifiedValues = localStorage.getItem(localKey);
         
     | 
| 
      
 18 
     | 
    
         
            +
            	try {
         
     | 
| 
      
 19 
     | 
    
         
            +
            		let values = JSON.parse(stringifiedValues);
         
     | 
| 
      
 20 
     | 
    
         
            +
            		values.forEach(loadingFunction(elements));
         
     | 
| 
      
 21 
     | 
    
         
            +
            	} catch (e) {
         
     | 
| 
      
 22 
     | 
    
         
            +
            		console.log(`No local data for ${localKey}`);
         
     | 
| 
      
 23 
     | 
    
         
            +
            	}
         
     | 
| 
      
 24 
     | 
    
         
            +
            };
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            let saveRadioValues = function() {
         
     | 
| 
      
 27 
     | 
    
         
            +
            	saver('input[type=radio]', 'radioValues', radioSaver);
         
     | 
| 
      
 28 
     | 
    
         
            +
            };
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            let saveCheckBoxValues = function() {
         
     | 
| 
      
 31 
     | 
    
         
            +
            	saver('input[type=checkbox]', 'checkBoxValues', radioSaver);
         
     | 
| 
      
 32 
     | 
    
         
            +
            };
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            let saveTextInputValues = function() {
         
     | 
| 
      
 35 
     | 
    
         
            +
            	saver('input[type=text]', 'textInputValues', textSaver);
         
     | 
| 
      
 36 
     | 
    
         
            +
            };
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            let saveDateInputValues = function() {
         
     | 
| 
      
 39 
     | 
    
         
            +
            	saver('input[type=date]', 'dateInputValues', textSaver);
         
     | 
| 
      
 40 
     | 
    
         
            +
            };
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            let loadRadioValues = function() {
         
     | 
| 
      
 43 
     | 
    
         
            +
            	loader('input[type=radio]', 'radioValues', radioLoader);
         
     | 
| 
      
 44 
     | 
    
         
            +
            };
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            let loadCheckBoxValues = function() {
         
     | 
| 
      
 47 
     | 
    
         
            +
            	loader('input[type=checkbox]', 'checkBoxValues', radioLoader);
         
     | 
| 
      
 48 
     | 
    
         
            +
            };
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            let loadTextInputValues = function() {
         
     | 
| 
      
 51 
     | 
    
         
            +
            	loader('input[type=text]', 'textInputValues', textLoader);
         
     | 
| 
      
 52 
     | 
    
         
            +
            };
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            let loadDateInputValues = function() {
         
     | 
| 
      
 55 
     | 
    
         
            +
            	loader('input[type=date]', 'dateInputValues', textLoader);
         
     | 
| 
      
 56 
     | 
    
         
            +
            };
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            let saveForm = () => {
         
     | 
| 
      
 59 
     | 
    
         
            +
            	saveRadioValues();
         
     | 
| 
      
 60 
     | 
    
         
            +
            	saveCheckBoxValues();
         
     | 
| 
      
 61 
     | 
    
         
            +
            	saveTextInputValues();
         
     | 
| 
      
 62 
     | 
    
         
            +
            	saveDateInputValues();
         
     | 
| 
      
 63 
     | 
    
         
            +
            }
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            let loadForm = function() {
         
     | 
| 
      
 66 
     | 
    
         
            +
            	loadRadioValues();
         
     | 
| 
      
 67 
     | 
    
         
            +
            	loadCheckBoxValues();
         
     | 
| 
      
 68 
     | 
    
         
            +
            	loadTextInputValues();
         
     | 
| 
      
 69 
     | 
    
         
            +
            	loadDateInputValues();
         
     | 
| 
      
 70 
     | 
    
         
            +
            };
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
            window.onbeforeunload = (e) => {
         
     | 
| 
      
 73 
     | 
    
         
            +
            	saveForm();
         
     | 
| 
      
 74 
     | 
    
         
            +
            }
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
            window.onload = (e) => {
         
     | 
| 
      
 77 
     | 
    
         
            +
            	loadForm();
         
     | 
| 
      
 78 
     | 
    
         
            +
            }
         
     | 
    
        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.7. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.7.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Gareth Rogers
         
     | 
| 
         @@ -94,6 +94,7 @@ files: 
     | 
|
| 
       94 
94 
     | 
    
         
             
            - assets/css/style.min.css
         
     | 
| 
       95 
95 
     | 
    
         
             
            - assets/js/vendor/jquery-3.1.1.min.js
         
     | 
| 
       96 
96 
     | 
    
         
             
            - assets/js/vendor/list.min.js
         
     | 
| 
      
 97 
     | 
    
         
            +
            - assets/js/vendor/main.js
         
     | 
| 
       97 
98 
     | 
    
         
             
            - assets/js/vendor/parsley.min.js
         
     | 
| 
       98 
99 
     | 
    
         
             
            - assets/uikit.css
         
     | 
| 
       99 
100 
     | 
    
         
             
            homepage: https://github.com/gtrogers/dta_rapid
         
     | 
| 
         @@ -116,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       116 
117 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       117 
118 
     | 
    
         
             
            requirements: []
         
     | 
| 
       118 
119 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       119 
     | 
    
         
            -
            rubygems_version: 2.6. 
     | 
| 
      
 120 
     | 
    
         
            +
            rubygems_version: 2.6.8
         
     | 
| 
       120 
121 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       121 
122 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       122 
123 
     | 
    
         
             
            summary: Converting the DTA UI kit (see https://github.com/AusDTO/gov-au-ui-kit) into
         
     |