Added support for button labels and tool tips on related sets.

This commit is contained in:
chouseknecht
2013-06-05 10:26:53 -04:00
parent 540ad1ad47
commit a33d90de83
2 changed files with 23 additions and 12 deletions

View File

@@ -162,7 +162,9 @@ angular.module('UserFormDefinition', [])
actions: { actions: {
add: { add: {
ngClick: "add('credentials')", ngClick: "add('credentials')",
icon: 'icon-plus' icon: 'icon-plus',
label: 'Add',
awToolTip: 'Add a credential for this user'
}, },
}, },
@@ -181,13 +183,15 @@ angular.module('UserFormDefinition', [])
label: 'Edit', label: 'Edit',
ngClick: "edit('credentials', \{\{ credential.id \}\}, '\{\{ credential.name \}\}')", ngClick: "edit('credentials', \{\{ credential.id \}\}, '\{\{ credential.name \}\}')",
icon: 'icon-edit', icon: 'icon-edit',
class: 'btn-success' class: 'btn-success',
awToolTip: 'Edit the credential'
}, },
delete: { delete: {
label: 'Delete', label: 'Delete',
ngClick: "delete('credentials', \{\{ credential.id \}\}, '\{\{ credential.name \}\}', 'credentials')", ngClick: "delete('credentials', \{\{ credential.id \}\}, '\{\{ credential.name \}\}', 'credentials')",
icon: 'icon-remove', icon: 'icon-remove',
class: 'btn-danger' class: 'btn-danger',
awToolTip: 'Delete the credential'
} }
} }

View File

@@ -814,10 +814,15 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
// Add actions(s) // Add actions(s)
html += "<div class=\"list-actions\">\n"; html += "<div class=\"list-actions\">\n";
for (var action in form.related[itm].actions) { for (var act in form.related[itm].actions) {
var action = form.related[itm].actions[act];
html += "<button class=\"btn btn-small btn-success\" "; html += "<button class=\"btn btn-small btn-success\" ";
html += this.attr(form.related[itm]['actions'][action],'ngClick'); html += this.attr(action,'ngClick');
html += "><i class=\"" + form.related[itm]['actions'][action].icon + "\"></i></button>\n"; html += (action.awToolTip) ? this.attr(action,'awToolTip') : "";
html += (action.awToolTip) ? "data-placement=\"right\" " : "";
html += "><i class=\"" + action.icon + "\"></i>";
html += (action.label) ? " " + action.label : "";
html += "</button>\n";
} }
html += "</div>\n"; html += "</div>\n";
@@ -866,13 +871,15 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
// Row level actions // Row level actions
html += "<td class=\"actions\">"; html += "<td class=\"actions\">";
for (action in form.related[itm].fieldActions) { for (act in form.related[itm].fieldActions) {
var action = form.related[itm].fieldActions[act];
html += "<button class=\"btn btn-small"; html += "<button class=\"btn btn-small";
html += (form.related[itm]['fieldActions'][action].class) ? html += (action.class) ? " " + action.class : "";
" " + form.related[itm]['fieldActions'][action].class : ""; html += "\" " + this.attr(action,'ngClick');
html += "\" " + this.attr(form.related[itm]['fieldActions'][action],'ngClick') + html += (action.awToolTip) ? this.attr(action,'awToolTip') : "";
">" + this.icon(form.related[itm]['fieldActions'][action].icon); html += (action.awToolTip) ? "data-placement=\"top\" " : "";
html += (form.related[itm].fieldActions[action].label) ? " " + form.related[itm].fieldActions[action].label : ""; html += ">" + this.icon(action.icon);
html += (action.label) ? " " + action.label : "";
html += "</button> "; html += "</button> ";
} }
html += "</td>"; html += "</td>";