Patch for demonstrating Issue #1184 of getgrav/grav for user directory from 1.1.8 download.
| <?xml version="1.0" encoding="utf-8" ?> | |
| <!DOCTYPE html | |
| PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" | |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" | |
| > | |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-NZ" lang="en-NZ"> <!-- bru --> | |
| <head> | |
| <title>Turn it in now</title> | |
| <style type="text/css"> |
| Storage.prototype.hasItem = function(itemName, rejectEmpty) { | |
| var setting = this.getItem(itemName); | |
| return ( (setting !== null) && (rejectEmpty ? setting.length > 0 : true) ); | |
| } | |
| /* | |
| testStorageHasItem = function() { | |
| window.localStorage.setItem('test.foo', 'foo'); | |
| console.log(window.localStorage.hasItem('test.foo')); // true | |
| console.log(window.localStorage.hasItem('test.foo', false)); // true | |
| console.log(window.localStorage.hasItem('test.foo', true)); // true |
This Gist shows an otherwise (AFAICT) undocumented way to upload images using the Imgur API with type=file.
I did not want to base64 encode (type=base64) the file contents because my use case was within a Cordova app where resources may limited.
The file is taken from the device file system, so no URL is accessible for file=url.
I was unable to find any guidance or examples in online documentation using this method in Javascript (or any language, AFAIR). I emailed(!) the suggested support contact laying out the problem and stressing that I had not found examples in the documentation. The reply came a month later, pointing me to the very docs in which I had told them I found no satisfactory answer or example! Gee, thanks.
It wasn't too hard, playing with cURL, to get a working call from command line:
| - name: had-allergies | |
| label: 'Have you ever had any allergies to medicines or other substances (such as Latex)?' | |
| type: radio | |
| options: | |
| yes: Yes | |
| no: No | |
| validate: | |
| required: true | |
| classes: question |
| - name: birthdate | |
| label: Date of Birth | |
| type: text | |
| classes: past lifespan dob datepicker pure-input-1-3 | |
| # default: "{{ date('-30years') }}" | |
| size: small | |
| placeholder: 'dd/mm/yyyy' #fallback only, JS resets this | |
| novalidate: true | |
| validate: | |
| required: true |