Commit fa7bf3af authored by Evren Kutar's avatar Evren Kutar

listnode fix

parent 9c28d279
...@@ -46,6 +46,7 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService']) ...@@ -46,6 +46,7 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
wf: routeParams.wf, wf: routeParams.wf,
object_id: routeParams.key object_id: routeParams.key
}; };
scope.form_params[scope.param] = scope.param_id;
scope.model = scope.form_params.model; scope.model = scope.form_params.model;
scope.wf = scope.form_params.wf; scope.wf = scope.form_params.wf;
scope.param = scope.form_params.param; scope.param = scope.form_params.param;
......
<!--<div class="tablescroll">--> <div class="tablescroll">
{{node.model}}
<!--<table class="table table-bordered" style="background-color:#fff;">--> <!--<table class="table table-bordered" style="background-color:#fff;">-->
<!--<thead>--> <!--<thead>-->
<!--<tr ng-if="node.schema.formType=='Node'">--> <!--<tr ng-if="node.schema.formType=='Node'">-->
...@@ -54,4 +55,4 @@ ...@@ -54,4 +55,4 @@
<!--</tbody>--> <!--</tbody>-->
<!--</table>--> <!--</table>-->
<!--</div>--> </div>
\ No newline at end of file \ No newline at end of file
...@@ -250,12 +250,18 @@ angular.module('formService', ['ui.bootstrap']) ...@@ -250,12 +250,18 @@ angular.module('formService', ['ui.bootstrap'])
formitem.selected_item = {value: item.key, name: item.value}; formitem.selected_item = {value: item.key, name: item.value};
} }
}); });
try {
// after rendering change input value to model value // after rendering change input value to model value
scope.$watch(document.querySelector('input[name=' + v.model_name + ']'), scope.$watch(document.querySelector('input[name=' + v.model_name + ']'),
function () { function () {
angular.element(document.querySelector('input[name=' + v.model_name + ']')).val(formitem.selected_item.name); angular.element(document.querySelector('input[name=' + v.model_name + ']')).val(formitem.selected_item.name);
} }
); );
}
catch (e) {
$log.debug('exception', e);
}
}) })
}; };
...@@ -369,7 +375,8 @@ angular.module('formService', ['ui.bootstrap']) ...@@ -369,7 +375,8 @@ angular.module('formService', ['ui.bootstrap'])
scope[v.type] = scope[v.type] || {}; scope[v.type] = scope[v.type] || {};
scope[v.type][k] = { // no pass by reference
scope[v.type][k] = angular.copy({
title: v.title, title: v.title,
form: [], form: [],
schema: { schema: {
...@@ -381,13 +388,16 @@ angular.module('formService', ['ui.bootstrap']) ...@@ -381,13 +388,16 @@ angular.module('formService', ['ui.bootstrap'])
model_name: k model_name: k
}, },
url: scope.url url: scope.url
}; });
if (scope.model[k] === null) { //if (scope.model[k] === null) {
scope[v.type][k].model = v.type === 'Node' ? {} : []; // scope[v.type][k].model = v.type === 'Node' ? {} : [];
} else { //} else {
scope[v.type][k].model = scope.model[k]; // scope[v.type][k].model = scope.model[k];
} //}
scope[v.type][k].model = angular.copy(scope.model[k]) || {};
if (v.type === 'ListNode') {scope[v.type][k].items = [];}
angular.forEach(v.schema, function (item) { angular.forEach(v.schema, function (item) {
scope[v.type][k].schema.properties[item.name] = item; scope[v.type][k].schema.properties[item.name] = item;
...@@ -761,6 +771,7 @@ angular.module('formService', ['ui.bootstrap']) ...@@ -761,6 +771,7 @@ angular.module('formService', ['ui.bootstrap'])
}; };
Generator.generate(newscope, {forms:scope.node}); Generator.generate(newscope, {forms:scope.node});
scope.model = {};
return scope.node; return scope.node;
} }
} }
...@@ -768,17 +779,17 @@ angular.module('formService', ['ui.bootstrap']) ...@@ -768,17 +779,17 @@ angular.module('formService', ['ui.bootstrap'])
modalInstance.result.then(function (childmodel, key) { modalInstance.result.then(function (childmodel, key) {
if (childmodel.schema.formType === 'Node') { //if (childmodel.schema.formType === 'Node') {
scope.$parent[childmodel.schema.formType][childmodel.schema.model_name].model = childmodel.model; // scope.$parent.model[childmodel.schema.model_name] = childmodel.model;
} //}
//
if (childmodel.schema.formType === 'ListNode') { //if (childmodel.schema.formType === 'ListNode') {
if (childmodel.edit) { // if (childmodel.edit) {
scope.$parent[childmodel.schema.formType][childmodel.schema.model_name].model[childmodel.edit] = childmodel.model; // scope.$parent[childmodel.schema.formType][childmodel.schema.model_name].model[childmodel.edit] = childmodel.model;
} else { // } else {
scope.$parent[childmodel.schema.formType][childmodel.schema.model_name].model.push(childmodel.model); // scope.$parent[childmodel.schema.formType][childmodel.schema.model_name].model.push(childmodel.model);
} // }
} //}
scope.$parent[childmodel.schema.formType][childmodel.schema.model_name].lengthModels += 1; scope.$parent[childmodel.schema.formType][childmodel.schema.model_name].lengthModels += 1;
}); });
......
This diff is collapsed.
This diff is collapsed.
...@@ -134,7 +134,7 @@ angular.module("components/crud/templates/form.html", []).run(["$templateCache", ...@@ -134,7 +134,7 @@ angular.module("components/crud/templates/form.html", []).run(["$templateCache",
angular.module("components/crud/templates/list.html", []).run(["$templateCache", function($templateCache) { angular.module("components/crud/templates/list.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/crud/templates/list.html", $templateCache.put("components/crud/templates/list.html",
"<div class=\"starter-template container\">\n" + "<div class=\"starter-template container\">\n" +
" <sort-directive></sort-directive>\n" + " <sort-directive ng-if=\"meta['allow_sort']===true\"></sort-directive>\n" +
" <search-directive ng-if=\"meta['allow_search']===true\"></search-directive>\n" + " <search-directive ng-if=\"meta['allow_search']===true\"></search-directive>\n" +
" <div class=\"clearfix\"></div>\n" + " <div class=\"clearfix\"></div>\n" +
" <!--<h1>{{form_params.model || form_params.wf}}</h1>-->\n" + " <!--<h1>{{form_params.model || form_params.wf}}</h1>-->\n" +
...@@ -1481,7 +1481,7 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu ...@@ -1481,7 +1481,7 @@ angular.module("shared/templates/foreignKey.html", []).run(["$templateCache", fu
" </span>\n" + " </span>\n" +
" <input type=\"text\"\n" + " <input type=\"text\"\n" +
" ng-model=\"$$value$$\"\n" + " ng-model=\"$$value$$\"\n" +
" typeahead=\"item.name for item in form.titleMap\"\n" + " uib-typeahead=\"item as item.name for item in form.titleMap | filter:{name:$viewValue}\"\n" +
" typeahead-on-select=\"form.onSelect($item)\"\n" + " typeahead-on-select=\"form.onSelect($item)\"\n" +
" placeholder=\"{{form.title}}\"\n" + " placeholder=\"{{form.title}}\"\n" +
" ng-model-options=\"form.ngModelOptions\"\n" + " ng-model-options=\"form.ngModelOptions\"\n" +
...@@ -1549,23 +1549,67 @@ angular.module("shared/templates/modalContent.html", []).run(["$templateCache", ...@@ -1549,23 +1549,67 @@ angular.module("shared/templates/modalContent.html", []).run(["$templateCache",
angular.module("shared/templates/multiselect.html", []).run(["$templateCache", function($templateCache) { angular.module("shared/templates/multiselect.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("shared/templates/multiselect.html", $templateCache.put("shared/templates/multiselect.html",
"<div class=\"form-group {{form.htmlClass}} schema-form-select\"\n" + "<div class=\"form-group {{form.htmlClass}} schema-form-select col-md-12\"\n" +
" ng-class=\"{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}\">\n" + " ng-class=\"{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}\">\n" +
" <div class=\"col-md-8\">\n" +
" <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">\n" + " <label class=\"control-label {{form.labelHtmlClass}}\" ng-show=\"showTitle()\">\n" +
" {{form.title}}\n" + " {{form.title}}\n" +
" </label>\n" + " </label>\n" +
" <select ng-model=\"$$value$$\"\n" + "\n" +
" <div class=\"row\">\n" +
" <div class=\"form-group input-group\">\n" +
" <input type=\"text\"\n" +
" placeholder=\"{{form.title}} filtrele\"\n" +
" class=\"form-control {{form.fieldHtmlClass}}\"\n" +
" name=\"filter-interface\"\n" +
" ng-model=\"form.filterValue\"\n" +
" ng-keyup=\"form.appendFiltered(form.filterValue)\"\n" +
" />\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"row\">\n" +
" <div class=\"col-md-5\">\n" +
" <label for=\"filterItems\">{{form.title}} Liste</label>\n" +
" <select ng-model=\"selectedItemsModel\"\n" +
" value=\"$$value$$\"\n" +
" ng-model-options=\"form.ngModelOptions\"\n" + " ng-model-options=\"form.ngModelOptions\"\n" +
" ng-disabled=\"form.readonly\"\n" + " ng-disabled=\"form.readonly\"\n" +
" sf-changed=\"form\"\n" + " sf-changed=\"form\"\n" +
" class=\"form-control {{form.fieldHtmlClass}}\"\n" + " class=\"form-control {{form.fieldHtmlClass}}\"\n" +
" schema-validate=\"form\"\n" + " schema-validate=\"form\"\n" +
" ng-options=\"item.value as item.name for item in form.titleMap\"\n" + " ng-options=\"item as item.name for item in form.filteredItems\"\n" +
" name=\"{{form.key.slice(-1)[0]}}\"\n" + " name=\"filterItems\" multiple>\n" +
" id=\"{{form.key.slice(-1)[0]}}\" multiple>\n" +
" </select>\n" + " </select>\n" +
" </div>\n" +
"\n" +
"\n" +
" <div class=\"col-md-1\">\n" +
" <a href=\"javascript:void(0)\" ng-click=\"form.select(selectedItemsModel)\"><i class=\"fa fa-arrow-right fa-fw\"></i></a><br>\n" +
" <a href=\"javascript:void(0)\" ng-click=\"form.deselect(selectedFilteredItemsModel)\"><i class=\"fa fa-arrow-left fa-fw\"></i></a>\n" +
" </div>\n" +
"\n" +
" <div class=\"col-md-5\">\n" +
" <label for=\"selectedItems\">Seçilenler</label>\n" +
" <select ng-model=\"selectedFilteredItemsModel\"\n" +
" value=\"$$value$$\"\n" +
" ng-model-options=\"form.ngModelOptions\"\n" +
" ng-disabled=\"form.readonly\"\n" +
" sf-changed=\"form\"\n" +
" class=\"form-control {{form.fieldHtmlClass}}\"\n" +
" schema-validate=\"form\"\n" +
" ng-options=\"item as item.name for item in form.selectedFilteredItems\"\n" +
" name=\"selectedItems\" multiple>\n" +
" </select>\n" +
" </div>\n" +
" </div>\n" +
"\n" + "\n" +
" <div class=\"help-block\" sf-message=\"form.description\"></div>\n" + " <div class=\"help-block\" sf-message=\"form.description\"></div>\n" +
" </div>\n" +
" <div class=\"col-md-4\">\n" +
" <a href=\"javascript:void(0);\" add-modal-for-linked-model>\n" +
" <i class=\"fa fa-plus-circle fa-fw\"></i>\n" +
" </a>\n" +
" </div>\n" +
"</div>"); "</div>");
}]); }]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment