Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
7d7e4b64
Commit
7d7e4b64
authored
Oct 29, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wf views
disable selected user cookie different url generators for get and post methods
parent
340d9636
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
390 additions
and
45 deletions
+390
-45
app.css
app/app.css
+29
-1
app.js
app/app.js
+1
-0
app_routes.js
app/app_routes.js
+5
-9
crud_controller.js
app/components/crud/crud_controller.js
+3
-3
dashboard_controller.js
app/components/dashboard/dashboard_controller.js
+8
-13
add.html
app/components/wf/templates/add.html
+33
-0
edit.html
app/components/wf/templates/edit.html
+6
-0
list.html
app/components/wf/templates/list.html
+65
-0
show.html
app/components/wf/templates/show.html
+58
-0
wf_controller.js
app/components/wf/wf_controller.js
+93
-0
wf_controller_test.js
app/components/wf/wf_controller_test.js
+61
-0
index.html
app/index.html
+1
-0
main.html
app/main.html
+1
-0
main.js
app/main.js
+1
-0
directives.js
app/shared/directives.js
+5
-5
header-sub-menu.html
app/shared/templates/directives/header-sub-menu.html
+1
-1
sidebar.html
app/shared/templates/directives/sidebar.html
+1
-1
form_service.js
app/zetalib/forms/form_service.js
+14
-8
form_service_test.js
app/zetalib/forms/form_service_test.js
+4
-4
No files found.
app/app.css
View file @
7d7e4b64
...
@@ -485,7 +485,7 @@ select {
...
@@ -485,7 +485,7 @@ select {
width
:
100%
;
width
:
100%
;
max-height
:
calc
(
85%
-
139px
);
max-height
:
calc
(
85%
-
139px
);
background
:
#fff
;
background
:
#fff
;
display
:
none
;
/*display:none;*/
/** angular template will hndle this */
}
}
.sidebar-person-info
.identity
{
.sidebar-person-info
.identity
{
...
@@ -1592,3 +1592,31 @@ table.dataTable thead .sorting:after {
...
@@ -1592,3 +1592,31 @@ table.dataTable thead .sorting:after {
background-size
:
100px
100px
;
background-size
:
100px
100px
;
}
}
/* page transitions */
.slide
{
position
:
absolute
;
left
:
0
;
top
:
0
;
width
:
100%
;
height
:
100%
;
}
.slide.ng-enter
,
.slide.ng-leave
{
-webkit-transition
:
all
1s
ease
;
transition
:
all
1s
ease
;
}
.slide.ng-enter
{
left
:
100%
;
}
.slide.ng-enter-active
{
left
:
0
;
}
.slide.ng-leave
{
left
:
0
;
}
.slide.ng-leave-active
{
left
:
-100%
;
}
/* end page transitions */
app/app.js
View file @
7d7e4b64
...
@@ -20,6 +20,7 @@ var app = angular.module(
...
@@ -20,6 +20,7 @@ var app = angular.module(
'ulakbus.auth'
,
'ulakbus.auth'
,
'ulakbus.error_pages'
,
'ulakbus.error_pages'
,
'ulakbus.crud'
,
'ulakbus.crud'
,
'ulakbus.wf'
,
'ulakbus.version'
,
'ulakbus.version'
,
//'schemaForm',
//'schemaForm',
'gettext'
,
'gettext'
,
...
...
app/app_routes.js
View file @
7d7e4b64
...
@@ -10,14 +10,6 @@ app.config(['$routeProvider', function ($routeProvider) {
...
@@ -10,14 +10,6 @@ app.config(['$routeProvider', function ($routeProvider) {
templateUrl
:
'components/dashboard/dashboard.html'
,
templateUrl
:
'components/dashboard/dashboard.html'
,
controller
:
'DashCtrl'
controller
:
'DashCtrl'
})
})
// .when('/500', {
// templateUrl: 'components/uitemplates/500.html',
// controller: '500Ctrl'
// })
// .when('/404', {
// templateUrl: 'components/uitemplates/404.html',
// controller: '404Ctrl'
// })
.
when
(
'/crud/:model/add'
,
{
.
when
(
'/crud/:model/add'
,
{
templateUrl
:
'components/crud/templates/add.html'
,
templateUrl
:
'components/crud/templates/add.html'
,
controller
:
'CRUDAddEditCtrl'
controller
:
'CRUDAddEditCtrl'
...
@@ -30,10 +22,14 @@ app.config(['$routeProvider', function ($routeProvider) {
...
@@ -30,10 +22,14 @@ app.config(['$routeProvider', function ($routeProvider) {
templateUrl
:
'components/crud/templates/list.html'
,
templateUrl
:
'components/crud/templates/list.html'
,
controller
:
'CRUDListCtrl'
controller
:
'CRUDListCtrl'
})
})
.
when
(
'/crud/:model/:id'
,
{
.
when
(
'/crud/:model/:
param/:
id'
,
{
templateUrl
:
'components/crud/templates/show.html'
,
templateUrl
:
'components/crud/templates/show.html'
,
controller
:
'CRUDShowCtrl'
controller
:
'CRUDShowCtrl'
})
})
.
when
(
'/:model/:id/'
,
{
templateUrl
:
'components/wf/templates/add.html'
,
controller
:
'WFAddEditCtrl'
})
.
otherwise
({
redirectTo
:
'/dashboard'
});
.
otherwise
({
redirectTo
:
'/dashboard'
});
}])
}])
.
run
(
function
(
$rootScope
)
{
.
run
(
function
(
$rootScope
)
{
...
...
app/components/crud/crud_controller.js
View file @
7d7e4b64
...
@@ -54,8 +54,8 @@ crud.controller('CRUDAddEditCtrl', function ($scope, $rootScope, $location, $htt
...
@@ -54,8 +54,8 @@ crud.controller('CRUDAddEditCtrl', function ($scope, $rootScope, $location, $htt
*/
*/
crud
.
controller
(
'CRUDListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
crud
.
controller
(
'CRUDListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud'
;
$scope
.
url
=
'crud
/
'
;
$scope
.
form_params
=
{
"model"
:
$routeParams
.
model
}
;
$scope
.
form_params
=
$routeParams
;
if
(
$routeParams
.
nobjects
){
if
(
$routeParams
.
nobjects
){
$scope
.
nobjects
=
$routeParams
.
nobjects
;
$scope
.
nobjects
=
$routeParams
.
nobjects
;
...
@@ -74,7 +74,7 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
...
@@ -74,7 +74,7 @@ crud.controller('CRUDListCtrl', function ($scope, $rootScope, Generator, $routeP
* CRUD Show Controller
* CRUD Show Controller
*/
*/
crud
.
controller
(
'CRUDShowCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
crud
.
controller
(
'CRUDShowCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud'
;
$scope
.
url
=
'crud
/
'
;
$scope
.
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"cmd"
:
"show"
,
"model"
:
$routeParams
.
model
};
$scope
.
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"cmd"
:
"show"
,
"model"
:
$routeParams
.
model
};
// call generator's get_single_itemfunc
// call generator's get_single_itemfunc
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
...
...
app/components/dashboard/dashboard_controller.js
View file @
7d7e4b64
...
@@ -47,9 +47,6 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
...
@@ -47,9 +47,6 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
$scope
.
getItems
=
function
(
where
,
what
)
{
$scope
.
getItems
=
function
(
where
,
what
)
{
return
$http
.
get
(
RESTURL
.
url
+
'ara/'
+
where
+
'/'
+
what
);
return
$http
.
get
(
RESTURL
.
url
+
'ara/'
+
where
+
'/'
+
what
);
//.success(function (data) {
// return data.results;
//});
};
};
$scope
.
select
=
function
(
who
,
type
)
{
$scope
.
select
=
function
(
who
,
type
)
{
...
@@ -59,19 +56,17 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
...
@@ -59,19 +56,17 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
$rootScope
.
$broadcast
(
"menuitems"
,
type
);
$rootScope
.
$broadcast
(
"menuitems"
,
type
);
// save selected user and type to cookie
// save selected user and type to cookie
$cookies
.
put
(
"selectedUserName"
,
who
[
0
]);
// its a development issue and will be deleted todo: remove at production
$cookies
.
put
(
"selectedUserTcNo"
,
who
[
1
]);
//$cookies.put("selectedUserName", who[0
]);
$cookies
.
put
(
"selectedUserKey"
,
who
[
2
]);
//$cookies.put("selectedUserTcNo", who[1
]);
$cookies
.
put
(
"selectedUserType"
,
type
);
//$cookies.put("selectedUserKey", who[2]
);
console
.
log
(
$cookies
.
getAll
()
);
//$cookies.put("selectedUserType", type
);
};
};
// if selected user in cookie, set selectedUser
// if selected user in cookie, set selectedUser
if
(
$cookies
.
getAll
()[
"selectedUser"
])
{
//if ($cookies.getAll()["selectedUser"]) {
$rootScope
.
selectedUser
=
{
name
:
$cookies
.
get
(
"selectedUserName"
),
tcno
:
$cookies
.
get
(
"selectedUserTcNo"
),
key
:
$cookies
.
get
(
"selectedUserKey"
)};
// $rootScope.selectedUser = {name: $cookies.get("selectedUserName"), tcno: $cookies.get("selectedUserTcNo"), key: $cookies.get("selectedUserKey")};
//$rootScope.$broadcast("menuitems", $cookies.get("selectedUserType"));
//}
console
.
log
(
$cookies
.
getAll
());
}
});
});
app/components/wf/templates/add.html
0 → 100644
View file @
7d7e4b64
<h1>
{{ schema.title }}
</h1>
<form
id=
"formgenerated"
name=
"formgenerated"
sf-schema=
"schema"
sf-form=
"form"
sf-model=
"model"
></form>
<div
ng-repeat=
"node in Node"
>
<h3>
{{ node.title }}
<span
ng-if=
"node.lengthModels < 1"
>
<a
href=
"javascript:void(0);"
modal-for-nodes=
"{{node.schema.model_name}},Node"
>
<i
class=
"fa fa-plus-circle fa-fw"
></i>
</a>
</span>
</h3>
<div
class=
"node-table"
>
<ng-include
src=
"'shared/templates/nodeTable.html'"
></ng-include>
</div>
<hr>
</div>
<div
ng-repeat=
"node in ListNode"
>
<h3>
{{ node.title }}
<span>
<a
href=
"javascript:void(0);"
modal-for-nodes=
"{{node.schema.model_name}},ListNode,add"
>
<i
class=
"fa fa-plus-circle fa-fw"
></i>
</a>
</span>
</h3>
<div
class=
"list-node-table"
>
<ng-include
src=
"'shared/templates/nodeTable.html'"
></ng-include>
</div>
<hr>
</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 -->
\ No newline at end of file
app/components/wf/templates/edit.html
0 → 100644
View file @
7d7e4b64
<div
ng-app=
"ulakbus.crud"
>
<div
class=
"col-md-6"
>
<h1>
{{ schema.title }}
</h1>
<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
app/components/wf/templates/list.html
0 → 100644
View file @
7d7e4b64
<div
class=
"starter-template"
>
<h1>
{{model}}
<a
href=
"#/crud/{{model}}/add"
><button
type=
"button"
class=
"btn btn-primary"
>
Ekle
</button></a></h1>
<div
class=
"row"
ng-if=
"!nobjects[1]"
>
<div
class=
"col-md-12"
>
<p
class=
"no-content"
>
Listelenecek içerik yok.
</p>
</div>
</div>
<div
class=
"tablescroll"
ng-if=
"nobjects[1]"
>
<table
class=
"table table-bordered"
style=
"background-color:#fff;"
>
<thead>
<tr>
<th
colspan=
"2"
>
<label>
<input
type=
"checkbox"
style=
"zoom:1.5; margin:5px 0 0 8px;"
>
Hepsini Seç
</label>
</th>
<th
ng-repeat=
"value in nobjects[0]"
ng-if=
"nobjects[0]!='-1'"
>
{{ value }}
</th>
<th
ng-if=
"nobjects[0]=='-1'"
>
{{ model }}
</th>
<th>
action
</th>
</tr>
</thead>
<tbody>
<tr
ng-repeat=
"object in nobjects"
ng-if=
"$index>0"
>
<td
width=
"60"
>
<label>
<input
type=
"checkbox"
style=
"zoom:1.5; margin:5px 0 0 8px;"
>
</label>
</td>
<th
scope=
"row"
style=
"text-align:center"
>
{{$index}}
</th>
<td
ng-repeat=
"k in object track by $index"
ng-if=
"nobjects[0]=='-1' && $index>0"
>
<a
ng-href=
"#/crud/{{model}}/{{object[0]}}"
>
{{object[1]}}
</a>
</td>
<td
ng-repeat=
"(key,value) in object track by $index"
ng-if=
"nobjects[0]!='-1' && $index>0"
>
<a
ng-href=
"#/crud/{{model}}/{{object[0]}}"
ng-if=
"$index==1"
>
{{object[key]}}
</a>
<span
ng-if=
"$index!=1"
>
{{object[key]}}
</span>
</td>
<td>
<a
ng-href=
"#/crud/{{model}}/edit/{{object[0]}}"
>
Edit
</a><br>
</td>
</tr>
</tbody>
</table>
</div>
<br/>
<hr/>
<div
class=
"btn-group"
ng-if=
"nobjects[1]"
>
<button
type=
"button"
class=
"btn btn-default dropdown-toggle"
data-toggle=
"dropdown"
aria-haspopup=
"true"
aria-expanded=
"false"
>
İşlemler
<span
class=
"caret"
></span>
</button>
<ul
class=
"dropdown-menu"
>
<li><a
href=
""
>
İşlem 1
</a></li>
<li><a
href=
""
>
İşlem 2
</a></li>
<li><a
href=
""
>
İşlem 3
</a></li>
<li
role=
"separator"
class=
"divider"
></li>
<li><a
href=
""
>
İşlem 4
</a></li>
</ul>
</div>
<hr>
</div>
\ No newline at end of file
app/components/wf/templates/show.html
0 → 100644
View file @
7d7e4b64
<!--<div class="starter-template">-->
<!--<h1>{{model}}</h1>-->
<!--<p ng-repeat="(key, value) in object"><span class="col-md-3">{{ key }}:</span>{{value}}</p>-->
<!--</div>-->
<div
class=
"starter-template"
>
<div
class=
"personnel-info-container"
>
<div
class=
"personnel-info-left"
>
<!--<div class="generic-profile-picture">-->
<!--<img src="../../img/sample-profile-pic.jpg" />-->
<!--</div>-->
<div
class=
"info-block"
>
<div
class=
"info-block-header"
>
<h1>
{{model}}
</h1>
</div>
<!-- end of info-block-header -->
<div
class=
"info-block-body"
ng-repeat=
"(key, value) in object"
>
<dl
class=
"dl-horizontal"
>
<dt>
{{ key }}
</dt>
<dd>
{{value}}
</dd>
</dl>
</div>
<!-- end of info-block-body -->
</div>
<!--<ul>-->
<!--<li ng-repeat="(key, value) in object"><span class="col-md-3">{{ key }}:</span>{{value}}</li>-->
<!--<li>Pozisyon</li>-->
<!--<li><i class="fa fa-phone"></i> (+90) 123 456 7890</li>-->
<!--<li><i class="fa fa-envelope"></i> samplemail@mail.com</li>-->
<!--<li><i class="fa fa-map-marker"></i> Gülbahçe Mah. İzmir Teknoloji Geliştirme Bölgesi A9 Blok 215/A IYTE Campus, URLA/IZMIR</li></li>-->
<!--</ul>-->
</div>
<!-- end of personnel-info-left -->
<div
class=
"personnel-info-right"
>
<div
class=
"info-block"
ng-repeat=
"(key, value) in listobjects"
>
<div
class=
"info-block-header"
>
<h2>
{{key}}
</h2>
</div>
<!-- end of info-block-header -->
<div
class=
"info-block-body"
ng-repeat=
"(k, v) in value"
>
<dl
class=
"dl-horizontal"
>
<dt>
{{k}}
</dt>
<dd>
{{v}}
</dd>
</dl>
</div>
<!-- end of info-block-body -->
</div>
<!-- end of info block -->
<!-- end of info block -->
</div>
<!-- personnel-info-left -->
</div>
<!-- end of personnel-info-container -->
</div>
\ No newline at end of file
app/components/wf/wf_controller.js
0 → 100644
View file @
7d7e4b64
/**
* Copyright (C) 2015 ZetaOps Inc.
*
* This file is licensed under the GNU General Public License v3
* (GPLv3). See LICENSE.txt for details.
*/
'use strict'
;
var
wf
=
angular
.
module
(
'ulakbus.wf'
,
[
'ui.bootstrap'
,
'schemaForm'
,
'formService'
]);
/**
* CRUDAddEditCtrl is a controller
* which provide a form with form generator.
*/
crud
.
controller
(
'WFAddEditCtrl'
,
function
(
$scope
,
$rootScope
,
$location
,
$http
,
$log
,
$modal
,
$timeout
,
Generator
,
$routeParams
)
{
$scope
.
url
=
$routeParams
.
model
;
$scope
.
form_params
=
{
'model'
:
$routeParams
.
model
};
//if ($routeParams.id) {
// $scope.form_params['object_id'] = $routeParams.id;
// $scope.form_params['cmd'] = 'edit';
//}
//else {
// $scope.form_params['cmd'] = 'add';
//}
// get form with generator
if
(
$routeParams
.
model
)
{
Generator
.
get_form
(
$scope
);
}
$scope
.
onSubmit
=
function
(
form
)
{
$scope
.
$broadcast
(
'schemaFormValidate'
);
if
(
form
.
$valid
)
{
Generator
.
submit
(
$scope
)
.
success
(
function
(
data
){
debugger
;
$location
.
path
(
'/crud/'
+
$scope
.
form_params
.
model
).
search
(
data
);
})
.
error
(
function
(
data
){
$scope
.
message
=
data
.
title
;
});
}
};
});
/**
* CRUD List Controller
*/
crud
.
controller
(
'CRUDListCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud/'
;
$scope
.
form_params
=
$routeParams
;
if
(
$routeParams
.
nobjects
){
$scope
.
nobjects
=
$routeParams
.
nobjects
;
$scope
.
model
=
$routeParams
.
model
;
}
else
{
// call generator's get_list func
Generator
.
get_list
(
$scope
)
.
then
(
function
(
res
)
{
$scope
.
nobjects
=
res
.
data
.
nobjects
;
$scope
.
model
=
$routeParams
.
model
;
});
}
});
/**
* CRUD Show Controller
*/
crud
.
controller
(
'CRUDShowCtrl'
,
function
(
$scope
,
$rootScope
,
Generator
,
$routeParams
)
{
$scope
.
url
=
'crud/'
;
$scope
.
form_params
=
{
"object_id"
:
$routeParams
.
id
,
"cmd"
:
"show"
,
"model"
:
$routeParams
.
model
};
// call generator's get_single_itemfunc
Generator
.
get_single_item
(
$scope
).
then
(
function
(
res
)
{
$scope
.
listobjects
=
{};
$scope
.
object
=
res
.
data
.
object
;
angular
.
forEach
(
$scope
.
object
,
function
(
value
,
key
)
{
if
(
typeof
value
==
'object'
){
$scope
.
listobjects
[
key
]
=
value
;
delete
$scope
.
object
[
key
];
}
});
$scope
.
model
=
$routeParams
.
model
;
})
});
\ No newline at end of file
app/components/wf/wf_controller_test.js
0 → 100644
View file @
7d7e4b64
/**
* 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
(
'crud controller module'
,
function
()
{
beforeEach
(
module
(
'ulakbus'
));
beforeEach
(
module
(
'ulakbus.crud'
));
var
$controller
;
beforeEach
(
inject
(
function
(
_$controller_
)
{
$controller
=
_$controller_
;
}));
describe
(
'crud add controller'
,
function
()
{
it
(
'should get form'
,
function
()
{
var
$scope
=
{};
var
controller
=
$controller
(
'CRUDAddEditCtrl'
,
{
$scope
:
$scope
});
expect
(
$scope
).
not
.
toEqual
(
null
);
});
});
// todo: chack if needed for these tests
// describe('crud list controller', function() {
// it('should get list', function() {
// var $scope = {};
// var controller = $controller('CRUDListCtrl', { $scope: $scope });
// expect($scope).not.toEqual(null);
// });
// });
// describe('crud show controller', function() {
// it('should get single item', function() {
// var $scope = {};
// var controller = $controller('CRUDShowCtrl', { $scope: $scope });
// expect($scope).not.toEqual(null);
// });
// });
describe
(
'crud controller'
,
function
()
{
it
(
'should have CRUDAddEditCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
it
(
'should have CRUDListCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
it
(
'should have CRUDShowCtrl'
,
inject
(
function
(
$controller
)
{
expect
(
$controller
).
toBeDefined
();
}));
});
});
\ No newline at end of file
app/index.html
View file @
7d7e4b64
...
@@ -101,6 +101,7 @@
...
@@ -101,6 +101,7 @@
<script
src=
"components/auth/auth_service.js"
></script>
<script
src=
"components/auth/auth_service.js"
></script>
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/crud/crud_controller.js"
></script>
<script
src=
"components/crud/crud_controller.js"
></script>
<script
src=
"components/wf/wf_controller.js"
></script>
<script
src=
"components/uitemplates/uitemplates.js"
></script>
<script
src=
"components/uitemplates/uitemplates.js"
></script>
<script
src=
"components/error_pages/error_controller.js"
></script>
<script
src=
"components/error_pages/error_controller.js"
></script>
<script
src=
"components/version/interpolate-filter.js"
></script>
<script
src=
"components/version/interpolate-filter.js"
></script>
...
...
app/main.html
View file @
7d7e4b64
...
@@ -109,6 +109,7 @@
...
@@ -109,6 +109,7 @@
<script
src=
"components/auth/auth_service.js"
></script>
<script
src=
"components/auth/auth_service.js"
></script>
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/dashboard/dashboard_controller.js"
></script>
<script
src=
"components/crud/crud_controller.js"
></script>
<script
src=
"components/crud/crud_controller.js"
></script>
<script
src=
"components/wf/wf_controller.js"
></script>
<script
src=
"components/uitemplates/uitemplates.js"
></script>
<script
src=
"components/uitemplates/uitemplates.js"
></script>
<script
src=
"components/error_pages/error_controller.js"
></script>
<script
src=
"components/error_pages/error_controller.js"
></script>
<script
src=
"components/version/interpolate-filter.js"
></script>
<script
src=
"components/version/interpolate-filter.js"
></script>
...
...
app/main.js
View file @
7d7e4b64
...
@@ -20,6 +20,7 @@ var app = angular.module(
...
@@ -20,6 +20,7 @@ var app = angular.module(
'ulakbus.auth'
,
'ulakbus.auth'
,
'ulakbus.error_pages'
,
'ulakbus.error_pages'
,
'ulakbus.crud'
,
'ulakbus.crud'
,
'ulakbus.wf'
,
'ulakbus.version'
,
'ulakbus.version'
,
//'schemaForm',
//'schemaForm',
'gettext'
,
'gettext'
,
...
...
app/shared/directives.js
View file @
7d7e4b64
...
@@ -33,8 +33,8 @@ app.directive('headerNotification', function ($http, $interval, RESTURL) {
...
@@ -33,8 +33,8 @@ app.directive('headerNotification', function ($http, $interval, RESTURL) {
replace
:
true
,
replace
:
true
,
link
:
function
(
$scope
)
{
link
:
function
(
$scope
)
{
$interval
(
function
()
{
$interval
(
function
()
{
//
todo: change url to backend
//
ignore loading bar here
$http
.
get
(
RESTURL
.
url
+
"notify"
).
success
(
function
(
data
)
{
$http
.
get
(
RESTURL
.
url
+
"notify"
,
{
ignoreLoadingBar
:
true
}
).
success
(
function
(
data
)
{
$scope
.
notifications
=
data
;
$scope
.
notifications
=
data
;
});
});
},
15000
);
},
15000
);
...
@@ -154,9 +154,9 @@ app.directive('sidebar', ['$location', function () {
...
@@ -154,9 +154,9 @@ app.directive('sidebar', ['$location', function () {
// if selecteduser on cookie then add related part to the menu
// if selecteduser on cookie then add related part to the menu
if
(
$cookies
.
get
(
"selectedUserType"
))
{
//
if ($cookies.get("selectedUserType")) {
$scope
.
menuItems
[
$cookies
.
get
(
"selectedUserType"
)]
=
$scope
.
allMenuItems
[
$cookies
.
get
(
"selectedUserType"
)];
//
$scope.menuItems[$cookies.get("selectedUserType")] = $scope.allMenuItems[$cookies.get("selectedUserType")];
}
//
}
$timeout
(
function
(){
sidebarmenu
.
metisMenu
()});
$timeout
(
function
(){
sidebarmenu
.
metisMenu
()});
});
});
...
...
app/shared/templates/directives/header-sub-menu.html
View file @
7d7e4b64
<div
class=
"manager-view-header"
ng-class=
"{hidden: $root.loggedInUser != true}"
>
<div
class=
"manager-view-header"
>
<div
class=
"clearfix"
>
<div
class=
"clearfix"
>
<header-breadcrumb></header-breadcrumb>
<header-breadcrumb></header-breadcrumb>
<loaderdiv><div></div></loaderdiv>
<loaderdiv><div></div></loaderdiv>
...
...
app/shared/templates/directives/sidebar.html
View file @
7d7e4b64
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
</a>
</a>
<ul
class=
"nav nav-second-level"
ng-class=
"{hidden: $root.collapsed}"
>
<ul
class=
"nav nav-second-level"
ng-class=
"{hidden: $root.collapsed}"
>
<li
ng-repeat=
"v in item"
>
<li
ng-repeat=
"v in item"
>
<a
ng-href=
"#{{v.url}}
?{{v.param}}=
{{$root.selectedUser.key}}"
<a
ng-href=
"#{{v.url}}
/{{v.param}}/
{{$root.selectedUser.key}}"
ng-click=
"breadcrumb([key, v.text])"
>
{{v.text}}
</a>
ng-click=
"breadcrumb([key, v.text])"
>
{{v.text}}
</a>
</li>
</li>
</ul>
</ul>
...
...
app/zetalib/forms/form_service.js
View file @
7d7e4b64
...
@@ -9,9 +9,18 @@ var form_generator = angular.module('formService', ['general']);
...
@@ -9,9 +9,18 @@ var form_generator = angular.module('formService', ['general']);
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$timeout
,
RESTURL
,
FormDiff
,
$rootScope
)
{
form_generator
.
factory
(
'Generator'
,
function
(
$http
,
$q
,
$timeout
,
RESTURL
,
FormDiff
,
$rootScope
)
{
var
generator
=
{};
var
generator
=
{};
generator
.
makeUrl
=
function
(
url
)
{
generator
.
make
Post
Url
=
function
(
url
)
{
return
RESTURL
.
url
+
url
;
return
RESTURL
.
url
+
url
;
};
};
generator
.
makeGetUrl
=
function
(
scope
)
{
if
(
scope
.
form_params
.
cmd
===
"list"
)
{
var
getparams
=
""
;
}
if
(
scope
.
form_params
.
cmd
===
"show"
)
{
var
getparams
=
"?"
+
scope
.
form_params
.
param
+
"="
+
scope
.
form_params
.
object_id
;
}
return
RESTURL
.
url
+
scope
.
url
+
scope
.
form_params
.
model
+
getparams
;
};
generator
.
generate
=
function
(
scope
,
data
)
{
generator
.
generate
=
function
(
scope
,
data
)
{
// if no form in response (in case of list and single item request) return scope
// if no form in response (in case of list and single item request) return scope
...
@@ -177,28 +186,25 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -177,28 +186,25 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
};
};
generator
.
get_form
=
function
(
scope
)
{
generator
.
get_form
=
function
(
scope
)
{
return
$http
return
$http
.
post
(
generator
.
makeUrl
(
scope
.
url
),
scope
.
form_params
)
.
post
(
generator
.
make
Post
Url
(
scope
.
url
),
scope
.
form_params
)
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
return
generator
.
generate
(
scope
,
res
.
data
);
return
generator
.
generate
(
scope
,
res
.
data
);
// todo: cover all other exceptions (4xx, 5xx)
});
});
};
};
generator
.
get_list
=
function
(
scope
)
{
generator
.
get_list
=
function
(
scope
)
{
return
$http
return
$http
.
post
(
generator
.
makeUrl
(
scope
.
url
),
scope
.
form_params
)
.
get
(
generator
.
makeGetUrl
(
scope
)
)
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
//generator.dateformatter(res);
//generator.dateformatter(res);
return
res
;
return
res
;
// todo: cover all other exceptions (4xx, 5xx)
});
});
};
};
generator
.
get_single_item
=
function
(
scope
)
{
generator
.
get_single_item
=
function
(
scope
)
{
return
$http
return
$http
.
post
(
generator
.
makeUrl
(
scope
.
url
),
scope
.
form_params
)
.
get
(
generator
.
makeGetUrl
(
scope
)
)
.
then
(
function
(
res
)
{
.
then
(
function
(
res
)
{
//generator.dateformatter(res);
//generator.dateformatter(res);
return
res
;
return
res
;
// todo: cover all other exceptions (4xx, 5xx)
});
});
};
};
generator
.
isValidEmail
=
function
(
email
)
{
generator
.
isValidEmail
=
function
(
email
)
{
...
@@ -254,7 +260,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
...
@@ -254,7 +260,7 @@ form_generator.factory('Generator', function ($http, $q, $timeout, RESTURL, Form
//data.form = get_diff;
//data.form = get_diff;
}
}
return
$http
.
post
(
generator
.
makeUrl
(
$scope
.
url
),
data
);
return
$http
.
post
(
generator
.
make
Post
Url
(
$scope
.
url
),
data
);
//.success(function () {
//.success(function () {
//
//
//})
//})
...
...
app/zetalib/forms/form_service_test.js
View file @
7d7e4b64
...
@@ -17,7 +17,7 @@ describe('form service module', function () {
...
@@ -17,7 +17,7 @@ describe('form service module', function () {
it
(
'should generate url'
,
inject
([
'Generator'
,
it
(
'should generate url'
,
inject
([
'Generator'
,
function
(
Generator
)
{
function
(
Generator
)
{
expect
(
Generator
.
group
).
not
.
toBe
(
null
);
expect
(
Generator
.
group
).
not
.
toBe
(
null
);
var
generated_url
=
Generator
.
makeUrl
(
'test'
);
var
generated_url
=
Generator
.
make
Post
Url
(
'test'
);
expect
(
generated_url
).
toEqual
(
"http://api.ulakbus.net/test"
);
expect
(
generated_url
).
toEqual
(
"http://api.ulakbus.net/test"
);
}])
}])
);
);
...
@@ -168,7 +168,7 @@ describe('form service module', function () {
...
@@ -168,7 +168,7 @@ describe('form service module', function () {
it
(
'should get list'
,
it
(
'should get list'
,
inject
(
function
(
Generator
,
$httpBackend
,
RESTURL
)
{
inject
(
function
(
Generator
,
$httpBackend
,
RESTURL
)
{
$httpBackend
.
expect
POST
(
RESTURL
.
url
+
'test'
,
{
cmd
:
'list'
}
)
$httpBackend
.
expect
GET
(
RESTURL
.
url
+
'test/'
)
.
respond
(
200
,
{
.
respond
(
200
,
{
items
:
{
items
:
{
"client_cmd"
:
"list_objects"
,
"client_cmd"
:
"list_objects"
,
...
@@ -193,8 +193,8 @@ describe('form service module', function () {
...
@@ -193,8 +193,8 @@ describe('form service module', function () {
}
}
});
});
var
cred
=
{
cmd
:
'list'
};
var
cred
=
{
cmd
:
'list'
,
param
:
"personel"
,
object_id
:
"5821bc25a90aa1"
};
Generator
.
get_list
({
url
:
'test'
,
form_params
:
cred
})
Generator
.
get_list
({
url
:
'test
/
'
,
form_params
:
cred
})
.
then
(
function
(
data
)
{
.
then
(
function
(
data
)
{
expect
(
data
.
data
.
items
.
token
).
toEqual
(
"0122b2843f504c15821bc25a90aa1370"
);
expect
(
data
.
data
.
items
.
token
).
toEqual
(
"0122b2843f504c15821bc25a90aa1370"
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment