Collapse/expand job_events list using the api parent/child relationship

This commit is contained in:
chouseknecht
2013-06-18 17:20:25 -04:00
parent c9da8294df
commit 2abd33cf22
9 changed files with 215 additions and 35 deletions

View File

@@ -84,7 +84,7 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
var html = '';
html += "<td ";
html += "<td class=\"" + fld + "-column";
html += "<td class=\"" + fld + "-column";
html += (field['class']) ? " " + field['class'] : "";
html += "\" ";
html += (field.ngClass) ? this.attr(field, 'ngClass') : "";
@@ -92,6 +92,13 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
// Add ngShow
html += (field.ngShow) ? "<span " + Attr(field,'ngShow') + ">" : "";
// Add collapse/expand icon --used on job_events page
if (list['hasChildren'] && field.hasChildren) {
html += "<span style=\"padding-left: \{\{ " + list.iterator + ".spaces \}\}px\"><a href=\"\" ng-click=\"\{\{ " + list.iterator + ".ngclick \}\}\"> " +
"<i class=\"\{\{ " + list.iterator + ".ngicon \}\}\" ng-show=\"'\{\{ " +
list.iterator + ".related.children \}\}' !== ''\" ></i></a> ";
}
// Start the Link
if ((field.key || field.link || field.linkTo || field.ngClick ) && options['mode'] != 'lookup' && options['mode'] != 'select') {
@@ -111,7 +118,9 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
html += "<i ng-show=\"" + field.ngShowIcon + "\" class=\"" + field.icon + "\"></i> ";
}
else {
html += Icon(field.icon) + " ";
if (field.icon) {
html += Icon(field.icon) + " ";
}
}
// Add data binds
@@ -120,15 +129,19 @@ angular.module('GeneratorHelpers', ['GeneratorHelpers'])
html += "{{ " + field.ngBind + " }}";
}
else {
html += "{{" + list.iterator + "." + fld + "}}";
html += "{{" + list.iterator + "." + fld + "}}";
}
}
// Add additional text:
if (field.text) {
html += field.text;
}
if (list['hasChildren'] && field.hasChildren) {
html += "</span>";
}
// close the link
if ((field.key || field.link || field.linkTo || field.ngClick )
&& options.mode != 'lookup' && options.mode != 'select') {

View File

@@ -153,20 +153,25 @@ angular.module('ListGenerator', ['GeneratorHelpers'])
html += "<th>#</th>\n";
}
for (var fld in list.fields) {
html += "<th class=\"list-header\" id=\"" + fld + "-header\" ng-click=\"sort('" + fld + "')\">" + list.fields[fld].label;
html += " <i class=\"";
if (list.fields[fld].key) {
if (list.fields[fld].desc) {
html += "icon-sort-down";
html += "<th class=\"list-header\" id=\"" + fld + "-header\" ";
html += (list.fields[fld].nosort === undefined || list.fields[fld].nosort !== true) ? "ng-click=\"sort('" + fld + "')\"" : "";
html += ">" + list.fields[fld].label;
if (list.fields[fld].nosort === undefined || list.fields[fld].nosort !== true) {
html += " <i class=\"";
if (list.fields[fld].key) {
if (list.fields[fld].desc) {
html += "icon-sort-down";
}
else {
html += "icon-sort-up";
}
}
else {
html += "icon-sort-up";
else {
html += "icon-sort";
}
html += "\"></i></a>";
}
else {
html += "icon-sort";
}
html += "\"></i></a></th>\n";
html += "</th>\n";
}
if (options.mode == 'select') {
html += "<th>Select</th>";