Skip to content

Commit 90e0343

Browse files
committed
Merge branch 'readonly' of https://github.com/mike-marcacci/angular-schema-form into mike-marcacci-readonly
2 parents 03ffee7 + be7d660 commit 90e0343

21 files changed

+63
-26
lines changed

bower.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,22 @@
2929
"coverage"
3030
],
3131
"dependencies": {
32-
"angular": ">= 1.2",
32+
"angular": ">= 1.3.0-rc.3",
3333
"tv4": "~1.0.15",
3434
"angular-sanitize": ">= 1.2",
3535
"objectpath": "~1.0.4"
3636
},
3737
"devDependencies": {
3838
"angular-ui-ace": "bower",
3939
"angular-schema-form-datepicker": ">= 0.1.0",
40+
"angular-schema-form-colorpicker": ">= 0.1.0",
4041
"jquery": "~2.1.1",
4142
"angular-mocks": ">= 1.2",
42-
"angular-schema-form-colorpicker": ">= 0.1.0",
43-
"tx-tinymce": ">= 0.0.5"
43+
"tx-tinymce": ">= 0.0.5",
44+
"angular-ui-sortable": "~0.12.11",
45+
"bootstrap-vertical-tabs": "~1.2.0"
46+
},
47+
"resolutions": {
48+
"angular": ">= 1.3.0-rc.3"
4449
}
4550
}

dist/bootstrap-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.

dist/schema-form.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,6 @@ angular.module('schemaForm').provider('schemaForm',
586586
};
587587

588588
var fieldset = function(name, schema, options) {
589-
590589
if (schema.type === 'object') {
591590
var f = stdFormObj(name, schema, options);
592591
f.type = 'fieldset';
@@ -640,7 +639,8 @@ angular.module('schemaForm').provider('schemaForm',
640639
path: arrPath,
641640
required: required || false,
642641
lookup: options.lookup,
643-
ignore: options.ignore
642+
ignore: options.ignore,
643+
global: options.global
644644
})];
645645

646646
return f;
@@ -769,13 +769,13 @@ angular.module('schemaForm').provider('schemaForm',
769769

770770
//if it's a type with items, merge 'em!
771771
if (obj.items) {
772-
obj.items = service.merge(schema, obj.items, ignore);
772+
obj.items = service.merge(schema, obj.items, ignore, options);
773773
}
774774

775775
//if its has tabs, merge them also!
776776
if (obj.tabs) {
777777
angular.forEach(obj.tabs, function(tab) {
778-
tab.items = service.merge(schema, tab.items, ignore);
778+
tab.items = service.merge(schema, tab.items, ignore, options);
779779
});
780780
}
781781

@@ -984,8 +984,16 @@ angular.module('schemaForm').directive('sfArray', ['sfSelect', 'schemaForm', 'sf
984984
// section. Unless there is just one.
985985
var subForm = form.items[0];
986986
if (form.items.length > 1) {
987-
subForm = {type: 'section', items: form.items};
987+
subForm = {
988+
type: 'section',
989+
items: form.items.map(function(item){
990+
item.ngModelOptions = form.ngModelOptions;
991+
item.readonly = form.readonly;
992+
return item;
993+
})
994+
};
988995
}
996+
989997
}
990998

991999
// We ceate copies of the form on demand, caching them for

dist/schema-form.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.

examples/bootstrap-example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ <h3>Schema</h3>
8282

8383
<script type="text/javascript" src="../dist/schema-form.js"></script>
8484
<script type="text/javascript" src="../dist/bootstrap-decorator.min.js"></script>
85-
<script type="text/javascript" src="../dist/bootstrap-datepicker.min.js"></script>
85+
<script type="text/javascript" src="../bower_components/angular-schema-form-datepicker/bootstrap-datepicker.min.js"></script>
8686
<script type="text/javascript" src="../bower_components/angular-schema-form-colorpicker/bootstrap-colorpicker.min.js"></script>
8787

8888
<!-- <script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>

src/directives/array.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,16 @@ angular.module('schemaForm').directive('sfArray', ['sfSelect', 'schemaForm', 'sf
4646
// section. Unless there is just one.
4747
var subForm = form.items[0];
4848
if (form.items.length > 1) {
49-
subForm = {type: 'section', items: form.items};
49+
subForm = {
50+
type: 'section',
51+
items: form.items.map(function(item){
52+
item.ngModelOptions = form.ngModelOptions;
53+
item.readonly = form.readonly;
54+
return item;
55+
})
56+
};
5057
}
58+
5159
}
5260

5361
// We ceate copies of the form on demand, caching them for

src/directives/decorators/bootstrap/actions.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
ng-if="item.type === 'submit'">
77
<button ng-repeat-end class="btn {{ item.style || 'btn-default' }}"
88
type="button"
9+
ng-disabled="form.readonly"
910
ng-if="item.type !== 'submit'"
1011
ng-click="buttonClick($event,item)">{{item.title}}</button>
1112
</div>

src/directives/decorators/bootstrap/array.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<h3 ng-show="form.title && form.notitle !== true">{{ form.title }}</h3>
33
<ol class="list-group" ng-model="modelArray" ui-sortable>
44
<li class="list-group-item" ng-repeat="item in modelArray track by $index">
5-
<button ng-click="deleteFromArray($index)"
5+
<button ng-hide="form.readonly"
6+
ng-click="deleteFromArray($index)"
67
style="position: relative; z-index: 20;"
78
type="button" class="close pull-right">
89
<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
@@ -11,7 +12,8 @@ <h3 ng-show="form.title && form.notitle !== true">{{ form.title }}</h3>
1112
</li>
1213
</ol>
1314
<div class="clearfix" style="padding: 15px;">
14-
<button ng-click="appendToArray()"
15+
<button ng-hide="form.readonly"
16+
ng-click="appendToArray()"
1517
type="button"
1618
class="btn {{ form.style.add || 'btn-default' }} pull-right">
1719
<i class="glyphicon glyphicon-plus"></i>

src/directives/decorators/bootstrap/bootstrap-decorator.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ angular.module('schemaForm').config(['schemaFormDecoratorsProvider', function(de
2323
help: base + 'help.html',
2424
'default': base + 'default.html'
2525
}, [
26-
function(form) {
27-
if (form.readonly && form.key && form.type !== 'fieldset') {
28-
return base + 'readonly.html';
29-
}
30-
}
26+
// function(form) {
27+
// if (form.readonly && form.key && form.type !== 'fieldset') {
28+
// return base + 'readonly.html';
29+
// }
30+
// }
3131
]);
3232

3333
//manual use directives

src/directives/decorators/bootstrap/checkbox.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<label>
33
<input type="checkbox"
44
sf-changed="form"
5+
ng-disabled="form.readonly"
56
ng-model="$$value$$"
67
ng-model-options="form.ngModelOptions"
78
schema-validate="form">

0 commit comments

Comments
 (0)