rails-backbone-forms 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Include this template file after backbone-forms.amd.js to override the default templates
3
+ *
4
+ * 'data-*' attributes control where elements are placed
5
+ */
6
+ ;(function(Form) {
7
+
8
+
9
+ /**
10
+ * Templates to match those used previous versions of Backbone Form, i.e. <= 0.11.0.
11
+ * NOTE: These templates are deprecated.
12
+ */
13
+ Form.template = _.template('\
14
+ <form class="bbf-form" data-fieldsets></form>\
15
+ ');
16
+
17
+
18
+ Form.Fieldset.template = _.template('\
19
+ <fieldset>\
20
+ <% if (legend) { %>\
21
+ <legend><%= legend %></legend>\
22
+ <% } %>\
23
+ <ul data-fields></ul>\
24
+ </fieldset>\
25
+ ');
26
+
27
+
28
+ Form.Field.template = _.template('\
29
+ <li class="bbf-field field-<%= key %>">\
30
+ <label for="<%= editorId %>"><%= title %></label>\
31
+ <div class="bbf-editor" data-editor></div>\
32
+ <div class="bbf-help"><%= help %></div>\
33
+ <div class="bbf-error" data-error></div>\
34
+ </li>\
35
+ ');
36
+
37
+
38
+ Form.NestedField.template = _.template('\
39
+ <li class="bbf-field bbf-nested-field field-<%= key %>">\
40
+ <label for="<%= editorId %>"><%= title %></label>\
41
+ <div class="bbf-editor" data-editor></div>\
42
+ <div class="bbf-help"><%= help %></div>\
43
+ <div class="bbf-error" data-error></div>\
44
+ </li>\
45
+ ');
46
+
47
+
48
+ Form.editors.Date.template = _.template('\
49
+ <div class="bbf-date">\
50
+ <select class="bbf-date" data-type="date"><%= dates %></select>\
51
+ <select class="bbf-month" data-type="month"><%= months %></select>\
52
+ <select class="bbf-year" data-type="year"><%= years %></select>\
53
+ </div>\
54
+ ');
55
+
56
+
57
+ Form.editors.DateTime.template = _.template('\
58
+ <div class="bbf-datetime">\
59
+ <div class="bbf-date-container" data-date></div>\
60
+ <select data-type="hour"><%= hours %></select>\
61
+ :\
62
+ <select data-type="min"><%= mins %></select>\
63
+ </div>\
64
+ ');
65
+
66
+
67
+ Form.editors.List.template = _.template('\
68
+ <div class="bbf-list">\
69
+ <ul data-items></ul>\
70
+ <div class="bbf-actions"><button type="button" data-action="add">Add</div>\
71
+ </div>\
72
+ ');
73
+
74
+
75
+ Form.editors.List.Item.template = _.template('\
76
+ <li>\
77
+ <button type="button" data-action="remove" class="bbf-remove">&times;</button>\
78
+ <div class="bbf-editor-container" data-editor></div>\
79
+ </li>\
80
+ ');
81
+
82
+
83
+ Form.editors.List.Object.template = Form.editors.List.NestedModel.template = _.template('\
84
+ <div class="bbf-list-modal"><%= summary %></div>\
85
+ ');
86
+
87
+
88
+ })(Backbone.Form);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-backbone-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.1
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aubrey Holland
@@ -33,11 +33,11 @@ files:
33
33
  - vendor/assets/javascripts/backbone-forms/editors/list.js
34
34
  - vendor/assets/javascripts/backbone-forms/editors/list.min.js
35
35
  - vendor/assets/javascripts/backbone-forms/templates/bootstrap.js
36
- - vendor/assets/javascripts/backbone-forms/templates/default.js
36
+ - vendor/assets/javascripts/backbone-forms/templates/old.js
37
37
  - vendor/assets/stylesheets/backbone-forms-bootstrap.css
38
38
  - vendor/assets/stylesheets/backbone-forms.css
39
39
  - vendor/assets/stylesheets/backbone-forms/templates/bootstrap.css
40
- - vendor/assets/stylesheets/backbone-forms/templates/default.css
40
+ - vendor/assets/stylesheets/backbone-forms/templates/old.css
41
41
  homepage: ''
42
42
  licenses: []
43
43
  metadata: {}
@@ -1,91 +0,0 @@
1
- /**
2
- * Include this file _after_ the main backbone-forms file to override the default templates.
3
- * You only need to include templates you want to override.
4
- *
5
- * Requirements when customising templates:
6
- * - Each template must have one 'parent' element tag.
7
- * - "data-type" attributes are required.
8
- * - The main placeholder tags such as the following are required: fieldsets, fields
9
- */
10
- ;(function() {
11
- var Form = Backbone.Form;
12
-
13
-
14
- //DEFAULT TEMPLATES
15
- Form.setTemplates({
16
-
17
- //HTML
18
- form: '\
19
- <form class="bbf-form">{{fieldsets}}</form>\
20
- ',
21
-
22
- fieldset: '\
23
- <fieldset>\
24
- <legend>{{legend}}</legend>\
25
- <ul>{{fields}}</ul>\
26
- </fieldset>\
27
- ',
28
-
29
- field: '\
30
- <li class="bbf-field field-{{key}}">\
31
- <label for="{{id}}">{{title}}</label>\
32
- <div class="bbf-editor">{{editor}}</div>\
33
- <div class="bbf-help">{{help}}</div>\
34
- <div class="bbf-error">{{error}}</div>\
35
- </li>\
36
- ',
37
-
38
- nestedField: '\
39
- <li class="bbf-field bbf-nested-field field-{{key}}" title="{{title}}">\
40
- <label for="{{id}}">{{title}}</label>\
41
- <div class="bbf-editor">{{editor}}</div>\
42
- <div class="bbf-help">{{help}}</div>\
43
- <div class="bbf-error">{{error}}</div>\
44
- </li>\
45
- ',
46
-
47
- list: '\
48
- <div class="bbf-list">\
49
- <ul>{{items}}</ul>\
50
- <div class="bbf-actions"><button type="button" data-action="add">Add</div>\
51
- </div>\
52
- ',
53
-
54
- listItem: '\
55
- <li>\
56
- <button type="button" data-action="remove" class="bbf-remove">&times;</button>\
57
- <div class="bbf-editor-container">{{editor}}</div>\
58
- </li>\
59
- ',
60
-
61
- date: '\
62
- <div class="bbf-date">\
63
- <select data-type="date" class="bbf-date">{{dates}}</select>\
64
- <select data-type="month" class="bbf-month">{{months}}</select>\
65
- <select data-type="year" class="bbf-year">{{years}}</select>\
66
- </div>\
67
- ',
68
-
69
- dateTime: '\
70
- <div class="bbf-datetime">\
71
- <div class="bbf-date-container">{{date}}</div>\
72
- <select data-type="hour">{{hours}}</select>\
73
- :\
74
- <select data-type="min">{{mins}}</select>\
75
- </div>\
76
- ',
77
-
78
- 'list.Modal': '\
79
- <div class="bbf-list-modal">\
80
- {{summary}}\
81
- </div>\
82
- '
83
- }, {
84
-
85
- //CLASSNAMES
86
- error: 'bbf-error'
87
-
88
- });
89
-
90
-
91
- })();