Commit 944ead14 authored by Evren Kutar's avatar Evren Kutar

merge

parents fbd02c97 2ade4514
......@@ -106,4 +106,7 @@ target/
coverage/
sync
*.rdb
\ No newline at end of file
*.rdb
api-docs/
api-docs-source/
\ No newline at end of file
......@@ -100,6 +100,17 @@ module.exports = function (grunt) {
{expand: true, cwd: 'app/bower_components/jquery/dist/', src: 'jquery.min.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'},
{expand: true, cwd: 'app/bower_components/angular/', src: 'angular.js', dest: 'dist/bower_components/', flatten: true, filter: 'isFile'}
]
},
for_api_docs: {
files: [
{expand: true, cwd: "app/", src: "app.js", dest: "api-docs-source/"},
{expand: true, cwd: "app/zetalib/", src: "interceptors.js", dest: "api-docs-source/"},
{expand: true, cwd: "app/zetalib/", src: "form_service.js", dest: "api-docs-source/"},
{expand: true, cwd: "app/shared/", src: "directives.js", dest: "api-docs-source/"},
{expand: true, cwd: "app/components/auth/", src: "auth_controller.js", dest: "api-docs-source/"},
{expand: true, cwd: "app/components/auth/", src: "auth_service.js", dest: "api-docs-source/"},
{expand: true, cwd: "app/components/crud/", src: "crud_controller.js", dest: "api-docs-source/"}
]
}
},
concat: {
......@@ -216,6 +227,14 @@ module.exports = function (grunt) {
"app/bower_components/intro.js/themes/introjs-nassim.css"
],
dest: 'dist/<%= grunt.branchname %>/css/app.css'
},
docs: {
src: ['docs/templates/index_head', 'docs/html/partials/api/**/*.html', 'docs/templates/index_tail'],
dest: 'docs/html/partials/api/index.html'
},
docs_list: {
src: ['docs/html/partials/api/**/index.html'],
dest: 'docs/html/partials/api/list.html'
}
},
watch: {
......@@ -323,6 +342,39 @@ module.exports = function (grunt) {
}
}
}
},
jsdoc: {
dist: {
src: [
"app/app.js",
"app/zetalib/interceptors.js",
"app/zetalib/form_service.js",
"app/shared/directives.js",
"app/components/auth/auth_controller.js",
"app/components/auth/auth_service.js",
"app/components/crud/crud_controller.js"
],
options: {
destination: 'docs/html',
configure: 'node_modules/angular-jsdoc/common/conf.json',
template: 'node_modules/angular-jsdoc/angular-template',
//tutorial: 'tutorials',
readme: './docs/DOCS.md'
}
}
},
mrdoc: {
custom: {
src: 'api-docs-source',
target: 'api-docs',
options: {
title: 'Ulakbus UI',
readme: './docs/DOCS.md'
//theme: 'cayman'
}
}
}
});
......@@ -339,9 +391,12 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-angular-gettext');
grunt.loadNpmTasks('grunt-preprocess');
grunt.loadNpmTasks('grunt-env');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-mrdoc');
grunt.registerTask('dev', ['env:dev', 'preprocess:dev', 'html2js:dev', 'default']);
grunt.registerTask('test', ['bower', 'karma:continuous']);
grunt.registerTask('api-docs', ['copy:for_api_docs', 'mrdoc']);
grunt.registerTask('i18n', ['nggettext_extract', 'nggettext_compile']);
grunt.registerTask('local_prod', ['bower', 'env:prod', 'preprocess:prod', 'nggettext_compile', 'concat:js', 'concat:css', 'concat:components', 'copy:local_prod', 'html2js:prod', 'uglify:dist', 'connect:prod_server', 'watch:local_prod']);
grunt.registerTask('default', ['bower', 'env:prod', 'preprocess:prod', 'nggettext_compile', 'concat:js', 'concat:css', 'concat:components', 'copy:prod', 'html2js:prod', 'uglify:dist']);
......@@ -362,11 +417,4 @@ 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
0.6.10
\ No newline at end of file
0.7
\ No newline at end of file
......@@ -91,6 +91,13 @@ a:hover {
letter-spacing: 0.5px;
}
img.header-profile {
width:27px;
height:27px;
border-radius:100%;
margin-right:6px;
}
/** DETAIL PAGE **/
.detail-page {
......@@ -360,11 +367,15 @@ select {
.manager-view-inner {
height:calc(100% - 41px);
-webkit-height:calc(100% - 41px);
width:100%;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-transition: all .2s;
-moz-transition: all .2s;
-ms-transition: all .2s;
-o-transition: all .2s;
transition: all .2s;
}
.manager-view-header {
......@@ -1152,15 +1163,19 @@ table.dataTable thead .sorting:after {
}
.right-sidebar {
width: 300px;
width: 0px;
background-color: #FFFFFF;
border-left: 1px solid #ccc;
/*height: calc(100% - 140px);*/
height: calc(100% - 40px);
position: absolute;
top: 0px;
right: 0px;
overflow-y: auto;
overflow-y: auto;
-webkit-transition: all .2s;
-moz-transition: all .2s;
-ms-transition: all .2s;
-o-transition: all .2s;
transition: all .2s;
}
.right-sidebar-box {
......@@ -1335,6 +1350,63 @@ table.dataTable thead .sorting:after {
/* END OF DASHBOARD */
/* SELECTED PERSON FIELD */
.selected-person-field .right-sidebar-header {
height:43px;
width:100%;
}
.selected-person-field .right-sidebar-header .bar-title {
margin-left: 10px;
height: 43px;
line-height: 43px;
font-family: 'robotomedium';
font-size: 15px;
}
.selected-person-field .right-sidebar-header .unselect-person {
height: 43px;
width: 43px;
font-size: 24px;
line-height: 43px;
float: right;
text-align: center;
cursor:pointer;
-webkit-transition: all .2s;
-moz-transition: all .2s;
-ms-transition: all .2s;
-o-transition: all .2s;
transition: all .2s;
}
.selected-person-field .right-sidebar-header .unselect-person:hover > i{
color:#333;
}
.selected-person-field .right-sidebar-header .unselect-person i {
color:#999;
}
.selected-person-field img.selected-person-img {
width:150px;
height:150px;
border-radius:100%;
margin-top:5px;
margin-left:75px;
margin-right:75px;
}
.selected-person-field .selected-person-info .selected-person-name {
width:100%;
padding:15px 20px;
text-align:center;
font-family:'robotomedium';
font-size:18px;
}
/* END OF SELECTED PERSON FIELD */
/* PERSONNEL INFO */
......
......@@ -8,14 +8,26 @@
'use strict';
var app = angular.module(
/**
* @ngdoc module
* @name ulakbus
* @module ulakbus
* @description Ulakbus module is the main module of ulakbus-ui.
* All application-wide configurations and definings of constants handled in this module.
*
* There are two scripts on `app/` root; `main.js` and `app.js`. And `main.html`, `index.html`.
* `main.*` files are contains both production and development requirements or configurations/necessities for relative environment.
* Tagged with `NODE_ENV='PRODUCTION'` in commented line and configured in Gruntfile.js with package `preprocess` and `env`, related grunt command generates index.* for given file.
*
*/
angular.module(
'ulakbus', [
'ui.bootstrap',
'angular-loading-bar',
'ngRoute',
'ngSanitize',
'ngCookies',
'formService',
'ulakbus.formService',
'ulakbus.dashboard',
'ulakbus.auth',
'ulakbus.error_pages',
......@@ -26,56 +38,37 @@ var app = angular.module(
//'schemaForm',
'gettext',
'ulakbus.uitemplates'
]).
/**
* RESTURL is the url of rest api to talk
* Based on the environment it changes from dev to prod
*/
constant("RESTURL", (function () {
// todo: below backendurl definition is for development purpose and will be deleted
var backendurl = location.href.indexOf('nightly') > -1 ? "//nightly.api.ulakbus.net/" : "//api.ulakbus.net/";
if (document.cookie.indexOf("backendurl") > -1) {
var cookiearray = document.cookie.split(';');
angular.forEach(cookiearray, function (item) {
if (item.indexOf("backendurl") > -1) {
backendurl = item.split('=')[1];
}
});
}
])
/**
* @memberof ulakbus
* @ngdoc constant
* @name RESTURL
* @description RESTURL is the url of rest api to talk.
* Based on the environment it changes from dev to prod.
*
* For development needs backendurl can be switched from both dev/settings page and querystring `?backendurl=http://example.com`
*/
.constant("RESTURL", (function () {
// todo: below backendurl definition is for development purpose and will be deleted
var backendurl = location.href.indexOf('nightly') > -1 ? "//nightly.api.ulakbus.net/" : "//api.ulakbus.net/";
if (document.cookie.indexOf("backendurl") > -1) {
var cookiearray = document.cookie.split(';');
angular.forEach(cookiearray, function (item) {
if (item.indexOf("backendurl") > -1) {
backendurl = item.split('=')[1];
}
});
}
if (location.href.indexOf("backendurl") > -1) {
var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
document.cookie = "backendurl=" + backendurl;
window.location.href = window.location.href.split('?')[0];
}
if (location.href.indexOf("backendurl") > -1) {
var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
document.cookie = "backendurl=" + backendurl;
window.location.href = window.location.href.split('?')[0];
}
return {url: backendurl};
})()).
/**
* USER_ROLES and AUTH_EVENTS are constant for auth functions
*/
constant("USER_ROLES", {
all: "*",
admin: "admin",
student: "student",
staff: "staff",
dean: "dean"
}).
constant('AUTH_EVENTS', {
loginSuccess: 'auth-login-success',
loginFailed: 'auth-login-failed',
logoutSuccess: 'auth-logout-success',
sessionTimeout: 'auth-session-timeout',
notAuthenticated: 'auth-not-authenticated',
notAuthorized: 'auth-not-authorized'
})
return {url: backendurl};
})())
.config(function ($logProvider) {
$logProvider.debugEnabled(true);
});
// test the code with strict di mode to see if it works when minified
//angular.bootstrap(document, ['ulakbus'], {
// strictDi: true
//});
});
\ No newline at end of file
'use strict';
app.config(['$routeProvider', function ($routeProvider, $route) {
$routeProvider
.when('/login', {
templateUrl: 'components/auth/login.html',
controller: 'LoginCtrl'
})
.when('/dashboard', {
templateUrl: 'components/dashboard/dashboard.html',
controller: 'DashCtrl'
})
.when('/dev/settings', {
templateUrl: 'components/devSettings/devSettings.html',
controller: 'DevSettingsCtrl'
})
.when('/debug/list', {
templateUrl: 'components/debug/debug.html',
controller: 'DebugCtrl'
})
angular.module('ulakbus')
.config(['$routeProvider', function ($routeProvider, $route) {
$routeProvider
.when('/login', {
templateUrl: 'components/auth/login.html',
controller: 'LoginCtrl'
})
.when('/dashboard', {
templateUrl: 'components/dashboard/dashboard.html',
controller: 'DashCtrl'
})
.when('/dev/settings', {
templateUrl: 'components/devSettings/devSettings.html',
controller: 'DevSettingsCtrl'
})
.when('/debug/list', {
templateUrl: 'components/debug/debug.html',
controller: 'DebugCtrl'
})
// use crud without selected user
// important: regex urls must be defined later than static ones
.when('/:wf/', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDCtrl'
})
.when('/:wf/do/:cmd', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDListFormCtrl'
})
.when('/:wf/do/:cmd/:key', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDListFormCtrl'
})
.when('/:wf/:model', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDCtrl'
})
.when('/:wf/:model/do/:cmd', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDListFormCtrl'
})
.when('/:wf/:model/do/:cmd/:key', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDListFormCtrl'
})
// use crud without selected user
// important: regex urls must be defined later than static ones
.when('/:wf/', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDCtrl'
})
.when('/:wf/do/:cmd', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDListFormCtrl'
})
.when('/:wf/do/:cmd/:key', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDListFormCtrl'
})
.when('/:wf/:model', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDCtrl'
})
.when('/:wf/:model/do/:cmd', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDListFormCtrl'
})
.when('/:wf/:model/do/:cmd/:key', {
templateUrl: 'components/crud/templates/crud.html',
controller: 'CRUDListFormCtrl'
})
.otherwise({redirectTo: '/dashboard'});
}])
.otherwise({redirectTo: '/dashboard'});
}])
.run(function ($rootScope) {
$rootScope.loggedInUser = true;
......
......@@ -8,36 +8,55 @@
'use strict';
var auth = angular.module('ulakbus.auth', ['ngRoute', 'schemaForm', 'ngCookies']);
auth.controller('LoginCtrl', function ($scope, $q, $timeout, $routeParams, $rootScope, $log, Generator, LoginService) {
$scope.url = 'login';
$scope.form_params = {};
$scope.form_params['clear_wf'] = 1;
Generator.get_form($scope).then(function(data){
$scope.form = [
{ key: "username", type: "string", title: "Kullanıcı Adı"},
{ key: "password", type: "password", title: "Şifre"},
{ type: 'submit', title: 'Giriş Yap' }
];
});
$scope.loggingIn = false;
$scope.onSubmit = function (form) {
$scope.$broadcast('schemaFormValidate');
if (form.$valid) {
$scope.loggingIn = true;
$rootScope.loginAttempt = 1;
LoginService.login($scope.url, $scope.model)
.error(function(data){
$scope.message = data.title;
})
.then(function () {
$scope.loggingIn = false;
})
}
else {
$log.debug("not valid");
}
};
$log.debug('login attempt: ', $rootScope.loginAttempt);
/**
* @ngdoc module
* @name ulakbus.auth
* @module ulakbus.auth
* @description ulakbus.auth module handles authorization process of ulakbus-ui.
*
* @requires ngRoute
* @requires ngCookies
*/
angular.module('ulakbus.auth', ['ngRoute', 'ngCookies'])
/**
* @memberof ulakbus.auth
* @ngdoc controller
* @name LoginCtrl
* @description LoginCtrl responsible to handle login process.<br>
* Using 'ulakbus.formService.get_form' function generates the login form and post it to the API with input datas.
*/
.controller('LoginCtrl', function ($scope, $q, $timeout, $routeParams, $rootScope, $log, Generator, AuthService) {
$scope.url = 'login';
$scope.form_params = {};
$scope.form_params['clear_wf'] = 1;
Generator.get_form($scope).then(function (data) {
$scope.form = [
{key: "username", type: "string", title: "Kullanıcı Adı"},
{key: "password", type: "password", title: "Şifre"},
{type: 'submit', title: 'Giriş Yap'}
];
});
$scope.loggingIn = false;
$scope.onSubmit = function (form) {
$scope.$broadcast('schemaFormValidate');
if (form.$valid) {
$scope.loggingIn = true;
$rootScope.loginAttempt = 1;
Generator.button_switch(false);
AuthService.login($scope.url, $scope.model)
.error(function (data) {
$scope.message = data.title;
$scope.loggingIn = false;
})
.then(function () {
$scope.loggingIn = false;
Generator.button_switch(false);
})
}
else {
$log.debug("not valid");
}
};
$log.debug('login attempt: ', $rootScope.loginAttempt);
});
\ No newline at end of file
});
\ No newline at end of file
......@@ -8,39 +8,59 @@
"use strict";
// TODO: login url change with correct one
angular.module('ulakbus.auth')
/**
* @memberof ulakbus.auth
* @ngdoc service
* @name AuthService
* @description provides generic functions for authorization process.
*/
.factory('AuthService', function ($http, $rootScope, $location, $log, Generator, RESTURL) {
var authService = {};
auth.factory('LoginService', function ($http, $rootScope, $location, $log, RESTURL) {
var loginService = {};
/**
* @memberof ulakbus.auth
* @ngdoc function
* @function login
* @description login function post credentials to API and handles login.
* If login req returns success then interceptor will redirects to related path.
*
* @param url
* @param credentials
* @returns {*}
*/
authService.login = function (url, credentials) {
credentials['cmd'] = "do";
return $http
.post(RESTURL.url + url, credentials)
.success(function (data, status, headers, config) {
//$window.sessionStorage.token = data.token;
loginService.login = function (url, credentials) {
credentials['cmd'] = "do";
return $http
.post(RESTURL.url + url, credentials)
.success(function (data, status, headers, config) {
//$window.sessionStorage.token = data.token;
$rootScope.loggedInUser = true;
})
.error(function (data, status, headers, config) {
// Handle login errors here
data.title = "İşlem başarısız oldu. Lütfen girdiğiniz bilgileri kontrol ediniz."
return data;
});
};
$rootScope.loggedInUser = true;
})
.error(function (data, status, headers, config) {
// Handle login errors here
return data;
/**
* @memberof ulakbus.auth
* @ngdoc controller
* @function logout
* @description logout function posts logout request to API and redirects to login path
*
* @returns {*}
*/
authService.logout = function () {
$log.debug("logout");
return $http.post(RESTURL.url + 'logout', {}).success(function (data) {
$rootScope.loggedInUser = false;
$log.debug("loggedout");
$location.path("/login");
});
};
};
loginService.logout = function () {
$log.debug("logout");
return $http.post(RESTURL.url + 'logout', {}).success(function (data) {
$rootScope.loggedInUser = false;
$log.debug("loggedout");
$location.path("/login");
});
};
loginService.isValidEmail = function (email) {
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
return re.test(email);
};
return loginService;
});
\ No newline at end of file
return authService;
});
\ No newline at end of file
......@@ -10,26 +10,30 @@
describe('ulakbus.auth module', function () {
// load dependencies of modules e.g REST_URL
beforeEach(module('ulakbus'));
beforeEach(module('ulakbus.auth'));
describe('login controller and service', function () {
var $controller;
var $rootScope;
it('should have a login controller', inject(function () {
expect('ulakbus.auth.LoginCtrl').toBeDefined();
}));
beforeEach(inject(function (_$controller_) {
$controller = _$controller_;
}));
var $controller;
var $rootScope;
beforeEach(inject(function ($injector) {
$rootScope = $injector.get('$rootScope');
}));
beforeEach(inject(function (_$controller_) {
$controller = _$controller_;
}));
beforeEach(inject(function ($injector) {
$httpBackend = $injector.get('$httpBackend');
var authRequestHandler = $httpBackend.when('GET', /\.[0-9a-z]+$/i)
.respond({userId: 'userX'}, {'A-Token': 'xxx'});
}));
describe('login controller and service', function () {
beforeEach(inject(function ($injector) {
$httpBackend = $injector.get('$httpBackend');
$rootScope = $injector.get('$rootScope');
it('should have a login controller', inject(function () {
expect('ulakbus.auth.LoginCtrl').toBeDefined();
}));
it('should get login form', inject(
......@@ -43,65 +47,22 @@ describe('ulakbus.auth module', function () {
var controller = $controller('LoginCtrl', {$scope: $scope});
expect($scope.onSubmit).toBeDefined();
//expect($scope.loginForm).toBeDefined();
//
//$scope.onSubmit($scope.loginForm);
})
);
it('should validate email', inject(['LoginService',
function (LoginService) {
expect(LoginService.isValidEmail).not.toBe(null);
// test cases - testing for success
var validEmails = [
'test@test.com',
'test@test.co.uk',
'test734ltylytkliytkryety9ef@jb-fe.com'
];
// test cases - testing for failure
var invalidEmails = [
'test@testcom',
'test@ test.co.uk',
'ghgf@fe.com.co.',
'tes@t@test.com',
''
];
// you can loop through arrays of test cases like this
for (var i in validEmails) {
var valid = LoginService.isValidEmail(validEmails[i]);
expect(valid).toBeTruthy();
}
for (var i in invalidEmails) {
var valid = LoginService.isValidEmail(invalidEmails[i]);
expect(valid).toBeFalsy();
}
}])
);
it('should submit form', inject(function ($httpBackend, RESTURL) {
}));
it('ensures user can log in', function (LoginService, $httpBackend, RESTURL) {
it('ensures user can log in', function (AuthService, $httpBackend, RESTURL) {
// todo: after backend api ready implement this
});
it('should get login success',
inject(function (LoginService, $httpBackend, $location, RESTURL) {
inject(function (AuthService, $httpBackend, $location, RESTURL) {
// use httpBackend to imitate login api
$httpBackend.expectPOST(RESTURL.url + 'login', {
email: 'test@test.com',
password: 'password',
cmd: 'do'
})
// todo: with real api change response data from list to obj
.respond(200, [{
'id': 1, 'user': {
'id': 12
......@@ -111,11 +72,9 @@ describe('ulakbus.auth module', function () {
}]);
var cred = {email: 'test@test.com', password: 'password'};
LoginService.login('login', cred)
AuthService.login('login', cred)
.then(function (data) {
expect(data).not.toBe(null);
// after login path need to be change dashboard
//expect($location.path()).toBe('');
});
$httpBackend.flush();
......@@ -123,7 +82,7 @@ describe('ulakbus.auth module', function () {
);
it('should logout',
inject(function (LoginService, $httpBackend, $location, RESTURL) {
inject(function (AuthService, $httpBackend, $location, RESTURL) {
// use httpBackend to imitate login api
......@@ -132,7 +91,7 @@ describe('ulakbus.auth module', function () {
is_login: false
});
LoginService.logout().success(function (data) {
AuthService.logout().success(function (data) {
expect(data.is_login).toBe(false);
});
......
......@@ -7,8 +7,20 @@
*/
'use strict';
angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
/**
* @ngdoc module
* @name ulakbus.crud
* @module ulakbus.crud
* @description
* ulakbus.crud module is the main module for ui. It interacts with backend and manipulate data to screen
* generically.
*
* @requires ui.bootstrap
* @requires schemaForm
* @requires ulakbus.formService
* @type {ng.$compileProvider|*}
*/
angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'ulakbus.formService'])
.config(function (sfErrorMessageProvider) {
sfErrorMessageProvider.setDefaultMessage(302, 'Bu alan zorunludur.');
sfErrorMessageProvider.setDefaultMessage(200, 'En az {{schema.minLength}} değer giriniz.');
......@@ -16,22 +28,24 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
})
/**
* @memberof ulakbus.crud
* @ngdoc service
* @name CrudUtility
* @description
* Crud Utility is a service to provide functionality for Crud controllers
* @returns {object}
* @description Crud Utility is a service to provide generic functions for Crud controllers to format data and
* scope object.
* @returns {service}
*/
.service('CrudUtility', function ($log, $rootScope) {
return {
/**
* @memberof ulakbus.crud
* @ngdoc function
* @name generateParam
* @description
* generateParam is a function to generate required params to post backend api.
*
* @param scope
* @param routeParams
* @param cmd
* @returns {*}
* @description generateParam is a function to generate required params to post backend api.
* @param {object} scope
* @param {object} routeParams
* @param {string} cmd
* @returns {object} scope
*/
generateParam: function (scope, routeParams, cmd) {
scope.url = routeParams.wf;
......@@ -66,12 +80,13 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
return scope;
},
/**
* @memberof ulakbus.crud
* @ngdoc function
* @name listPageItems
* @description
* listPageItems is a function to prepare objects to list in list page.
* @description listPageItems is a function to prepare objects to list in the list page.
*
* @param scope
* @param pageData
* @param {object} scope
* @param {object} pageData
*/
listPageItems: function (scope, pageData) {
angular.forEach(pageData, function (value, key) {
......@@ -104,9 +119,10 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
})
/**
* @memberof ulakbus.crud
* @ngdoc controller
* @name CRUDCtrl
* @description
* CRUDCtrl controller is base controller for crud module to redirect to related controller
* @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
*
......@@ -119,17 +135,19 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
})
/**
* @memberof ulakbus.crud
* @ngdoc controller
* @name CRUDListFormCtrl
* @description
* CRUDListFormCtrl is the main controller for crud module
* @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
*
* <br>
* The controller works in 2 ways, with and without pageData.
* pageData is generated by formService.Generator and it contains data to manipulate page.
* 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.
*
* <br>
* If pageData has not set using Generator's get_wf() function gets scope items from api call.
*
* @returns {object}
......@@ -238,6 +256,10 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
CrudUtility.generateParam($scope, $routeParams, $routeParams.cmd);
Generator.get_wf($scope);
}
if ($scope.object) {
$scope.createListObjects();
}
};
$scope.reloadCmd = function () {
$scope.reload({});
......@@ -260,6 +282,13 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
})
/**
* @memberof ulakbus.crud
* @ngdoc directive
* @name crudListDirective
* @description directive for listing objects.
* provides template for `scope.objects` object.
*/
.directive('crudListDirective', function () {
return {
templateUrl: 'components/crud/templates/list.html',
......@@ -267,7 +296,13 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
replace: true
};
})
/**
* @memberof ulakbus.crud
* @ngdoc directive
* @name crudFormDirective
* @description directive for form generation.
* provides template for `scope.forms` object.
*/
.directive('crudFormDirective', function () {
return {
templateUrl: 'components/crud/templates/form.html',
......@@ -275,7 +310,13 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
replace: true
};
})
/**
* @memberof ulakbus.crud
* @ngdoc directive
* @name crudShowDirective
* @description directive for single object or detail of an object.
* provides template for `scope.object` object.
*/
.directive('crudShowDirective', function () {
return {
templateUrl: 'components/crud/templates/show.html',
......@@ -283,7 +324,13 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
replace: true
};
})
/**
* @memberof ulakbus.crud
* @ngdoc directive
* @name formLocator
* @description directive for finding form element. we use this directive because when form dynamically generated using
* schemaform it belongs to a scope which is hard to reach. This makes it easy to locate form object.
*/
.directive('formLocator', function () {
return {
link: function (scope) {
......@@ -292,6 +339,13 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
}
})
/**
* @memberof ulakbus.crud
* @ngdoc directive
* @name crudFilters
* @description directive for filtering functionality. There are three types of filters; `check`, `select`, and `date`.
* @todo filter items returns unselected in response object
*/
.directive('crudFilters', function(Generator) {
return {
templateUrl: 'components/crud/templates/filter.html',
......
......@@ -10,7 +10,7 @@ describe('crud controller module', function () {
beforeEach(module('ulakbus'));
beforeEach(module('ulakbus.crud'));
beforeEach(module('formService'));
beforeEach(module('ulakbus.formService'));
beforeEach(inject(function ($injector) {
$httpBackend = $injector.get('$httpBackend');
......
<div ng-app="ulakbus.dashboard" class="dashboard">
<div class="starter-template" style="width: calc(100% - 300px);">
<div class="starter-template">
<div class="dashboard-main-search clearfix">
......@@ -125,107 +125,24 @@
</div>
<!-- end of dashboard-main-anouncement -->
<div class="right-sidebar">
<!--<div class="right-sidebar selected-person-field">-->
<div class="right-sidebar-box" data-step="4"
data-intro="mesajlar, yapılan görevlerin son durumları, duyurular ve son yapılan işlemleri buradan takip edebilirsiniz.">
<div class="right-sidebar-messages">
<div class="right-sidebar-title clearfix">
<h3>Mesajlar</h3>
<span><a role="button">Tüm Mesajlar</a></span>
</div>
<!-- end of right-sidebar-title -->
<p ng-show="notifications[2].length === 0" class="text-center">Görüntülenecek içerik yok.</p>
<div class="right-sidebar-message-block" ng-repeat="notify in notifications[2] | limitTo:5">
<a class="clearfix" ng-click="markAsRead(notify)">
<img src="../../../img/sample-profile-pic.jpg">
<div class="right-sidebar-message-content">
<div>{{notify.title}}</div>
<div>{{notify.body}}</div>
<div>16:05</div>
</div>
<!-- end of right-sidebar-message-content -->
</a>
</div>
<!-- end of right-sidebar-message-block -->
</div>
<!-- end of right-sidebar-messages -->
</div>
<!-- end of right-sidebar-box -->
<div class="right-sidebar-box">
<div class="right-sidebar-tasks">
<div class="right-sidebar-title clearfix">
<h3>Görevler</h3>
<span><a role="button">Tüm Görevler</a></span>
</div>
<p ng-show="notifications[1].length === 0" class="text-center">Görüntülenecek içerik yok.</p>
<div class="right-sidebar-task-block">
<!--<div class="task-type">Onay Bekleyen Görevler</div>-->
<a ng-click="markAsRead(notify)" ng-repeat="notify in notifications[1] | limitTo:5">
<div class="task-title">{{notify.title}}</div>
</a>
</div>
<!-- end of right-sidebar-task-block -->
</div>
<!-- end of right-sidebar-tasks -->
</div>
<!-- end of right-sidebar-box -->
<!--<div class="right-sidebar-box">-->
<!--<div class="right-sidebar-announcements">-->
<!--<div class="right-sidebar-title clearfix">-->
<!--<h3>Duyurular</h3>-->
<!--<span><a role="button">Tüm Duyurular</a></span>-->
<!--</div>-->
<!--&lt;!&ndash; end of right-sidebar-title &ndash;&gt;-->
<!--<div class="right-sidebar-announcement-block">-->
<!--<a ng-click="markAsRead(notify)"-->
<!--ng-repeat="notify in notifications[3] | limitTo:5">{{notify-->
<!--.body}}</a>-->
<!--</div>-->
<!--&lt;!&ndash; end of right-sidebar-status-block &ndash;&gt;-->
<!--</div>-->
<!--&lt;!&ndash; end of right-sidebar-status &ndash;&gt;-->
<!--<div class="right-sidebar-header">-->
<!--<span class="bar-title">Kişi seçildi</span>-->
<!--<span class="unselect-person"><i class="fa fa-times"></i></span>-->
<!--</div>-->
<!-- end of right-sidebar-box -->
<div class="right-sidebar-box">
<div class="right-sidebar-last-actions">
<div class="right-sidebar-title clearfix">
<h3>Son İşlemler</h3>
<span><a role="button">Tüm İşlemler</a></span>
</div>
<p class="text-center">Görüntülenecek içerik yok.</p>
<!--&lt;!&ndash; end of right-sidebaer-header &ndash;&gt;-->
<!---->
<!--<div class="selected-person-info">-->
<!--<img src="../../img/sample-profile-pic.jpg" class="selected-person-img">-->
<!--<div class="selected-person-name">Erkan Öğümsöğütlü</div>-->
<!--</div>-->
<!--&lt;!&ndash; end of selected-person-info &ndash;&gt;-->
<div class="right-sidebar-task-block">
<a>
<div class="task-title"></div>
</a>
</div>
<!--</div>-->
<!-- end of right-sidebar -->
</div>
<!-- end of right-sidebar-status -->
</div>
<!-- end of right-sidebar-box -->
</div>
<!-- end of right-sidebar -->
</div>
</div>
\ No newline at end of file
......@@ -8,6 +8,14 @@
'use strict';
/**
* @ngdoc module
* @name ulakbus.dashboard
* @module ulakbus.dashboard
* @description ulakbus.dashboard module is holding dashboard's controller, directives and other components.
*
* @type {ng.$compileProvider|*}
*/
angular.module('ulakbus.dashboard', [])
.config(function ($uibTooltipProvider) {
$uibTooltipProvider.setTriggers({'click': 'mouseleave'});
......
......@@ -8,7 +8,7 @@
'use strict';
app.config(['$routeProvider', function ($routeProvider) {
angular.module('ulakbus').config(['$routeProvider', function ($routeProvider) {
$routeProvider
.when('/error/500', {
templateUrl: 'components/error_pages/500.html',
......
......@@ -64,7 +64,7 @@
<div class="main" ng-view>
</div>
<right-sidebar></right-sidebar>
</div>
</div>
</div>
......
......@@ -71,7 +71,7 @@
<div class="main" ng-view>
</div>
<right-sidebar></right-sidebar>
</div>
</div>
</div>
......
......@@ -8,14 +8,26 @@
'use strict';
var app = angular.module(
/**
* @ngdoc module
* @name ulakbus
* @module ulakbus
* @description Ulakbus module is the main module of ulakbus-ui.
* All application-wide configurations and definings of constants handled in this module.
*
* There are two scripts on `app/` root; `main.js` and `app.js`. And `main.html`, `index.html`.
* `main.*` files are contains both production and development requirements or configurations/necessities for relative environment.
* Tagged with `NODE_ENV='PRODUCTION'` in commented line and configured in Gruntfile.js with package `preprocess` and `env`, related grunt command generates index.* for given file.
*
*/
angular.module(
'ulakbus', [
'ui.bootstrap',
'angular-loading-bar',
'ngRoute',
'ngSanitize',
'ngCookies',
'formService',
'ulakbus.formService',
'ulakbus.dashboard',
'ulakbus.auth',
'ulakbus.error_pages',
......@@ -31,50 +43,37 @@ var app = angular.module(
// @if NODE_ENV='DEVELOPMENT'
'ulakbus.uitemplates'
// @endif
]).
/**
* RESTURL is the url of rest api to talk
* Based on the environment it changes from dev to prod
*/
constant("RESTURL", (function () {
// todo: below backendurl definition is for development purpose and will be deleted
var backendurl = location.href.indexOf('nightly') > -1 ? "//nightly.api.ulakbus.net/" : "//api.ulakbus.net/";
if (document.cookie.indexOf("backendurl") > -1) {
var cookiearray = document.cookie.split(';');
angular.forEach(cookiearray, function (item) {
if (item.indexOf("backendurl") > -1) {
backendurl = item.split('=')[1];
}
});
}
])
/**
* @memberof ulakbus
* @ngdoc constant
* @name RESTURL
* @description RESTURL is the url of rest api to talk.
* Based on the environment it changes from dev to prod.
*
* For development needs backendurl can be switched from both dev/settings page and querystring `?backendurl=http://example.com`
*/
.constant("RESTURL", (function () {
// todo: below backendurl definition is for development purpose and will be deleted
var backendurl = location.href.indexOf('nightly') > -1 ? "//nightly.api.ulakbus.net/" : "//api.ulakbus.net/";
if (document.cookie.indexOf("backendurl") > -1) {
var cookiearray = document.cookie.split(';');
angular.forEach(cookiearray, function (item) {
if (item.indexOf("backendurl") > -1) {
backendurl = item.split('=')[1];
}
});
}
if (location.href.indexOf("backendurl") > -1) {
var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
document.cookie = "backendurl=" + backendurl;
window.location.href = window.location.href.split('?')[0];
}
if (location.href.indexOf("backendurl") > -1) {
var urlfromqstr = location.href.split('?')[1].split('=')[1];
backendurl = decodeURIComponent(urlfromqstr.replace(/\+/g, " "));
document.cookie = "backendurl=" + backendurl;
window.location.href = window.location.href.split('?')[0];
}
return {url: backendurl};
})()).
/**
* USER_ROLES and AUTH_EVENTS are constant for auth functions
*/
constant("USER_ROLES", {
all: "*",
admin: "admin",
student: "student",
staff: "staff",
dean: "dean"
}).
constant('AUTH_EVENTS', {
loginSuccess: 'auth-login-success',
loginFailed: 'auth-login-failed',
logoutSuccess: 'auth-logout-success',
sessionTimeout: 'auth-session-timeout',
notAuthenticated: 'auth-not-authenticated',
notAuthorized: 'auth-not-authorized'
})
return {url: backendurl};
})())
.config(function ($logProvider) {
// @if NODE_ENV='PRODUCTION'
$logProvider.debugEnabled(false);
......@@ -82,10 +81,4 @@ constant("USER_ROLES", {
// @if NODE_ENV='DEVELOPMENT'
$logProvider.debugEnabled(true);
// @endif
});
// test the code with strict di mode to see if it works when minified
//angular.bootstrap(document, ['ulakbus'], {
// strictDi: true
//});
});
\ No newline at end of file
This diff is collapsed.
......@@ -82,11 +82,10 @@
<!-- /.dropdown-alerts -->
</li>
<!-- /.dropdown -->
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-user fa-fw" tooltip-placement="bottom"
uib-tooltip="Profil"></i>&nbsp;{{$root.current_user.name}}&nbsp;{{$root.current_user.surname}}&nbsp;<i
class="fa fa-caret-down"></i>
<li class="dropdown" style="border-left:1px solid #891723;">
<a class="dropdown-toggle" data-toggle="dropdown" style="padding-top: 7px; padding-bottom: 6px;">
<img src="../../../img/sample-profile-pic.jpg" class="header-profile">&nbsp;{{$root.current_user.name}}&nbsp;{{$root.current_user.surname}}&nbsp;
<i class="fa fa-caret-down" style="margin-left:3px;"></i>
</a>
<ul class="dropdown-menu dropdown-user">
<li><a role="button"><i class="fa fa-user fa-fw"></i> Profil</a></li>
......
<div class="manager-view-header" style="{{style}}">
<div class="manager-view-header">
<div class="clearfix">
<header-breadcrumb></header-breadcrumb>
<loaderdiv><div></div></loaderdiv>
......
<div class="right-sidebar selected-person-field">
<div class="right-sidebar-header">
<button type="button" class="close" ng-click="deselectUser()"
aria-label="Close">
<span class="unselect-person"><i class="fa fa-times"></i></span>
</button>
</div>
<div class="selected-person-info">
<img class="selected-person-img"
ng-src="{{selectedUser ? '/img/sample-profile-pic.jpg' : '/img/empty-profile-pic.jpg'}}">
<div class="selected-person-name">
<p class="identity-name">{{selectedUser.name || 'Kişi seçilmedi.'}}</p>
<p class="identity-surname">{{selectedUser.surname}}</p>
<p>{{selectedUser ? 'TCNo: ' + selectedUser.tcno : ''}}</p>
</div>
</div>
<div class="">
<ul class="nav in" id="side-user-menu" data-step="2"
data-intro="seçilen personele veya öğrenciye göre ilgili menüler yer almaktadır. yapılacak işlemi buradan seçebilirsiniz.">
<li ng-repeat="(key, item) in selectedMenuItems" ng-class="{active: collapseVar == $index+100}">{{dropDown}}
<a href="" ng-click="check($index+100)">
<i class="fa fa-fw"
ng-class="{
'Admin': 'fa fa-fw fa-terminal',
'Genel': 'fa fa-fw fa-graduation-cap',
'Alt Kategori': 'fa fa-fw fa-tags',
'Kadro Islemleri': 'fa fa-fw fa-users',
'Seçime Uygun Görevler':'fa fa-fw fa-user'
}[item[0].kategori]"></i>
<span class="menu-text">{{ key }}</span>
<span class="fa arrow"></span>
</a>
<ul class="nav nav-second-level">
<li ng-repeat="(k, v) in item">
<a ng-href="#/{{v.wf}}/{{v.model}}?{{v.param}}={{selectedUser.key}}"
ng-click="breadcrumb([key, v.text], $event)">{{v.text}}</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
\ No newline at end of file
<div class="navbar-default sidebar" role="navigation" ng-mouseenter="openSidebar()" ng-mouseleave="closeSidebar()">
<div class="sidebar-container">
<!-- sidebar-person-info -->
<div class="sidebar-person-info" ng-show="$root.current_user.can_search">
<!--<button class="btn btn-primary close-sidebar-person-info">Profili Kapat</button>-->
<div class="identity">
<button type="button" class="close" ng-class="{hidden: $root.collapsed || !selectedUser}"
ng-click="deselectUser()"
aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<div class="identity-header clearfix">
<img ng-src="{{selectedUser ? '/img/sample-profile-pic.jpg' : '/img/empty-profile-pic.jpg'}}">
<div class="pull-left" ng-class="{hidden: $root.collapsed}">
<p class="identity-name">{{selectedUser.name || 'Kişi seçilmedi.'}}</p>
<p class="identity-surname">{{selectedUser.surname}}</p>
<p>{{selectedUser ? 'TCNo: ' + selectedUser.tcno : ''}}</p>
</div>
</div>
<!-- end of identity-header -->
<!--<div class="identity-info" ng-class="{hidden: $root.collapsed}">-->
<!--<div class="clearfix">-->
<!--<span class="fa fa-envelope"></span>-->
<!--<div>erkanogum@gmail.com</div>-->
<!--</div>-->
<!--<div class="clearfix">-->
<!--<span class="fa fa-home"></span>-->
<!--<div>İşçi Blokları Mah. 1524. sokak B Blok 6. Kat A Kanat 27 numara</div>-->
<!--</div>-->
<!--</div>-->
</div>
<!-- end of identity -->
<div class="">
<ul class="nav in" id="side-user-menu" ng-class="{hidden: !selectedMenuItems}" data-step="2"
data-intro="seçilen personele veya öğrenciye göre ilgili menüler yer almaktadır. yapılacak işlemi buradan seçebilirsiniz.">
<li ng-repeat="(key, item) in selectedMenuItems" ng-class="{active: collapseVar == $index+100}">{{dropDown}}
<a href="" ng-click="check($index+100)">
<i class="fa fa-fw"
ng-class="{
'Admin': 'fa fa-fw fa-terminal',
'Genel': 'fa fa-fw fa-graduation-cap',
'Alt Kategori': 'fa fa-fw fa-tags',
'Kadro Islemleri': 'fa fa-fw fa-users',
'Seçime Uygun Görevler':'fa fa-fw fa-user'
}[item[0].kategori]"></i>
<span class="menu-text" ng-class="{hidden: $root.collapsed}">{{ key }}</span>
<span class="fa arrow" ng-class="{hidden: $root.collapsed}"></span>
</a>
<ul class="nav nav-second-level" ng-class="{hidden: $root.collapsed}">
<li ng-repeat="(k, v) in item">
<!--<a ng-if="v.model" ng-href="#{{v.url}}" ng- -->
<!--ng-click="breadcrumb([key, v.text], $event)">{{v.text}}</a>-->
<a ng-href="#/{{v.wf}}/{{v.model}}?{{v.param}}={{selectedUser.key}}"
ng-click="breadcrumb([key, v.text], $event)">{{v.text}}</a>
</li>
</ul>
<!-- /.nav-second-level -->
</li>
</ul>
</div>
<!-- end of person-actions -->
</div>
<!-- end of sidebar-person-info -->
<div class="sidebar-nav navbar-collapse">
<ul class="nav in" id="side-menu" ng-class="{hidden: $root.loggedInUser != true}" data-step="1"
data-intro="Genel menüler yer almaktadır. yapılacak işlemi buradan seçebilirsiniz.">
......
......@@ -22,7 +22,7 @@
<span ng-if="value.verbose_name">{{ value.verbose_name }}</span>
<span ng-if="!value.verbose_name">{{key}}</span>
</th>
<th>İşlem</th>
<th ng-if="meta.allow_actions!==false">İşlem</th>
</tr>
</thead>
<tbody ng-class="{hidden: node.lengthModels < 1}">
......@@ -55,7 +55,7 @@
ng-model="node.model[outerIndex][k]"
ng-change="nodeModelChange(this)">
</td>
<td>
<td ng-if="meta.allow_actions!==false">
<button modal-for-nodes="{{node.schema.model_name}},{{node.schema.formType}},edit,{{$index}}">Düzenle
</button>
<br>
......
This diff is collapsed.
......@@ -10,7 +10,7 @@
describe('form service module', function () {
beforeEach(module('ulakbus'));
beforeEach(module('formService'));
beforeEach(module('ulakbus.formService'));
var location;
beforeEach(inject(function ($location, $injector) {
......@@ -84,6 +84,13 @@ describe('form service module', function () {
}]
);
it('should return scope if no scope.forms', inject['Generator',
function () {
var returnScope = Generator.generate({"test": "scope"}, {"data": "no forms"});
expect(returnScope).toEqual({"test": "scope"});
}]
);
it('should prepare form items', inject(
function (Generator, $httpBackend, RESTURL) {
expect(Generator.prepareFormItems).not.toBe(null);
......@@ -107,14 +114,14 @@ describe('form service module', function () {
var scope = {
wf: 'test',
form: ['email', 'id', 'name', 'save', 'select', 'date', 'date2', 'text_general', 'model', 'node', 'listnode'],
form: ['email', 'id', 'name', 'save', {"type": "select", "key": "select"}, 'date', 'date2', 'text_general', 'model', 'node', 'listnode'],
schema: {
properties: {
email: {title: 'email', type: 'email'},
id: {title: 'id', type: 'int'},
name: {title: 'name', type: 'string'},
save: {title: 'save', type: 'submit'},
select: {title: 'select', type: 'select', key: 'select'},
select: {title: 'select', type: 'select'},
date: {title: 'date', type: 'date'},
date2: {title: 'date', type: 'date'},
text_general: {title: 'text_general', type: 'text_general'},
......@@ -174,14 +181,22 @@ describe('form service module', function () {
},
grouping: [
{
"group_title": "title-1",
"items": ["email", "id"],
"groups": [
{
"group_title": "title-1",
"items": ["email", "id"],
}
],
"layout": "4",
"collapse": false
},
{
"group_title": "title-2",
"items": ["name", "save"],
"groups": [
{
"group_title": "title-2",
"items": ["name", "save"],
}
],
"layout": "2",
"collapse": false
}
......@@ -483,8 +498,8 @@ describe('form service module', function () {
// test cases - testing for success
var same_json = [
{email: 'test@test.com', id: 2, name: 'travolta', foo: {'a':1}, foo2: [1,2,3]},
{email: 'test@test.com', id: 2, name: 'travolta', foo: {'a':1}, foo2: [1,2,3]}
{email: 'test@test.com', id: 2, name: 'travolta', foo2: [1,2,3], foo: {'a':1}},
{email: 'test@test.com', id: 2, name: 'travolta', foo2: [1,2,3], foo: {'a':1}}
];
// test cases - testing for failure
......@@ -511,21 +526,21 @@ describe('form service module', function () {
var diff = {email: 'test1@test.com', name: 'john'};
var diff2 = {email: 'test1@test.com', id: 2, name: 'john'};
var noequal = {email: 'test1@test.com', id: 2, name: 'john'};
var noequal = {name: 'travolta'};
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]);
var different = Generator.get_diff(different_jsons[json_obj][0], different_jsons[json_obj][1]);
expect(different).toEqual(diff);
}
var different2 = Generator.get_diff(different_json[1], different_json[0]);
var different2 = Generator.get_diff(different_json[0], different_json[1]);
expect(different2).toEqual(diff2);
var not_equal = Generator.get_diff(notEqual[1], notEqual[0]);
var not_equal = Generator.get_diff(notEqual[0], notEqual[1]);
expect(not_equal).toEqual(noequal);
})
);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -56,7 +56,7 @@
<div class="main" ng-view>
</div>
<right-sidebar></right-sidebar>
</div>
</div>
</div>
......
This diff is collapsed.
#UI API Docs
UI Application consists of those elements:
- `app.js`: Main module of the app.
- `crud_controller.js`: The module of controllers for CRUD works.
- `auth_controller.js`: The module of controllers for authorization.
- `auth_service.js`: The module of service for authorization.
- `form_service.js`: The service that handles dynamically form generation, prepare input types, validation, redirection of related crud page and form submiting.
- `directives.js`: Carries app-wide directives.
- `interceptors.js`: Module for configure request and response objects of http functions.
\ No newline at end of file
// Canonical path provides a consistent path (i.e. always forward slashes) across different OSes
var path = require('canonical-path');
var Package = require('dgeni').Package;
// Create and export a new Dgeni package called dgeni-example. This package depends upon
// the jsdoc and nunjucks packages defined in the dgeni-packages npm module.
module.exports = new Package('docs_conf', [
require('dgeni-packages/jsdoc'),
require('dgeni-packages/nunjucks')
])
// Configure our dgeni-example package. We can ask the Dgeni dependency injector
// to provide us with access to services and processors that we wish to configure
.config(function(log, readFilesProcessor, templateFinder, writeFilesProcessor) {
// Set logging level
log.level = 'info';
// Specify the base path used when resolving relative paths to source and output files
readFilesProcessor.basePath = path.resolve(__dirname, '..');
console.log(readFilesProcessor.basePath);
// Specify collections of source files that should contain the documentation to extract
readFilesProcessor.sourceFiles = [
{
// Process all js files in `app` and its subfolders ...
include: 'app/components/**/*.js',
// ... except for this one!
exclude: 'app/**/*_test.js',
// When calculating the relative path to these files use this as the base path.
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
basePath: 'app'
}
];
// Add a folder to search for our own templates to use when rendering docs
templateFinder.templateFolders.unshift(path.resolve(__dirname, 'templates'));
// Specify how to match docs to templates.
// In this case we just use the same static template for all docs
templateFinder.templatePatterns.unshift('docs-template.html');
// Specify where the writeFilesProcessor will write our generated doc files
writeFilesProcessor.outputFolder = 'documentation';
});
\ No newline at end of file
<h1>{{ doc.codeName }} ({{ doc.outputPath }})</h1>
<p>{{ doc.description }}</p>
{% if doc.params %}
<h2>Params</h2>
<ul>
{% for param in doc.params %}
<li>
<strong>{{ param.name }}</strong> { {{ param.typeList }} } - {{ param.description }}
</li>
{% endfor %}
</ul>
{% endif %}
{% if doc.returns %}
<h2>Returns</h2>
<p>
{ {{ doc.returns.typeList }} } - {{ doc.returns.description }}
</p>
{% endif %}
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -73,7 +73,8 @@ module.exports = function (config) {
reporters: ['progress', 'coverage'],
preprocessors: {
//'app/app.js': ['coverage'],
'app/app.js': ['coverage'],
'app/app_routes.js': ['coverage'],
'app/components/auth/*.js': ['coverage'],
'app/components/crud/*.js': ['coverage'],
'app/components/dashboard/*.js': ['coverage'],
......@@ -90,6 +91,7 @@ module.exports = function (config) {
lines: 60,
excludes: [
'app/components/uitemplates/*.js',
//'app/zetalib/interceptors.js'
]
}
},
......
......@@ -34,7 +34,10 @@
"grunt-karma": "~0.8.0",
"grunt-angular-gettext": "~2.1.0",
"git-branch": "*",
"phantomjs": "~1.9.18"
"phantomjs": "~1.9.18",
"dgeni": "*",
"dgeni-packages": "*",
"canonical-path": "*"
},
"scripts": {
"postinstall": "bower install",
......
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