├── .gitignore
├── Gemfile
├── LICENSE
├── README.md
├── Rakefile
├── jsonform-rails.gemspec
├── lib
└── jsonform
│ ├── rails.rb
│ └── rails
│ └── version.rb
├── package.json
└── vendor
└── assets
└── javascripts
├── deps
├── README.md
├── img
│ └── glyphicons-halflings.png
├── jquery.min.js
├── opt
│ ├── ace
│ │ ├── ace.js
│ │ ├── mode-css.js
│ │ ├── mode-html.js
│ │ ├── mode-javascript.js
│ │ ├── mode-json.js
│ │ ├── mode-less.js
│ │ ├── mode-markdown.js
│ │ ├── theme-twilight.js
│ │ ├── worker-css.js
│ │ ├── worker-javascript.js
│ │ └── worker-json.js
│ ├── bootstrap-dropdown.js
│ ├── bootstrap-wysihtml5.css
│ ├── bootstrap-wysihtml5.js
│ ├── bootstrap.css
│ ├── emmet.js
│ ├── jquery.transloadit2.js
│ ├── jquery.ui.core.js
│ ├── jquery.ui.mouse.js
│ ├── jquery.ui.sortable.js
│ ├── jquery.ui.widget.js
│ ├── jsv.js
│ ├── spectrum.css
│ └── spectrum.js
└── underscore.js
├── example.html
├── lib
├── jsonform-defaults.js
├── jsonform-split.js
└── jsonform.js
├── playground-wiwo
├── README.md
├── data
│ ├── __wiwo-repayment-widget-simple.json
│ ├── wiwo-repayment-widget-full.json
│ └── wiwo-repayment-widget-simplest.json
├── index.html
├── playground.js
└── schemas
│ ├── wiwo-repayment-widget-full.json
│ ├── wiwo-repayment-widget-simple.json
│ └── wiwo-repayment-widget-simplest.json
├── playground
├── README.md
├── examples
│ ├── events.json
│ ├── factory-sleek.json
│ ├── fields-ace.json
│ ├── fields-actions.json
│ ├── fields-advancedfieldset.json
│ ├── fields-array.json
│ ├── fields-authfieldset.json
│ ├── fields-checkbox.json
│ ├── fields-checkboxes.json
│ ├── fields-color.json
│ ├── fields-common.json
│ ├── fields-fieldset.json
│ ├── fields-help.json
│ ├── fields-hidden.json
│ ├── fields-imageselect.json
│ ├── fields-password.json
│ ├── fields-questions.json
│ ├── fields-radiobuttons.json
│ ├── fields-radios.json
│ ├── fields-range.json
│ ├── fields-section.json
│ ├── fields-select.json
│ ├── fields-selectfieldset-key.json
│ ├── fields-selectfieldset.json
│ ├── fields-submit.json
│ ├── fields-tabarray-maxitems.json
│ ├── fields-tabarray-value.json
│ ├── fields-tabarray.json
│ ├── fields-textarea.json
│ ├── gettingstarted.json
│ ├── previousvalues.json
│ ├── schema-array.json
│ ├── schema-basic.json
│ ├── schema-morecomplex.json
│ ├── templating-idx.json
│ ├── templating-tpldata.json
│ ├── templating-value.json
│ └── templating-values.json
├── index.html
└── playground.js
└── tests
├── ace
└── t.js
├── actions
└── t.js
├── array
└── t.js
├── checkbox
└── t.js
├── checkboxes
└── t.js
├── color
└── t.js
├── fieldset
└── t.js
├── file
└── t.js
├── help
└── t.js
├── hidden
└── t.js
├── i18n
└── t.js
├── imageselect
└── t.js
├── index.html
├── number
└── t.js
├── other
├── array.html
├── checkboxes.html
├── complexlists.html
├── defaults.html
├── expandable.html
├── forms
│ ├── array.js
│ ├── basic.js
│ ├── checkboxes.js
│ ├── complexlists.js
│ ├── defaults.js
│ ├── expandable.js
│ ├── prefix.js
│ ├── tabarray.js
│ ├── tabs-array.js
│ ├── tabs-values.js
│ ├── tabs.js
│ └── titleMap.js
├── index.html
├── prefix.html
├── tabarray.html
├── tabs-array.html
├── tabs-values.html
├── tabs.html
└── titleMap.html
├── runner.js
├── section
└── t.js
├── select
└── t.js
├── selectfieldset
└── t.js
├── tabarray
└── t.js
├── template
└── t.js
├── text
└── t.js
├── value
└── t.js
└── wysihtml5
└── t.js
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | *.gem
3 | *.rbc
4 | .bundle
5 | .config
6 | .yardoc
7 | Gemfile.lock
8 | InstalledFiles
9 | _yardoc
10 | coverage
11 | doc/
12 | lib/bundler/man
13 | pkg
14 | rdoc
15 | spec/reports
16 | test/tmp
17 | test/version_tmp
18 | tmp
19 | .idea/
20 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # Specify your gem's dependencies in jsonform-rails.gemspec
4 | gemspec
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 Joshfire
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | JSON Form
2 | =========
3 |
4 | The JSON Form library is a JavaScript client-side library that takes a
5 | structured data model defined using [JSON Schema](http://json-schema.org/) as
6 | input and returns a [Bootstrap](http://twitter.github.com/bootstrap/)-friendly
7 | HTML form that matches the schema.
8 |
9 | The generated HTML form includes client-side validation logic that provides direct inline feedback to the user upon form submission (provided a JSON Schema validator is available). If values are valid, the JSON Form library uses submitted values to create the JavaScript data structure that matches the data model.
10 |
11 | The layout of the generated HTML form may be entirely fine-tuned through
12 | a simple declarative mechanism.
13 |
14 |
15 | # Jsonform::Rails
16 |
17 | Jsonform-rails wraps joshfire's JSONForm into an easy to bundle asset gem.
18 |
19 | TODO: helpers as the need emerges
20 |
21 | ## Installation
22 |
23 | Add this line to your application's Gemfile:
24 |
25 | gem 'jsonform-rails'
26 |
27 | And then execute:
28 |
29 | $ bundle
30 |
31 | Or install it yourself as:
32 |
33 | $ gem install jsonform-rails
34 |
35 | ## Usage
36 |
37 | Step 1: Make sure you're calling the javascript file in your application.js. There is no CSS, jsonform styles for bootstrap and lets you handle that:
38 |
39 | //= require jsonform
40 |
41 | Step 2: Use is as described in the jsonform doco
42 |
43 |
44 | Getting started
45 | ---------------
46 |
47 | The example below creates a form that asks for the user's name and age. The user's name is a required field, while the age is optional.
48 |
49 | ```html
50 |
51 |
52 |
53 |
23 | *
24 | * Alternatively, the contents of this file may be used under the terms of
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
28 | * of those above. If you wish to allow use of your version of this file only
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
30 | * use your version of this file under the terms of the MPL, indicate your
31 | * decision by deleting the provisions above and replace them with the notice
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
33 | * the provisions above, a recipient may use your version of this file under
34 | * the terms of any one of the MPL, the GPL or the LGPL.
35 | *
36 | * ***** END LICENSE BLOCK ***** */
37 |
38 | ace.define('ace/theme/twilight', ['require', 'exports', 'module', 'ace/lib/dom'], function(require, exports, module) {
39 |
40 | exports.isDark = true;
41 | exports.cssClass = "ace-twilight";
42 | exports.cssText = "\
43 | .ace-twilight .ace_editor {\
44 | border: 2px solid rgb(159, 159, 159);\
45 | }\
46 | \
47 | .ace-twilight .ace_editor.ace_focus {\
48 | border: 2px solid #327fbd;\
49 | }\
50 | \
51 | .ace-twilight .ace_gutter {\
52 | background: #e8e8e8;\
53 | color: #333;\
54 | }\
55 | \
56 | .ace-twilight .ace_print_margin {\
57 | width: 1px;\
58 | background: #e8e8e8;\
59 | }\
60 | \
61 | .ace-twilight .ace_scroller {\
62 | background-color: #141414;\
63 | }\
64 | \
65 | .ace-twilight .ace_text-layer {\
66 | cursor: text;\
67 | color: #F8F8F8;\
68 | }\
69 | \
70 | .ace-twilight .ace_cursor {\
71 | border-left: 2px solid #A7A7A7;\
72 | }\
73 | \
74 | .ace-twilight .ace_cursor.ace_overwrite {\
75 | border-left: 0px;\
76 | border-bottom: 1px solid #A7A7A7;\
77 | }\
78 | \
79 | .ace-twilight .ace_marker-layer .ace_selection {\
80 | background: rgba(221, 240, 255, 0.20);\
81 | }\
82 | \
83 | .ace-twilight.multiselect .ace_selection.start {\
84 | box-shadow: 0 0 3px 0px #141414;\
85 | border-radius: 2px;\
86 | }\
87 | \
88 | .ace-twilight .ace_marker-layer .ace_step {\
89 | background: rgb(102, 82, 0);\
90 | }\
91 | \
92 | .ace-twilight .ace_marker-layer .ace_bracket {\
93 | margin: -1px 0 0 -1px;\
94 | border: 1px solid rgba(255, 255, 255, 0.25);\
95 | }\
96 | \
97 | .ace-twilight .ace_marker-layer .ace_active_line {\
98 | background: rgba(255, 255, 255, 0.031);\
99 | }\
100 | \
101 | .ace-twilight .ace_gutter_active_line {\
102 | background-color : #dcdcdc;\
103 | }\
104 | \
105 | .ace-twilight .ace_marker-layer .ace_selected_word {\
106 | border: 1px solid rgba(221, 240, 255, 0.20);\
107 | }\
108 | \
109 | .ace-twilight .ace_invisible {\
110 | color: rgba(255, 255, 255, 0.25);\
111 | }\
112 | \
113 | .ace-twilight .ace_keyword, .ace-twilight .ace_meta {\
114 | color:#CDA869;\
115 | }\
116 | \
117 | .ace-twilight .ace_constant, .ace-twilight .ace_constant.ace_other {\
118 | color:#CF6A4C;\
119 | }\
120 | \
121 | .ace-twilight .ace_constant.ace_character, {\
122 | color:#CF6A4C;\
123 | }\
124 | \
125 | .ace-twilight .ace_constant.ace_character.ace_escape, {\
126 | color:#CF6A4C;\
127 | }\
128 | \
129 | .ace-twilight .ace_invalid.ace_illegal {\
130 | color:#F8F8F8;\
131 | background-color:rgba(86, 45, 86, 0.75);\
132 | }\
133 | \
134 | .ace-twilight .ace_invalid.ace_deprecated {\
135 | text-decoration:underline;\
136 | font-style:italic;\
137 | color:#D2A8A1;\
138 | }\
139 | \
140 | .ace-twilight .ace_support {\
141 | color:#9B859D;\
142 | }\
143 | \
144 | .ace-twilight .ace_support.ace_constant {\
145 | color:#CF6A4C;\
146 | }\
147 | \
148 | .ace-twilight .ace_fold {\
149 | background-color: #AC885B;\
150 | border-color: #F8F8F8;\
151 | }\
152 | \
153 | .ace-twilight .ace_support.ace_function {\
154 | color:#DAD085;\
155 | }\
156 | \
157 | .ace-twilight .ace_storage {\
158 | color:#F9EE98;\
159 | }\
160 | \
161 | .ace-twilight .ace_variable {\
162 | color:#AC885B;\
163 | }\
164 | \
165 | .ace-twilight .ace_string {\
166 | color:#8F9D6A;\
167 | }\
168 | \
169 | .ace-twilight .ace_string.ace_regexp {\
170 | color:#E9C062;\
171 | }\
172 | \
173 | .ace-twilight .ace_comment {\
174 | font-style:italic;\
175 | color:#5F5A60;\
176 | }\
177 | \
178 | .ace-twilight .ace_variable {\
179 | color:#7587A6;\
180 | }\
181 | \
182 | .ace-twilight .ace_xml_pe {\
183 | color:#494949;\
184 | }\
185 | \
186 | .ace-twilight .ace_meta.ace_tag {\
187 | color:#AC885B;\
188 | }\
189 | \
190 | .ace-twilight .ace_entity.ace_name.ace_function {\
191 | color:#AC885B;\
192 | }\
193 | \
194 | .ace-twilight .ace_markup.ace_underline {\
195 | text-decoration:underline;\
196 | }\
197 | \
198 | .ace-twilight .ace_markup.ace_heading {\
199 | color:#CF6A4C;\
200 | }\
201 | \
202 | .ace-twilight .ace_markup.ace_list {\
203 | color:#F9EE98;\
204 | }";
205 |
206 | var dom = require("../lib/dom");
207 | dom.importCssString(exports.cssText, exports.cssClass);
208 | });
209 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/deps/opt/bootstrap-dropdown.js:
--------------------------------------------------------------------------------
1 | /* ============================================================
2 | * bootstrap-dropdown.js v2.0.4
3 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns
4 | * ============================================================
5 | * Copyright 2012 Twitter, Inc.
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ============================================================ */
19 |
20 |
21 | !function ($) {
22 |
23 | "use strict"; // jshint ;_;
24 |
25 |
26 | /* DROPDOWN CLASS DEFINITION
27 | * ========================= */
28 |
29 | var toggle = '[data-toggle="dropdown"]'
30 | , Dropdown = function (element) {
31 | var $el = $(element).on('click.dropdown.data-api', this.toggle)
32 | $('html').on('click.dropdown.data-api', function () {
33 | $el.parent().removeClass('open')
34 | })
35 | }
36 |
37 | Dropdown.prototype = {
38 |
39 | constructor: Dropdown
40 |
41 | , toggle: function (e) {
42 | var $this = $(this)
43 | , $parent
44 | , selector
45 | , isActive
46 |
47 | if ($this.is('.disabled, :disabled')) return
48 |
49 | selector = $this.attr('data-target')
50 |
51 | if (!selector) {
52 | selector = $this.attr('href')
53 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
54 | }
55 |
56 | $parent = $(selector)
57 | $parent.length || ($parent = $this.parent())
58 |
59 | isActive = $parent.hasClass('open')
60 |
61 | clearMenus()
62 |
63 | if (!isActive) $parent.toggleClass('open')
64 |
65 | return false
66 | }
67 |
68 | }
69 |
70 | function clearMenus() {
71 | $(toggle).parent().removeClass('open')
72 | }
73 |
74 |
75 | /* DROPDOWN PLUGIN DEFINITION
76 | * ========================== */
77 |
78 | $.fn.dropdown = function (option) {
79 | return this.each(function () {
80 | var $this = $(this)
81 | , data = $this.data('dropdown')
82 | if (!data) $this.data('dropdown', (data = new Dropdown(this)))
83 | if (typeof option == 'string') data[option].call($this)
84 | })
85 | }
86 |
87 | $.fn.dropdown.Constructor = Dropdown
88 |
89 |
90 | /* APPLY TO STANDARD DROPDOWN ELEMENTS
91 | * =================================== */
92 |
93 | $(function () {
94 | $('html').on('click.dropdown.data-api', clearMenus)
95 | $('body')
96 | .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
97 | .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
98 | })
99 |
100 | }(window.jQuery);
--------------------------------------------------------------------------------
/vendor/assets/javascripts/deps/opt/bootstrap-wysihtml5.css:
--------------------------------------------------------------------------------
1 | ul.wysihtml5-toolbar {
2 | margin: 0;
3 | padding: 0;
4 | display: block;
5 | }
6 |
7 | ul.wysihtml5-toolbar::after {
8 | clear: both;
9 | display: table;
10 | content: "";
11 | }
12 |
13 | ul.wysihtml5-toolbar > li {
14 | float: left;
15 | display: list-item;
16 | list-style: none;
17 | margin: 0 5px 10px 0;
18 | }
19 |
20 | ul.wysihtml5-toolbar a[data-wysihtml5-command=bold] {
21 | font-weight: bold;
22 | }
23 |
24 | ul.wysihtml5-toolbar a[data-wysihtml5-command=italic] {
25 | font-style: italic;
26 | }
27 |
28 | ul.wysihtml5-toolbar a[data-wysihtml5-command=underline] {
29 | text-decoration: underline;
30 | }
31 |
32 | ul.wysihtml5-toolbar a.btn.wysihtml5-command-active {
33 | background-image: none;
34 | -webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
35 | -moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
36 | box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15),0 1px 2px rgba(0, 0, 0, 0.05);
37 | background-color: #E6E6E6;
38 | background-color: #D9D9D9 9;
39 | outline: 0;
40 | }
41 |
42 | ul.wysihtml5-commands-disabled .dropdown-menu {
43 | display: none !important;
44 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/deps/opt/bootstrap-wysihtml5.js:
--------------------------------------------------------------------------------
1 | !function($, wysi) {
2 | "use strict"
3 |
4 | var templates = {
5 | "font-styles": "" +
6 | "" +
7 | " Normal text " +
8 | " " +
9 | "" +
14 | " ",
15 | "emphasis": "" +
16 | ""
21 | + " ",
22 | "lists": ""
23 | + ""
24 | + "
"
25 | + "
"
26 | + "
"
27 | + "
"
28 | + "
"
29 | + " ",
30 |
31 | "link": ""
32 |
33 | + ""
34 | + ""
38 | + "
"
39 | + " "
40 | + "
"
41 | + ""
45 | + "
"
46 |
47 | + " "
48 |
49 | + " ",
50 |
51 | "image": ""
52 |
53 | + ""
54 | + ""
58 | + "
"
59 | + " "
60 | + "
"
61 | + ""
65 | + "
"
66 |
67 | + " "
68 |
69 | + " ",
70 |
71 | "html":
72 | ""
73 | + ""
76 | + " "
77 | };
78 |
79 | var defaultOptions = {
80 | "font-styles": true,
81 | "emphasis": true,
82 | "lists": true,
83 | "html": false,
84 | "link": true,
85 | "image": true,
86 | events: {},
87 | parserRules: {
88 | tags: {
89 | "b": {},
90 | "i": {},
91 | "br": {},
92 | "ol": {},
93 | "ul": {},
94 | "li": {},
95 | "h1": {},
96 | "h2": {},
97 | "u": 1,
98 | "img": {
99 | "check_attributes": {
100 | "width": "numbers",
101 | "alt": "alt",
102 | "src": "url",
103 | "height": "numbers"
104 | }
105 | },
106 | "a": {
107 | set_attributes: {
108 | target: "_blank",
109 | rel: "nofollow"
110 | },
111 | check_attributes: {
112 | href: "url" // important to avoid XSS
113 | }
114 | }
115 | }
116 | }
117 | };
118 |
119 | var Wysihtml5 = function(el, options) {
120 | this.el = el;
121 | this.toolbar = this.createToolbar(el, options || defaultOptions);
122 | this.editor = this.createEditor(options);
123 |
124 | window.editor = this.editor;
125 |
126 | $('iframe.wysihtml5-sandbox').each(function(i, el){
127 | $(el.contentWindow).off('focus.wysihtml5').on({
128 | 'focus.wysihtml5' : function(){
129 | $('li.dropdown').removeClass('open');
130 | }
131 | });
132 | });
133 | };
134 |
135 | Wysihtml5.prototype = {
136 | constructor: Wysihtml5,
137 |
138 | createEditor: function(options) {
139 | var parserRules = defaultOptions.parserRules;
140 |
141 | if(options && options.parserRules) {
142 | parserRules = options.parserRules;
143 | }
144 |
145 | var editor = new wysi.Editor(this.el.attr('id'), {
146 | toolbar: this.toolbar.attr('id'),
147 | parserRules: parserRules
148 | });
149 |
150 | if(options && options.events) {
151 | for(var eventName in options.events) {
152 | editor.on(eventName, options.events[eventName]);
153 | }
154 | }
155 |
156 | return editor;
157 | },
158 |
159 | createToolbar: function(el, options) {
160 | var self = this;
161 | var toolbar = $("", {
162 | 'id' : el.attr('id') + "-wysihtml5-toolbar",
163 | 'class' : "wysihtml5-toolbar",
164 | 'style': "display:none"
165 | });
166 |
167 | for(var key in defaultOptions) {
168 | var value = false;
169 |
170 | if(options[key] != undefined) {
171 | if(options[key] == true) {
172 | value = true;
173 | }
174 | } else {
175 | value = defaultOptions[key];
176 | }
177 |
178 | if(value == true) {
179 | toolbar.append(templates[key]);
180 |
181 | if(key == "html") {
182 | this.initHtml(toolbar);
183 | }
184 |
185 | if(key == "link") {
186 | this.initInsertLink(toolbar);
187 | }
188 |
189 | if(key == "image") {
190 | this.initInsertImage(toolbar);
191 | }
192 | }
193 | }
194 |
195 | var self = this;
196 |
197 | toolbar.find("a[data-wysihtml5-command='formatBlock']").click(function(e) {
198 | var el = $(e.srcElement);
199 | self.toolbar.find('.current-font').text(el.html())
200 | });
201 |
202 | this.el.before(toolbar);
203 |
204 | return toolbar;
205 | },
206 |
207 | initHtml: function(toolbar) {
208 | var changeViewSelector = "a[data-wysihtml5-action='change_view']";
209 | toolbar.find(changeViewSelector).click(function(e) {
210 | toolbar.find('a.btn').not(changeViewSelector).toggleClass('disabled');
211 | });
212 | },
213 |
214 | initInsertImage: function(toolbar) {
215 | var self = this;
216 | var insertImageModal = toolbar.find('.bootstrap-wysihtml5-insert-image-modal');
217 | var urlInput = insertImageModal.find('.bootstrap-wysihtml5-insert-image-url');
218 | var insertButton = insertImageModal.find('a.btn-primary');
219 | var initialValue = urlInput.val();
220 |
221 | var insertImage = function() {
222 | var url = urlInput.val();
223 | urlInput.val(initialValue);
224 | self.editor.composer.commands.exec("insertImage", url);
225 | };
226 |
227 | urlInput.keypress(function(e) {
228 | if(e.which == 13) {
229 | insertImage();
230 | insertImageModal.modal('hide');
231 | }
232 | });
233 |
234 | insertButton.click(insertImage);
235 |
236 | insertImageModal.on('shown', function() {
237 | urlInput.focus();
238 | });
239 |
240 | insertImageModal.on('hide', function() {
241 | self.editor.currentView.element.focus();
242 | });
243 |
244 | toolbar.find('a[data-wysihtml5-command=insertImage]').click(function() {
245 | insertImageModal.modal('show');
246 | return false;
247 | });
248 | },
249 |
250 | initInsertLink: function(toolbar) {
251 | var self = this;
252 | var insertLinkModal = toolbar.find('.bootstrap-wysihtml5-insert-link-modal');
253 | var urlInput = insertLinkModal.find('.bootstrap-wysihtml5-insert-link-url');
254 | var insertButton = insertLinkModal.find('a.btn-primary');
255 | var initialValue = urlInput.val();
256 |
257 | var insertLink = function() {
258 | var url = urlInput.val();
259 | urlInput.val(initialValue);
260 | self.editor.composer.commands.exec("createLink", {
261 | href: url,
262 | target: "_blank",
263 | rel: "nofollow"
264 | });
265 | };
266 | var pressedEnter = false;
267 |
268 | urlInput.keypress(function(e) {
269 | if(e.which == 13) {
270 | insertLink();
271 | insertLinkModal.modal('hide');
272 | }
273 | });
274 |
275 | insertButton.click(insertLink);
276 |
277 | insertLinkModal.on('shown', function() {
278 | urlInput.focus();
279 | });
280 |
281 | insertLinkModal.on('hide', function() {
282 | self.editor.currentView.element.focus();
283 | });
284 |
285 | toolbar.find('a[data-wysihtml5-command=createLink]').click(function() {
286 | insertLinkModal.modal('show');
287 | return false;
288 | });
289 | }
290 | };
291 |
292 | $.fn.wysihtml5 = function (options) {
293 | return this.each(function () {
294 | var $this = $(this);
295 | $this.data('wysihtml5', new Wysihtml5($this, options));
296 | })
297 | };
298 |
299 | $.fn.wysihtml5.Constructor = Wysihtml5;
300 |
301 | }(window.jQuery, window.wysihtml5);
--------------------------------------------------------------------------------
/vendor/assets/javascripts/deps/opt/jquery.ui.core.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery UI 1.8.20
3 | *
4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
5 | * Dual licensed under the MIT or GPL Version 2 licenses.
6 | * http://jquery.org/license
7 | *
8 | * http://docs.jquery.com/UI
9 | */
10 | (function( $, undefined ) {
11 |
12 | // prevent duplicate loading
13 | // this is only a problem because we proxy existing functions
14 | // and we don't want to double proxy them
15 | $.ui = $.ui || {};
16 | if ( $.ui.version ) {
17 | return;
18 | }
19 |
20 | $.extend( $.ui, {
21 | version: "1.8.20",
22 |
23 | keyCode: {
24 | ALT: 18,
25 | BACKSPACE: 8,
26 | CAPS_LOCK: 20,
27 | COMMA: 188,
28 | COMMAND: 91,
29 | COMMAND_LEFT: 91, // COMMAND
30 | COMMAND_RIGHT: 93,
31 | CONTROL: 17,
32 | DELETE: 46,
33 | DOWN: 40,
34 | END: 35,
35 | ENTER: 13,
36 | ESCAPE: 27,
37 | HOME: 36,
38 | INSERT: 45,
39 | LEFT: 37,
40 | MENU: 93, // COMMAND_RIGHT
41 | NUMPAD_ADD: 107,
42 | NUMPAD_DECIMAL: 110,
43 | NUMPAD_DIVIDE: 111,
44 | NUMPAD_ENTER: 108,
45 | NUMPAD_MULTIPLY: 106,
46 | NUMPAD_SUBTRACT: 109,
47 | PAGE_DOWN: 34,
48 | PAGE_UP: 33,
49 | PERIOD: 190,
50 | RIGHT: 39,
51 | SHIFT: 16,
52 | SPACE: 32,
53 | TAB: 9,
54 | UP: 38,
55 | WINDOWS: 91 // COMMAND
56 | }
57 | });
58 |
59 | // plugins
60 | $.fn.extend({
61 | propAttr: $.fn.prop || $.fn.attr,
62 |
63 | _focus: $.fn.focus,
64 | focus: function( delay, fn ) {
65 | return typeof delay === "number" ?
66 | this.each(function() {
67 | var elem = this;
68 | setTimeout(function() {
69 | $( elem ).focus();
70 | if ( fn ) {
71 | fn.call( elem );
72 | }
73 | }, delay );
74 | }) :
75 | this._focus.apply( this, arguments );
76 | },
77 |
78 | scrollParent: function() {
79 | var scrollParent;
80 | if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
81 | scrollParent = this.parents().filter(function() {
82 | return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
83 | }).eq(0);
84 | } else {
85 | scrollParent = this.parents().filter(function() {
86 | return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
87 | }).eq(0);
88 | }
89 |
90 | return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
91 | },
92 |
93 | zIndex: function( zIndex ) {
94 | if ( zIndex !== undefined ) {
95 | return this.css( "zIndex", zIndex );
96 | }
97 |
98 | if ( this.length ) {
99 | var elem = $( this[ 0 ] ), position, value;
100 | while ( elem.length && elem[ 0 ] !== document ) {
101 | // Ignore z-index if position is set to a value where z-index is ignored by the browser
102 | // This makes behavior of this function consistent across browsers
103 | // WebKit always returns auto if the element is positioned
104 | position = elem.css( "position" );
105 | if ( position === "absolute" || position === "relative" || position === "fixed" ) {
106 | // IE returns 0 when zIndex is not specified
107 | // other browsers return a string
108 | // we ignore the case of nested elements with an explicit value of 0
109 | //
110 | value = parseInt( elem.css( "zIndex" ), 10 );
111 | if ( !isNaN( value ) && value !== 0 ) {
112 | return value;
113 | }
114 | }
115 | elem = elem.parent();
116 | }
117 | }
118 |
119 | return 0;
120 | },
121 |
122 | disableSelection: function() {
123 | return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
124 | ".ui-disableSelection", function( event ) {
125 | event.preventDefault();
126 | });
127 | },
128 |
129 | enableSelection: function() {
130 | return this.unbind( ".ui-disableSelection" );
131 | }
132 | });
133 |
134 | $.each( [ "Width", "Height" ], function( i, name ) {
135 | var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
136 | type = name.toLowerCase(),
137 | orig = {
138 | innerWidth: $.fn.innerWidth,
139 | innerHeight: $.fn.innerHeight,
140 | outerWidth: $.fn.outerWidth,
141 | outerHeight: $.fn.outerHeight
142 | };
143 |
144 | function reduce( elem, size, border, margin ) {
145 | $.each( side, function() {
146 | size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0;
147 | if ( border ) {
148 | size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0;
149 | }
150 | if ( margin ) {
151 | size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0;
152 | }
153 | });
154 | return size;
155 | }
156 |
157 | $.fn[ "inner" + name ] = function( size ) {
158 | if ( size === undefined ) {
159 | return orig[ "inner" + name ].call( this );
160 | }
161 |
162 | return this.each(function() {
163 | $( this ).css( type, reduce( this, size ) + "px" );
164 | });
165 | };
166 |
167 | $.fn[ "outer" + name] = function( size, margin ) {
168 | if ( typeof size !== "number" ) {
169 | return orig[ "outer" + name ].call( this, size );
170 | }
171 |
172 | return this.each(function() {
173 | $( this).css( type, reduce( this, size, true, margin ) + "px" );
174 | });
175 | };
176 | });
177 |
178 | // selectors
179 | function focusable( element, isTabIndexNotNaN ) {
180 | var nodeName = element.nodeName.toLowerCase();
181 | if ( "area" === nodeName ) {
182 | var map = element.parentNode,
183 | mapName = map.name,
184 | img;
185 | if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
186 | return false;
187 | }
188 | img = $( "img[usemap=#" + mapName + "]" )[0];
189 | return !!img && visible( img );
190 | }
191 | return ( /input|select|textarea|button|object/.test( nodeName )
192 | ? !element.disabled
193 | : "a" == nodeName
194 | ? element.href || isTabIndexNotNaN
195 | : isTabIndexNotNaN)
196 | // the element and all of its ancestors must be visible
197 | && visible( element );
198 | }
199 |
200 | function visible( element ) {
201 | return !$( element ).parents().andSelf().filter(function() {
202 | return $.curCSS( this, "visibility" ) === "hidden" ||
203 | $.expr.filters.hidden( this );
204 | }).length;
205 | }
206 |
207 | $.extend( $.expr[ ":" ], {
208 | data: function( elem, i, match ) {
209 | return !!$.data( elem, match[ 3 ] );
210 | },
211 |
212 | focusable: function( element ) {
213 | return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
214 | },
215 |
216 | tabbable: function( element ) {
217 | var tabIndex = $.attr( element, "tabindex" ),
218 | isTabIndexNaN = isNaN( tabIndex );
219 | return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
220 | }
221 | });
222 |
223 | // support
224 | $(function() {
225 | var body = document.body,
226 | div = body.appendChild( div = document.createElement( "div" ) );
227 |
228 | // access offsetHeight before setting the style to prevent a layout bug
229 | // in IE 9 which causes the elemnt to continue to take up space even
230 | // after it is removed from the DOM (#8026)
231 | div.offsetHeight;
232 |
233 | $.extend( div.style, {
234 | minHeight: "100px",
235 | height: "auto",
236 | padding: 0,
237 | borderWidth: 0
238 | });
239 |
240 | $.support.minHeight = div.offsetHeight === 100;
241 | $.support.selectstart = "onselectstart" in div;
242 |
243 | // set display to none to avoid a layout bug in IE
244 | // http://dev.jquery.com/ticket/4014
245 | body.removeChild( div ).style.display = "none";
246 | });
247 |
248 |
249 |
250 |
251 |
252 | // deprecated
253 | $.extend( $.ui, {
254 | // $.ui.plugin is deprecated. Use the proxy pattern instead.
255 | plugin: {
256 | add: function( module, option, set ) {
257 | var proto = $.ui[ module ].prototype;
258 | for ( var i in set ) {
259 | proto.plugins[ i ] = proto.plugins[ i ] || [];
260 | proto.plugins[ i ].push( [ option, set[ i ] ] );
261 | }
262 | },
263 | call: function( instance, name, args ) {
264 | var set = instance.plugins[ name ];
265 | if ( !set || !instance.element[ 0 ].parentNode ) {
266 | return;
267 | }
268 |
269 | for ( var i = 0; i < set.length; i++ ) {
270 | if ( instance.options[ set[ i ][ 0 ] ] ) {
271 | set[ i ][ 1 ].apply( instance.element, args );
272 | }
273 | }
274 | }
275 | },
276 |
277 | // will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()
278 | contains: function( a, b ) {
279 | return document.compareDocumentPosition ?
280 | a.compareDocumentPosition( b ) & 16 :
281 | a !== b && a.contains( b );
282 | },
283 |
284 | // only used by resizable
285 | hasScroll: function( el, a ) {
286 |
287 | //If overflow is hidden, the element might have extra content, but the user wants to hide it
288 | if ( $( el ).css( "overflow" ) === "hidden") {
289 | return false;
290 | }
291 |
292 | var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
293 | has = false;
294 |
295 | if ( el[ scroll ] > 0 ) {
296 | return true;
297 | }
298 |
299 | // TODO: determine which cases actually cause this to happen
300 | // if the element doesn't have the scroll set, see if it's possible to
301 | // set the scroll
302 | el[ scroll ] = 1;
303 | has = ( el[ scroll ] > 0 );
304 | el[ scroll ] = 0;
305 | return has;
306 | },
307 |
308 | // these are odd functions, fix the API or move into individual plugins
309 | isOverAxis: function( x, reference, size ) {
310 | //Determines when x coordinate is over "b" element axis
311 | return ( x > reference ) && ( x < ( reference + size ) );
312 | },
313 | isOver: function( y, x, top, left, height, width ) {
314 | //Determines when x, y coordinates is over "b" element
315 | return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
316 | }
317 | });
318 |
319 | })( jQuery );
--------------------------------------------------------------------------------
/vendor/assets/javascripts/deps/opt/jquery.ui.mouse.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery UI Mouse 1.8.20
3 | *
4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
5 | * Dual licensed under the MIT or GPL Version 2 licenses.
6 | * http://jquery.org/license
7 | *
8 | * http://docs.jquery.com/UI/Mouse
9 | *
10 | * Depends:
11 | * jquery.ui.widget.js
12 | */
13 | (function( $, undefined ) {
14 |
15 | var mouseHandled = false;
16 | $( document ).mouseup( function( e ) {
17 | mouseHandled = false;
18 | });
19 |
20 | $.widget("ui.mouse", {
21 | options: {
22 | cancel: ':input,option',
23 | distance: 1,
24 | delay: 0
25 | },
26 | _mouseInit: function() {
27 | var self = this;
28 |
29 | this.element
30 | .bind('mousedown.'+this.widgetName, function(event) {
31 | return self._mouseDown(event);
32 | })
33 | .bind('click.'+this.widgetName, function(event) {
34 | if (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {
35 | $.removeData(event.target, self.widgetName + '.preventClickEvent');
36 | event.stopImmediatePropagation();
37 | return false;
38 | }
39 | });
40 |
41 | this.started = false;
42 | },
43 |
44 | // TODO: make sure destroying one instance of mouse doesn't mess with
45 | // other instances of mouse
46 | _mouseDestroy: function() {
47 | this.element.unbind('.'+this.widgetName);
48 | $(document)
49 | .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
50 | .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
51 | },
52 |
53 | _mouseDown: function(event) {
54 | // don't let more than one widget handle mouseStart
55 | if( mouseHandled ) { return };
56 |
57 | // we may have missed mouseup (out of window)
58 | (this._mouseStarted && this._mouseUp(event));
59 |
60 | this._mouseDownEvent = event;
61 |
62 | var self = this,
63 | btnIsLeft = (event.which == 1),
64 | // event.target.nodeName works around a bug in IE 8 with
65 | // disabled inputs (#7620)
66 | elIsCancel = (typeof this.options.cancel == "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
67 | if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
68 | return true;
69 | }
70 |
71 | this.mouseDelayMet = !this.options.delay;
72 | if (!this.mouseDelayMet) {
73 | this._mouseDelayTimer = setTimeout(function() {
74 | self.mouseDelayMet = true;
75 | }, this.options.delay);
76 | }
77 |
78 | if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
79 | this._mouseStarted = (this._mouseStart(event) !== false);
80 | if (!this._mouseStarted) {
81 | event.preventDefault();
82 | return true;
83 | }
84 | }
85 |
86 | // Click event may never have fired (Gecko & Opera)
87 | if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
88 | $.removeData(event.target, this.widgetName + '.preventClickEvent');
89 | }
90 |
91 | // these delegates are required to keep context
92 | this._mouseMoveDelegate = function(event) {
93 | return self._mouseMove(event);
94 | };
95 | this._mouseUpDelegate = function(event) {
96 | return self._mouseUp(event);
97 | };
98 | $(document)
99 | .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
100 | .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
101 |
102 | event.preventDefault();
103 |
104 | mouseHandled = true;
105 | return true;
106 | },
107 |
108 | _mouseMove: function(event) {
109 | // IE mouseup check - mouseup happened when mouse was out of window
110 | if ($.browser.msie && !(document.documentMode >= 9) && !event.button) {
111 | return this._mouseUp(event);
112 | }
113 |
114 | if (this._mouseStarted) {
115 | this._mouseDrag(event);
116 | return event.preventDefault();
117 | }
118 |
119 | if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
120 | this._mouseStarted =
121 | (this._mouseStart(this._mouseDownEvent, event) !== false);
122 | (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
123 | }
124 |
125 | return !this._mouseStarted;
126 | },
127 |
128 | _mouseUp: function(event) {
129 | $(document)
130 | .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
131 | .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
132 |
133 | if (this._mouseStarted) {
134 | this._mouseStarted = false;
135 |
136 | if (event.target == this._mouseDownEvent.target) {
137 | $.data(event.target, this.widgetName + '.preventClickEvent', true);
138 | }
139 |
140 | this._mouseStop(event);
141 | }
142 |
143 | return false;
144 | },
145 |
146 | _mouseDistanceMet: function(event) {
147 | return (Math.max(
148 | Math.abs(this._mouseDownEvent.pageX - event.pageX),
149 | Math.abs(this._mouseDownEvent.pageY - event.pageY)
150 | ) >= this.options.distance
151 | );
152 | },
153 |
154 | _mouseDelayMet: function(event) {
155 | return this.mouseDelayMet;
156 | },
157 |
158 | // These are placeholder methods, to be overriden by extending plugin
159 | _mouseStart: function(event) {},
160 | _mouseDrag: function(event) {},
161 | _mouseStop: function(event) {},
162 | _mouseCapture: function(event) { return true; }
163 | });
164 |
165 | })(jQuery);
--------------------------------------------------------------------------------
/vendor/assets/javascripts/deps/opt/jquery.ui.widget.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery UI Widget 1.8.20
3 | *
4 | * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
5 | * Dual licensed under the MIT or GPL Version 2 licenses.
6 | * http://jquery.org/license
7 | *
8 | * http://docs.jquery.com/UI/Widget
9 | */
10 | (function( $, undefined ) {
11 |
12 | // jQuery 1.4+
13 | if ( $.cleanData ) {
14 | var _cleanData = $.cleanData;
15 | $.cleanData = function( elems ) {
16 | for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
17 | try {
18 | $( elem ).triggerHandler( "remove" );
19 | // http://bugs.jquery.com/ticket/8235
20 | } catch( e ) {}
21 | }
22 | _cleanData( elems );
23 | };
24 | } else {
25 | var _remove = $.fn.remove;
26 | $.fn.remove = function( selector, keepData ) {
27 | return this.each(function() {
28 | if ( !keepData ) {
29 | if ( !selector || $.filter( selector, [ this ] ).length ) {
30 | $( "*", this ).add( [ this ] ).each(function() {
31 | try {
32 | $( this ).triggerHandler( "remove" );
33 | // http://bugs.jquery.com/ticket/8235
34 | } catch( e ) {}
35 | });
36 | }
37 | }
38 | return _remove.call( $(this), selector, keepData );
39 | });
40 | };
41 | }
42 |
43 | $.widget = function( name, base, prototype ) {
44 | var namespace = name.split( "." )[ 0 ],
45 | fullName;
46 | name = name.split( "." )[ 1 ];
47 | fullName = namespace + "-" + name;
48 |
49 | if ( !prototype ) {
50 | prototype = base;
51 | base = $.Widget;
52 | }
53 |
54 | // create selector for plugin
55 | $.expr[ ":" ][ fullName ] = function( elem ) {
56 | return !!$.data( elem, name );
57 | };
58 |
59 | $[ namespace ] = $[ namespace ] || {};
60 | $[ namespace ][ name ] = function( options, element ) {
61 | // allow instantiation without initializing for simple inheritance
62 | if ( arguments.length ) {
63 | this._createWidget( options, element );
64 | }
65 | };
66 |
67 | var basePrototype = new base();
68 | // we need to make the options hash a property directly on the new instance
69 | // otherwise we'll modify the options hash on the prototype that we're
70 | // inheriting from
71 | // $.each( basePrototype, function( key, val ) {
72 | // if ( $.isPlainObject(val) ) {
73 | // basePrototype[ key ] = $.extend( {}, val );
74 | // }
75 | // });
76 | basePrototype.options = $.extend( true, {}, basePrototype.options );
77 | $[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
78 | namespace: namespace,
79 | widgetName: name,
80 | widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
81 | widgetBaseClass: fullName
82 | }, prototype );
83 |
84 | $.widget.bridge( name, $[ namespace ][ name ] );
85 | };
86 |
87 | $.widget.bridge = function( name, object ) {
88 | $.fn[ name ] = function( options ) {
89 | var isMethodCall = typeof options === "string",
90 | args = Array.prototype.slice.call( arguments, 1 ),
91 | returnValue = this;
92 |
93 | // allow multiple hashes to be passed on init
94 | options = !isMethodCall && args.length ?
95 | $.extend.apply( null, [ true, options ].concat(args) ) :
96 | options;
97 |
98 | // prevent calls to internal methods
99 | if ( isMethodCall && options.charAt( 0 ) === "_" ) {
100 | return returnValue;
101 | }
102 |
103 | if ( isMethodCall ) {
104 | this.each(function() {
105 | var instance = $.data( this, name ),
106 | methodValue = instance && $.isFunction( instance[options] ) ?
107 | instance[ options ].apply( instance, args ) :
108 | instance;
109 | // TODO: add this back in 1.9 and use $.error() (see #5972)
110 | // if ( !instance ) {
111 | // throw "cannot call methods on " + name + " prior to initialization; " +
112 | // "attempted to call method '" + options + "'";
113 | // }
114 | // if ( !$.isFunction( instance[options] ) ) {
115 | // throw "no such method '" + options + "' for " + name + " widget instance";
116 | // }
117 | // var methodValue = instance[ options ].apply( instance, args );
118 | if ( methodValue !== instance && methodValue !== undefined ) {
119 | returnValue = methodValue;
120 | return false;
121 | }
122 | });
123 | } else {
124 | this.each(function() {
125 | var instance = $.data( this, name );
126 | if ( instance ) {
127 | instance.option( options || {} )._init();
128 | } else {
129 | $.data( this, name, new object( options, this ) );
130 | }
131 | });
132 | }
133 |
134 | return returnValue;
135 | };
136 | };
137 |
138 | $.Widget = function( options, element ) {
139 | // allow instantiation without initializing for simple inheritance
140 | if ( arguments.length ) {
141 | this._createWidget( options, element );
142 | }
143 | };
144 |
145 | $.Widget.prototype = {
146 | widgetName: "widget",
147 | widgetEventPrefix: "",
148 | options: {
149 | disabled: false
150 | },
151 | _createWidget: function( options, element ) {
152 | // $.widget.bridge stores the plugin instance, but we do it anyway
153 | // so that it's stored even before the _create function runs
154 | $.data( element, this.widgetName, this );
155 | this.element = $( element );
156 | this.options = $.extend( true, {},
157 | this.options,
158 | this._getCreateOptions(),
159 | options );
160 |
161 | var self = this;
162 | this.element.bind( "remove." + this.widgetName, function() {
163 | self.destroy();
164 | });
165 |
166 | this._create();
167 | this._trigger( "create" );
168 | this._init();
169 | },
170 | _getCreateOptions: function() {
171 | return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
172 | },
173 | _create: function() {},
174 | _init: function() {},
175 |
176 | destroy: function() {
177 | this.element
178 | .unbind( "." + this.widgetName )
179 | .removeData( this.widgetName );
180 | this.widget()
181 | .unbind( "." + this.widgetName )
182 | .removeAttr( "aria-disabled" )
183 | .removeClass(
184 | this.widgetBaseClass + "-disabled " +
185 | "ui-state-disabled" );
186 | },
187 |
188 | widget: function() {
189 | return this.element;
190 | },
191 |
192 | option: function( key, value ) {
193 | var options = key;
194 |
195 | if ( arguments.length === 0 ) {
196 | // don't return a reference to the internal hash
197 | return $.extend( {}, this.options );
198 | }
199 |
200 | if (typeof key === "string" ) {
201 | if ( value === undefined ) {
202 | return this.options[ key ];
203 | }
204 | options = {};
205 | options[ key ] = value;
206 | }
207 |
208 | this._setOptions( options );
209 |
210 | return this;
211 | },
212 | _setOptions: function( options ) {
213 | var self = this;
214 | $.each( options, function( key, value ) {
215 | self._setOption( key, value );
216 | });
217 |
218 | return this;
219 | },
220 | _setOption: function( key, value ) {
221 | this.options[ key ] = value;
222 |
223 | if ( key === "disabled" ) {
224 | this.widget()
225 | [ value ? "addClass" : "removeClass"](
226 | this.widgetBaseClass + "-disabled" + " " +
227 | "ui-state-disabled" )
228 | .attr( "aria-disabled", value );
229 | }
230 |
231 | return this;
232 | },
233 |
234 | enable: function() {
235 | return this._setOption( "disabled", false );
236 | },
237 | disable: function() {
238 | return this._setOption( "disabled", true );
239 | },
240 |
241 | _trigger: function( type, event, data ) {
242 | var prop, orig,
243 | callback = this.options[ type ];
244 |
245 | data = data || {};
246 | event = $.Event( event );
247 | event.type = ( type === this.widgetEventPrefix ?
248 | type :
249 | this.widgetEventPrefix + type ).toLowerCase();
250 | // the original event may come from any element
251 | // so we need to reset the target on the new event
252 | event.target = this.element[ 0 ];
253 |
254 | // copy original event properties over to the new event
255 | orig = event.originalEvent;
256 | if ( orig ) {
257 | for ( prop in orig ) {
258 | if ( !( prop in event ) ) {
259 | event[ prop ] = orig[ prop ];
260 | }
261 | }
262 | }
263 |
264 | this.element.trigger( event, data );
265 |
266 | return !( $.isFunction(callback) &&
267 | callback.call( this.element[0], event, data ) === false ||
268 | event.isDefaultPrevented() );
269 | }
270 | };
271 |
272 | })( jQuery );
--------------------------------------------------------------------------------
/vendor/assets/javascripts/example.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Getting started with JSON Form
6 |
7 |
8 |
9 | Getting started with JSON Form
10 |
11 |
12 |
13 |
14 |
15 |
16 |
41 |
42 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground-wiwo/README.md:
--------------------------------------------------------------------------------
1 | JSON Form Playground
2 | =========
3 |
4 | The playground is a one-page application that lets you try out JSON Form. It features all the examples that appear in the documentation, as well as an editor that lets you build on top of them.
5 |
6 | For examples to load, the playground must be served over HTTP. There are many ways you can achieve that. Here are two:
7 |
8 | 1. Using Python's `SimpleHTTPServer` from the root of the JSON Form project:
9 | ```bash
10 | python -m SimpleHTTPServer
11 | ```
12 | Then open this page in your favorite browser:
13 | [`http://localhost:8000/playground/`](http://localhost:8000/playground/)
14 |
15 | 2. Using `http-server` node module from the root of the JSON Form project:
16 | ```bash
17 | npm install -g http-server
18 | http-server
19 | ```
20 | Then open this in page in your favorite browser:
21 | [`http://localhost:8080/playground/`](http://localhost:8080/playground/)
22 |
23 | NB: The final `/` in the URL is needed.
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground-wiwo/data/__wiwo-repayment-widget-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "wiwo-repayment-widget": {
3 | "text": {
4 | "assumptions": {
5 | "title": "Assumptions",
6 | "content": "Calculator Information The Repayment Calculator calculates the type of repayment required, at the frequency requested, in respect of the loan parameters entered, namely amount, term and interest rate. The Product selected determines the default interest rate for standard variable products or the default interest rate and fixed period for fixed rate loans. In both scenarios, the customer can manually amend this interest rate. In the case of the fixed rate loans, it will default to the standard variable interest rate once the fixed period has completed.
The Repayment Calculator also calculates the time saved to pay off the loan and the amount of interest saved based on a number of additional inputs from the customer. Included are, if repayments are increased by the entered amount of extra contribution per repayment period, if a single additional lump sum repayment is made, equal to the entered amount of additional lump sum repayment after the loan has been in force for the entered number of years, in addition to continuing the regular repayment and/or 100% of the offset account balance entered is used to reduce the outstanding loan balance per period when calculating interest.
These calculations are done at the repayment frequency entered, in respect of the original loan parameters entered, namely amount, annual interest rate and term in years.
Calculator Assumptions Length of Month All months are assumed to be of equal length. In reality, many loans accrue on a daily basis leading to a varying number of days' interest dependent on the number of days in the particular month.
Number of Weeks or Fortnights in a Year One year is assumed to contain exactly 52 weeks or 26 fortnights. This implicitly assumes that a year has 364 days rather than the actual 365 or 366.
Rounding of Amount of Each Repayment In practice, repayments are rounded to at least the nearer cent. However the calculator uses the unrounded repayment to derive the amount of interest payable at points along the graph and in total over the full term of the loan. This assumption allows for a smooth graph and equal repayment amounts. Note that the final repayment after the increase in repayment amount, after the additional lump sum repayment amount or the effect of the offset account balance will be a partial repayment as required to reduce the loan balance to zero.
Rounding of Time Saved The time saved is presented as a number of years and months, fortnights or weeks, based on the repayment frequency selected. It assumes the potential partial last repayment when calculating the savings.
Amount of Interest Saved This amount can only be approximated from the amount of time saved and based on the original loan details.
Calculator Disclaimer The results from this calculator should be used as an indication only. Results do not represent either quotes or pre-qualifications for the product. Individual institutions apply different formulas. Information such as interest rates quoted and default figures used in the assumptions are subject to change.
"
7 | },
8 | "callToAction": {
9 | "enabled": true,
10 | "actions": [
11 | {
12 | "text": "Want this calculator on your website? Contact us now for a quote
"
13 | },
14 | {
15 | "text": "Want this calculator on your website? Contact us now for a quote
"
16 | }
17 | ]
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground-wiwo/data/wiwo-repayment-widget-simplest.json:
--------------------------------------------------------------------------------
1 | {
2 | "callToAction": {
3 | "actions": [
4 | {
5 | "text": "Want this calculator on your website? Contact us now for a quote
"
6 | },
7 | {
8 | "text": "Want this calculator on your website? Contact us now for a quote
"
9 | }
10 | ]
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground-wiwo/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JSON Form Playground
6 |
69 |
70 |
71 |
72 |
89 |
90 |
91 |
Choose a JSON Form example below and check the generated form. Refer to the documentation for details and directions to extend the form.
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | Roundtrip
103 |
104 |
Generated form
105 |
(please wait)
106 |
107 | Roundtrip
110 |
111 |
112 |
113 |
114 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
136 |
137 |
138 |
139 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground-wiwo/playground.js:
--------------------------------------------------------------------------------
1 | /*global $, ace, console*/
2 | $('document').ready(function () {
3 | var formObject = {
4 | schema: {
5 | example: {
6 | title: 'JSON Form example to start from',
7 | type: 'string',
8 | 'enum': [
9 | 'wiwo-repayment-widget-simplest'
10 | ,'wiwo-repayment-widget-simple'
11 | ,'wiwo-repayment-widget-full'
12 | ],
13 | 'default': 'wiwo-repayment-widget-simplest'
14 | },
15 | greatform: {
16 | title: 'JSON Form object to render',
17 | type: 'string'
18 | }
19 | },
20 | form: [
21 | {
22 | key: 'example',
23 | notitle: true,
24 | prepend: 'Try with',
25 | htmlClass: 'trywith',
26 | titleMap: {
27 | 'wiwo-repayment-widget-simplest': 'Repayment simplest'
28 | },
29 | onChange: function (evt) {
30 | var selected = $(evt.target).val();
31 |
32 | loadExample(selected);
33 | if (history) {
34 | history.pushState(
35 | { example: selected},
36 | 'Example - ' + selected,
37 | '?example=' + selected
38 | );
39 | }
40 | }
41 | },
42 | {
43 | key: 'greatform',
44 | type: 'ace',
45 | aceMode: 'json',
46 | width: '100%',
47 | height: '' + (window.innerHeight - 140) + 'px',
48 | notitle: true,
49 | onChange: function () {
50 | generateForm();
51 | }
52 | }
53 | ]
54 | };
55 |
56 |
57 | /**
58 | * Extracts a potential form to load from query string
59 | */
60 | var getRequestedExample = function () {
61 | var query = window.location.search.substring(1);
62 | var vars = query.split('&');
63 | var param = null;
64 | for (var i = 0; i < vars.length; i++) {
65 | param = vars[i].split('=');
66 | if (param[0] === 'example') {
67 | return param[1];
68 | }
69 | }
70 | return null;
71 | };
72 |
73 | /**
74 | * Loads and displays the example identified by the given name
75 | */
76 | var loadExample = function (example) {
77 | $.when(
78 | $.ajax({
79 | url: 'schemas/' + example + '.json',
80 | dataType: 'text'
81 | }),
82 |
83 | _loadData(example)
84 | ).then(
85 | function(schemaArgs, dataArgs){
86 | updateWithSchemaAndData(schemaArgs[0], dataArgs[0]);
87 | },
88 | function(){
89 | $('#result').html('Sorry, I could not retrieve the example!');
90 | }
91 | );
92 | };
93 |
94 |
95 | /**
96 | * Workaround for old jquery promise support so we can recover
97 | * from a rejected promise state.
98 | *
99 | * @private
100 | */
101 | function _loadData(example){
102 | var deferred = $.Deferred();
103 |
104 | $.ajax({
105 | url: 'data/' + example + '.json',
106 | dataType: 'text'
107 | }).then(function(data, status, xhr){
108 | deferred.resolve([data]);
109 | }, function(xjr, status, error){
110 | // return an empty data object.
111 | deferred.resolve(['{}']);
112 | });
113 |
114 | return deferred.promise();
115 | }
116 |
117 |
118 | var _data;
119 | var _formTree;
120 | function updateWithSchemaAndData(schema, data){
121 | _data = data;
122 | if (typeof data === 'string'){
123 | _data = JSON.parse(data);
124 | }
125 |
126 | var aceId = $('#form .ace_editor').attr('id');
127 | var editor = ace.edit(aceId);
128 | editor.getSession().setValue(schema);
129 | }
130 |
131 |
132 | /**
133 | * Displays the form entered by the user
134 | * (this function runs whenever once per second whenever the user
135 | * changes the contents of the ACE input field)
136 | */
137 | var generateForm = function () {
138 | var values = $('#form').jsonFormValue();
139 |
140 | // Reset result pane
141 | $('#result').html('');
142 |
143 | // Parse entered content as JavaScript
144 | // (mostly JSON but functions are possible)
145 | var createdForm = null;
146 | try {
147 | // Most examples should be written in pure JSON,
148 | // but playground is helpful to check behaviors too!
149 | eval('createdForm=' + values.greatform);
150 | }
151 | catch (e) {
152 | $('#result').html('Entered content is not yet a valid' +
153 | ' JSON Form object.\n\nJavaScript parser returned:\n' +
154 | e + ' ');
155 | return;
156 | }
157 |
158 | // Render the resulting form, binding to onSubmitValid
159 | createdForm.value = _data;
160 |
161 | createdForm.onSubmitValid = function (values) {
162 | if (console && console.log) {
163 | console.log('Values extracted from submitted form', values);
164 | }
165 | window.alert('Form submitted. Values object:\n' +
166 | JSON.stringify(values, null, 2));
167 | };
168 | createdForm.onSubmit = function (errors, values) {
169 | if (errors) {
170 | console.log('Validation errors', errors);
171 | return false;
172 | }
173 | return true;
174 | };
175 |
176 | // TESTING.
177 | // Create array field types - clone the defaults and set their `fieldtemplate` property to false.
178 | var arrayFieldTemplates = [
179 | 'text',
180 | 'password',
181 | 'date',
182 | 'datetime',
183 | 'datetime-local',
184 | 'email',
185 | 'month',
186 | 'number',
187 | 'search',
188 | 'tel',
189 | 'time',
190 | 'url',
191 | 'week'
192 | ];
193 | _.each(arrayFieldTemplates, function(id){
194 | var o = _.clone(JSONForm.fieldTypes[id])
195 | o.fieldtemplate = false;
196 | JSONForm.fieldTypes['table'+id] = o;
197 | });
198 |
199 | function getParentType(node){
200 | var type = null;
201 | if (node && node.parentNode && node.parentNode.schemaElement){
202 | type = node.parentNode.schemaElement.type
203 | }
204 | return type;
205 | }
206 |
207 | createdForm.onBeforeRender = function(data, node){
208 | if (!node.schemaElement){
209 | return;
210 | }
211 |
212 | if (node.schemaElement.type == 'array' && node.schemaElement.items && node.schemaElement.items.type == 'object'){
213 | // console.log('onBeforeRender "array":\ndata=', data, ',\nnode=', node);
214 | node.view = JSONForm.fieldTypes['tablearray'];
215 | console.log('!!!tablearray\ndata=', data, '\nnode=', node);
216 |
217 | } else if (node.schemaElement.type == 'object' && getParentType(node) == 'array'){
218 | // Object item in an array.
219 | node.view = JSONForm.fieldTypes['tableobject'];
220 | console.log('@@@tableobject\ndata=', data, '\nnode=', node);
221 |
222 | } else if (getParentType(node.parentNode) == 'array' && getParentType(node) == 'object') {
223 | // Sub-property of the object item in an array.
224 | // The parent is an object on an array.
225 |
226 | // Get the view type.
227 | var type = node.formElement.type;
228 | var newView = JSONForm.fieldTypes['table'+type];
229 | if (newView){
230 | node.view = newView;
231 |
232 | // TODO: Wrap each child in a .
233 |
234 | // We should be a leaf node - a text input or something like that.
235 | // Can we be a fieldset??
236 | console.log('###node.schemaElement.type=', type, ', newView=', newView);
237 | }
238 | }
239 | };
240 | // TESTING.
241 |
242 | $('#result').html('');
243 | _formTree = $('#result-form').jsonForm(createdForm);
244 | };
245 |
246 | // Render the form
247 | _formTree = $('#form').jsonForm(formObject);
248 |
249 |
250 | // Delegate click listener
251 | $(document).on('click', '.js-btn-roundtrip', function(){
252 | // Check form data aginst original loaded content.
253 | var result = _formTree.validate();
254 | if (result.errors && result.errors.length){
255 | // has errors.
256 | console.warn('Errors: ', result.errors);
257 | } else {
258 | var data = _formTree.root.getFormValues();
259 |
260 | console.log('original _data=', _data);
261 | console.log('new data=', data);
262 | }
263 | });
264 |
265 |
266 | // Wait until ACE is loaded
267 | var itv = window.setInterval(function() {
268 | var example = getRequestedExample() || formObject.schema.example.default;
269 | $('.trywith select').val(example);
270 | if (window.ace) {
271 | window.clearInterval(itv);
272 | loadExample(example);
273 | }
274 | }, 1000);
275 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground-wiwo/schemas/wiwo-repayment-widget-simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "$wiwoVersion": "wiwo-repayment-widget#11.2.0",
3 | "schema": {
4 | "wiwo-repayment-widget": {
5 | "type": "object",
6 | "id": "http://jsonschema.net/wiwo-repayment-widget",
7 | "required": true,
8 | "properties": {
9 | "text": {
10 | "type": "object",
11 | "id": "http://jsonschema.net/wiwo-repayment-widget/text",
12 | "required": true,
13 | "properties": {
14 | "assumptions": {
15 | "type": "object",
16 | "id": "http://jsonschema.net/wiwo-repayment-widget/text/assumptions",
17 | "required": true,
18 | "properties": {
19 | "title": {
20 | "type": "string",
21 | "id": "http://jsonschema.net/wiwo-repayment-widget/text/assumptions/title",
22 | "required": true,
23 | "title": "Title"
24 | },
25 | "content": {
26 | "type": "string",
27 | "id": "http://jsonschema.net/wiwo-repayment-widget/text/assumptions/content",
28 | "required": true,
29 | "title": "Content"
30 | }
31 | },
32 | "title": "Assumptions",
33 | "additionalProperties": false
34 | },
35 | "callToAction": {
36 | "type": "object",
37 | "id": "http://jsonschema.net/wiwo-repayment-widget/text/callToAction",
38 | "required": true,
39 | "properties": {
40 | "enabled": {
41 | "type": "boolean",
42 | "id": "http://jsonschema.net/wiwo-repayment-widget/text/callToAction/enabled",
43 | "required": true,
44 | "title": "Enabled"
45 | },
46 | "actions": {
47 | "type": "array",
48 | "id": "http://jsonschema.net/wiwo-repayment-widget/text/callToAction/actions",
49 | "required": true,
50 | "items": {
51 | "type": "object",
52 | "id": "http://jsonschema.net/wiwo-repayment-widget/text/callToAction/actions/0",
53 | "required": true,
54 | "properties": {
55 | "text": {
56 | "type": "string",
57 | "id": "http://jsonschema.net/wiwo-repayment-widget/text/callToAction/actions/0/text",
58 | "required": true,
59 | "title": "Text"
60 | }
61 | },
62 | "additionalProperties": false
63 | },
64 | "title": "Actions"
65 | }
66 | },
67 | "title": "Call To Action",
68 | "additionalProperties": false
69 | }
70 | },
71 | "title": "Text",
72 | "additionalProperties": false
73 | }
74 | },
75 | "title": "Wiwo-repayment-widget",
76 | "additionalProperties": false
77 | }
78 | },
79 | "customFormItems": {
80 | "wiwo-repayment-widget.text.assumptions.content": {
81 | "type": "ace",
82 | "aceMode": "html",
83 | "width": "100%",
84 | "height": "200px"
85 | }
86 | ,"wiwo-repayment-widget.text.callToAction.actions[].text": {
87 | "type": "ace",
88 | "aceMode": "html",
89 | "width": "100%",
90 | "height": "200px"
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground-wiwo/schemas/wiwo-repayment-widget-simplest.json:
--------------------------------------------------------------------------------
1 | {
2 | "$wiwoVersion": "wiwo-repayment-widget#11.2.0",
3 | "schema": {
4 | "callToAction": {
5 | "type": "object",
6 | "id": "http://jsonschema.net/callToAction",
7 | "required": true,
8 | "properties": {
9 | "actions": {
10 | "type": "array",
11 | "id": "http://jsonschema.net/callToAction/actions",
12 | "required": true,
13 | "items": {
14 | "type": "object",
15 | "id": "http://jsonschema.net/callToAction/actions/0",
16 | "required": true,
17 | "properties": {
18 | "text": {
19 | "type": "string",
20 | "id": "http://jsonschema.net/callToAction/actions/0/text",
21 | "required": true,
22 | "title": "Text"
23 | }
24 | },
25 | "additionalProperties": false
26 | },
27 | "title": "Actions"
28 | }
29 | },
30 | "title": "Call To Action",
31 | "additionalProperties": false
32 | }
33 | },
34 | "customFormItems": {
35 | "callToAction.actions[].text": {
36 | "type": "ace",
37 | "aceMode": "html",
38 | "width": "100%",
39 | "height": "200px",
40 | "aceOptions": {
41 | "xxxwrap": "free"
42 | }
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/README.md:
--------------------------------------------------------------------------------
1 | JSON Form Playground
2 | =========
3 |
4 | The playground is a one-page application that lets you try out JSON Form. It features all the examples that appear in the documentation, as well as an editor that lets you build on top of them.
5 |
6 | For examples to load, the playground must be served over HTTP. There are many ways you can achieve that. Here are two:
7 |
8 | 1. Using Python's `SimpleHTTPServer` from the root of the JSON Form project:
9 | ```bash
10 | python -m SimpleHTTPServer
11 | ```
12 | Then open this page in your favorite browser:
13 | [`http://localhost:8000/playground/`](http://localhost:8000/playground/)
14 |
15 | 2. Using `http-server` node module from the root of the JSON Form project:
16 | ```bash
17 | npm install -g http-server
18 | http-server
19 | ```
20 | Then open this in page in your favorite browser:
21 | [`http://localhost:8080/playground/`](http://localhost:8080/playground/)
22 |
23 | NB: The final `/` in the URL is needed.
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/events.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "text": {
4 | "type": "string",
5 | "title": "Text"
6 | }
7 | },
8 | "form": [
9 | {
10 | "key": "text",
11 | "onChange": function (evt) {
12 | var value = $(evt.target).val();
13 | if (value) alert(value);
14 | }
15 | },
16 | {
17 | "type": "button",
18 | "title": "Click me",
19 | "onClick": function (evt) {
20 | evt.preventDefault();
21 | alert('Thank you!');
22 | }
23 | }
24 | ]
25 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/factory-sleek.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "color": {
4 | "title": "Color",
5 | "type": "string",
6 | "enum": [
7 | "blue",
8 | "spicy",
9 | "gray",
10 | "earth",
11 | "vegetal"
12 | ],
13 | "default":"gray",
14 | "required": true
15 | },
16 | "backgroundimage" : {
17 | "title": "Background image for TV version",
18 | "type": "object"
19 | },
20 | "tabs": {
21 | "title": "Tabs titles",
22 | "type": "array",
23 | "items": {
24 | "title": "Short tab title (max. 15 characters)",
25 | "type": "string",
26 | "maxLength": 15
27 | }
28 | },
29 | "tabicons": {
30 | "title": "Tabs icons",
31 | "maxLength":8,
32 | "type": "array",
33 | "items": {
34 | "title": "Tab icon",
35 | "type": "string",
36 | "enum": [
37 | "contact",
38 | "event",
39 | "map",
40 | "news",
41 | "photo",
42 | "product",
43 | "sound",
44 | "status",
45 | "video"
46 | ]
47 | }
48 | }
49 | },
50 | "form": [
51 | {
52 | "type": "fieldset",
53 | "legend": "Styles",
54 | "items": [
55 | "color",
56 | {
57 | "key" : "backgroundimage",
58 | "type": "file-hosted-public"
59 | }
60 |
61 | ]
62 | },
63 | {
64 | "type": "fieldset",
65 | "legend": "Tabs",
66 | "items": [
67 | {
68 | "type": "tabarray",
69 | "items": [
70 | {
71 | "type": "section",
72 | "legend": "{{value}}",
73 | "items": [
74 | {
75 | "key": "tabicons[]",
76 | "type": "imageselect",
77 | "imageWidth": 32,
78 | "imageHeight": 42,
79 | "imageButtonClass": "btn-inverse",
80 | "imagePrefix": "app/images/tv-",
81 | "imageSuffix": ".png",
82 | "imageSelectorTitle": "Based on tab data source"
83 | },
84 | {
85 | "key": "tabs[]",
86 | "valueInLegend": true,
87 | "value": "{{values.datasources.main[]}}"
88 | }
89 | ]
90 | }
91 | ]
92 | }
93 | ]
94 | }
95 | ]
96 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-ace.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "code": {
4 | "type": "string",
5 | "title": "Some JSON"
6 | }
7 | },
8 | "form": [
9 | {
10 | "key": "code",
11 | "type": "ace",
12 | "aceMode": "json",
13 | "aceTheme": "twilight",
14 | "width": "100%",
15 | "height": "200px"
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-actions.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "search": {
4 | "type": "string",
5 | "title": "Search"
6 | }
7 | },
8 | "form": [
9 | "search",
10 | {
11 | "type": "actions",
12 | "items": [
13 | {
14 | "type": "submit",
15 | "title": "Submit"
16 | },
17 | {
18 | "type": "button",
19 | "title": "Cancel"
20 | }
21 | ]
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-advancedfieldset.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "name": {
4 | "type": "string",
5 | "title": "Name"
6 | },
7 | "age": {
8 | "type": "number",
9 | "title": "Age"
10 | }
11 | },
12 | "form": [
13 | "name",
14 | {
15 | "type": "advancedfieldset",
16 | "items": [
17 | "age"
18 | ]
19 | }
20 | ]
21 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "friends": {
4 | "type": "array",
5 | "items": {
6 | "type": "object",
7 | "title": "Friend",
8 | "properties": {
9 | "nick": {
10 | "type": "string",
11 | "title": "Nickname"
12 | },
13 | "animals": {
14 | "type": "array",
15 | "items": {
16 | "type": "string",
17 | "title": "Animal name"
18 | }
19 | }
20 | }
21 | }
22 | }
23 | },
24 | "form": [
25 | {
26 | "type": "array",
27 | "items": {
28 | "type": "section",
29 | "items": [
30 | "friends[].nick",
31 | {
32 | "type": "array",
33 | "items": [
34 | "friends[].animals[]"
35 | ]
36 | }
37 | ]
38 | }
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-authfieldset.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "name": {
4 | "type": "string",
5 | "title": "Name"
6 | },
7 | "key": {
8 | "type": "string",
9 | "title": "Access key"
10 | }
11 | },
12 | "form": [
13 | "name",
14 | {
15 | "type": "authfieldset",
16 | "items": [
17 | "key"
18 | ]
19 | }
20 | ]
21 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-checkbox.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "flag": {
4 | "type": "boolean",
5 | "title": "Adult"
6 | }
7 | },
8 | "form": [
9 | {
10 | "key": "flag",
11 | "inlinetitle": "Check this box if you are over 18"
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-checkboxes.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "menu": {
4 | "type": "array",
5 | "title": "Options",
6 | "items": {
7 | "type": "string",
8 | "title": "Option",
9 | "enum": [
10 | "starter",
11 | "maincourse",
12 | "cheese",
13 | "dessert"
14 | ]
15 | }
16 | }
17 | },
18 | "form": [
19 | {
20 | "key": "menu",
21 | "type": "checkboxes",
22 | "titleMap": {
23 | "starter": "Starter would be great",
24 | "maincourse": "No way I'll skip the main course",
25 | "cheese": "Cheddar rules!",
26 | "dessert": "Thumbs up for a dessert"
27 | }
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-color.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "maincolor": {
4 | "type": "string",
5 | "title": "Main color",
6 | "format": "color"
7 | }
8 | }
9 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-common.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "shortmood": {
4 | "type": "string",
5 | "title": "Mood of the day",
6 | "description": "Describe how you feel in short",
7 | "default": "happy",
8 | "required": true
9 | },
10 | "longmood": {
11 | "type": "string",
12 | "title": "Mood of the day",
13 | "description": "Describe how you feel with a rather long adjective-like series of words"
14 | }
15 | },
16 | "form": [
17 | "shortmood",
18 | {
19 | "key": "longmood",
20 | "prepend": "I feel",
21 | "append": "today",
22 | "notitle": true,
23 | "htmlClass": "usermood",
24 | "fieldHtmlClass": "input-xxlarge",
25 | "placeholder": "incredibly and admirably great"
26 | }
27 | ]
28 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-fieldset.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "comment": {
4 | "type": "string",
5 | "title": "Comment"
6 | },
7 | "name": {
8 | "type": "string",
9 | "title": "Name"
10 | },
11 | "age": {
12 | "type": "number",
13 | "title": "Age"
14 | }
15 | },
16 | "form": [
17 | {
18 | "key": "comment",
19 | "type": "textarea"
20 | },
21 | {
22 | "type": "fieldset",
23 | "title": "Author",
24 | "expandable": true,
25 | "items": [
26 | "name",
27 | "age"
28 | ]
29 | }
30 | ]
31 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-help.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "name": {
4 | "title": "Name",
5 | "description": "Nickname allowed",
6 | "type": "string"
7 | },
8 | "gender": {
9 | "title": "Gender",
10 | "description": "Your gender",
11 | "type": "string",
12 | "enum": [
13 | "male",
14 | "female",
15 | "alien"
16 | ]
17 | }
18 | },
19 | "form": [
20 | "*",
21 | {
22 | "type": "help",
23 | "helpvalue": "Click on Submit when you're done"
24 | },
25 | {
26 | "type": "submit",
27 | "title": "Submit"
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-hidden.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "apikey": {
4 | "type": "string",
5 | "title": "API key",
6 | "default": "supercalifragilisticexpialidocious"
7 | },
8 | "text": {
9 | "type": "string",
10 | "title": "Search string"
11 | }
12 | },
13 | "form": [
14 | {
15 | "key": "apikey",
16 | "type": "hidden"
17 | },
18 | "text",
19 | {
20 | "type": "submit",
21 | "title": "Search"
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-imageselect.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "icon": {
4 | "title": "Choose an icon",
5 | "type": "string",
6 | "enum": [
7 | "address-book",
8 | "archive",
9 | "balloon",
10 | "calendar",
11 | "camera",
12 | "cd",
13 | "disk",
14 | "heart",
15 | "home",
16 | "mail"
17 | ]
18 | }
19 | },
20 | "form": [
21 | {
22 | "key": "icon",
23 | "type": "imageselect",
24 | "imageWidth": 64,
25 | "imageHeight": 64,
26 | "imageButtonClass": "btn-inverse",
27 | "imagePrefix": "http://icons.iconarchive.com/icons/double-j-design/origami-colored-pencil/64/blue-",
28 | "imageSuffix": "-icon.png",
29 | "imageSelectorColumns": 4,
30 | "imageSelectorTitle": "Random choice"
31 | }
32 | ]
33 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-password.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "pwd": {
4 | "type": "string",
5 | "title": "Your secret"
6 | }
7 | },
8 | "form": [
9 | {
10 | "key": "pwd",
11 | "type": "password"
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-questions.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "response": {
4 | "type": "string",
5 | "title": "Search"
6 | }
7 | },
8 | "form": [
9 | {
10 | "type": "questions",
11 | "key": "response",
12 | "title": "Let's check your mood",
13 | "items": [
14 | {
15 | "type": "question",
16 | "title": "Are you happy?",
17 | "activeClass": "btn-success",
18 | "optionsType": "radiobuttons",
19 | "options": [
20 | {
21 | "title": "Yes",
22 | "value": "happy",
23 | "next": "q2",
24 | "htmlClass": "btn-primary"
25 | },
26 | {
27 | "title": "No",
28 | "value": "sad",
29 | "submit": true
30 | }
31 | ]
32 | },
33 | {
34 | "type": "question",
35 | "qid": "q2",
36 | "title": "Really happy?",
37 | "options": [
38 | {
39 | "title": "Yes",
40 | "value": "reallyhappy",
41 | "submit": true
42 | },
43 | {
44 | "title": "No",
45 | "value": "happy",
46 | "submit": true
47 | }
48 | ]
49 | }
50 | ]
51 | }
52 | ]
53 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-radiobuttons.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "language": {
4 | "type": "string",
5 | "title": "Best language",
6 | "enum": [ "JavaScript", "Python", "PHP", "Java", "C++", "other" ]
7 | }
8 | },
9 | "form": [
10 | {
11 | "key": "language",
12 | "type": "radiobuttons",
13 | "activeClass": "btn-success"
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-radios.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "language": {
4 | "type": "string",
5 | "title": "Best language",
6 | "enum": [ "JavaScript", "Python", "PHP", "Java", "C++", "other" ]
7 | }
8 | },
9 | "form": [
10 | {
11 | "key": "language",
12 | "type": "radios"
13 | }
14 | ]
15 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-range.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "range": {
4 | "type": "integer",
5 | "title": "Is JSON Form useful?",
6 | "description": "The field should appear as a range that accepts values between 0 (excluded) and 200 by steps of 20 on browsers that support the \"range\" input type. Note that the \"step\" constraint is not enforced when the form is submitted.",
7 | "default": 40,
8 | "minimum": 0,
9 | "exclusiveMinimum": true,
10 | "maximum": 200
11 | }
12 | },
13 | "form": [
14 | {
15 | "key": "range",
16 | "type": "range",
17 | "step": 20
18 | }
19 | ]
20 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-section.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "comment": {
4 | "type": "string",
5 | "title": "Comment"
6 | },
7 | "name": {
8 | "type": "string",
9 | "title": "Name"
10 | },
11 | "age": {
12 | "type": "number",
13 | "title": "Age"
14 | }
15 | },
16 | "form": [
17 | {
18 | "key": "comment",
19 | "type": "textarea"
20 | },
21 | {
22 | "type": "section",
23 | "title": "Author",
24 | "items": [
25 | "name",
26 | "age"
27 | ]
28 | }
29 | ]
30 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-select.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "gender": {
4 | "type": "string",
5 | "title": "Gender",
6 | "enum": [ "male", "female", "alien" ]
7 | }
8 | },
9 | "form": [
10 | {
11 | "key": "gender",
12 | "titleMap": {
13 | "male": "Dude",
14 | "female": "Dudette",
15 | "alien": "I'm from outer space!"
16 | }
17 | }
18 | ]
19 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-selectfieldset-key.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "choice": {
4 | "type": "string",
5 | "enum": [ "text", "cat" ]
6 | },
7 | "text": {
8 | "type": "string",
9 | "title": "Text"
10 | },
11 | "category": {
12 | "type": "string",
13 | "title": "Category",
14 | "enum": [
15 | "Geography",
16 | "Entertainment",
17 | "History",
18 | "Arts",
19 | "Science",
20 | "Sports"
21 | ]
22 | }
23 | },
24 | "form": [
25 | {
26 | "type": "selectfieldset",
27 | "key": "choice",
28 | "title": "Make a choice",
29 | "titleMap": {
30 | "text": "Search by text",
31 | "cat": "Search by category"
32 | },
33 | "items": [
34 | "text",
35 | "category"
36 | ]
37 | },
38 | {
39 | "type": "submit",
40 | "value": "Submit"
41 | }
42 | ]
43 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-selectfieldset.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "text": {
4 | "type": "string",
5 | "title": "Text"
6 | },
7 | "category": {
8 | "type": "string",
9 | "title": "Category",
10 | "enum": [
11 | "Geography",
12 | "Entertainment",
13 | "History",
14 | "Arts",
15 | "Science",
16 | "Sports"
17 | ]
18 | }
19 | },
20 | "form": [
21 | {
22 | "type": "selectfieldset",
23 | "title": "Make a choice",
24 | "items": [
25 | {
26 | "key": "text",
27 | "legend": "Search by text"
28 | },
29 | {
30 | "key": "category",
31 | "legend": "Search by category"
32 | }
33 | ]
34 | },
35 | {
36 | "type": "submit",
37 | "title": "Submit"
38 | }
39 | ]
40 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-submit.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "name": {
4 | "title": "Name",
5 | "description": "Nickname allowed",
6 | "type": "string"
7 | },
8 | "gender": {
9 | "title": "Gender",
10 | "description": "Your gender",
11 | "type": "string",
12 | "enum": [
13 | "male",
14 | "female",
15 | "alien"
16 | ]
17 | }
18 | },
19 | "form": [
20 | "*",
21 | {
22 | "type": "submit",
23 | "title": "OK Go - This Too Shall Pass"
24 | }
25 | ]
26 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-tabarray-maxitems.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "friends": {
4 | "type": "array",
5 | "maxItems": 3,
6 | "items": {
7 | "type": "object",
8 | "title": "Friend",
9 | "properties": {
10 | "nick": {
11 | "type": "string",
12 | "title": "Nickname"
13 | },
14 | "animals": {
15 | "type": "array",
16 | "maxItems": 2,
17 | "items": {
18 | "type": "string",
19 | "title": "Animal name"
20 | }
21 | }
22 | }
23 | }
24 | }
25 | },
26 | "form": [
27 | {
28 | "type": "tabarray",
29 | "items": {
30 | "type": "section",
31 | "items": [
32 | "friends[].nick",
33 | {
34 | "type": "array",
35 | "items": [
36 | "friends[].animals[]"
37 | ]
38 | }
39 | ]
40 | }
41 | }
42 | ]
43 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-tabarray-value.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "thoughts": {
4 | "type": "array",
5 | "items": {
6 | "type": "string",
7 | "title": "Thought",
8 | "default": "wtf"
9 | }
10 | }
11 | },
12 | "form": [
13 | {
14 | "type": "tabarray",
15 | "items": [
16 | {
17 | "type": "section",
18 | "legend": "{{idx}}. {{value}}",
19 | "items": [
20 | {
21 | "key": "thoughts[]",
22 | "valueInLegend": true
23 | }
24 | ]
25 | }
26 | ]
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-tabarray.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "friends": {
4 | "type": "array",
5 | "items": {
6 | "type": "object",
7 | "title": "Friend",
8 | "properties": {
9 | "nick": {
10 | "type": "string",
11 | "title": "Nickname"
12 | },
13 | "animals": {
14 | "type": "array",
15 | "items": {
16 | "type": "string",
17 | "title": "Animal name"
18 | }
19 | }
20 | }
21 | }
22 | }
23 | },
24 | "form": [
25 | {
26 | "type": "tabarray",
27 | "items": {
28 | "type": "section",
29 | "items": [
30 | "friends[].nick",
31 | {
32 | "type": "array",
33 | "items": [
34 | "friends[].animals[]"
35 | ]
36 | }
37 | ]
38 | }
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/fields-textarea.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "comment": {
4 | "type": "string",
5 | "title": "Your thoughts"
6 | }
7 | },
8 | "form": [
9 | {
10 | "key": "comment",
11 | "type": "textarea"
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/gettingstarted.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "field": {
4 | "type": "string",
5 | "title": "A field"
6 | }
7 | },
8 | "form": [
9 | {
10 | "key": "field"
11 | },
12 | {
13 | "type": "submit",
14 | "title": "Submit"
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/previousvalues.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "friends": {
4 | "type": "array",
5 | "items": {
6 | "type": "object",
7 | "title": "Friend",
8 | "properties": {
9 | "nick": {
10 | "type": "string",
11 | "title": "Nickname",
12 | "required": true
13 | },
14 | "gender": {
15 | "type": "string",
16 | "title": "Gender",
17 | "enum": [ "male", "female", "alien" ]
18 | },
19 | "age": {
20 | "type": "integer",
21 | "title": "Age"
22 | }
23 | }
24 | }
25 | }
26 | },
27 | "value": {
28 | "friends": [
29 | { "nick": "tidoust", "gender": "male", "age": 34 },
30 | { "nick": "titine", "gender": "female", "age": 6 },
31 | { "nick": "E.T.", "gender": "alien" }
32 | ]
33 | }
34 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/schema-array.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "friends": {
4 | "type": "array",
5 | "items": {
6 | "type": "object",
7 | "title": "Friend",
8 | "properties": {
9 | "nick": {
10 | "type": "string",
11 | "title": "Nickname",
12 | "required": true
13 | },
14 | "gender": {
15 | "type": "string",
16 | "title": "Gender",
17 | "enum": [ "male", "female", "alien" ]
18 | },
19 | "age": {
20 | "type": "integer",
21 | "title": "Age"
22 | }
23 | }
24 | }
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/schema-basic.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "name": {
4 | "title": "Name",
5 | "description": "Nickname allowed",
6 | "type": "string"
7 | },
8 | "gender": {
9 | "title": "Gender",
10 | "description": "Your gender",
11 | "type": "string",
12 | "enum": [
13 | "male",
14 | "female",
15 | "alien"
16 | ]
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/schema-morecomplex.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "message": {
4 | "type": "string",
5 | "title": "Message"
6 | },
7 | "author": {
8 | "type": "object",
9 | "title": "Author",
10 | "properties": {
11 | "name": {
12 | "type": "string",
13 | "title": "Name"
14 | },
15 | "gender": {
16 | "type": "string",
17 | "title": "Gender",
18 | "enum": [ "male", "female", "alien" ]
19 | },
20 | "magic": {
21 | "type": "integer",
22 | "title": "Magic number",
23 | "default": 42
24 | }
25 | }
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/templating-idx.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "thoughts": {
4 | "type": "array",
5 | "items": {
6 | "title": "A thought",
7 | "type": "string"
8 | }
9 | }
10 | },
11 | "form": [
12 | {
13 | "type": "array",
14 | "items": [{
15 | "key": "thoughts[]",
16 | "title": "Thought number {{idx}}"
17 | }]
18 | }
19 | ]
20 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/templating-tpldata.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "age": {
4 | "type": "integer",
5 | "title": "Age"
6 | }
7 | },
8 | "form": [
9 | {
10 | "key": "age",
11 | "title": "{{user.name}}'s age"
12 | }
13 | ],
14 | "tpldata": {
15 | "user": { "name": "tidoust" }
16 | }
17 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/templating-value.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "thoughts": {
4 | "type": "array",
5 | "title": "Thoughts",
6 | "items": {
7 | "type": "string",
8 | "title": "A thought",
9 | "default": "Grmpf"
10 | }
11 | }
12 | },
13 | "form": [
14 | {
15 | "type": "tabarray",
16 | "items": [
17 | {
18 | "type": "section",
19 | "legend": "{{idx}}. {{value}}",
20 | "items": [
21 | {
22 | "key": "thoughts[]",
23 | "title": "Thought {{idx}}",
24 | "valueInLegend": true
25 | }
26 | ]
27 | }
28 | ]
29 | }
30 | ]
31 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/examples/templating-values.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": {
3 | "firstname": {
4 | "type": "string",
5 | "title": "First name"
6 | },
7 | "lastname": {
8 | "type": "string",
9 | "title": "Last name"
10 | },
11 | "fullname": {
12 | "type": "string",
13 | "title": "Full name"
14 | }
15 | },
16 | "form": [
17 | "firstname",
18 | "lastname",
19 | {
20 | "key": "fullname",
21 | "value": "{{values.firstname}} {{values.lastname}}"
22 | }
23 | ],
24 | "value": {
25 | "firstname": "François",
26 | "lastname": "Daoust"
27 | }
28 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | JSON Form Playground
6 |
69 |
70 |
71 |
72 |
89 |
90 |
91 |
Choose a JSON Form example below and check the generated form. Refer to the documentation for details and directions to extend the form.
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
Generated form
100 |
(please wait)
101 |
102 |
103 |
104 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/playground/playground.js:
--------------------------------------------------------------------------------
1 | /*global $, ace, console*/
2 | $('document').ready(function () {
3 | var formObject = {
4 | schema: {
5 | example: {
6 | title: 'JSON Form example to start from',
7 | type: 'string',
8 | 'enum': [
9 | 'gettingstarted',
10 | 'schema-basic',
11 | 'schema-morecomplex',
12 | 'schema-array',
13 | 'fields-common',
14 | 'fields-password',
15 | 'fields-textarea',
16 | 'fields-ace',
17 | 'fields-color',
18 | 'fields-checkbox',
19 | 'fields-checkboxes',
20 | 'fields-select',
21 | 'fields-radios',
22 | 'fields-radiobuttons',
23 | 'fields-range',
24 | 'fields-imageselect',
25 | 'fields-fieldset',
26 | 'fields-advancedfieldset',
27 | 'fields-authfieldset',
28 | 'fields-section',
29 | 'fields-actions',
30 | 'fields-array',
31 | 'fields-tabarray',
32 | 'fields-tabarray-maxitems',
33 | 'fields-selectfieldset',
34 | 'fields-selectfieldset-key',
35 | 'fields-submit',
36 | 'fields-help',
37 | 'fields-hidden',
38 | 'fields-questions',
39 | 'templating-idx',
40 | 'templating-value',
41 | 'templating-values',
42 | 'templating-tpldata',
43 | 'events',
44 | 'previousvalues',
45 | 'factory-sleek'
46 | ],
47 | 'default': 'gettingstarted'
48 | },
49 | greatform: {
50 | title: 'JSON Form object to render',
51 | type: 'string'
52 | }
53 | },
54 | form: [
55 | {
56 | key: 'example',
57 | notitle: true,
58 | prepend: 'Try with',
59 | htmlClass: 'trywith',
60 | titleMap: {
61 | 'gettingstarted': 'Getting started',
62 | 'schema-basic': 'JSON Schema - A basic example',
63 | 'schema-morecomplex': 'JSON Schema - Slightly more complex example',
64 | 'schema-array': 'JSON Schema - Arrays',
65 | 'fields-common': 'Fields - Common properties',
66 | 'fields-password': 'Fields - Gathering secrets: the password type',
67 | 'fields-textarea': 'Fields - Large text: the textarea type',
68 | 'fields-ace': 'Fields - Code (JavaScript, JSON...): the ace type',
69 | 'fields-color': 'Fields - Color picker: the color type',
70 | 'fields-checkbox': 'Fields - Boolean flag: the checkbox type',
71 | 'fields-checkboxes': 'Fields - Multiple options: the checkboxes type',
72 | 'fields-select': 'Fields - Selection list: the select type',
73 | 'fields-radios': 'Fields - A list of radio buttons: the radios type',
74 | 'fields-radiobuttons': 'Fields - Radio buttons as real buttons: the radio buttons type',
75 | 'fields-range': 'Fields - Number: the range type',
76 | 'fields-imageselect': 'Fields - Image selector: the imageselect type',
77 | 'fields-fieldset': 'Fields - Grouping: the fieldset type',
78 | 'fields-advancedfieldset': 'Fields - Advanced options section: the advancedfieldset type',
79 | 'fields-authfieldset': 'Fields - Authentication settings section: the authfieldset type',
80 | 'fields-section': 'Fields - Generic group: the section type',
81 | 'fields-actions': 'Fields - Group of buttons: the actions type',
82 | 'fields-array': 'Fields - Generic array: the array type',
83 | 'fields-tabarray': 'Fields - Arrays with tabs: the tabarray type',
84 | 'fields-tabarray-maxitems': 'Fields - Arrays with tabs: the tabarray type w/ maxItems',
85 | 'fields-selectfieldset': 'Fields - Alternative: the selectfieldset type',
86 | 'fields-selectfieldset-key': 'Fields - Alternative with schema key',
87 | 'fields-submit': 'Fields - Submit the form: the submit type',
88 | 'fields-help': 'Fields - Guide users: the help type',
89 | 'fields-hidden': 'Fields - Hidden form values: the hidden type',
90 | 'fields-questions': 'Fields - Series of questions: the questions type',
91 | 'templating-idx': 'Templating - item index with idx',
92 | 'templating-value': 'Templating - tab legend with value and valueInLegend',
93 | 'templating-values': 'Templating - values.xxx to reference another field',
94 | 'templating-tpldata': 'Templating - Using the tpldata property',
95 | 'events': 'Using event handlers',
96 | 'previousvalues': 'Using previously submitted values',
97 | 'factory-sleek': 'Joshfire Factory - Sleek template'
98 | },
99 | onChange: function (evt) {
100 | var selected = $(evt.target).val();
101 |
102 | loadExample(selected);
103 | if (history) history.pushState(
104 | { example: selected},
105 | 'Example - ' + selected,
106 | '?example=' + selected);
107 | }
108 | },
109 | {
110 | key: 'greatform',
111 | type: 'ace',
112 | aceMode: 'json',
113 | width: '100%',
114 | height: '' + (window.innerHeight - 140) + 'px',
115 | notitle: true,
116 | onChange: function () {
117 | generateForm();
118 | }
119 | }
120 | ]
121 | };
122 |
123 |
124 | /**
125 | * Extracts a potential form to load from query string
126 | */
127 | var getRequestedExample = function () {
128 | var query = window.location.search.substring(1);
129 | var vars = query.split('&');
130 | var param = null;
131 | for (var i = 0; i < vars.length; i++) {
132 | param = vars[i].split('=');
133 | if (param[0] === 'example') {
134 | return param[1];
135 | }
136 | }
137 | return null;
138 | };
139 |
140 | /**
141 | * Loads and displays the example identified by the given name
142 | */
143 | var loadExample = function (example) {
144 | $.ajax({
145 | url: 'examples/' + example + '.json',
146 | dataType: 'text'
147 | }).done(function (code) {
148 | var aceId = $('#form .ace_editor').attr('id');
149 | var editor = ace.edit(aceId);
150 | editor.getSession().setValue(code);
151 | }).fail(function () {
152 | $('#result').html('Sorry, I could not retrieve the example!');
153 | });
154 | };
155 |
156 |
157 | /**
158 | * Displays the form entered by the user
159 | * (this function runs whenever once per second whenever the user
160 | * changes the contents of the ACE input field)
161 | */
162 | var generateForm = function () {
163 | var values = $('#form').jsonFormValue();
164 |
165 | // Reset result pane
166 | $('#result').html('');
167 |
168 | // Parse entered content as JavaScript
169 | // (mostly JSON but functions are possible)
170 | var createdForm = null;
171 | try {
172 | // Most examples should be written in pure JSON,
173 | // but playground is helpful to check behaviors too!
174 | eval('createdForm=' + values.greatform);
175 | }
176 | catch (e) {
177 | $('#result').html('Entered content is not yet a valid' +
178 | ' JSON Form object.\n\nJavaScript parser returned:\n' +
179 | e + ' ');
180 | return;
181 | }
182 |
183 | // Render the resulting form, binding to onSubmitValid
184 | // try {
185 | createdForm.onSubmitValid = function (values) {
186 | if (console && console.log) {
187 | console.log('Values extracted from submitted form', values);
188 | }
189 | window.alert('Form submitted. Values object:\n' +
190 | JSON.stringify(values, null, 2));
191 | };
192 | createdForm.onSubmit = function (errors, values) {
193 | if (errors) {
194 | console.log('Validation errors', errors);
195 | return false;
196 | }
197 | return true;
198 | };
199 |
200 | // TESTING.
201 | // Create array field types - clone the defaults and set their `fieldtemplate` property to false.
202 | var arrayFieldTemplates = [
203 | 'text',
204 | 'password',
205 | 'date',
206 | 'datetime',
207 | 'datetime-local',
208 | 'email',
209 | 'month',
210 | 'number',
211 | 'search',
212 | 'tel',
213 | 'time',
214 | 'url',
215 | 'week'
216 | ];
217 | _.each(arrayFieldTemplates, function(id){
218 | var o = _.clone(JSONForm.fieldTypes[id])
219 | o.fieldtemplate = false;
220 | JSONForm.fieldTypes['table'+id] = o;
221 | });
222 |
223 | function getParentType(node){
224 | var type = null;
225 | if (node && node.parentNode && node.parentNode.schemaElement){
226 | type = node.parentNode.schemaElement.type
227 | }
228 | return type;
229 | }
230 |
231 | createdForm.onBeforeRender = function(data, node){
232 | if (!node.schemaElement){
233 | return;
234 | }
235 |
236 | if (node.schemaElement.type == 'array' && node.schemaElement.items && node.schemaElement.items.type == 'object'){
237 | // console.log('onBeforeRender "array":\ndata=', data, ',\nnode=', node);
238 | node.view = JSONForm.fieldTypes['tablearray'];
239 | console.log('!!!tablearray\ndata=', data, '\nnode=', node);
240 |
241 | } else if (node.schemaElement.type == 'object' && getParentType(node) == 'array'){
242 | // Object item in an array.
243 | node.view = JSONForm.fieldTypes['tableobject'];
244 | console.log('@@@tableobject\ndata=', data, '\nnode=', node);
245 |
246 | } else if (getParentType(node.parentNode) == 'array' && getParentType(node) == 'object') {
247 | // Sub-property of the object item in an array.
248 | // The parent is an object on an array.
249 |
250 | // Get the view type.
251 | var type = node.formElement.type;
252 | var newView = JSONForm.fieldTypes['table'+type];
253 | if (newView){
254 | node.view = newView;
255 |
256 | // TODO: Wrap each child in a .
257 |
258 | // We should be a leaf node - a text input or something like that.
259 | // Can we be a fieldset??
260 | console.log('###node.schemaElement.type=', type, ', newView=', newView);
261 | }
262 | }
263 |
264 | // node.view = null;
265 | };
266 | // createdForm.onElementSchema = function(formElement, schemaElement){
267 | // if (schemaElement.type == 'array'){
268 | // console.log('onElementSchema: formElement=', formElement, ',\nschemaElement=', schemaElement);
269 |
270 | // if (schemaElement.items && schemaElement.items.type == 'object'){
271 | // // Set the table item types.
272 | // formElement.type = 'tablearray';
273 | // }
274 | // }
275 | // };
276 | // TESTING.
277 |
278 | $('#result').html('');
279 | $('#result-form').jsonForm(createdForm);
280 | // }
281 | // catch (e) {
282 | // $('#result').html('Entered content is not yet a valid' +
283 | // ' JSON Form object.\n\nThe JSON Form library returned:\n' +
284 | // e + ' ');
285 | // return;
286 | // }
287 | };
288 |
289 | // Render the form
290 | $('#form').jsonForm(formObject);
291 |
292 | // Wait until ACE is loaded
293 | var itv = window.setInterval(function() {
294 | var example = getRequestedExample() || 'gettingstarted';
295 | $('.trywith select').val(example);
296 | if (window.ace) {
297 | window.clearInterval(itv);
298 | loadExample(example);
299 | }
300 | }, 1000);
301 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/ace/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | code: {
7 | type: 'string',
8 | title: 'Code'
9 | }
10 | },
11 | form: [
12 | {
13 | key: 'code',
14 | type: 'ace',
15 | aceMode: 'json',
16 | width: '100%',
17 | height: '100px'
18 | }
19 | ]
20 | }
21 | },
22 | {
23 | name: 'value',
24 | jsonform: {
25 | schema: {
26 | code: {
27 | type: 'string',
28 | title: 'Code'
29 | }
30 | },
31 | form: [
32 | {
33 | key: 'code',
34 | type: 'ace',
35 | aceMode: 'json',
36 | width: '100%',
37 | height: '100px'
38 | }
39 | ],
40 | value: {
41 | code: 'Toto '
42 | }
43 | }
44 | }
45 | ];
46 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/actions/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | form: [
6 | {
7 | type: 'actions'
8 | }
9 | ]
10 | }
11 | },
12 | {
13 | name: 'submit',
14 | jsonform: {
15 | form: [
16 | {
17 | type: 'actions',
18 | items: [
19 | {
20 | type: 'submit',
21 | title: 'Submit'
22 | }
23 | ]
24 | }
25 | ]
26 | }
27 | },
28 | {
29 | name: 'button',
30 | jsonform: {
31 | form: [
32 | {
33 | type: 'actions',
34 | items: [
35 | {
36 | type: 'button',
37 | title: 'Button'
38 | }
39 | ]
40 | }
41 | ]
42 | }
43 | },
44 | {
45 | name: 'buttons',
46 | jsonform: {
47 | form: [
48 | {
49 | type: 'actions',
50 | items: [
51 | {
52 | type: 'button',
53 | title: 'Button 1'
54 | },
55 | {
56 | type: 'button',
57 | title: 'Button 2'
58 | },
59 | {
60 | type: 'submit',
61 | title: 'Button 3'
62 | },
63 | {
64 | type: 'button',
65 | title: 'Button 4'
66 | }
67 | ]
68 | }
69 | ]
70 | }
71 | }
72 | ];
73 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/array/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | arr: {
7 | type: 'array',
8 | title: 'An array',
9 | items: {
10 | type: 'string',
11 | title: 'Array item'
12 | }
13 | }
14 | }
15 | }
16 | },
17 | {
18 | name: 'simple form',
19 | jsonform: {
20 | schema: {
21 | arr: {
22 | type: 'array',
23 | title: 'An array',
24 | items: {
25 | type: 'string',
26 | title: 'Array item'
27 | }
28 | }
29 | },
30 | form: [
31 | {
32 | type: 'array',
33 | items: [
34 | {
35 | type: 'fieldset',
36 | title: 'Great array item',
37 | items: [
38 | 'arr[]'
39 | ]
40 | }
41 | ]
42 | }
43 | ]
44 | }
45 | },
46 | {
47 | name: 'Using index',
48 | jsonform: {
49 | schema: {
50 | arr: {
51 | type: 'array',
52 | title: 'An array',
53 | items: {
54 | type: 'string',
55 | title: 'Array item'
56 | }
57 | }
58 | },
59 | form: [
60 | {
61 | type: 'array',
62 | items: [
63 | {
64 | type: 'fieldset',
65 | title: 'Number {{idx}}',
66 | items: [
67 | {
68 | key: 'arr[]',
69 | title: 'Item {{idx}}'
70 | }
71 | ]
72 | }
73 | ]
74 | }
75 | ]
76 | }
77 | },
78 | {
79 | name: 'Default value',
80 | jsonform: {
81 | schema: {
82 | arr: {
83 | type: 'array',
84 | title: 'An array',
85 | items: {
86 | type: 'string',
87 | title: 'Array item',
88 | 'default': 'Hey dude'
89 | }
90 | }
91 | },
92 | form: [
93 | {
94 | type: 'array',
95 | items: [
96 | {
97 | type: 'fieldset',
98 | title: 'Number {{idx}}',
99 | items: [
100 | {
101 | key: 'arr[]',
102 | title: 'Item {{idx}}'
103 | }
104 | ]
105 | }
106 | ]
107 | }
108 | ]
109 | }
110 | },
111 | {
112 | name: 'Default array',
113 | jsonform: {
114 | schema: {
115 | arr: {
116 | type: 'array',
117 | title: 'An array',
118 | items: {
119 | type: 'string',
120 | title: 'Array item'
121 | },
122 | 'default': [
123 | 'Hey',
124 | 'dude'
125 | ]
126 | }
127 | }
128 | }
129 | },
130 | {
131 | name: 'Value as legend',
132 | jsonform: {
133 | schema: {
134 | arr: {
135 | type: 'array',
136 | title: 'An array',
137 | items: {
138 | type: 'string',
139 | title: 'Array item',
140 | maxLength: 15
141 | }
142 | }
143 | },
144 | form: [
145 | {
146 | type: 'array',
147 | items: [
148 | {
149 | type: 'fieldset',
150 | title: 'Number {{idx}}',
151 | legend: '{{idx}}. {{value}}',
152 | items: [
153 | {
154 | key: 'arr[]',
155 | title: 'Item {{idx}}',
156 | value: 'Hello number {{idx}}',
157 | valueInLegend: true
158 | }
159 | ]
160 | }
161 | ]
162 | }
163 | ]
164 | }
165 | }
166 | ];
167 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/checkbox/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | check: {
7 | type: 'boolean',
8 | title: 'Title'
9 | }
10 | }
11 | }
12 | },
13 | {
14 | name: 'inline',
15 | jsonform: {
16 | schema: {
17 | check: {
18 | type: 'boolean',
19 | title: 'Title',
20 | 'default': true
21 | }
22 | },
23 | form: [
24 | {
25 | key: 'check',
26 | inlinetitle: 'Check da box'
27 | }
28 | ]
29 | }
30 | },
31 | {
32 | name: 'clearing bug',
33 | jsonform: {
34 | schema: {
35 | check: {
36 | type: 'boolean',
37 | title: 'Title'
38 | },
39 | checktoo: {
40 | type: 'boolean',
41 | title: 'Other title'
42 | }
43 | }
44 | }
45 | }
46 | ];
47 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/checkboxes/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | opt: {
7 | type: 'array',
8 | title: 'Options',
9 | uniqueItems: true,
10 | items: {
11 | type: 'string',
12 | title: 'Option',
13 | 'enum': [ 'one', 'two', 'three' ]
14 | }
15 | }
16 | },
17 | form: [
18 | {
19 | key: 'opt',
20 | type: 'checkboxes'
21 | }
22 | ]
23 | }
24 | },
25 | {
26 | name: 'default',
27 | jsonform: {
28 | schema: {
29 | opt: {
30 | type: 'array',
31 | title: 'Options',
32 | uniqueItems: true,
33 | items: {
34 | type: 'string',
35 | title: 'Option',
36 | 'enum': [ 'one', 'two', 'three' ]
37 | },
38 | 'default': [ 'one', 'three' ],
39 | minItems: 2
40 | }
41 | },
42 | form: [
43 | {
44 | key: 'opt',
45 | type: 'checkboxes'
46 | }
47 | ]
48 | }
49 | },
50 | {
51 | name: 'titleMap',
52 | jsonform: {
53 | "schema": {
54 | "menu": {
55 | "type": "array",
56 | "title": "Options",
57 | "items": {
58 | "type": "string",
59 | "title": "Option",
60 | "enum": [
61 | "starter",
62 | "maincourse",
63 | "cheese",
64 | "dessert"
65 | ]
66 | }
67 | }
68 | },
69 | "form": [
70 | {
71 | "key": "menu",
72 | "type": "checkboxes",
73 | "titleMap": {
74 | "starter": "I'd like a starter",
75 | "maincourse": "Thumbs up for a main course",
76 | "cheese": "Cheddar rules!",
77 | "dessert": "I'll take some dessert, of course"
78 | }
79 | }
80 | ]
81 | }
82 | }
83 | ];
84 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/color/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | mainappcolor: {
7 | type: 'string',
8 | title: 'One color',
9 | format: 'color',
10 | 'default': 'blue'
11 | }
12 | }
13 | }
14 | },
15 | {
16 | name: 'form',
17 | jsonform: {
18 | schema: {
19 | mainappcolor: {
20 | type: 'string',
21 | title: 'One color'
22 | }
23 | },
24 | form: [
25 | {
26 | key: 'mainappcolor',
27 | type: 'color'
28 | }
29 | ]
30 | }
31 | }
32 | ];
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/fieldset/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | text: {
7 | type: 'string',
8 | title: 'Text field'
9 | },
10 | nb: {
11 | type: 'number',
12 | title: 'Number'
13 | }
14 | },
15 | form: [
16 | {
17 | type: 'fieldset',
18 | title: 'Group of input fields',
19 | items: [
20 | 'text',
21 | 'nb'
22 | ]
23 | }
24 | ]
25 | }
26 | },
27 | {
28 | name: 'multiple',
29 | jsonform: {
30 | schema: {
31 | text: {
32 | type: 'string',
33 | title: 'Text field'
34 | },
35 | nb: {
36 | type: 'number',
37 | title: 'Number'
38 | }
39 | },
40 | form: [
41 | {
42 | type: 'fieldset',
43 | title: 'First group',
44 | items: 'text'
45 | },
46 | {
47 | type: 'fieldset',
48 | title: 'Second group',
49 | items: [
50 | 'nb'
51 | ]
52 | }
53 | ]
54 | }
55 | },
56 | {
57 | name: 'advanced',
58 | jsonform: {
59 | schema: {
60 | text: {
61 | type: 'string',
62 | title: 'Text field'
63 | },
64 | nb: {
65 | type: 'number',
66 | title: 'Number'
67 | }
68 | },
69 | form: [
70 | {
71 | type: 'advancedfieldset',
72 | items: [
73 | 'text',
74 | 'nb'
75 | ]
76 | }
77 | ]
78 | }
79 | },
80 | {
81 | name: 'auth',
82 | jsonform: {
83 | schema: {
84 | text: {
85 | type: 'string',
86 | title: 'Text field'
87 | },
88 | nb: {
89 | type: 'number',
90 | title: 'Number'
91 | }
92 | },
93 | form: [
94 | {
95 | type: 'authfieldset',
96 | items: [
97 | 'text',
98 | 'nb'
99 | ]
100 | }
101 | ]
102 | }
103 | },
104 | {
105 | name: 'expandable',
106 | jsonform: {
107 | "schema": {
108 | "comment": {
109 | "type": "string",
110 | "title": "Comment"
111 | },
112 | "name": {
113 | "type": "string",
114 | "title": "Name"
115 | },
116 | "age": {
117 | "type": "number",
118 | "title": "Age"
119 | }
120 | },
121 | "form": [
122 | {
123 | "key": "comment",
124 | "type": "textarea"
125 | },
126 | {
127 | "type": "fieldset",
128 | "title": "Author",
129 | "expandable": true,
130 | "items": [
131 | "name",
132 | "age"
133 | ]
134 | }
135 | ]
136 | }
137 | }
138 | ];
139 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/file/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | filemeup: {
7 | type: 'string',
8 | title: 'Title'
9 | }
10 | },
11 | form: [
12 | {
13 | key: 'filemeup',
14 | type: 'file'
15 | }
16 | ]
17 | }
18 | }
19 | ];
20 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/help/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'help',
4 | jsonform: {
5 | form: [
6 | {
7 | type: 'help',
8 | helpvalue: 'Yell help! for help'
9 | }
10 | ]
11 | }
12 | }
13 | ];
14 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/hidden/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'hidden',
4 | jsonform: {
5 | schema: {
6 | hidden: {
7 | type: 'string',
8 | 'default': 'def'
9 | }
10 | },
11 | form: [
12 | {
13 | key: 'hidden',
14 | type: 'hidden'
15 | }
16 | ]
17 | }
18 | }
19 | ];
20 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/i18n/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'english',
4 | jsonform: {
5 | schema: {
6 | textfield: {
7 | title: '{{hello}} {{user.name}}',
8 | type: 'string',
9 | 'default': '{{def}}',
10 | description: '{{desc}}'
11 | },
12 | tagline: {
13 | type: 'string',
14 | 'enum': [
15 | 'happy',
16 | 'lifesucks',
17 | 'cestlavie'
18 | ]
19 | },
20 | positive: {
21 | type: 'boolean'
22 | },
23 | arr: {
24 | type: 'array',
25 | items: {
26 | type: 'string',
27 | title: '{{arr.title}} {{idx}}',
28 | description: '{{arr.desc}}',
29 | 'default': '{{arr.default}}'
30 | }
31 | }
32 | },
33 | form: [
34 | {
35 | key: 'textfield',
36 | prepend: '{{prepend}}',
37 | append: '{{append}}'
38 | },
39 | {
40 | key: 'tagline',
41 | titleMap: {
42 | 'happy': '{{tagline.happy}}',
43 | 'lifesucks': '{{tagline.lifesucks}}',
44 | 'cestlavie': '{{tagline.cestlavie}}'
45 | }
46 | },
47 | {
48 | key: 'positive',
49 | inlinetitle: '{{positive.label}}'
50 | },
51 | 'arr'
52 | ],
53 | tpldata: {
54 | hello: 'Hello',
55 | user: {
56 | name: 'tidoust'
57 | },
58 | desc: 'Mood of the day',
59 | prepend: 'I\'m feeling',
60 | def: 'happy',
61 | append: 'today',
62 | positive: {
63 | label: 'Check the box for extra karma'
64 | },
65 | tagline: {
66 | happy: 'Don\'t worry, be happy!',
67 | lifesucks: 'Life sucks',
68 | cestlavie: 'C\'est la vie!'
69 | },
70 | arr: {
71 | title: 'Short memory item',
72 | desc: 'I think about...',
73 | 'default': 'kittens'
74 | }
75 | }
76 | }
77 | },
78 |
79 | {
80 | name: 'french',
81 | jsonform: {
82 | schema: {
83 | textfield: {
84 | title: '{{hello}} {{user.name}}',
85 | type: 'string',
86 | 'default': '{{def}}',
87 | description: '{{desc}}'
88 | },
89 | tagline: {
90 | type: 'string',
91 | 'enum': [
92 | 'happy',
93 | 'lifesucks',
94 | 'cestlavie'
95 | ]
96 | },
97 | positive: {
98 | type: 'boolean'
99 | },
100 | arr: {
101 | type: 'array',
102 | items: {
103 | type: 'string',
104 | title: '{{arr.title}} {{idx}}',
105 | description: '{{arr.desc}}',
106 | 'default': '{{arr.default}}'
107 | }
108 | }
109 | },
110 | form: [
111 | {
112 | key: 'textfield',
113 | prepend: '{{prepend}}',
114 | append: '{{append}}'
115 | },
116 | {
117 | key: 'tagline',
118 | titleMap: {
119 | 'happy': '{{tagline.happy}}',
120 | 'lifesucks': '{{tagline.lifesucks}}',
121 | 'cestlavie': '{{tagline.cestlavie}}'
122 | }
123 | },
124 | {
125 | key: 'positive',
126 | inlinetitle: '{{positive.label}}'
127 | },
128 | 'arr'
129 | ],
130 | tpldata: {
131 | hello: 'Salut',
132 | user: {
133 | name: 'tidoust'
134 | },
135 | desc: 'Humeur du moment',
136 | def: 'joyeux',
137 | prepend: 'Je suis',
138 | append: 'aujourd\'hui',
139 | positive: {
140 | label: 'Cocher la case pour des points de karma en plus!'
141 | },
142 | tagline: {
143 | happy: 'Y\'a d\'la joie!',
144 | lifesucks: 'Vie de merde!',
145 | cestlavie: '"C\'est la vie!" comme disent les anglo-saxons'
146 | },
147 | arr: {
148 | title: 'Dans ma mémoire à court terme',
149 | desc: 'Je fais rien qu\'à penser à...',
150 | 'default': 'des chats'
151 | }
152 | }
153 | }
154 | }
155 | ];
156 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/imageselect/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | choice: {
7 | type: 'string',
8 | title: 'Title',
9 | 'enum': [
10 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/add-to-desktop.png',
11 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/address-book-new-2.png',
12 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/application-exit-4.png',
13 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/appointment-new-3.png',
14 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/archive-insert-2.png'
15 | ]
16 | }
17 | },
18 | form: [
19 | {
20 | key: 'choice',
21 | type: 'imageselect'
22 | }
23 | ]
24 | }
25 | },
26 | {
27 | name: 'titleMap',
28 | jsonform: {
29 | schema: {
30 | choice: {
31 | type: 'string',
32 | title: 'Title',
33 | 'enum': [
34 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/add-to-desktop.png',
35 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/address-book-new-2.png',
36 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/application-exit-4.png',
37 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/appointment-new-3.png',
38 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/archive-insert-2.png'
39 | ]
40 | }
41 | },
42 | form: [
43 | {
44 | key: 'choice',
45 | type: 'imageselect',
46 | titleMap: {
47 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/add-to-desktop.png': 'Add to desktop',
48 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/address-book-new-2.png': 'Address book',
49 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/application-exit-4.png': 'Exit',
50 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/appointment-new-3.png': 'New appointment',
51 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/archive-insert-2.png': 'Insert archive'
52 | }
53 | }
54 | ]
55 | }
56 | },
57 | {
58 | name: 'prefix',
59 | jsonform: {
60 | schema: {
61 | choice: {
62 | type: 'string',
63 | title: 'Title',
64 | 'enum': [
65 | 'add-to-desktop.png',
66 | 'address-book-new-2.png',
67 | 'application-exit-4.png',
68 | 'appointment-new-3.png',
69 | 'archive-insert-2.png'
70 | ],
71 | 'default': 'application-exit-4.png'
72 | }
73 | },
74 | form: [
75 | {
76 | key: 'choice',
77 | type: 'imageselect',
78 | imagePrefix: 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/'
79 | }
80 | ]
81 | }
82 | },
83 | {
84 | name: 'options',
85 | jsonform: {
86 | schema: {
87 | choice: {
88 | type: 'string',
89 | title: 'Title',
90 | 'enum': [
91 | 'add-to-desktop.png',
92 | 'address-book-new-2.png',
93 | 'application-exit-4.png',
94 | 'appointment-new-3.png',
95 | 'archive-insert-2.png'
96 | ]
97 | }
98 | },
99 | form: [
100 | {
101 | key: 'choice',
102 | type: 'imageselect',
103 | imagePrefix: 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/',
104 | imageWidth: 64,
105 | imageHeight: 64,
106 | imageSelectorColumns: 3,
107 | imageSelectorTitle: 'Choose an icon!'
108 | }
109 | ]
110 | }
111 | },
112 | {
113 | name: 'inverse',
114 | jsonform: {
115 | schema: {
116 | choice: {
117 | type: 'string',
118 | title: 'Title',
119 | 'enum': [
120 | 'add-to-desktop.png',
121 | 'address-book-new-2.png',
122 | 'application-exit-4.png',
123 | 'appointment-new-3.png',
124 | 'archive-insert-2.png'
125 | ]
126 | }
127 | },
128 | form: [
129 | {
130 | key: 'choice',
131 | type: 'imageselect',
132 | imagePrefix: 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/',
133 | imageWidth: 64,
134 | imageHeight: 64,
135 | imageSelectorColumns: 3,
136 | imageSelectorTitle: 'Choose an icon!',
137 | imageButtonClass: 'btn-inverse'
138 | }
139 | ]
140 | }
141 | },
142 | {
143 | name: 'warning',
144 | jsonform: {
145 | schema: {
146 | choice: {
147 | type: 'string',
148 | title: 'Title',
149 | 'enum': [
150 | 'add-to-desktop.png',
151 | 'address-book-new-2.png',
152 | 'application-exit-4.png',
153 | 'appointment-new-3.png',
154 | 'archive-insert-2.png'
155 | ]
156 | }
157 | },
158 | form: [
159 | {
160 | key: 'choice',
161 | type: 'imageselect',
162 | imagePrefix: 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/',
163 | imageWidth: 64,
164 | imageHeight: 64,
165 | imageSelectorColumns: 3,
166 | imageSelectorTitle: 'Choose an icon!',
167 | imageButtonClass: 'btn-warning'
168 | }
169 | ]
170 | }
171 | },
172 | {
173 | name: 'sleek',
174 | jsonform: {
175 | schema: {
176 | choice: {
177 | type: 'string',
178 | title: 'Icon',
179 | "enum": [
180 | "app/images/tv-contact.png",
181 | "app/images/tv-events.png",
182 | "app/images/tv-map.png",
183 | "app/images/tv-news.png",
184 | "app/images/tv-photos.png",
185 | "app/images/tv-play.png",
186 | "app/images/tv-products.png",
187 | "app/images/tv-sounds.png",
188 | "app/images/tv-statuses.png",
189 | "app/images/tv-videos.png",
190 | "app/images/tv-zoom.png"
191 | ]
192 | }
193 | },
194 | form: [
195 | {
196 | key: 'choice',
197 | type: 'imageselect',
198 | imageButtonClass: 'btn-inverse',
199 | imagePrefix: 'http://exports.platform.joshfire.com.s3.amazonaws.com/template/official/4f/cc/4fccd335ef88120db50000dd/df5d0b32d95b/',
200 | imageWidth: 32,
201 | imageHeight: 64
202 | }
203 | ]
204 | }
205 | },
206 | {
207 | name: 'absolute',
208 | jsonform: {
209 | schema: {
210 | choice: {
211 | type: 'string',
212 | title: 'Icon',
213 | "enum": [
214 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/add-to-desktop.png',
215 | 'http://openiconlibrary.sourceforge.net/gallery2/open_icon_library-full/icons/png/128x128/actions/address-book-new-2.png',
216 | "app/images/tv-contact.png",
217 | "app/images/tv-events.png",
218 | "app/images/tv-map.png",
219 | "app/images/tv-news.png",
220 | "app/images/tv-photos.png",
221 | "app/images/tv-play.png",
222 | "app/images/tv-products.png",
223 | "app/images/tv-sounds.png",
224 | "app/images/tv-statuses.png",
225 | "app/images/tv-videos.png",
226 | "app/images/tv-zoom.png"
227 | ]
228 | }
229 | },
230 | form: [
231 | {
232 | key: 'choice',
233 | type: 'imageselect',
234 | imageButtonClass: 'btn-inverse',
235 | imagePrefix: 'http://exports.platform.joshfire.com.s3.amazonaws.com/template/official/4f/cc/4fccd335ef88120db50000dd/df5d0b32d95b/',
236 | imageWidth: 32,
237 | imageHeight: 64
238 | }
239 | ]
240 | }
241 | },
242 | {
243 | name: 'suffix',
244 | jsonform: {
245 | schema: {
246 | choice: {
247 | type: 'string',
248 | title: 'Icon',
249 | "enum": [
250 | "contact",
251 | "events",
252 | "map",
253 | "news",
254 | "photos",
255 | "play",
256 | "products",
257 | "sounds",
258 | "statuses",
259 | "videos",
260 | "zoom"
261 | ]
262 | }
263 | },
264 | form: [
265 | {
266 | key: 'choice',
267 | type: 'imageselect',
268 | imageButtonClass: 'btn-inverse',
269 | imagePrefix: 'http://exports.platform.joshfire.com.s3.amazonaws.com/template/official/4f/cc/4fccd335ef88120db50000dd/df5d0b32d95b/app/images/tv-',
270 | imageSuffix: '.png',
271 | imageWidth: 32,
272 | imageHeight: 64
273 | }
274 | ]
275 | }
276 | },
277 | ];
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/number/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'number',
4 | jsonform: {
5 | schema: {
6 | score: {
7 | type: 'number',
8 | title: 'score'
9 | }
10 | }
11 | }
12 | },
13 | {
14 | name: 'integer',
15 | jsonform: {
16 | schema: {
17 | age: {
18 | type: 'integer',
19 | title: 'Age'
20 | }
21 | }
22 | }
23 | }
24 | ];
25 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/array.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/checkboxes.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/complexlists.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/defaults.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/expandable.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/array.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "datasources": {
4 | "type": "object",
5 | "properties": {
6 | "ds1": {
7 | "type": "array",
8 | "title": "ds1",
9 | "items": {
10 | "type": "string"
11 | }
12 | },
13 | "ds2": {
14 | "type": "array",
15 | "title": "ds2",
16 | "items": {
17 | "type": "string"
18 | }
19 | },
20 | "ds3": {
21 | "type": "array",
22 | "title": "ds1",
23 | "items": {
24 | "type": "string"
25 | }
26 | }
27 | }
28 | }
29 | },
30 | "form": [
31 | {
32 | "type": "array",
33 | "items": [
34 | {
35 | "type": "fieldset",
36 | "legend": "Entry XXXidxXXX",
37 | "items": [
38 | {
39 | "key": "datasources.ds1[]",
40 | "title": "First ds XXXidxXXX"
41 | },
42 | "datasources.ds2[]",
43 | "datasources.ds3[]"
44 | ]
45 | }
46 | ]
47 | },
48 | {
49 | "type": "actions",
50 | "items": [
51 | {
52 | "type": "submit",
53 | "value": "Submit"
54 | }
55 | ]
56 | }
57 | ],
58 | "value": {
59 | "datasources": {
60 | "ds1": [
61 | "toto",
62 | "tutu"
63 | ],
64 | "ds2": [
65 | null,
66 | "truc"
67 | ],
68 | "ds3": [
69 | "blah"
70 | ]
71 | }
72 | },
73 | "onSubmit": function (errors,values) {
74 | console.log(errors,values);
75 | }
76 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/basic.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema":{
3 | "name":"Product",
4 | "properties":
5 | {
6 | "id":
7 | {
8 | "type":"number",
9 | "title":"Identifier",
10 | "description":"Enter a valid product identifier",
11 | "required":true
12 | },
13 | "name":
14 | {
15 | "title":"Name of the product",
16 | "type":"string",
17 | "maxLength":20,
18 | "required":true
19 | },
20 | "shortname":
21 | {
22 | "title":"short name",
23 | "type":"string",
24 | "required":true
25 | },
26 | "price":
27 | {
28 | "type":"number",
29 | "minimum":10,
30 | "required":true
31 | },
32 | "opts":
33 | {
34 | "type":"array",
35 | "title":"Options",
36 | "uniqueItems":true,
37 | "items":{
38 | "type":"string",
39 | "enum":["one","two","three"]
40 | },
41 | "default":["two","three"],
42 | "minItems":2
43 | },
44 | "gender":{
45 | "type":"string",
46 | "enum":["male", "female"]
47 | },
48 | "flag": {
49 | "type": "boolean"
50 | }
51 | }
52 | },
53 | "value":{
54 | "price": 42,
55 | "gender": "female"
56 | },
57 | "form":[
58 | {
59 | "type":"fieldset",
60 | "legend":"Test legend",
61 | "items":[
62 | "id",
63 | {
64 | "key":"name",
65 | "type":"textarea",
66 | "value":"ok",
67 | "onBlur":function() {
68 | alert();
69 | }
70 | }
71 |
72 | ]
73 | },
74 | {
75 | "key":"shortname",
76 | "allowEmpty":true
77 | },
78 | "gender",
79 | "price",
80 | "flag",
81 | {
82 | "key":"opts",
83 | "type":"checkboxes",
84 | "titleMap":{
85 | "one":"1. One",
86 | "two":"2. Two",
87 | "three":"3. Three"
88 | }
89 | },
90 | {
91 | "type":"actions",
92 | "items":[
93 | {
94 | "type":"submit",
95 | "value":"OK"
96 | }
97 | ]
98 | }
99 | ],
100 | "onSubmit": function(errors,values) {
101 | console.log(errors,values);
102 | }
103 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/checkboxes.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "check1": {
4 | "type": "boolean",
5 | "title": "Check 1",
6 | "default": false
7 | },
8 | "check2": {
9 | "type": "boolean",
10 | "title": "Check 2",
11 | "default": true
12 | },
13 | "check3": {
14 | "type": "boolean",
15 | "title": "Check 3",
16 | "default": true
17 | }
18 | },
19 | "form": [
20 | {
21 | "key": "check1",
22 | "inlinetitle": "Checkbox is not checked by default"
23 | },
24 | {
25 | "type": "selectfieldset",
26 | "items": [
27 | {
28 | "type": "optionfieldset",
29 | "legend": "One option",
30 | "items": [
31 | {
32 | "key": "check2",
33 | "inlinetitle": "Checkbox is checked by default but value is false"
34 | }
35 | ]
36 | },
37 | {
38 | "type": "optionfieldset",
39 | "legend": "Another option",
40 | "items": [
41 | {
42 | "key": "check3",
43 | "inlinetitle": "Checkbox is checked by default and value is undefined"
44 | }
45 | ]
46 | }
47 | ]
48 | },
49 | {
50 | "type": "actions",
51 | "items": [
52 | {
53 | "type": "submit",
54 | "value": "Submit"
55 | }
56 | ]
57 | }
58 | ],
59 | "value": {
60 | },
61 | "onSubmit": function (errors,values) {
62 | console.log(errors, JSON.stringify(values, null, 2));
63 | }
64 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/complexlists.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "simplearray": {
4 | "title": "A simple array",
5 | "type": "array",
6 | "items": {
7 | "title": "Array item",
8 | "type": "string"
9 | }
10 | },
11 | "arraykey": {
12 | "title": "An array referenced through a key",
13 | "type": "array",
14 | "items": {
15 | "title": "Element",
16 | "type": "string"
17 | }
18 | },
19 | "arrayarray": {
20 | "title": "An array whose item types are defined in an array",
21 | "type": "array",
22 | "items": [
23 | {
24 | "title": "Element",
25 | "type": "string"
26 | }
27 | ]
28 | },
29 | "arrayarraylayout": {
30 | "title": "An array whose item types are defined in an array whose layout is given",
31 | "type": "array",
32 | "items": [
33 | {
34 | "type": "object",
35 | "properties": {
36 | "key1": {
37 | "title": "Key 1",
38 | "type": "string"
39 | },
40 | "key2": {
41 | "title": "Key 2",
42 | "type": "string"
43 | }
44 | }
45 | }
46 | ]
47 | },
48 | "selectme": {
49 | "title": "A list of values",
50 | "type": "array",
51 | "items": {
52 | "title": "Possible values",
53 | "type": "string",
54 | "enum": [
55 | "blah",
56 | "foo",
57 | "bar",
58 | "baz"
59 | ]
60 | }
61 | },
62 | "quizzes": {
63 | "title": "Quizzes metadata",
64 | "type": "array",
65 | "items": {
66 | "type": "object",
67 | "title": "A Quiz",
68 | "properties": {
69 | "desc": {
70 | "title": "Description",
71 | "description": "Short description of the quiz",
72 | "type": "string"
73 | },
74 | "image": {
75 | "title": "Image",
76 | "description": "URL of the quiz image. Image should be a square, 200x200 at least",
77 | "type": "string"
78 | }
79 | }
80 | }
81 | },
82 | "pictures": {
83 | "title": "Pictures metadata",
84 | "type": "array",
85 | "items": {
86 | "type": "object",
87 | "properties": {
88 | "desc": {
89 | "title": "Description",
90 | "description": "Short description of the pictures",
91 | "type": "string"
92 | },
93 | "thumbnail": {
94 | "title": "Thumbnail",
95 | "description": "URL of the thumbnail of the picture",
96 | "type": "string",
97 | "required": true
98 | }
99 | }
100 | }
101 | },
102 | "happy": {
103 | "title": "Are you happy?",
104 | "type": "string",
105 | "enum": [
106 | "yes",
107 | "no"
108 | ]
109 | },
110 | "enums": {
111 | "title": "onChange in an array",
112 | "type": "array",
113 | "items": [
114 | {
115 | "type": "string",
116 | "enum": [
117 | "toto",
118 | "tutu"
119 | ]
120 | }
121 | ]
122 | }
123 | },
124 | "form": [
125 | "simplearray",
126 | {
127 | "type": "array",
128 | "key": "arraykey"
129 | },
130 | "arrayarray",
131 | {
132 | "type": "array",
133 | "items": {
134 | "type": "fieldset",
135 | "legend": "Keys",
136 | "items": [
137 | "arrayarraylayout[].key1",
138 | "arrayarraylayout[].key2"
139 | ]
140 | }
141 | },
142 | {
143 | "type": "checkboxes",
144 | "title": "Select me",
145 | "key": "selectme"
146 | },
147 | "quizzes",
148 | {
149 | "type": "array",
150 | "title": "Pictures",
151 | "items": [
152 | {
153 | "type": "fieldset",
154 | "legend": "Picture XXXidxXXX",
155 | "items": [
156 | "pictures[].desc",
157 | "pictures[].thumbnail"
158 | ]
159 | }
160 | ]
161 | },
162 | {
163 | "type": "actions",
164 | "items": [
165 | {
166 | "type": "submit",
167 | "value": "Submit"
168 | }
169 | ]
170 | },
171 | {
172 | "type": "array",
173 | "title": "onChange in an array",
174 | "items": [
175 | {
176 | "key": "enums[]",
177 | "title": "Enum number XXXidxXXX",
178 | "onChange": function () {
179 | alert('turlututu');
180 | }
181 | }
182 | ]
183 | }
184 | ],
185 | "value": {
186 | "enums": [
187 | "toto",
188 | "tutu"
189 | ]
190 | },
191 | "onSubmit": function (errors,values) {
192 | console.log(errors,values);
193 | }
194 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/defaults.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "user": {
4 | "title": "Username",
5 | "type": "string",
6 | "default": "toto"
7 | },
8 | "search": {
9 | "title": "Search text",
10 | "type": "string",
11 | "default": "Joshfire",
12 | "required": true
13 | },
14 | "array": {
15 | "type": "array",
16 | "required": true,
17 | "items": [
18 | {
19 | "type": "string"
20 | }
21 | ]
22 | },
23 | "object": {
24 | "type": "object",
25 | "required": true,
26 | "properties": {
27 | "child": {
28 | "type": "string"
29 | }
30 | }
31 | },
32 | "string": {
33 | "type": "string",
34 | "required": true
35 | },
36 | "boolean": {
37 | "type": "boolean",
38 | "required": true
39 | },
40 | "any": {
41 | "type": "any",
42 | "required": true
43 | },
44 | "notincluded": {
45 | "type": "string"
46 | }
47 | },
48 | "form": [
49 | "*",
50 | {
51 | "type": "actions",
52 | "items": [
53 | {
54 | "type": "submit",
55 | "value": "Submit"
56 | }
57 | ]
58 | }
59 | ],
60 | "onSubmit": function (errors,values) {
61 | console.log(errors, JSON.stringify(values, null, 2));
62 | window.JSONForm.setDefaultValues(values, this.schema);
63 | console.log(errors, JSON.stringify(values, null, 2));
64 | window.JSONForm.setDefaultValues(values, this.schema, true);
65 | console.log(errors, JSON.stringify(values, null, 2));
66 | }
67 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/expandable.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "happy": {
4 | "title": "Are you happy?",
5 | "type": "string",
6 | "enum": [
7 | "yes",
8 | "no"
9 | ]
10 | },
11 | "search": {
12 | "title": "Search text",
13 | "type": "string"
14 | },
15 | "clientkey": {
16 | "title": "Client key",
17 | "type": "string"
18 | },
19 | "clientside": {
20 | "title": "Run clientside",
21 | "type": "boolean"
22 | }
23 | },
24 | "form": [
25 | "happy",
26 | "search",
27 | {
28 | "type": "fieldset",
29 | "legend": "Advanced settings",
30 | "expandable": true,
31 | "items": [
32 | "clientkey",
33 | "clientside"
34 | ]
35 | },
36 | {
37 | "type": "advancedfieldset",
38 | "items": [
39 | {
40 | "template": "This text should belong to an \"Advanced options\" expandable section.
"
41 | }
42 | ]
43 | },
44 | {
45 | "type": "authfieldset",
46 | "items": [
47 | {
48 | "template": "This text should belong to an \"Authentication settings\" expandable section.
"
49 | }
50 | ]
51 | },
52 | {
53 | "type": "actions",
54 | "items": [
55 | {
56 | "type": "submit",
57 | "value": "Submit"
58 | }
59 | ]
60 | }
61 | ],
62 | "onSubmit": function (errors,values) {
63 | console.log(errors,values);
64 | }
65 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/prefix.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "prefix": "idefix",
3 | "schema": {
4 | "user": {
5 | "title": "Username",
6 | "type": "string",
7 | "default": "toto"
8 | },
9 | "search": {
10 | "title": "Search text",
11 | "type": "string",
12 | "default": "Joshfire",
13 | "required": true
14 | },
15 | "array": {
16 | "type": "array",
17 | "required": true,
18 | "items": [
19 | {
20 | "type": "string"
21 | }
22 | ]
23 | },
24 | "object": {
25 | "type": "object",
26 | "required": true,
27 | "properties": {
28 | "child": {
29 | "type": "string"
30 | }
31 | }
32 | },
33 | "string": {
34 | "type": "string",
35 | "required": true
36 | },
37 | "boolean": {
38 | "type": "boolean",
39 | "required": true
40 | },
41 | "any": {
42 | "type": "any",
43 | "required": true
44 | },
45 | "notincluded": {
46 | "type": "string"
47 | }
48 | },
49 | "form": [
50 | "*",
51 | {
52 | "type": "actions",
53 | "items": [
54 | {
55 | "type": "submit",
56 | "value": "Submit"
57 | }
58 | ]
59 | }
60 | ],
61 | "onSubmit": function (errors,values) {
62 | console.log(errors, JSON.stringify(values, null, 2));
63 | return false;
64 | }
65 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/tabarray.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "tabs": {
4 | "type": "array",
5 | "items": [{
6 | "type": "object",
7 | "properties": {
8 | "name": {
9 | "type": "string",
10 | "title": "Tab title"
11 | },
12 | "thumbnail": {
13 | "type": "array",
14 | "title": "Tab thumbnails",
15 | "items": {
16 | "type": "string"
17 | }
18 | }
19 | }
20 | }]
21 | }
22 | },
23 | "form": [
24 | {
25 | "type": "tabarray",
26 | "items": [
27 | {
28 | "type": "fieldset",
29 | "legend": "{{idx}}",
30 | "items": [
31 | "tabs[].name"
32 | ]
33 | }
34 | ]
35 | },
36 | {
37 | "type": "actions",
38 | "items": [
39 | {
40 | "type": "submit",
41 | "value": "Submit"
42 | }
43 | ]
44 | }
45 | ],
46 | "onSubmit": function (errors,values) {
47 | console.log(errors,values);
48 | }
49 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/tabs-array.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "datasources": {
4 | "type": "object",
5 | "properties": {
6 | "ds1": {
7 | "type": "array",
8 | "title": "ds1",
9 | "items": {
10 | "type": "string"
11 | }
12 | },
13 | "ds2": {
14 | "type": "array",
15 | "title": "ds2",
16 | "items": {
17 | "type": "string"
18 | }
19 | },
20 | "ds3": {
21 | "type": "array",
22 | "title": "ds1",
23 | "items": {
24 | "type": "string"
25 | }
26 | }
27 | }
28 | }
29 | },
30 | "form": [
31 | {
32 | "type": "tabarray",
33 | "items": [
34 | {
35 | "type": "tabfieldset",
36 | "legend": "Entry XXXidxXXX",
37 | "items": [
38 | {
39 | "key": "datasources.ds1[]",
40 | "title": "First ds XXXidxXXX"
41 | },
42 | "datasources.ds2[]",
43 | "datasources.ds3[]"
44 | ]
45 | }
46 | ]
47 | },
48 | {
49 | "type": "actions",
50 | "items": [
51 | {
52 | "type": "submit",
53 | "value": "Submit"
54 | }
55 | ]
56 | }
57 | ],
58 | "value": {
59 | "datasources": {
60 | "ds1": [
61 | "toto",
62 | "tutu"
63 | ],
64 | "ds2": [
65 | null,
66 | "truc"
67 | ],
68 | "ds3": [
69 | "blah"
70 | ]
71 | }
72 | },
73 | "onSubmit": function (errors,values) {
74 | console.log(errors,values);
75 | }
76 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/tabs-values.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "user": {
4 | "title": "Username",
5 | "type": "string"
6 | },
7 | "search": {
8 | "title": "Search text",
9 | "type": "string"
10 | }
11 | },
12 | "form": [
13 | {
14 | "type": "selectfieldset",
15 | "title": "Search by",
16 | "items": [
17 | {
18 | "type": "optionfieldset",
19 | "legend": "Username",
20 | "items": [
21 | "user"
22 | ]
23 | },
24 | {
25 | "type": "optionfieldset",
26 | "legend": "String",
27 | "items": [
28 | {
29 | "key": "search"
30 | }
31 | ]
32 | }
33 | ]
34 | }
35 | ],
36 | "value": {
37 | "search": "youpi"
38 | },
39 | "onSubmit": function (errors,values) {
40 | console.log(errors,values);
41 | }
42 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/tabs.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "happy": {
4 | "title": "Are you happy?",
5 | "type": "string",
6 | "enum": [
7 | "yes",
8 | "no"
9 | ]
10 | },
11 | "user": {
12 | "title": "Username",
13 | "type": "string"
14 | },
15 | "playlist": {
16 | "title": "Playlist URL",
17 | "type": "string"
18 | },
19 | "search": {
20 | "title": "Search text",
21 | "type": "string"
22 | },
23 | "feed": {
24 | "title": "Feed",
25 | "type": "string",
26 | "enum":[
27 | "",
28 | "top_rated",
29 | "most_viewed",
30 | "most_shared",
31 | "most_popular",
32 | "most_recent",
33 | "most_discussed",
34 | "most_responded",
35 | "recently_featured",
36 | "on_the_web"
37 | ]
38 | },
39 | "clientkey": {
40 | "title": "Client key",
41 | "type": "string",
42 | "required": true
43 | }
44 | },
45 | "form": [
46 | "happy",
47 | {
48 | "type": "selectfieldset",
49 | "title": "Search by",
50 | "items": [
51 | {
52 | "type": "optionfieldset",
53 | "legend": "Username",
54 | "items": [
55 | "user"
56 | ]
57 | },
58 | {
59 | "type": "optionfieldset",
60 | "legend": "Playlist",
61 | "items": [
62 | "playlist"
63 | ]
64 | },
65 | {
66 | "type": "optionfieldset",
67 | "legend": "String",
68 | "items": [
69 | "search"
70 | ]
71 | },
72 | {
73 | "type": "optionfieldset",
74 | "legend": "Feed name",
75 | "items": [
76 | "feed"
77 | ]
78 | }
79 | ]
80 | },
81 | "clientkey",
82 | {
83 | "type": "actions",
84 | "items": [
85 | {
86 | "type": "submit",
87 | "value": "Submit"
88 | }
89 | ]
90 | }
91 | ],
92 | "onSubmit": function (errors,values) {
93 | console.log(errors,values);
94 | }
95 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/forms/titleMap.js:
--------------------------------------------------------------------------------
1 | $("#testform").jsonForm({
2 | "schema": {
3 | "opts": {
4 | "type": "array",
5 | "title": "Options",
6 | "uniqueItems": true,
7 | "items": {
8 | "type": "string",
9 | "enum": [
10 | "one",
11 | "two",
12 | "three"
13 | ]
14 | },
15 | "default": [
16 | "two",
17 | "three"],
18 | "minItems": 2
19 | },
20 | "gender": {
21 | "type": "string",
22 | "title": "Gender",
23 | "enum": [
24 | "male",
25 | "female"
26 | ]
27 | }
28 | },
29 | "form": [
30 | {
31 | "key": "opts",
32 | "type": "checkboxes",
33 | "titleMap": {
34 | "one": "1. One",
35 | "two": "2. Two",
36 | "three": "3. Three"
37 | }
38 | },
39 | {
40 | "key": "gender",
41 | "titleMap": {
42 | "male": "Man",
43 | "female": "Woman"
44 | }
45 | },
46 | {
47 | "type":"actions",
48 | "items":[
49 | {
50 | "type":"submit",
51 | "value":"OK"
52 | }
53 | ]
54 | }
55 | ],
56 | "onSubmit": function(errors,values) {
57 | console.log(errors,values);
58 | }
59 | });
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/prefix.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/tabarray.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/tabs-array.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/tabs-values.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/tabs.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/other/titleMap.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/runner.js:
--------------------------------------------------------------------------------
1 | var $tests = $('.tests');
2 | var idx = 0; //or enter the index like before. ex.: 5
3 | var limit = (idx == 0 ? tests.length - 1 : idx);
4 |
5 | for (idx; idx <= limit; idx++) {
6 | if (!tests[idx].jsonform.form) {
7 | tests[idx].jsonform.form = ['*'];
8 | }
9 | tests[idx].jsonform.form.push({
10 | type: 'actions',
11 | items: [
12 | {
13 | type: 'submit',
14 | value: 'Submit'
15 | }
16 | ]
17 | });
18 | tests[idx].jsonform.onSubmit = function (errors, values) {
19 | console.log(errors, values);
20 | };
21 |
22 | $('Test " " ').appendTo($tests);
23 | $('').appendTo($tests);
24 | $tests.find(".test-name").last().html(tests[idx].name);
25 | $tests.find("#testform").last().jsonForm(tests[idx].jsonform);
26 | }
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/section/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | text: {
7 | type: 'string',
8 | title: 'Text field'
9 | },
10 | nb: {
11 | type: 'number',
12 | title: 'Number'
13 | }
14 | },
15 | form: [
16 | {
17 | type: 'section',
18 | title: 'Section that contains fields',
19 | items: [
20 | 'text',
21 | 'nb'
22 | ]
23 | }
24 | ]
25 | }
26 | },
27 | {
28 | name: 'tabarray',
29 | jsonform: {
30 | schema: {
31 | arr: {
32 | type: 'array',
33 | title: 'An array',
34 | items: {
35 | type: 'object',
36 | title: 'Array item',
37 | properties: {
38 | name: {
39 | type: 'string',
40 | title: 'Name'
41 | },
42 | age: {
43 | type: 'number',
44 | title: 'Age'
45 | }
46 | }
47 | }
48 | }
49 | },
50 | form: [
51 | {
52 | type: 'tabarray',
53 | items: [
54 | {
55 | type: 'section',
56 | title: 'Number {{idx}}',
57 | items: [
58 | {
59 | key: 'arr[].name',
60 | title: 'Name'
61 | },
62 | {
63 | key: 'arr[].age',
64 | title: 'Age'
65 | }
66 | ]
67 | }
68 | ]
69 | }
70 | ]
71 | }
72 | }
73 | ];
74 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/select/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | choice: {
7 | type: 'string',
8 | title: 'Title',
9 | 'enum': [
10 | 'choice-1',
11 | 'choice-2',
12 | 'choice-3'
13 | ]
14 | }
15 | }
16 | }
17 | },
18 | {
19 | name: 'titleMap',
20 | jsonform: {
21 | schema: {
22 | choice: {
23 | type: 'string',
24 | title: 'Title',
25 | 'enum': [
26 | 'choice-1',
27 | 'choice-2',
28 | 'choice-3'
29 | ]
30 | }
31 | },
32 | form: [
33 | {
34 | key: 'choice',
35 | titleMap: {
36 | 'choice-1': 'Choice 1',
37 | 'choice-2': 'Choice 2',
38 | 'choice-3': 'Choice 3'
39 | }
40 | }
41 | ]
42 | }
43 | },
44 | {
45 | name: 'value',
46 | jsonform: {
47 | schema: {
48 | choice: {
49 | type: 'string',
50 | title: 'Title',
51 | 'enum': [
52 | 'choice-1',
53 | 'choice-2',
54 | 'choice-3'
55 | ]
56 | }
57 | },
58 | value: {
59 | choice: 'choice-3'
60 | }
61 | }
62 | },
63 | {
64 | name: 'titleMap-value',
65 | jsonform: {
66 | schema: {
67 | choice: {
68 | type: 'string',
69 | title: 'Title',
70 | 'enum': [
71 | 'choice-1',
72 | 'choice-2',
73 | 'choice-3'
74 | ]
75 | }
76 | },
77 | form: [
78 | {
79 | key: 'choice',
80 | titleMap: {
81 | 'choice-1': 'Choice 1',
82 | 'choice-2': 'Choice 2',
83 | 'choice-3': 'Choice 3'
84 | }
85 | }
86 | ],
87 | value: {
88 | choice: 'choice-3'
89 | }
90 | }
91 | },
92 | {
93 | name: 'radios-value',
94 | jsonform: {
95 | schema: {
96 | choice: {
97 | type: 'string',
98 | title: 'Title',
99 | 'enum': [
100 | 'choice-1',
101 | 'choice-2',
102 | 'choice-3'
103 | ]
104 | }
105 | },
106 | value: {
107 | choice: 'choice-3'
108 | }
109 | }
110 | },
111 | {
112 | name: 'radios-titleMap-value',
113 | jsonform: {
114 | schema: {
115 | choice: {
116 | type: 'string',
117 | title: 'Title',
118 | 'enum': [
119 | 'choice-1',
120 | 'choice-2',
121 | 'choice-3'
122 | ]
123 | }
124 | },
125 | form: [
126 | {
127 | key: 'choice',
128 | type: 'radios',
129 | titleMap: {
130 | 'choice-1': 'Choice 1',
131 | 'choice-2': 'Choice 2',
132 | 'choice-3': 'Choice 3'
133 | }
134 | }
135 | ],
136 | value: {
137 | choice: 'choice-3'
138 | }
139 | }
140 | },
141 | {
142 | name: 'Integer titleMap',
143 | jsonform: {
144 | schema: {
145 | choice: {
146 | type: 'integer',
147 | title: 'Title',
148 | 'enum': [
149 | 1,
150 | 2,
151 | 3
152 | ],
153 | 'default': 3
154 | }
155 | },
156 | form: [
157 | {
158 | key: 'choice',
159 | titleMap: {
160 | 1: 'Choice 1',
161 | 2: 'Choice 2',
162 | 3: 'Choice 3'
163 | }
164 | }
165 | ]
166 | }
167 | }
168 | ];
169 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/selectfieldset/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | text: {
7 | type: 'string',
8 | title: 'Text field'
9 | },
10 | nb: {
11 | type: 'number',
12 | title: 'Number'
13 | }
14 | },
15 | form: [
16 | {
17 | type: 'selectfieldset',
18 | title: 'Make your choice',
19 | items: [
20 | 'text',
21 | 'nb',
22 | {
23 | type: 'help',
24 | helpvalue: 'Yo, selected choice 3!'
25 | }
26 | ]
27 | }
28 | ]
29 | }
30 | },
31 | {
32 | name: 'legend',
33 | jsonform: {
34 | schema: {
35 | text: {
36 | type: 'string',
37 | title: 'Text field'
38 | },
39 | nb: {
40 | type: 'number',
41 | title: 'Number'
42 | }
43 | },
44 | form: [
45 | {
46 | type: 'selectfieldset',
47 | title: 'Make your choice',
48 | items: [
49 | {
50 | key: 'text',
51 | legend: 'Choice 1'
52 | },
53 | {
54 | key: 'nb',
55 | legend: 'Choice 2'
56 | },
57 | {
58 | type: 'help',
59 | helpvalue: 'Yo, selected choice 3!',
60 | legend: 'Choice 3'
61 | }
62 | ]
63 | }
64 | ]
65 | }
66 | },
67 | {
68 | name: 'optionfieldset',
69 | jsonform: {
70 | schema: {
71 | text: {
72 | type: 'string',
73 | title: 'Text field'
74 | },
75 | nb: {
76 | type: 'number',
77 | title: 'Number'
78 | }
79 | },
80 | form: [
81 | {
82 | type: 'selectfieldset',
83 | title: 'Make your choice',
84 | items: [
85 | {
86 | type: 'optionfieldset',
87 | title: 'Choice 1',
88 | items: [
89 | 'text',
90 | {
91 | type: 'help',
92 | helpvalue: 'Yo, selected choice 1!'
93 | }
94 | ]
95 | },
96 | {
97 | type: 'optionfieldset',
98 | title: 'Choice 2',
99 | items: [
100 | 'nb',
101 | {
102 | type: 'help',
103 | helpvalue: 'Yo, selected choice 2!'
104 | }
105 | ]
106 | },
107 | {
108 | type: 'optionfieldset',
109 | title: 'Choice 3',
110 | items: [
111 | {
112 | type: 'help',
113 | helpvalue: 'Yo, selected choice 3!'
114 | }
115 | ]
116 | }
117 | ]
118 | }
119 | ]
120 | }
121 | }
122 | ];
123 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/tabarray/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | arr: {
7 | type: 'array',
8 | title: 'An array',
9 | items: {
10 | type: 'string',
11 | title: 'Array item'
12 | }
13 | }
14 | },
15 | form: [
16 | {
17 | type: 'tabarray',
18 | key: 'arr'
19 | }
20 | ]
21 | }
22 | },
23 | {
24 | name: 'Using index',
25 | jsonform: {
26 | schema: {
27 | arr: {
28 | type: 'array',
29 | title: 'An array',
30 | items: {
31 | type: 'string',
32 | title: 'Array item'
33 | }
34 | }
35 | },
36 | form: [
37 | {
38 | type: 'tabarray',
39 | items: [
40 | {
41 | type: 'fieldset',
42 | title: 'Number {{idx}}',
43 | items: [
44 | {
45 | key: 'arr[]',
46 | title: 'Item {{idx}}'
47 | }
48 | ]
49 | }
50 | ]
51 | }
52 | ]
53 | }
54 | },
55 | {
56 | name: 'Value as legend',
57 | jsonform: {
58 | schema: {
59 | arr: {
60 | type: 'array',
61 | title: 'An array',
62 | items: {
63 | type: 'string',
64 | title: 'Array item',
65 | 'default': 'Hey dude'
66 | }
67 | }
68 | },
69 | form: [
70 | {
71 | type: 'tabarray',
72 | items: [
73 | {
74 | type: 'fieldset',
75 | title: 'Number {{idx}}',
76 | legend: '{{idx}}. {{value}}',
77 | items: [
78 | {
79 | key: 'arr[]',
80 | title: 'Item {{idx}}',
81 | valueInLegend: true
82 | }
83 | ]
84 | }
85 | ]
86 | }
87 | ]
88 | }
89 | },
90 | {
91 | name: 'Value as legend',
92 | jsonform: {
93 | schema: {
94 | arr: {
95 | type: 'array',
96 | title: 'An array',
97 | items: {
98 | type: 'string',
99 | title: 'Array item',
100 | maxLength: 15
101 | }
102 | }
103 | },
104 | form: [
105 | {
106 | type: 'tabarray',
107 | items: [
108 | {
109 | type: 'fieldset',
110 | title: 'Number {{idx}}',
111 | legend: '{{idx}}. {{value}}',
112 | items: [
113 | {
114 | key: 'arr[]',
115 | title: 'Item {{idx}}',
116 | value: 'Hello number {{idx}}',
117 | valueInLegend: true
118 | }
119 | ]
120 | }
121 | ]
122 | }
123 | ]
124 | }
125 | },
126 | {
127 | name: 'Value with quote',
128 | jsonform: {
129 | schema: {
130 | arr: {
131 | type: 'array',
132 | title: 'An array',
133 | items: {
134 | type: 'string',
135 | title: 'Array item',
136 | maxLength: 15
137 | }
138 | }
139 | },
140 | form: [
141 | {
142 | type: 'tabarray',
143 | items: [
144 | {
145 | type: 'fieldset',
146 | title: 'Number {{idx}}',
147 | legend: '{{idx}}. {{value}}',
148 | items: [
149 | {
150 | key: 'arr[]',
151 | title: 'Item {{idx}}',
152 | value: 'Hello number {{idx}}',
153 | valueInLegend: true
154 | }
155 | ]
156 | }
157 | ]
158 | }
159 | ],
160 | value: {
161 | arr: [
162 | "'bout"
163 | ]
164 | }
165 | }
166 | },
167 | {
168 | name: 'Values with null item',
169 | jsonform: {
170 | schema: {
171 | arr: {
172 | type: 'array',
173 | title: 'An array',
174 | items: {
175 | type: 'object',
176 | properties: {
177 | icon: {
178 | type: 'string',
179 | title: 'Icon'
180 | }
181 | },
182 | title: 'Array item'
183 | }
184 | }
185 | },
186 | form: [
187 | {
188 | type: 'tabarray',
189 | items: [
190 | {
191 | type: 'fieldset',
192 | title: 'Number {{idx}}',
193 | legend: '{{idx}}. {{value}}',
194 | items: [
195 | {
196 | key: 'arr[].icon',
197 | title: 'Item {{idx}}',
198 | value: 'Hello number {{idx}}',
199 | valueInLegend: true
200 | }
201 | ]
202 | }
203 | ]
204 | }
205 | ],
206 | value: {
207 | arr: [
208 | { icon: 'blah' },
209 | { icon: 'foo' },
210 | null,
211 | { icon: 'bar' }
212 | ]
213 | }
214 | }
215 | }
216 | ];
217 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/template/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'template',
4 | jsonform: {
5 | schema: {
6 | textfield: {
7 | type: 'string'
8 | }
9 | },
10 | form: [
11 | {
12 | key: 'textfield',
13 | template: 'I can haz template miam-miam '
14 | }
15 | ]
16 | }
17 | }
18 | ];
19 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/text/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'schema-minimal',
4 | jsonform: {
5 | schema: {
6 | textfield: {
7 | type: 'string'
8 | }
9 | }
10 | }
11 | },
12 | {
13 | name: 'schema-title',
14 | jsonform: {
15 | schema: {
16 | textfield: {
17 | type: 'string',
18 | title: 'Title'
19 | }
20 | }
21 | }
22 | },
23 | {
24 | name: 'schema-desc',
25 | jsonform: {
26 | schema: {
27 | textfield: {
28 | type: 'string',
29 | title: 'Title',
30 | description: 'Desc'
31 | }
32 | }
33 | }
34 | },
35 | {
36 | name: 'schema-required',
37 | jsonform: {
38 | schema: {
39 | textfield: {
40 | title: 'Title',
41 | type: 'string',
42 | required: true
43 | }
44 | }
45 | }
46 | },
47 | {
48 | name: 'schema-default',
49 | jsonform: {
50 | schema: {
51 | textfield: {
52 | title: 'Title',
53 | type: 'string',
54 | 'default': 'def'
55 | }
56 | }
57 | }
58 | },
59 | {
60 | name: 'schema-value',
61 | jsonform: {
62 | schema: {
63 | textfield: {
64 | title: 'Title',
65 | type: 'string',
66 | 'default': 'def'
67 | }
68 | },
69 | value: {
70 | textfield: 'val'
71 | }
72 | }
73 | },
74 | {
75 | name: 'form-minimal',
76 | jsonform: {
77 | schema: {
78 | textfield: {
79 | title: 'Title',
80 | type: 'string',
81 | 'default': 'def'
82 | }
83 | },
84 | value: {
85 | textfield: 'val'
86 | },
87 | form: [
88 | 'textfield'
89 | ]
90 | }
91 | },
92 | {
93 | name: 'form-textarea',
94 | jsonform: {
95 | schema: {
96 | textfield: {
97 | title: 'Title',
98 | type: 'string',
99 | 'default': 'def'
100 | }
101 | },
102 | value: {
103 | textfield: 'val'
104 | },
105 | form: [
106 | {
107 | key: 'textfield',
108 | type: 'textarea',
109 | title: 'New title',
110 | description: 'New desc'
111 | }
112 | ]
113 | }
114 | },
115 | {
116 | name: 'form-password',
117 | jsonform: {
118 | schema: {
119 | textfield: {
120 | title: 'Title',
121 | type: 'string',
122 | 'default': 'def'
123 | }
124 | },
125 | value: {
126 | textfield: 'val'
127 | },
128 | form: [
129 | {
130 | key: 'textfield',
131 | type: 'password',
132 | title: 'New title',
133 | description: 'New desc'
134 | }
135 | ]
136 | }
137 | },
138 | {
139 | name: 'form-placeholder',
140 | jsonform: {
141 | schema: {
142 | textfield: {
143 | title: 'Title',
144 | type: 'string'
145 | }
146 | },
147 | form: [
148 | {
149 | key: 'textfield',
150 | placeholder: 'place holder'
151 | }
152 | ]
153 | }
154 | }
155 | ];
156 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/value/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | first: {
7 | type: 'string',
8 | title: 'First field',
9 | description: 'The initial value should be that of the second field',
10 | 'default': '{{values.second}}'
11 | },
12 | second: {
13 | type: 'string',
14 | title: 'Second field',
15 | 'default': 'Hello copycat'
16 | }
17 | }
18 | }
19 | },
20 | {
21 | name: 'using value',
22 | jsonform: {
23 | schema: {
24 | first: {
25 | type: 'string',
26 | title: 'First field',
27 | description: 'The initial value should be that of the second field',
28 | 'default': 'This first value should not appear'
29 | },
30 | second: {
31 | type: 'string',
32 | title: 'Second field',
33 | 'default': 'This second value should not appear'
34 | }
35 | },
36 | form: [
37 | {
38 | key: 'first',
39 | value: '{{values.second}}'
40 | },
41 | {
42 | key: 'second',
43 | value: 'Hello copycat'
44 | }
45 | ]
46 | }
47 | },
48 | {
49 | name: 'array',
50 | jsonform: {
51 | schema: {
52 | thoughts: {
53 | type: 'array',
54 | title: 'Thoughts',
55 | items: {
56 | type: 'object',
57 | title: 'A thought',
58 | properties: {
59 | label: {
60 | type: 'string',
61 | title: 'Label',
62 | 'default': 'Great thought {{idx}}'
63 | },
64 | desc: {
65 | type: 'string',
66 | title: 'Description'
67 | }
68 | }
69 | }
70 | }
71 | },
72 | form: [
73 | {
74 | type: 'array',
75 | items: [{
76 | type: 'section',
77 | items: [
78 | {
79 | key: 'thoughts[].label'
80 | },
81 | {
82 | key: 'thoughts[].desc',
83 | value: '{{values.thoughts[].label}}\'s description'
84 | }
85 | ]
86 | }]
87 | }
88 | ]
89 | }
90 | },
91 | {
92 | name: 'tabarray',
93 | jsonform: {
94 | schema: {
95 | thoughts: {
96 | type: 'array',
97 | title: 'Thoughts',
98 | items: {
99 | type: 'object',
100 | title: 'A thought',
101 | properties: {
102 | label: {
103 | type: 'string',
104 | title: 'Label',
105 | 'default': 'Great thought {{idx}}'
106 | },
107 | desc: {
108 | type: 'string',
109 | title: 'Description'
110 | }
111 | }
112 | }
113 | }
114 | },
115 | form: [
116 | {
117 | type: 'tabarray',
118 | items: [{
119 | type: 'section',
120 | legend: '{{idx}}. {{value}}',
121 | items: [
122 | {
123 | key: 'thoughts[].label'
124 | },
125 | {
126 | key: 'thoughts[].desc',
127 | value: '{{values.thoughts[].label}}\'s description',
128 | valueInLegend: true
129 | }
130 | ]
131 | }]
132 | }
133 | ]
134 | }
135 | },
136 | {
137 | name: 'enum',
138 | jsonform: {
139 | schema: {
140 | first: {
141 | type: 'string',
142 | title: 'First field',
143 | description: 'The initial value should be that of the second field',
144 | 'default': 'This first value should not appear'
145 | },
146 | second: {
147 | type: 'string',
148 | title: 'Second field',
149 | 'enum': [
150 | 'c1',
151 | 'c2',
152 | 'c3'
153 | ],
154 | 'default': 'c2'
155 | }
156 | },
157 | form: [
158 | {
159 | key: 'first',
160 | value: '{{values.second}}'
161 | },
162 | {
163 | key: 'second',
164 | titleMap: {
165 | 'c1': 'Choice 1',
166 | 'c2': 'Choice 2',
167 | 'c3': 'Choice 3'
168 | }
169 | }
170 | ]
171 | }
172 | },
173 | {
174 | name: 'previous values',
175 | jsonform: {
176 | schema: {
177 | first: {
178 | type: 'string',
179 | title: 'First field',
180 | description: 'The initial value should be that of the second field',
181 | 'default': 'This first value should not appear'
182 | },
183 | second: {
184 | type: 'string',
185 | title: 'Second field',
186 | 'enum': [
187 | 'c1',
188 | 'c2',
189 | 'c3'
190 | ],
191 | 'default': 'c2'
192 | }
193 | },
194 | form: [
195 | {
196 | key: 'first',
197 | value: '{{values.second}}'
198 | },
199 | {
200 | key: 'second',
201 | titleMap: {
202 | 'c1': 'Choice 1',
203 | 'c2': 'Choice 2',
204 | 'c3': 'Choice 3'
205 | }
206 | }
207 | ],
208 | value: {
209 | second: 'c3'
210 | }
211 | }
212 | },
213 | {
214 | name: 'tabarray with values',
215 | jsonform: {
216 | schema: {
217 | thoughts: {
218 | type: 'array',
219 | title: 'Thoughts',
220 | items: {
221 | type: 'object',
222 | title: 'A thought',
223 | properties: {
224 | label: {
225 | type: 'string',
226 | title: 'Label',
227 | 'default': 'Great thought {{idx}}'
228 | },
229 | desc: {
230 | type: 'string',
231 | title: 'Description'
232 | }
233 | }
234 | }
235 | }
236 | },
237 | form: [
238 | {
239 | type: 'tabarray',
240 | items: [{
241 | type: 'section',
242 | legend: '{{idx}}. {{value}}',
243 | items: [
244 | {
245 | key: 'thoughts[].label'
246 | },
247 | {
248 | key: 'thoughts[].desc',
249 | value: '{{values.thoughts[].label}}\'s description',
250 | valueInLegend: true
251 | }
252 | ]
253 | }]
254 | }
255 | ],
256 | value: {
257 | thoughts: [
258 | {
259 | label: 'blah',
260 | desc: 'foo'
261 | },
262 | {
263 | label: 'Ho',
264 | desc: 'thing'
265 | }
266 | ]
267 | }
268 | }
269 | }
270 | ];
271 |
--------------------------------------------------------------------------------
/vendor/assets/javascripts/tests/wysihtml5/t.js:
--------------------------------------------------------------------------------
1 | var tests = [
2 | {
3 | name: 'minimal',
4 | jsonform: {
5 | schema: {
6 | textfield: {
7 | type: 'string'
8 | }
9 | },
10 | form: [
11 | {
12 | key: 'textfield',
13 | type: 'wysihtml5'
14 | }
15 | ]
16 | }
17 | }
18 | ];
--------------------------------------------------------------------------------