Moved inventory detail load procedure from inventory controller to the helper so that it can be called when the detail page first loads and anytime we need to refresh tree data. Working on a way to refresh tree data, re-open previously open nodes and re-select previously active node after add/edit/delete of a group. Any change to tree data should be instantly reflect in the tree in an ajax/async fashion.

This commit is contained in:
chouseknecht
2013-06-03 07:08:08 -04:00
parent 9ca489d5ab
commit b19e1dd97a
10 changed files with 593 additions and 139 deletions

View File

@@ -76,9 +76,12 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
element = angular.element(document.getElementById('form-modal-body'));
}
else {
var element = angular.element(document.getElementById('htmlTemplate'));
element = angular.element(document.getElementById('htmlTemplate'));
}
this.mode = options.mode;
this.modal = (options.modal) ? true : false;
this.setForm(form);
element.html(this.build(options)); // Inject the html
this.scope = element.scope(); // Set scope specific to the element we're compiling, avoids circular reference
@@ -94,12 +97,9 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
}
if (options.modal) {
(options.mode == 'add') ? scope.formHeader = form.addTitle : form.editTitle;
this.scope.formHeader = (options.mode == 'add') ? form.addTitle : form.editTitle;
$('#form-modal').modal();
}
this.mode = options.mode;
this.modal = (options.modal) ? true : false;
return this.scope;
},
@@ -641,8 +641,12 @@ angular.module('FormGenerator', ['GeneratorHelpers'])
if (form.related[itm].type == 'tree') {
html += "<div class=\"span5\">";
html += "<div class=\"inventory-buttons pull-right\">";
html += "<button ng-hide=\"groupAddHide\" id=\"inv-group-add\" class=\"btn btn-mini btn-success\"><i class=\"icon-plus\"></i> Add Group</button>";
html += "<button ng-hide=\"groupEditHide\" id=\"inv-group-edit\" class=\"btn btn-mini btn-success\"><i class=\"icon-edit\"></i> Edit Group</button>";
html += "<button ng-click=\"addGroup()\" ng-hide=\"groupAddHide\" id=\"inv-group-add\" " +
"class=\"btn btn-mini btn-success\"><i class=\"icon-plus\"></i> Add Group</button>";
html += "<button ng-hide=\"groupEditHide\" id=\"inv-group-edit\" class=\"btn btn-mini btn-success\">" +
"<i class=\"icon-edit\"></i> Edit Group</button>";
html += "<button ng-hide=\"groupDeleteHide\" id=\"inv-group-delete\" class=\"btn btn-mini btn-danger\">" +
"<i class=\"icon-remove\"></i> Delete Group</button>";
html += "</div>\n";
html += "<div id=\"tree-view\"></div>\n";
html += "</div>\n";

View File

@@ -67,7 +67,10 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
// For options.mode == 'lookup', include the following:
//
// hdr: <lookup dialog header>
//
//
// Inject into a custom element using options.id: <'.selector'>
// Control breadcrumb creation with options.breadCrumbs: <true | false>
//
if (options.mode == 'lookup') {
var element = angular.element(document.getElementById('lookup-modal-body'));
}
@@ -130,7 +133,7 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
html += "</div>\n";
}
if (options.mode != 'lookup') {
if (options.mode != 'lookup' && (list.well == undefined || list.well == 'true')) {
html += "<div class=\"well\">\n";
}
@@ -161,7 +164,7 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
}
}
}
if (options.mode == 'select') {
if (options.mode == 'select' && (options.selectButton == undefined || options.selectButton == true)) {
html += " <button class=\"btn btn-small btn-success\" aw-tool-tip=\"Complete your selection\" " +
"ng-click=\"finishSelection()\"><i class=\"icon-ok\"></i> Finished</button>\n";
}
@@ -272,7 +275,7 @@ angular.module('ListGenerator', ['GeneratorHelpers',])
html += "</tbody>\n";
html += "</table>\n";
if (options.mode != 'lookup') {
if (options.mode != 'lookup' && (list.well == undefined || list.well == 'true')) {
html += "</div>\n"; //well
}