Commit 0e38699b authored by Evren Kutar's avatar Evren Kutar

fixes #38

parent 3b43dce2
<div class="form-group {{form.htmlClass}} schema-form-select"
ng-class="{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}">
<label class="control-label {{form.labelHtmlClass}}" ng-show="showTitle()">
{{form.title}}
</label>
<select ng-model="$$value$$"
ng-model-options="form.ngModelOptions"
ng-disabled="form.readonly"
sf-changed="form"
class="form-control {{form.fieldHtmlClass}}"
schema-validate="form"
ng-options="item.value as item.name for item in form.titleMap"
name="{{form.key.slice(-1)[0]}}"
id="{{form.key.slice(-1)[0]}}">
</select>
<div class="help-block" sf-message="form.description"></div>
</div>
\ No newline at end of file
...@@ -51,13 +51,16 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE ...@@ -51,13 +51,16 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE
/** /**
* prepareforms checks input types and convert if necessary * prepareforms checks input types and convert if necessary
*/ */
//delete scope.form[7];
//scope.schema.properties.ulke.type = 'select'; // todo: remove after backend fix
//scope.schema.properties.ulke.titleMap = scope.form[7].titleMap; angular.forEach(scope.form, function (value, key) {
//scope.schema.properties.ulke.replace = true; if (value.type === 'select') {
//scope.form[7] = {key: "ulke", title: "Ulke"}; scope.schema.properties[value.key].type = 'select';
//scope.schema.properties.ulke.enum = [1, 2, 3, 4]; scope.schema.properties[value.key].titleMap = value.titleMap;
//scope.form.push('ulke'); scope.form[key] = value.key;
}
});
angular.forEach(scope.schema.properties, function (v, k) { angular.forEach(scope.schema.properties, function (v, k) {
// generically change _id fields model value // generically change _id fields model value
...@@ -69,16 +72,16 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE ...@@ -69,16 +72,16 @@ form_generator.factory('Generator', function ($http, $q, $timeout, $location, RE
return; return;
} }
//if (v.type === 'select') { if (v.type === 'select') {
// scope.form[scope.form.indexOf(k)] = { scope.form[scope.form.indexOf(k)] = {
// type: "template", type: "template",
// title: v.title, title: v.title,
// templateUrl: "shared/templates/select.html", templateUrl: "shared/templates/select.html",
// name: "ulke", name: k,
// model_name: "ulke", key: k,
// titleMap: [{name: "belcika", value: 1}, {name: "almanya", value: 2}, {name: "fransa", value: 3}, {name: "fransa1", value: 4}, {name: "fransa2", value: 5}] titleMap: v.titleMap
// } };
//} }
if (v.type === 'submit' || v.type === 'button') { if (v.type === 'submit' || v.type === 'button') {
......
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