Commit b5a1fd90 authored by Evren Kutar's avatar Evren Kutar

resolves #44 resolves #44

Merge branch 'Feature/issue19'
parents d1c4af40 7694ca14
......@@ -352,4 +352,11 @@ module.exports = function (grunt) {
'uglify:branch'
]);
});
grunt.registerTask('dgeni', 'Generate docs via dgeni.', function() {
var Dgeni = require('dgeni');
var done = this.async();
var dgeni = new Dgeni([require('./docs/docs_conf')]);
dgeni.generate().then(done);
});
};
\ 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
......@@ -14,7 +15,6 @@ var app = angular.module(
'ngRoute',
'ngSanitize',
'ngCookies',
'general',
'formService',
'ulakbus.dashboard',
'ulakbus.auth',
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......@@ -7,7 +8,7 @@
'use strict';
var auth = angular.module('ulakbus.auth', ['ngRoute', 'schemaForm', 'ngCookies', 'general']);
var auth = angular.module('ulakbus.auth', ['ngRoute', 'schemaForm', 'ngCookies']);
auth.controller('LoginCtrl', function ($scope, $q, $timeout, $routeParams, Generator, LoginService) {
$scope.url = 'login';
$scope.form_params = {};
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......@@ -31,10 +32,9 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, Sessi
$log.info("logout");
return $http.post(RESTURL.url + 'logout', {}).success(function (data) {
$rootScope.loggedInUser = false;
$log.info("loggedout");
$location.path("/login");
});
$log.info("loggedout");
};
loginService.isAuthenticated = function () {
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......@@ -7,13 +8,26 @@
'use strict';
var crud = angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService']);
angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
/**
*
/**
* @name CrudUtility
* @description
* Crud Utility is a service to provide functionality for Crud controllers
* @returns {object}
*/
crud.service('CrudUtility', function () {
.service('CrudUtility', function ($log) {
return {
/**
* @name generateParam
* @description
* generateParam is a function to generate required params to post backend api.
*
* @param scope
* @param routeParams
* @param cmd
* @returns {*}
*/
generateParam: function (scope, routeParams, cmd) {
// define api request url path
scope.url = routeParams.wf;
......@@ -38,28 +52,67 @@ crud.service('CrudUtility', function () {
scope.param_id = scope.form_params.id;
return scope;
},
/**
* @name listPageItems
* @description
* listPageItems is a function to prepare objects to list in list page.
*
* @param scope
* @param pageData
*/
listPageItems: function (scope, pageData) {
angular.forEach(pageData, function (value, key) {
scope[key] = value;
});
angular.forEach(scope.objects, function (value, key) {
if (value!=='-1') {
var linkIndexes = [];
angular.forEach(value.actions, function (v, k) {
if (v.show_as === 'link') {linkIndexes= v.fields}
});
angular.forEach(value.fields, function (v, k) {
scope.objects[key].fields[k] = {type: linkIndexes.indexOf(k) > -1 ? 'link' : 'str', content: v};
});
}
});
$log.debug(scope.objects);
}
}
});
/**
})
/**
* @name CRUDCtrl
* @description
* CRUDCtrl controller is base controller for crud module to redirect to related controller
* This controller play an empty role for api calls.
* With response data, location path change to related controller
*
* @returns {object}
*/
crud.controller('CRUDCtrl', function ($scope, $routeParams, Generator, CrudUtility) {
.controller('CRUDCtrl', function ($scope, $routeParams, Generator, CrudUtility) {
// get required params by calling CrudUtility.generateParam function
CrudUtility.generateParam($scope, $routeParams);
Generator.get_wf($scope);
});
/**
})
/**
* @name CRUDListFormCtrl
* @description
* CRUDListFormCtrl is the main controller for crud module
* Based on the client_cmd parameter it generates its scope items.
* client_cmd can be in ['show', 'list', 'form', 'reload', 'refresh']
* There are 3 directives to manipulate controllers scope objects in crud.html
*
* The controller works in 2 ways, with and without pageData.
* If pageData has set, using Generator's getPageData() function, sets its scope items. After getting pageData
* pageData must be set to `{pageData: false}` for clear scope of next job.
*
* If pageData has not set using Generator's get_wf() function gets scope items from api call.
*
* @returns {object}
*/
crud.controller('CRUDListFormCtrl', function ($scope, $rootScope, $location, $http, $log, $modal, $timeout, Generator, $routeParams, CrudUtility) {
if ($routeParams.cmd==='show') {
.controller('CRUDListFormCtrl', function ($scope, $rootScope, $location, $http, $log, $modal, $timeout, Generator, $routeParams, CrudUtility) {
if ($routeParams.cmd === 'show') {
CrudUtility.generateParam($scope, $routeParams, $routeParams.cmd);
// todo: refactor createListObjects func
var createListObjects = function () {
......@@ -88,7 +141,7 @@ crud.controller('CRUDListFormCtrl', function ($scope, $rootScope, $location, $ht
createListObjects();
}
if ($routeParams.cmd==='form' || $routeParams.cmd==='list') {
if ($routeParams.cmd === 'form' || $routeParams.cmd === 'list') {
// function to set scope objects
var setpageobjects = function (data) {
CrudUtility.listPageItems($scope, data);
......@@ -114,7 +167,7 @@ crud.controller('CRUDListFormCtrl', function ($scope, $rootScope, $location, $ht
// we use form generator for generic forms. this makes form's scope to confuse on the path to generate form
// object by its name. to manage to locate the form to controllers scope we use a directive called form locator
// a bit dirty way to find form working on but solves our problem
$scope.$on('formLocator', function(event) {
$scope.$on('formLocator', function (event) {
$scope.formgenerated = event.targetScope.formgenerated;
});
......@@ -128,38 +181,61 @@ crud.controller('CRUDListFormCtrl', function ($scope, $rootScope, $location, $ht
$scope.do_action = function (key, action) {
Generator.doItemAction($scope, key, action);
};
//$scope.searchForm = ['searchbox', {type: "submit", title: "Ara"}];
//$scope.searchSchema = {
// type: "object",
// properties: {searchbox: {type: "string", minLength: 2, title: "Ara", "x-schema-form": {placeholder: "Arama kriteri giriniz..."}}},
// required: ['searchbox']
//};
//$scope.searchModel = {searchbox: ''};
//$scope.searchSubmit = function (form) {
// if(form.$valid) {
// Generator.submit({url: 'search', model: $scope.searchModel, form_params: {}});
// }
//}
}
});
if ($routeParams.cmd === 'reload') {
$scope.cmd = 'reload';
Generator.get_wf($scope);
}
crud.directive('crudListDirective', function () {
if ($routeParams.cmd === 'reset') {
delete $scope.token;
$scope.cmd = 'reset';
Generator.get_wf($scope);
}
})
.directive('crudListDirective', function () {
return {
templateUrl: 'components/crud/templates/list.html',
restrict: 'E',
replace: true
};
});
})
crud.directive('crudFormDirective', function () {
.directive('crudFormDirective', function () {
return {
templateUrl: 'components/crud/templates/form.html',
restrict: 'E',
replace: true
};
});
})
crud.directive('crudShowDirective', function () {
.directive('crudShowDirective', function () {
return {
templateUrl: 'components/crud/templates/show.html',
restrict: 'E',
replace: true
};
});
})
crud.directive('formLocator', function() {
.directive('formLocator', function () {
return {
link: function(scope) {
link: function (scope) {
scope.$emit('formLocator');
}
}
});
\ No newline at end of file
});
\ 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
......
<crud-show-directive ng-if="object"></crud-show-directive>
<crud-form-directive ng-if="forms"></crud-form-directive>
<hr>
<hr class="col-md-12">
<crud-list-directive ng-if="objects"></crud-list-directive>
\ No newline at end of file
......@@ -34,8 +34,4 @@
</div>
<div class="buttons-on-bottom"></div>
<!--<button id="submitbutton" type="button" class="btn btn-primary" ng-click="onSubmit(formgenerated)">Kaydet</button>-->
<!-- <button type="button" class="btn btn-warning">Düzenle</button> todo: make it conditional -->
<!-- <button type="button" class="btn btn-danger">İptal</button> todo: turn back to previous page -->
</div>
\ No newline at end of file
<div class="starter-template container">
<!--<h1>{{model}}-->
<!--<a href="{{addLink}}">-->
<!--<button type="button" class="btn btn-primary">Ekle</button>-->
<!--</a>-->
<!--</h1>-->
<search-directive ng-if="meta['allow_search']===true"></search-directive>
<div class="clearfix"></div>
<h1>{{form_params.model || form_params.wf}}</h1>
<div class="row" ng-if="!objects[1]">
<div class="col-md-12">
<p class="no-content">Listelenecek içerik yok.</p>
......@@ -19,7 +17,7 @@
Hepsini Seç
</label>
</td>
<td ng-repeat="value in objects[0]" ng-if="objects[0]!='-1'">{{ objects }}</td>
<td ng-repeat="value in objects[0]" ng-if="objects[0]!='-1'">{{values }}</td>
<td ng-if="objects[0]=='-1'">{{ schema.title||model}}</td>
<td>action</td>
</tr>
......@@ -32,25 +30,19 @@
</label>
</td>
<td scope="row" style="text-align:center">{{$index}}</td>
<!-- below 2 of object will not be listed there for ng repeat loops 2 less -->
<td ng-repeat="field in object.fields track by $index" ng-if="objects[0]=='-1'">
<a ng-repeat="action in object.actions" ng-href="javascript:void(0)"
ng-if="action.show_as==='link'&&action.fields.indexOf($parent.$index)>-1" ng-click="do_action(object.key, action)">{{field}}</a>
</td>
<td ng-repeat="field in object.fields track by $index" ng-if="objects[0]!='-1'">
<a ng-repeat="action in object.actions" ng-href="javascript:void(0)"
ng-if="action.show_as==='link'&&action.fields.indexOf($index)>-1"
ng-click="do_action(object.key, action)">{{field}}</a>
<span ng-if="$index!=1">{{field}}</span>
<td ng-repeat="field in object.fields track by $index">
<a ng-href="javascript:void(0)"
ng-if="field.type==='link'"
ng-click="do_action(object.key, action)">{{field.content}}</a>
<span ng-if="field.type==='str'">{{field.content}}</span>
</td>
<td>
<button class="btn btn-primary" style="margin-right: 5px;" ng-repeat="action in object.actions"
ng-if="action.show_as==='button'" ng-click="do_action(object.key, action)">{{action
.name}}
</button>
<!--<a ng-href="javascript:void(0)" ng-repeat="action in object.actions"-->
<!--ng-if="action.show_as==='link'" ng-click="do_action(object.key, action)">{{action.name}}</a>-->
<br>
</td>
</tr>
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......
......@@ -64,27 +64,27 @@
</div>
</div>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="bower_components/angular-route/angular-route.min.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.min.js"></script>
<script src="bower_components/angular-resource/angular-resource.min.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="bower_components/tv4/tv4.js"></script>
<script src="bower_components/objectpath/lib/ObjectPath.js"></script>
<script src="bower_components/angular-schema-form/dist/schema-form.js"></script>
<script src="bower_components/angular-schema-form/dist/bootstrap-decorator.js"></script>
<script src="bower_components/angular-gettext/dist/angular-gettext.js"></script>
<script src="bower_components/angular-schema-form/dist/schema-form.min.js"></script>
<script src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script>
<script src="bower_components/angular-gettext/dist/angular-gettext.min.js"></script>
<!-- TODO: check all js and remove unused -->
<script src="bower_components/json3/lib/json3.js"></script>
<script src="bower_components/angular-loading-bar/build/loading-bar.js"></script>
<script src="bower_components/metisMenu/dist/metisMenu.js"></script>
<script src="bower_components/Chart.js/Chart.js"></script>
<!--<script src="bower_components/json3/lib/json3.js"></script>-->
<script src="bower_components/angular-loading-bar/build/loading-bar.min.js"></script>
<script src="bower_components/metisMenu/dist/metisMenu.min.js"></script>
<!--<script src="bower_components/Chart.js/Chart.js"></script>-->
<script src="shared/translations.js"></script>
<script src="tmp/templates.js"></script>
<script src="app.js"></script>
......@@ -92,8 +92,7 @@
<script src="shared/scripts/jquery-ui.min.js"></script>
<script src="shared/directives.js"></script>
<script src="zetalib/interceptors.js"></script>
<script src="zetalib/general.js"></script>
<script src="zetalib/forms/form_service.js"></script>
<script src="zetalib/form_service.js"></script>
<!-- components -->
......@@ -103,7 +102,6 @@
<script src="components/crud/crud_controller.js"></script>
<script src="components/debug/debug_controller.js"></script>
<script src="components/devSettings/devSettings_controller.js"></script>
<script src="components/wf/wf_controller.js"></script>
<script src="components/uitemplates/uitemplates.js"></script>
<script src="components/error_pages/error_controller.js"></script>
<script src="components/version/interpolate-filter.js"></script>
......
......@@ -72,27 +72,27 @@
</div>
<!-- @if NODE_ENV == 'DEVELOPMENT' -->
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="bower_components/angular-route/angular-route.min.js"></script>
<script src="bower_components/angular-cookies/angular-cookies.min.js"></script>
<script src="bower_components/angular-resource/angular-resource.min.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js"></script>
<script src="bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="bower_components/tv4/tv4.js"></script>
<script src="bower_components/objectpath/lib/ObjectPath.js"></script>
<script src="bower_components/angular-schema-form/dist/schema-form.js"></script>
<script src="bower_components/angular-schema-form/dist/bootstrap-decorator.js"></script>
<script src="bower_components/angular-gettext/dist/angular-gettext.js"></script>
<script src="bower_components/angular-schema-form/dist/schema-form.min.js"></script>
<script src="bower_components/angular-schema-form/dist/bootstrap-decorator.min.js"></script>
<script src="bower_components/angular-gettext/dist/angular-gettext.min.js"></script>
<!-- TODO: check all js and remove unused -->
<script src="bower_components/json3/lib/json3.js"></script>
<script src="bower_components/angular-loading-bar/build/loading-bar.js"></script>
<script src="bower_components/metisMenu/dist/metisMenu.js"></script>
<script src="bower_components/Chart.js/Chart.js"></script>
<!--<script src="bower_components/json3/lib/json3.js"></script>-->
<script src="bower_components/angular-loading-bar/build/loading-bar.min.js"></script>
<script src="bower_components/metisMenu/dist/metisMenu.min.js"></script>
<!--<script src="bower_components/Chart.js/Chart.js"></script>-->
<script src="shared/translations.js"></script>
<script src="tmp/templates.js"></script>
<script src="app.js"></script>
......@@ -100,8 +100,7 @@
<script src="shared/scripts/jquery-ui.min.js"></script>
<script src="shared/directives.js"></script>
<script src="zetalib/interceptors.js"></script>
<script src="zetalib/general.js"></script>
<script src="zetalib/forms/form_service.js"></script>
<script src="zetalib/form_service.js"></script>
<!-- components -->
......@@ -111,7 +110,6 @@
<script src="components/crud/crud_controller.js"></script>
<script src="components/debug/debug_controller.js"></script>
<script src="components/devSettings/devSettings_controller.js"></script>
<script src="components/wf/wf_controller.js"></script>
<script src="components/uitemplates/uitemplates.js"></script>
<script src="components/error_pages/error_controller.js"></script>
<script src="components/version/interpolate-filter.js"></script>
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......@@ -14,7 +15,6 @@ var app = angular.module(
'ngRoute',
'ngSanitize',
'ngCookies',
'general',
'formService',
'ulakbus.dashboard',
'ulakbus.auth',
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......@@ -20,13 +21,13 @@ app.directive('logout', function ($http, $location, RESTURL) {
});
}
};
});
})
/**
/**
* headerNotification directive for header
*/
app.directive('headerNotification', function ($http, $rootScope, $cookies, $interval, RESTURL) {
.directive('headerNotification', function ($http, $rootScope, $cookies, $interval, RESTURL) {
return {
templateUrl: 'shared/templates/directives/header-notification.html',
restrict: 'E',
......@@ -74,14 +75,62 @@ app.directive('headerNotification', function ($http, $rootScope, $cookies, $inte
});
}
};
});
})
/**
/**
*
*/
.directive('searchDirective', function (Generator, $log) {
return {
templateUrl: 'shared/templates/directives/search.html',
restrict: 'E',
replace: true,
link: function ($scope) {
$scope.searchForm = [{key: 'searchbox', htmlClass: "pull-left"}, {type: "submit", title: "Ara", htmlClass: "pull-left"}];
$scope.searchSchema = {
type: "object",
properties: {
searchbox: {
type: "string",
minLength: 2,
title: "Ara",
"x-schema-form": {placeholder: "Arama kriteri giriniz..."}
}
},
required: ['searchbox']
};
$scope.searchModel = {searchbox: ''};
$scope.searchSubmit = function (form) {
$scope.$broadcast('schemaFormValidate');
if (form.$valid) {
var searchparams = {
url: $scope.wf,
token: $scope.$parent.token,
object_id: $scope.$parent.object_id,
form_params: {
model: $scope.$parent.form_params.model,
cmd: $scope.$parent.reload_cmd,
flow: $scope.$parent.form_params.flow,
param: 'query',
id: $scope.searchModel.searchbox
}
};
Generator.submit(searchparams);
}
}
}
};
})
/**
* collapseMenu directive
* toggle collapses sidebar menu when clicked menu button
*/
app.directive('collapseMenu', function ($timeout, $window) {
.directive('collapseMenu', function ($timeout, $window) {
return {
templateUrl: 'shared/templates/directives/menuCollapse.html',
restrict: 'E',
......@@ -115,13 +164,13 @@ app.directive('collapseMenu', function ($timeout, $window) {
});
}
};
});
})
/**
/**
* headerSubmenu directive
*/
app.directive('headerSubMenu', function ($location) {
.directive('headerSubMenu', function ($location) {
return {
templateUrl: 'shared/templates/directives/header-sub-menu.html',
restrict: 'E',
......@@ -133,26 +182,26 @@ app.directive('headerSubMenu', function ($location) {
});
}
};
});
})
/**
/**
* breadcrumb directive
* produces breadcrumb with related links
*/
app.directive('headerBreadcrumb', function () {
.directive('headerBreadcrumb', function () {
return {
templateUrl: 'shared/templates/directives/header-breadcrumb.html',
restrict: 'E',
replace: true
};
});
})
/**
/**
* selected user directive
*/
app.directive('selectedUser', function () {
.directive('selectedUser', function () {
return {
templateUrl: 'shared/templates/directives/selected-user.html',
restrict: 'E',
......@@ -161,16 +210,16 @@ app.directive('selectedUser', function () {
$scope.selectedUser = $rootScope.selectedUser;
}
};
});
})
/**
/**
* sidebar directive
* changes breadcrumb when an item selected
* consists of menu items of related user or transaction
* controller communicates with dashboard controller to shape menu items and authz
*/
app.directive('sidebar', ['$location', function () {
.directive('sidebar', ['$location', function () {
return {
templateUrl: 'shared/templates/directives/sidebar.html',
restrict: 'E',
......@@ -199,14 +248,6 @@ app.directive('sidebar', ['$location', function () {
angular.forEach(items, function (value, key) {
newItems[value.kategori] = newItems[value.kategori] || [];
value['baseCategory'] = baseCategory;
// todo: generate urls here
//value['url'] = '#/wf' + value.wf;
//if (value.model) {
// value['url'] += '/model/' + value.model;
//}
value['wf'] = value.url.split('/')[0];
value['model'] = value.url.split('/')[1];
newItems[value.kategori].push(value);
});
return newItems;
......@@ -310,9 +351,9 @@ app.directive('sidebar', ['$location', function () {
};
}
};
}]);
}])
app.directive('stats', function () {
.directive('stats', function () {
return {
templateUrl: 'shared/templates/directives/stats.html',
restrict: 'E',
......@@ -329,37 +370,37 @@ app.directive('stats', function () {
}
};
});
})
/**
/**
* header menu notifications directive
*/
app.directive('notifications', function () {
.directive('notifications', function () {
return {
templateUrl: 'shared/templates/directives/notifications.html',
restrict: 'E',
replace: true
};
});
})
/**
/**
* msgbox directive
*/
app.directive('msgbox', function () {
.directive('msgbox', function () {
return {
templateUrl: 'shared/templates/directives/msgbox.html',
restrict: 'E',
replace: false
};
});
})
/**
/**
* search directive in sidebar
*/
app.directive('sidebarSearch', function () {
.directive('sidebarSearch', function () {
return {
templateUrl: 'shared/templates/directives/sidebar-search.html',
restrict: 'E',
......@@ -369,7 +410,7 @@ app.directive('sidebarSearch', function () {
$scope.selectedMenu = 'home';
}
};
});
});
//app.directive('timeline', function () {
// return {
......
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......
<form class="form-inline col-md-8" id="search" name="search" sf-schema="searchSchema" sf-form="searchForm"
sf-model="searchModel"
ng-submit="searchSubmit(search)"></form>
\ No newline at end of file
This diff is collapsed.
/**
* @license Ulakbus-UI
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
......@@ -323,6 +324,50 @@ describe('form service module', function () {
})
);
it('should return diff object',
inject( function (Generator) {
expect(Generator.get_diff).not.toBe(null);
// test cases - testing for success
var same_json = [
{email: 'test@test.com', id: 2, name: 'travolta'},
{email: 'test@test.com', id: 2, name: 'travolta'}
];
// test cases - testing for failure
var different_jsons = [
[
{email: 'test@test.com', id: 2, name: 'travolta'},
{email: 'test1@test.com', id: 2, name: 'john'}
],
[
{id: 2, name: 'travolta'},
{email: 'test1@test.com', id: 2, name: 'john'}
]
];
var different_json = [
{},
{email: 'test1@test.com', id: 2, name: 'john'}
]
var diff = {email: 'test1@test.com', name: 'john'};
var diff2 = {email: 'test1@test.com', id: 2, name: 'john'};
var nodiff = {};
var same = Generator.get_diff(same_json[0], same_json[1]);
expect(same).toEqual(nodiff);
for (var json_obj in different_jsons) {
var different = Generator.get_diff(different_jsons[json_obj][1], different_jsons[json_obj][0]);
expect(different).toEqual(diff);
}
var different2 = Generator.get_diff(different_json[1], different_json[0]);
expect(different2).toEqual(diff2);
})
);
});
describe('form service', function () {
......
This diff is collapsed.
<div ng-app="FormGenerator">
<div ng-controller="FormController">
<form name="formgenerated" sf-schema="schema" sf-form="form" sf-model="model" ng-submit="onSubmit(formgenerated)"></form>
</div>
</div>
\ No newline at end of file
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
// todo: move to form
//angular.module('FormDiff', [])
/**
* this file contains general functions of app.
*/
var general = angular.module('general', []);
general.factory('FormDiff', function () {
/**
* function to return diff of models of submitted form
* @type {{}}
* @params obj1, obj2
* @attention: obj1 must be initialModel, obj2 must be model after inputs
* filled
*/
var formDiff = {};
formDiff.get_diff = function (obj1, obj2) {
var result = {};
for (key in obj1) {
if (obj2[key] != obj1[key]) result[key] = obj1[key];
if (typeof obj2[key] == 'array' && typeof obj1[key] == 'array')
result[key] = arguments.callee(obj1[key], obj2[key]);
if (typeof obj2[key] == 'object' && typeof obj1[key] == 'object')
result[key] = arguments.callee(obj1[key], obj2[key]);
}
return result;
};
return formDiff;
});
\ No newline at end of file
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict';
describe('general module', function () {
beforeEach(module('general'));
describe('form diff factory', function () {
it('should return diff object', inject(['FormDiff',
function (FormDiff) {
expect(FormDiff.get_diff).not.toBe(null);
// test cases - testing for success
var same_json = [
{email: 'test@test.com', id: 2, name: 'travolta'},
{email: 'test@test.com', id: 2, name: 'travolta'}
];
// test cases - testing for failure
var different_jsons = [
[
{email: 'test@test.com', id: 2, name: 'travolta'},
{email: 'test1@test.com', id: 2, name: 'john'}
],
[
{id: 2, name: 'travolta'},
{email: 'test1@test.com', id: 2, name: 'john'}
]
];
var different_json = [
{},
{email: 'test1@test.com', id: 2, name: 'john'}
]
var diff = {email: 'test1@test.com', name: 'john'};
var diff2 = {email: 'test1@test.com', id: 2, name: 'john'};
var nodiff = {};
var same = FormDiff.get_diff(same_json[0], same_json[1]);
expect(same).toEqual(nodiff);
for (var json_obj in different_jsons) {
var different = FormDiff.get_diff(different_jsons[json_obj][1], different_jsons[json_obj][0]);
expect(different).toEqual(diff);
}
var different2 = FormDiff.get_diff(different_json[1], different_json[0]);
expect(different2).toEqual(diff2);
}])
);
});
});
\ 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
......
This diff is collapsed.
This diff is collapsed.
angular.module('templates-prod', ['components/auth/login.html', 'components/crud/templates/crud.html', 'components/crud/templates/form.html', 'components/crud/templates/list.html', 'components/crud/templates/show.html', 'components/dashboard/dashboard.html', 'components/debug/debug.html', 'components/devSettings/devSettings.html', 'components/error_pages/404.html', 'components/error_pages/500.html', 'components/uitemplates/404.html', 'components/uitemplates/500.html', 'shared/templates/add.html', 'shared/templates/datefield.html', 'shared/templates/directives/chat.html', 'shared/templates/directives/header-breadcrumb.html', 'shared/templates/directives/header-notification.html', 'shared/templates/directives/header-sub-menu.html', 'shared/templates/directives/menuCollapse.html', 'shared/templates/directives/msgbox.html', 'shared/templates/directives/notifications.html', 'shared/templates/directives/selected-user.html', 'shared/templates/directives/sidebar-notification.html', 'shared/templates/directives/sidebar-search.html', 'shared/templates/directives/sidebar.html', 'shared/templates/directives/stats.html', 'shared/templates/directives/timeline.html', 'shared/templates/fieldset.html', 'shared/templates/foreignKey.html', 'shared/templates/linkedModelModalContent.html', 'shared/templates/listnodeModalContent.html', 'shared/templates/modalContent.html', 'shared/templates/nodeTable.html', 'shared/templates/select.html']);
angular.module('templates-prod', ['components/auth/login.html', 'components/crud/templates/crud.html', 'components/crud/templates/form.html', 'components/crud/templates/list.html', 'components/crud/templates/show.html', 'components/dashboard/dashboard.html', 'components/debug/debug.html', 'components/devSettings/devSettings.html', 'components/error_pages/404.html', 'components/error_pages/500.html', 'components/uitemplates/404.html', 'components/uitemplates/500.html', 'shared/templates/add.html', 'shared/templates/datefield.html', 'shared/templates/directives/chat.html', 'shared/templates/directives/header-breadcrumb.html', 'shared/templates/directives/header-notification.html', 'shared/templates/directives/header-sub-menu.html', 'shared/templates/directives/menuCollapse.html', 'shared/templates/directives/msgbox.html', 'shared/templates/directives/notifications.html', 'shared/templates/directives/search.html', 'shared/templates/directives/selected-user.html', 'shared/templates/directives/sidebar-notification.html', 'shared/templates/directives/sidebar-search.html', 'shared/templates/directives/sidebar.html', 'shared/templates/directives/stats.html', 'shared/templates/directives/timeline.html', 'shared/templates/fieldset.html', 'shared/templates/foreignKey.html', 'shared/templates/linkedModelModalContent.html', 'shared/templates/listnodeModalContent.html', 'shared/templates/modalContent.html', 'shared/templates/nodeTable.html', 'shared/templates/select.html']);
angular.module("components/auth/login.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/auth/login.html",
......@@ -24,7 +24,7 @@ angular.module("components/crud/templates/crud.html", []).run(["$templateCache",
$templateCache.put("components/crud/templates/crud.html",
"<crud-show-directive ng-if=\"object\"></crud-show-directive>\n" +
"<crud-form-directive ng-if=\"forms\"></crud-form-directive>\n" +
"<hr>\n" +
"<hr class=\"col-md-12\">\n" +
"<crud-list-directive ng-if=\"objects\"></crud-list-directive>");
}]);
......@@ -66,21 +66,15 @@ angular.module("components/crud/templates/form.html", []).run(["$templateCache",
" </div>\n" +
"\n" +
" <div class=\"buttons-on-bottom\"></div>\n" +
"\n" +
" <!--<button id=\"submitbutton\" type=\"button\" class=\"btn btn-primary\" ng-click=\"onSubmit(formgenerated)\">Kaydet</button>-->\n" +
" <!-- <button type=\"button\" class=\"btn btn-warning\">Düzenle</button> todo: make it conditional -->\n" +
" <!-- <button type=\"button\" class=\"btn btn-danger\">İptal</button> todo: turn back to previous page -->\n" +
"</div>");
}]);
angular.module("components/crud/templates/list.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("components/crud/templates/list.html",
"<div class=\"starter-template container\">\n" +
" <!--<h1>{{model}}-->\n" +
" <!--<a href=\"{{addLink}}\">-->\n" +
" <!--<button type=\"button\" class=\"btn btn-primary\">Ekle</button>-->\n" +
" <!--</a>-->\n" +
" <!--</h1>-->\n" +
" <search-directive ng-if=\"meta['allow_search']===true\"></search-directive>\n" +
" <div class=\"clearfix\"></div>\n" +
" <h1>{{form_params.model || form_params.wf}}</h1>\n" +
" <div class=\"row\" ng-if=\"!objects[1]\">\n" +
" <div class=\"col-md-12\">\n" +
" <p class=\"no-content\">Listelenecek içerik yok.</p>\n" +
......@@ -96,7 +90,7 @@ angular.module("components/crud/templates/list.html", []).run(["$templateCache",
" Hepsini Seç\n" +
" </label>\n" +
" </td>\n" +
" <td ng-repeat=\"value in objects[0]\" ng-if=\"objects[0]!='-1'\">{{ objects }}</td>\n" +
" <td ng-repeat=\"value in objects[0]\" ng-if=\"objects[0]!='-1'\">{{values }}</td>\n" +
" <td ng-if=\"objects[0]=='-1'\">{{ schema.title||model}}</td>\n" +
" <td>action</td>\n" +
" </tr>\n" +
......@@ -109,25 +103,19 @@ angular.module("components/crud/templates/list.html", []).run(["$templateCache",
" </label>\n" +
" </td>\n" +
" <td scope=\"row\" style=\"text-align:center\">{{$index}}</td>\n" +
" <!-- below 2 of object will not be listed there for ng repeat loops 2 less -->\n" +
" <td ng-repeat=\"field in object.fields track by $index\" ng-if=\"objects[0]=='-1'\">\n" +
" <a ng-repeat=\"action in object.actions\" ng-href=\"javascript:void(0)\"\n" +
" ng-if=\"action.show_as==='link'&&action.fields.indexOf($parent.$index)>-1\" ng-click=\"do_action(object.key, action)\">{{field}}</a>\n" +
" </td>\n" +
"\n" +
" <td ng-repeat=\"field in object.fields track by $index\" ng-if=\"objects[0]!='-1'\">\n" +
" <a ng-repeat=\"action in object.actions\" ng-href=\"javascript:void(0)\"\n" +
" ng-if=\"action.show_as==='link'&&action.fields.indexOf($index)>-1\"\n" +
" ng-click=\"do_action(object.key, action)\">{{field}}</a>\n" +
" <span ng-if=\"$index!=1\">{{field}}</span>\n" +
" <td ng-repeat=\"field in object.fields track by $index\">\n" +
" <a ng-href=\"javascript:void(0)\"\n" +
" ng-if=\"field.type==='link'\"\n" +
" ng-click=\"do_action(object.key, action)\">{{field.content}}</a>\n" +
" <span ng-if=\"field.type==='str'\">{{field.content}}</span>\n" +
" </td>\n" +
"\n" +
" <td>\n" +
" <button class=\"btn btn-primary\" style=\"margin-right: 5px;\" ng-repeat=\"action in object.actions\"\n" +
" ng-if=\"action.show_as==='button'\" ng-click=\"do_action(object.key, action)\">{{action\n" +
" .name}}\n" +
" </button>\n" +
" <!--<a ng-href=\"javascript:void(0)\" ng-repeat=\"action in object.actions\"-->\n" +
" <!--ng-if=\"action.show_as==='link'\" ng-click=\"do_action(object.key, action)\">{{action.name}}</a>-->\n" +
" <br>\n" +
" </td>\n" +
" </tr>\n" +
......@@ -1049,6 +1037,13 @@ angular.module("shared/templates/directives/notifications.html", []).run(["$temp
"</div>");
}]);
angular.module("shared/templates/directives/search.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("shared/templates/directives/search.html",
"<form class=\"form-inline col-md-8\" id=\"search\" name=\"search\" sf-schema=\"searchSchema\" sf-form=\"searchForm\"\n" +
" sf-model=\"searchModel\"\n" +
" ng-submit=\"searchSubmit(search)\"></form>");
}]);
angular.module("shared/templates/directives/selected-user.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("shared/templates/directives/selected-user.html",
"<a href=\"#\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Tooltip on left\">İşlem: {{$root.selectedUser.name}}</a>\n" +
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
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