Skip to content

Commit 1139c97

Browse files
committed
Merge pull request #1 from Anthropic/develop
Pulling in Develop
2 parents 8bc5f82 + b43cc34 commit 1139c97

14 files changed

+179
-157
lines changed

.jscsrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"preset": "google",
3+
"disallowSpacesInsideObjectBrackets": null,
4+
"requireSpacesInsideObjectBrackets": {
5+
"allExcept": [ "[", "]", "{", "}" ]
6+
},
7+
"disallowSpacesInsideArrayBrackets": null,
8+
"requireSpacesInsideArrayBrackets": {
9+
"allExcept": [ "[", "]", "{", "}" ]
10+
},
11+
"disallowKeywordsOnNewLine": [ ],
12+
"disallowMultipleVarDecl": null,
13+
"maximumLineLength": 120,
14+
"requireSemicolons": true
15+
}

examples/data/titlemaps.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@
6161
"key": "noenum",
6262
"type": "select",
6363
"titleMap": [
64-
{ "value":"a", "name": "A" },
65-
{ "value":"b", "name":"B" },
66-
{ "value":"c", "name":"C" }
64+
{ "value":"a1", "name": "A1", "group": "A" },
65+
{ "value":"a2", "name":"A2", "group": "A" },
66+
{ "value":"a3", "name":"A3", "group": "A" },
67+
{ "value":"b1", "name": "B1", "group": "B" },
68+
{ "value":"b2", "name":"B2", "group": "B" },
69+
{ "value":"b3", "name":"B3", "group": "B" }
6770
]
6871
},
6972
"array",

examples/material-example.html

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<title>Angular Material Schema Form example</title>
5+
<title>Material Design Schema Form example</title>
66
<link rel="stylesheet" href="../bower_components/angular-material/angular-material.css">
77
<style type="text/css">
88
.spinner {
@@ -38,14 +38,6 @@
3838
min-height: 1400px;
3939
}
4040

41-
body {
42-
padding: 15px;
43-
}
44-
45-
.editors {
46-
padding: 0 15px;
47-
}
48-
4941
.alert .form-group {
5042
margin-bottom: 0px;
5143
}
@@ -144,10 +136,12 @@
144136
</div><!-- /.container-fluid -->
145137
</nav>
146138

139+
147140
<div>
148141
<h1><a href="/"><span class="glyphicon glyphicon-home" aria-hidden="true"></a> Schema Form Example</h1>
149-
<div layout="row">
150-
<div flex="33">
142+
<h2>Material Design</h2>
143+
<div layout="row" layout-margin>
144+
<div layout="column" flex="45">
151145
<h3>The Generated Form</h3>
152146

153147
<form name="ngform" sf-model="modelData" sf-form="form" sf-schema="schema" ng-submit="submitForm(ngform,modelData)"></form>
@@ -166,13 +160,12 @@ <h3>The Generated Form</h3>
166160
<h3>Model</h3>
167161
<pre ng-cloak>{{pretty()}}</pre>
168162
</div>
169-
<div class="editors" flex="66">
163+
<div layout="column" flex>
170164
<h3>Select Example</h3>
171165
<div class="form-group">
172-
<select class="form-control" id="selectTest"
173-
ng-model="selectedTest"
174-
ng-options="obj.name for obj in tests">
175-
</select>
166+
<md-select id="selectTest" ng-model="selectedTest" placeholder="{{form.placeholder}}">
167+
<md-option ng-value="obj" ng-repeat="obj in tests">{{ obj.name }}</md-option>
168+
</md-select>
176169
<span class="btw">
177170
By the way, there is also an example of
178171
<a href="custom-validators.html">custom (async) validators</a> example.
@@ -250,7 +243,7 @@ <h3>Schema</h3>
250243
// To test the tinymce addon, uncomment the files above and inject 'tx-tinymce' below.
251244
/*global alert*/
252245
//var app = angular.module('test', ['schemaForm', 'ui.ace', 'ngClipboard', 'ui.bootstrap.tooltip']);
253-
var app = angular.module('test', ['schemaForm', 'ngMaterial', 'ui.ace']);
246+
var app = angular.module('test', ['schemaForm', 'ngMaterial', 'ui.ace'])
254247

255248
/*app.config(['ngClipProvider', function(ngClipProvider) {
256249
ngClipProvider.setPath('//cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.2.0/ZeroClipboard.swf');
@@ -267,11 +260,11 @@ <h3>Schema</h3>
267260
$scope.tests = [
268261
{ name: "Simple", data: 'data/simple.json' },
269262
{ name: "Basic JSON Schema Type", data: 'data/types.json' },
263+
{ name: "TitleMap Examples", data: 'data/titlemaps.json' },
270264
{ name: "Bootstrap Grid", data: 'data/grid.json' },
271265
{ name: "Complex Key Support", data: 'data/complex-keys.json' },
272266
{ name: "Array", data: 'data/array.json' },
273267
{ name: "Tab Array", data: 'data/tabarray.json' },
274-
{ name: "TitleMap Examples", data: 'data/titlemaps.json' },
275268
{ name: "Kitchen Sink", data: 'data/sink.json' },
276269
{ name: "Hack: Conditional required", data: 'data/conditional-required.json' },
277270
];

material-decorator.js

Lines changed: 42 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material-decorator.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/checkbox.html

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@
1717
<!--
1818
<div class="checkbox schema-form-checkbox {{form.htmlClass}}"
1919
ng-class="{'has-error': hasError(), 'has-success': hasSuccess()}">
20-
<label>
21-
<input type="checkbox"
22-
sf-changed="form"
23-
ng-disabled="form.readonly"
24-
ng-model="$$value$$"
25-
ng-model-options="form.ngModelOptions"
26-
schema-validate="form"
27-
class="{{form.fieldHtmlClass}}"
28-
name="{{form.key.slice(-1)[0]}}">
20+
<md-checkbox ng-model="$$value$$"
21+
ng-model-options="form.ngModelOptions"
22+
sf-changed="form"
23+
ng-disabled="form.readonly"
24+
schema-validate="form"
25+
class="{{form.fieldHtmlClass}}"
26+
name="{{form.key.slice(-1)[0]}}"
27+
aria-label="{{form.title || form.key.slice(-1)[0]}}">
2928
<span ng-bind-html="form.title"></span>
30-
</label>
31-
<div class="help-block" sf-message="form.description"></div>
29+
</md-checkbox>
30+
<div class="help-block md-caption" sf-message="form.description"></div>
3231
</div>
3332
-->

src/checkboxes.html

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
ng-class="{'has-error': hasError(), 'has-success': hasSuccess()}">
44
<label class="control-label" ng-show="showTitle()">{{form.title}}</label>
55
<div class="checkbox" ng-repeat="val in titleMapValues track by $index" >
6-
<label>
7-
<input type="checkbox"
8-
ng-disabled="form.readonly"
9-
sf-changed="form"
10-
class="{{form.fieldHtmlClass}}"
11-
ng-model="titleMapValues[$index]"
12-
schema-vaidate="form"
13-
name="{{form.key.slice(-1)[0]}}">
6+
<md-checkbox ng-model="titleMapValues[$index]"
7+
sf-changed="form"
8+
ng-disabled="form.readonly"
9+
schema-validate="form"
10+
name="{{form.key.slice(-1)[0]}}"
11+
aria-label="{{form.title || form.key.slice(-1)[0]}}">
1412
<span ng-bind-html="form.titleMap[$index].name"></span>
15-
</label>
16-
13+
</md-checkbox>
14+
</div>
15+
<div ng-messages="ngModel.$error">
16+
<!--
17+
This is a bit of a hack. sf-message does the work, but ng-messages and ng-message
18+
is needed for the styling
19+
-->
20+
<div sf-message ng-message></div>
1721
</div>
18-
<div class="help-block" sf-message="form.description"></div>
1922
</div>

src/fieldset-trcl.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<fieldset ng-disabled="form.readonly" class="schema-form-fieldset {{form.htmlClass}}">
1+
<fieldset ng-disabled="form.readonly" class="standard {{form.htmlClass}}" flex>
22
<legend ng-show="form.title">{{ form.title }}</legend>
3-
<div class="help-block" ng-show="form.description" ng-bind-html="form.description"></div>
43
<div ng-transclude></div>
54
</fieldset>

src/fieldset.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<fieldset ng-disabled="form.readonly" class="schema-form-fieldset {{form.htmlClass}}">
1+
<fieldset ng-disabled="form.readonly" class="standard {{form.htmlClass}}" flex>
22
<legend ng-show="form.title">{{ form.title }}</legend>
3-
<div class="help-block" ng-show="form.description" ng-bind-html="form.description"></div>
43
<sf-decorator ng-repeat="item in form.items" form="item"></sf-decorator>
54
</fieldset>

src/material-decorator.js

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,40 @@
1-
angular.module('schemaForm').config(['schemaFormDecoratorsProvider', function(decoratorsProvider) {
2-
var base = 'decorators/material/';
1+
angular.module('schemaForm')
2+
.config([ 'schemaFormDecoratorsProvider', function(decoratorsProvider) {
3+
var base = 'decorators/material/';
34

4-
decoratorsProvider.defineDecorator('materialDecorator', {
5-
textarea: {template: base + 'textarea.html'},
6-
checkbox: {template: base + 'checkbox.html'},
7-
'default': {template: base + 'default.html'},
8-
submit: {template: base + 'submit.html'}
9-
});
5+
decoratorsProvider.defineDecorator('materialDecorator', {
6+
textarea: { template: base + 'textarea.html' },
7+
fieldset: { template: base + 'fieldset.html' },
8+
'default': { template: base + 'default.html' },
9+
select: { template: base + 'select.html' },
10+
checkbox: { template: base + 'checkbox.html' },
11+
checkboxes: { template: base + 'checkboxes.html' },
12+
radios: { template: base + 'radios.html' },
13+
'radios-inline': { template: base + 'radios-inline.html' },
14+
radiobuttons: { template: base + 'radio-buttons.html' },
15+
submit: { template: base + 'submit.html' }
16+
});
1017

11-
/* decoratorsProvider.createDecorator('materialDecorator', {
12-
textarea: base + 'textarea.html',
13-
fieldset: base + 'fieldset.html',
14-
array: base + 'array.html',
15-
tabarray: base + 'tabarray.html',
16-
tabs: base + 'tabs.html',
17-
section: base + 'section.html',
18-
conditional: base + 'section.html',
19-
actions: base + 'actions.html',
20-
select: base + 'select.html',
21-
checkbox: base + 'checkbox.html',
22-
checkboxes: base + 'checkboxes.html',
23-
number: base + 'default.html',
24-
password: base + 'default.html',
25-
submit: base + 'submit.html',
26-
button: base + 'submit.html',
27-
radios: base + 'radios.html',
28-
'radios-inline': base + 'radios-inline.html',
29-
radiobuttons: base + 'radio-buttons.html',
30-
help: base + 'help.html',
31-
'default': base + 'default.html'
32-
});*/
33-
}]);
18+
/* decoratorsProvider.createDecorator('materialDecorator', {
19+
textarea: base + 'textarea.html',
20+
fieldset: base + 'fieldset.html',
21+
array: base + 'array.html',
22+
tabarray: base + 'tabarray.html',
23+
tabs: base + 'tabs.html',
24+
section: base + 'section.html',
25+
conditional: base + 'section.html',
26+
actions: base + 'actions.html',
27+
select: base + 'select.html',
28+
checkbox: base + 'checkbox.html',
29+
checkboxes: base + 'checkboxes.html',
30+
number: base + 'default.html',
31+
password: base + 'default.html',
32+
submit: base + 'submit.html',
33+
button: base + 'submit.html',
34+
radios: base + 'radios.html',
35+
'radios-inline': base + 'radios-inline.html',
36+
radiobuttons: base + 'radio-buttons.html',
37+
help: base + 'help.html',
38+
'default': base + 'default.html'
39+
});*/
40+
}]);

0 commit comments

Comments
 (0)