Skip to content

Commit

Permalink
Update Documentation (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinchappell committed Jul 16, 2016
1 parent ddab558 commit 953ff3f
Show file tree
Hide file tree
Showing 31 changed files with 94 additions and 141 deletions.
4 changes: 0 additions & 4 deletions docs/demos/basic-formRender.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/demos/formRender-options.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/demos/preview-popup.md

This file was deleted.

4 changes: 0 additions & 4 deletions docs/demos/translation.md

This file was deleted.

4 changes: 2 additions & 2 deletions docs/editing-fonts.md
@@ -1,13 +1,13 @@
# Fonts
SVG icons may be all the [rage](https://github.com/blog/2112-delivering-octicons-with-svg), but for now formBuilder still uses an icon font generated with Fontello and Gulp. Fontello makes it easy for developers to collaborate by providing an API we can incorporate with our normal build processes.
SVG icons uses an icon font generated with Fontello and Gulp. Fontello makes it easy for developers to collaborate by providing an API we can incorporate with our normal build processes.

### Editing
To edit the current icon font, open terminal and run:
```
gulp font-edit
```

This will open create a new session on fontello.com where you can choose new icons or upload your own.
This will open create a new session on fontello.com where you can choose new icons or upload your own.

### Saving
When finished, click the Save Session button and return to the terminal and type:
Expand Down
File renamed without changes.
10 changes: 7 additions & 3 deletions docs/demos/get-data.md → docs/formBuilder/demos/data.md
Expand Up @@ -6,9 +6,13 @@ var fbTemplate = document.getElementById('fb-template'),
formData = fbTemplate.value;
```

There is also a jQuery data method to grab the data as demonstrated here:
<p data-height="580" data-theme-id="22927" data-slug-hash="bpRowv" data-default-tab="js,result" data-user="kevinchappell" data-embed-version="2" class="codepen">See the Pen <a href="http://codepen.io/kevinchappell/pen/bpRowv/">formBuilder: getData</a> by Kevin Chappell (<a href="http://codepen.io/kevinchappell">@kevinchappell</a>) on <a href="http://codepen.io">CodePen</a>.</p>
There is also a jQuery data way to grab the data as demonstrated here:
<p data-height="580" data-theme-id="22927" data-slug-hash="bpRowv" data-default-tab="js,result" data-user="kevinchappell" data-embed-version="2" class="codepen"></p>

## Saving/Load Data
This example demonstrates saving and loading data to/from `window.sessionStorage`.
<p data-height="550" data-theme-id="0" data-slug-hash="Vedrqr" data-default-tab="result" data-user="kevinchappell" class="codepen"></p>

## Where's my HTML
There are some cases where you would want the HTML instead of a rendered form. This can be accomplished by calling formRender and setting the `render` option to false:
<p data-height="300" data-theme-id="22927" data-slug-hash="wWvyaM" data-default-tab="result" data-user="kevinchappell" data-embed-version="2" class="codepen">See the Pen <a href="http://codepen.io/kevinchappell/pen/wWvyaM/">formRender: return markup</a> by Kevin Chappell (<a href="http://codepen.io/kevinchappell">@kevinchappell</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<p data-height="300" data-theme-id="22927" data-slug-hash="wWvyaM" data-default-tab="result" data-user="kevinchappell" data-embed-version="2" class="codepen"></p>
Expand Up @@ -2,4 +2,4 @@
formBuidler and formRender ship as separate plugins because in most cases formBuilder will be used for the admin part of a website and the form it generates will be displayed in another area. In some cases the functionality of both needs to be combined, below you'll find a basic example of how to do that.

## Demo
<p data-height="535" data-theme-id="22927" data-slug-hash="obyeya" data-default-tab="result" data-user="kevinchappell" class="codepen">See the Pen <a href="http://codepen.io/kevinchappell/pen/obyeya/">formBuilder: Toggle Edit</a> by Kevin Chappell (<a href="http://codepen.io/kevinchappell">@kevinchappell</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<p data-height="535" data-theme-id="22927" data-slug-hash="obyeya" data-default-tab="result" data-user="kevinchappell" class="codepen"></p>
4 changes: 4 additions & 0 deletions docs/formBuilder/demos/translation.md
@@ -0,0 +1,4 @@
# Translation

Translate formBuilder to any language through the configuration property `messages`.
<p data-height="580" data-theme-id="22927" data-slug-hash="PNZZmw" data-default-tab="result" data-user="kevinchappell" class="codepen"></p>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions docs/formRender/demos/basic.md
@@ -0,0 +1,4 @@
# Basic formRender usage

Render your formData with no options:
<p data-height="300" data-theme-id="22927" data-slug-hash="vGBWxO" data-default-tab="js,result" data-user="kevinchappell" data-embed-version="2" class="codepen"></p>
4 changes: 4 additions & 0 deletions docs/formRender/demos/preview-popup.md
@@ -0,0 +1,4 @@
# formRender Preview Popup

Display the form preview in a popup on save:
<p data-height="545" data-theme-id="22927" data-slug-hash="mPQMYZ" data-default-tab="result" data-user="kevinchappell" data-embed-version="2" class="codepen"></p>
26 changes: 26 additions & 0 deletions docs/formRender/options.md
@@ -0,0 +1,26 @@
# Options

<pre><code class="js">
var defaults = {
container: false,
formData: false,
label: {
formRendered: 'Form Rendered',
noFormData: 'No form data.',
other: 'Other',
selectColor: 'Select Color'
},
render: true,
notify: {
error: function(message) {
return console.error(message);
},
success: function(message) {
return console.log(message);
},
warning: function(message) {
return console.warn(message);
}
}
}
</code></pre>
@@ -1,4 +1,4 @@
# formRender Columns

I hesitated even putting this in the Docs but some found it useful. It possible to render columns by field type, however I would recommend writing some additional JS to work as an addon in the editing to give your users control over which fields should be rendered as columns.
<p data-height="300" data-theme-id="22927" data-slug-hash="MKXybG" data-default-tab="html,result" data-user="kevinchappell" data-embed-version="2" class="codepen">See the Pen <a href="http://codepen.io/kevinchappell/pen/MKXybG/">formRender Columns</a> by Kevin Chappell (<a href="http://codepen.io/kevinchappell">@kevinchappell</a>) on <a href="http://codepen.io">CodePen</a>.</p>
<p data-height="300" data-theme-id="22927" data-slug-hash="MKXybG" data-default-tab="result" data-user="kevinchappell" data-embed-version="2" class="codepen"></p>
4 changes: 4 additions & 0 deletions docs/formRender/options/container.md
@@ -0,0 +1,4 @@
# formRender `container` option

Here we are defining and output container for our rendered form:
<p data-height="360" data-theme-id="22927" data-slug-hash="vKpPbz" data-default-tab="js,result" data-user="kevinchappell" data-embed-version="2" class="codepen"></p>
4 changes: 4 additions & 0 deletions docs/formRender/options/formData.md
@@ -0,0 +1,4 @@
# formRender `formData` option

Pass formData to formRender through a configuration Object:
<p data-height="360" data-theme-id="22927" data-slug-hash="bprXzw" data-default-tab="js,result" data-user="kevinchappell" data-embed-version="2" class="codepen"></p>
9 changes: 9 additions & 0 deletions docs/formRender/options/render.md
@@ -0,0 +1,9 @@
# formRender `render` option

Setting render to false prevents formRender from making any changes to the DOM. From there we can choose to print our markup or return it.

Print:
<p data-height="360" data-theme-id="22927" data-slug-hash="wWvyaM" data-default-tab="js" data-user="kevinchappell" data-embed-version="2" class="codepen"></p>

Return:
<p data-height="360" data-theme-id="22927" data-slug-hash="bZarNd" data-default-tab="js" data-user="kevinchappell" data-embed-version="2" class="codepen"></p>
2 changes: 1 addition & 1 deletion docs/index.md
@@ -1,7 +1,7 @@
# jQuery formBuilder
Drag and drop form creation for your app.

<p data-height="550" data-theme-id="0" data-slug-hash="vLjOLL" data-default-tab="result" data-user="kevinchappell" class="codepen"></p>
<p data-height="570" data-theme-id="0" data-slug-hash="vLjOLL" data-default-tab="result" data-user="kevinchappell" class="codepen"></p>

## Introduction
jQuery formBuilder is a 100% client-side plugin that gives users the power to create forms using an intuitive drag and drop interface. FormBuilder supports a number of form fields and some html tags. See: [Field Types]()
Expand Down
1 change: 0 additions & 1 deletion docs/js/ei.js

This file was deleted.

95 changes: 0 additions & 95 deletions docs/js/scripts.js
@@ -1,100 +1,5 @@
'use strict';

var isSite = (window.location.href.indexOf('kevinchappell.github.io') !== -1 || window.location.href.indexOf('kevinchappell.github.io') !== -1);

((window.gitter = {}).chat = {}).options = {
room: 'kevinchappell/formBuilder'
};

var getStyles = function() {
var styles = [];
var extStyles = [
'//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/styles/monokai-sublime.min.css',
];
for (var i = extStyles.length - 1; i >= 0; i--) {
var style = document.createElement('link');
style.appendChild(document.createTextNode(''));
style.setAttribute('href', extStyles[i]);
style.setAttribute('rel', 'stylesheet');
style.setAttribute('type', 'text/css');
document.head.appendChild(style);
styles.push(style);
}
return styles;
};

var getScripts = function() {
var scripts = [];
var extScripts = [
// '//formbuilder.online/assets/js/form-render.min.js',
// '//formbuilder.online/assets/js/form-builder.min.js',
// '//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/highlight.min.js',
'//assets.codepen.io/assets/embed/ei.js',
'//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js'
];

if (isSite) {
extScripts = extScripts.push('//sidecar.gitter.im/dist/sidecar.v1.js');
}

var i = (extScripts.length - 1);

function readyState() {
var script = this;
if (!script.readyState || script.readyState === 'loaded' || script.readyState === 'complete') {
script.onload = script.onreadystatechange = null;
i--;
if (i === -1) {
// remove script after added
for (i = scripts.length - 1; i >= 0; i--) {
scripts[i].remove();
}
} else {
getScript(i);
}
}
}

function getScript(i) {
var script = document.createElement('script');
script.appendChild(document.createTextNode(''));
script.setAttribute('src', extScripts[i]);
script.setAttribute('type', 'text/javascript');
script.async = true;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = readyState;
// siteScript.parentNode.insertBefore(script, siteScript.nextSibling);
scripts.push(script);
document.head.appendChild(script);
}

getScript(i);

};

getStyles();
getScripts();

document.addEventListener('viewData', function() {
var code = document.querySelector('.data-dialog code');
window.hljs.highlightBlock(code);
}, false);

if (isSite) {
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments);
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-4784386-21', 'auto');
ga('send', 'pageview');
}
48 changes: 27 additions & 21 deletions mkdocs.yml
Expand Up @@ -12,31 +12,37 @@ pages:
- Overview: development.md
- Icon Font: editing-fonts.md
- formBuilder Demos:
- Basic: demos/basic.md
- Toggle formBuilder: demos/toggle-builder.md
- Translating: demos/translation.md
- Data: demos/get-data.md
- Basic: formBuilder/demos/basic.md
- Toggle formBuilder: formBuilder/demos/toggle-builder.md
- Translating: formBuilder/demos/translation.md
- Data: formBuilder/demos/data.md
- formBuilder Options:
- Overview: formBuilder/options.md
- append/prepend: formBuilder/options/appendPrepend.md
- controlPosition: formBuilder/options/controlPosition.md
- controlOrder: formBuilder/options/controlOrder.md
- disableFields: formBuilder/options/disableFields.md
- editOnAdd: formBuilder/options/editOnAdd.md
- fieldRemoveWarn: formBuilder/options/fieldRemoveWarn.md
- messages: formBuilder/options/messages.md
- notify: formBuilder/options/notify.md
- sortableControls: formBuilder/options/sortableControls.md
- stickyControls: formBuilder/options/stickyControls.md
- formRender Demos:
- Basic: demos/basic-formRender.md
- Container: demos/formRender-options.md
- Preview popup: demos/preview-popup.md
- Columns: demos/formRender-columns.md
- Options:
- Overview: options.md
- append/prepend: options/appendPrepend.md
- controlPosition: options/controlPosition.md
- controlOrder: options/controlOrder.md
- disableFields: options/disableFields.md
- editOnAdd: options/editOnAdd.md
- fieldRemoveWarn: options/fieldRemoveWarn.md
- messages: options/messages.md
- notify: options/notify.md
- sortableControls: options/sortableControls.md
- stickyControls: options/stickyControls.md
- Basic: formRender/demos/basic.md
- Preview popup: formRender/demos/preview-popup.md
- formRender Options:
- Overview: formRender/options.md
- container: formRender/options/container.md
- formData: formRender/options/formData.md
- render: formRender/options/render.md
- Contributing: contributing.md
- About:
- License: license.md
extra_css:
- 'css/site.css'
- '//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.2.0/styles/monokai-sublime.min.css'
extra_javascript:
- 'js/scripts.js'
- 'js/scripts.js'
- '//assets.codepen.io/assets/embed/ei.js'
- '//sidecar.gitter.im/dist/sidecar.v1.js'

0 comments on commit 953ff3f

Please sign in to comment.