Commit 2e9d3502 authored by bahadircyildiz's avatar bahadircyildiz

ADD rref #5271. Form Service playground was implemented under uitemplates....

ADD rref #5271. Form Service playground was implemented under uitemplates. Test cases will be written afterwards.
parent 5fd7b4bc
......@@ -27,6 +27,10 @@ angular.module('ulakbus')
templateUrl: 'components/uitemplates/base.html',
controller: 'NewDesignsCtrl'
})
.when('/formservicepg', {
templateUrl: 'components/uitemplates/form_service_pg.html',
controller: 'FormServicePg'
})
// use crud without selected user
// important: regex urls must be defined later than static ones
......@@ -55,6 +59,7 @@ angular.module('ulakbus')
controller: 'CRUDListFormController'
})
.otherwise({redirectTo: '/dashboard'});
}])
.factory('IsOnline', function () {
......
<div>
<select ng-model="selection" ng-options="forms.indexOf(form) as form.name for form in forms" ng-change="selectform(selection)">
</select>
<form sf-schema="schema" sf-form="form" sf-model="model"></form>
</div>
\ No newline at end of file
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
angular.module('ulakbus.uitemplates', ['ngRoute', 'ui.bootstrap', 'schemaForm'])
.controller('formServicePg', function ($scope) {
$scope.forms = [
{
name: "Deneme Form",
form: ['email', 'id', 'name'],
schema: {
properties: {
email: {title: 'email', type: 'email'},
id: {title: 'id', type: 'int'},
name: {title: 'name', type: 'string'}
}, required: [], type: 'object', title: 'servicetest'
},
model: {
email: 'test@test.com', id: 2, name: 'travolta'
}
},
{
name: "Deneme Form 2",
form: ['email', 'id', 'name'],
schema: {
properties: {
email: {title: 'email', type: 'email'},
id: {title: 'id', type: 'int'},
name: {title: 'name', type: 'string'}
}, required: [], type: 'object', title: 'servicetest'
},
model: {
email: 'test@test.com', id: 2, name: 'travolta'
}
}
];
$scope.selection = $scope.forms[0];
});
\ No newline at end of file
......@@ -6,9 +6,55 @@
* (GPLv3). See LICENSE.txt for details.
*/
angular.module('ulakbus.uitemplates', ['ngRoute'])
angular.module('ulakbus.uitemplates', ['ngRoute', 'schemaForm', 'ulakbus.formService'])
.controller('NewDesignsCtrl', function ($scope) {
$scope.items = ['student', 'staff', 'academician'];
$scope.selection = $scope.items[0];
})
/*
This controller is for testing new SchemaForm components. In addition, forms need to have the attribute:
"name" for defining the name shown in dropdown box. Paste the JSON of form as a member of $scope.forms.
*/
.controller('FormServicePg', function ($scope, Generator) {
$scope.forms = [
{
name: 'Deneme Form 1',
form: ['email', 'id', 'name'],
schema: {
properties: {
email: {title: 'email', type: 'string'},
id: {title: 'id', type: 'number'},
name: {title: 'name', type: 'string'}
}, required: [], type: 'object', title: 'servicetest'
},
model: {
email: 'test@test.com', id: 2, name: 'travolta'
}
},
{
name: 'Deneme Form 2',
form: ['email', 'id', 'name'],
schema: {
properties: {
email: {title: 'email', type: 'string'},
id: {title: 'id', type: 'number'},
name: {title: 'name', type: 'string'}
}, required: [], type: 'object', title: 'servicetest'
},
model: {
email: 'test@test.com', id: 2, name: 'cageman'
}
}
];
$scope.form_params = {};
$scope.selection = 0;
$scope.selectform = function (index) {
var form = $scope.forms[index];
$scope = Generator.generate($scope, {forms: form});
};
$scope.selectform($scope.selection);
});
\ No newline at end of file
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