Skip to content

Commit 9bb4239

Browse files
committed
Docs and a fix for icons on buttons
1 parent 26cd899 commit 9bb4239

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

docs/index.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ element to the select.
890890
891891
### actions
892892
893-
*actions* behaves the same as fieldset, but can only handle buttons as chidren.
893+
*actions* behaves the same as fieldset, but can only handle buttons and submits as children.
894894
```javascript
895895
{
896896
type: "actions",
@@ -913,15 +913,15 @@ We can change this with ```style``` attribute:
913913
}
914914
```
915915
916-
### button
916+
### button and submit
917917
918-
*button* can have a ```onClick``` attribute that either, as in JSON Form, is a function *or* a
918+
*button* and *submit* can have a ```onClick``` attribute that either a function *or* a
919919
string with an angular expression, as with ng-click. The expression is evaluated in the parent scope of
920920
the ```sf-schema``` directive.
921921
922922
```javascript
923923
[
924-
{ type: 'button', title: 'Ok', onClick: function(){ ... } }
924+
{ type: 'submit', title: 'Ok', onClick: function(){ ... } }
925925
{ type: 'button', title: 'Cancel', onClick: "cancel()" }
926926
[
927927
```
@@ -930,11 +930,24 @@ The submit and other buttons have btn-default as default.
930930
We can change this with ```style``` attribute:
931931
```javascript
932932
[
933-
{ type: 'button', style: 'btn-warning', title: 'Ok', onClick: function(){ ... } }
933+
{ type: 'submit', style: 'btn-warning', title: 'Ok', onClick: function(){ ... } }
934934
{ type: 'button', style: 'btn-danger', title: 'Cancel', onClick: "cancel()" }
935935
[
936936
```
937937
938+
A *button* can also have optional icon classes:
939+
```javascript
940+
[
941+
{
942+
type: 'button',
943+
title: 'Cancel',
944+
icon: 'glyphicon glyphicon-icon-exclamation-sign'
945+
onClick: "cancel()"
946+
}
947+
[
948+
```
949+
950+
938951
### radios and radiobuttons
939952
Both type *radios* and *radiobuttons* work the same way.
940953
They take a `titleMap` and renders ordinary radio buttons or bootstrap 3 buttons

src/directives/decorators/bootstrap/submit.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
type="button"
99
ng-click="buttonClick($event,form)"
1010
ng-disabled="form.readonly"
11-
ng-if="form.type !== 'submit'">{{form.title}}</button>
11+
ng-if="form.type !== 'submit'">
12+
<span ng-if="form.icon" class="{{form.icon}}"></span>
13+
{{form.title}}
14+
</button>
1215
</div>

0 commit comments

Comments
 (0)