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
62f3f75d
Commit
62f3f75d
authored
Dec 16, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/issue7'
parents
299b8a16
169cf02a
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
208 additions
and
80 deletions
+208
-80
app.css
app/app.css
+1
-1
auth_service.js
app/components/auth/auth_service.js
+3
-30
crud_controller.js
app/components/crud/crud_controller.js
+2
-1
dashboard.html
app/components/dashboard/dashboard.html
+13
-4
dashboard_controller.js
app/components/dashboard/dashboard_controller.js
+17
-2
user-info.html
app/components/dashboard/user-info.html
+24
-0
foreignKey.html
app/shared/templates/foreignKey.html
+4
-5
form_service.js
app/zetalib/form_service.js
+112
-16
form_service_test.js
app/zetalib/form_service_test.js
+32
-21
No files found.
app/app.css
View file @
62f3f75d
...
@@ -1071,7 +1071,7 @@ table.dataTable thead .sorting:after {
...
@@ -1071,7 +1071,7 @@ table.dataTable thead .sorting:after {
margin-right
:
-5px
;
margin-right
:
-5px
;
}
}
.
dashboard-main-search
.fa
{
.
bordered-fa-icon
{
padding
:
10px
15px
;
padding
:
10px
15px
;
border
:
1px
solid
#e0e0e0
;
border
:
1px
solid
#e0e0e0
;
border-bottom-right-radius
:
3px
;
border-bottom-right-radius
:
3px
;
...
...
app/components/auth/auth_service.js
View file @
62f3f75d
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
// TODO: login url change with correct one
// TODO: login url change with correct one
auth
.
factory
(
'LoginService'
,
function
(
$http
,
$rootScope
,
$location
,
$log
,
Session
,
RESTURL
)
{
auth
.
factory
(
'LoginService'
,
function
(
$http
,
$rootScope
,
$location
,
$log
,
RESTURL
)
{
var
loginService
=
{};
var
loginService
=
{};
loginService
.
login
=
function
(
url
,
credentials
)
{
loginService
.
login
=
function
(
url
,
credentials
)
{
...
@@ -29,26 +29,14 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, Sessi
...
@@ -29,26 +29,14 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, Sessi
};
};
loginService
.
logout
=
function
()
{
loginService
.
logout
=
function
()
{
$log
.
info
(
"logout"
);
$log
.
debug
(
"logout"
);
return
$http
.
post
(
RESTURL
.
url
+
'logout'
,
{}).
success
(
function
(
data
)
{
return
$http
.
post
(
RESTURL
.
url
+
'logout'
,
{}).
success
(
function
(
data
)
{
$rootScope
.
loggedInUser
=
false
;
$rootScope
.
loggedInUser
=
false
;
$log
.
info
(
"loggedout"
);
$log
.
debug
(
"loggedout"
);
$location
.
path
(
"/login"
);
$location
.
path
(
"/login"
);
});
});
};
};
loginService
.
isAuthenticated
=
function
()
{
return
!!
Session
.
userId
;
};
loginService
.
isAuthorized
=
function
(
authorizedRoles
)
{
if
(
!
angular
.
isArray
(
authorizedRoles
))
{
authorizedRoles
=
[
authorizedRoles
];
}
return
(
loginService
.
isAuthenticated
()
&&
loginService
.
indexOf
(
Session
.
userRole
)
!==
-
1
);
};
loginService
.
isValidEmail
=
function
(
email
)
{
loginService
.
isValidEmail
=
function
(
email
)
{
var
re
=
/^
([\w
-
]
+
(?:\.[\w
-
]
+
)
*
)
@
((?:[\w
-
]
+
\.)
*
\w[\w
-
]{0,66})\.([
a-z
]{2,6}(?:\.[
a-z
]{2})?)
$/i
;
var
re
=
/^
([\w
-
]
+
(?:\.[\w
-
]
+
)
*
)
@
((?:[\w
-
]
+
\.)
*
\w[\w
-
]{0,66})\.([
a-z
]{2,6}(?:\.[
a-z
]{2})?)
$/i
;
return
re
.
test
(
email
);
return
re
.
test
(
email
);
...
@@ -56,18 +44,3 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, Sessi
...
@@ -56,18 +44,3 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, Sessi
return
loginService
;
return
loginService
;
});
});
\ No newline at end of file
// TODO: initial service not working!!
auth
.
service
(
'Session'
,
function
()
{
this
.
create
=
function
(
sessionId
,
userId
,
userRole
)
{
this
.
id
=
sessionId
;
this
.
userId
=
userId
;
this
.
userRole
=
userRole
;
};
this
.
destroy
=
function
()
{
this
.
id
=
null
;
this
.
userId
=
null
;
this
.
userRole
=
null
;
};
});
\ No newline at end of file
app/components/crud/crud_controller.js
View file @
62f3f75d
...
@@ -173,7 +173,8 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
...
@@ -173,7 +173,8 @@ angular.module('ulakbus.crud', ['ui.bootstrap', 'schemaForm', 'formService'])
};
};
$scope
.
do_action
=
function
(
key
,
todo
)
{
$scope
.
do_action
=
function
(
key
,
todo
)
{
Generator
.
doItemAction
(
$scope
,
key
,
todo
.
cmd
,
todo
.
wf
,
todo
.
mode
||
'normal'
);
//Generator.doItemAction($scope, key, todo.cmd, todo.wf, todo.mode || 'normal');
Generator
.
doItemAction
(
$scope
,
key
,
todo
,
todo
.
mode
||
'normal'
);
};
};
$scope
.
getNumber
=
function
(
num
)
{
$scope
.
getNumber
=
function
(
num
)
{
...
...
app/components/dashboard/dashboard.html
View file @
62f3f75d
...
@@ -7,12 +7,16 @@
...
@@ -7,12 +7,16 @@
<div
class=
"text-center"
>
<div
class=
"text-center"
>
<h3>
ÖĞRENCİ
</h3>
<h3>
ÖĞRENCİ
</h3>
<input
type=
"text"
placeholder=
"Öğrenci ara"
ng-model=
"student_kw"
ng-keyup=
"search('ogrenci')"
>
<input
type=
"text"
placeholder=
"Öğrenci ara"
ng-model=
"student_kw"
ng-keyup=
"search('ogrenci')"
>
<span
class=
"fa fa-search"
ng-click=
"search('ogrenci')"
></span>
<span
class=
"
bordered-fa-icon
fa fa-search"
ng-click=
"search('ogrenci')"
></span>
</div>
</div>
<div
class=
"dashboard-search-results"
>
<div
class=
"dashboard-search-results"
>
<ul
ng-if=
"students.length > 0"
>
<ul
ng-if=
"students.length > 0"
>
<li
ng-repeat=
"student in students"
>
<li
ng-repeat=
"student in students"
>
<a
role=
"button"
ng-click=
"select(student, 'ogrenci')"
>
{{student[0]}}
</a>
<a
role=
"button"
>
<span
ng-click=
"select(student, 'ogrenci')"
>
{{student[0]}}
</span>
<i
class=
"fa fa-fw fa-info-circle pull-right"
popover-placement=
"bottom"
uib-popover-template=
"userPopover.templateUrl"
ng-click=
"get_info('Ogrenci', student[2])"
></i></a>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
@@ -24,12 +28,17 @@
...
@@ -24,12 +28,17 @@
<div
class=
"text-center"
>
<div
class=
"text-center"
>
<h3>
PERSONEL
</h3>
<h3>
PERSONEL
</h3>
<input
type=
"text"
placeholder=
"Personel ara"
ng-model=
"staff_kw"
ng-keyup=
"search('personel')"
>
<input
type=
"text"
placeholder=
"Personel ara"
ng-model=
"staff_kw"
ng-keyup=
"search('personel')"
>
<span
class=
"fa fa-search"
ng-click=
"search('personel')"
></span>
<span
class=
"
bordered-fa-icon
fa fa-search"
ng-click=
"search('personel')"
></span>
</div>
</div>
<div
class=
"dashboard-search-results"
>
<div
class=
"dashboard-search-results"
>
<ul
ng-if=
"staffs.length > 0"
>
<ul
ng-if=
"staffs.length > 0"
>
<li
ng-repeat=
"staff in staffs"
>
<li
ng-repeat=
"staff in staffs"
>
<a
role=
"button"
ng-click=
"select(staff, 'personel')"
>
{{staff[0]}}
</a>
<a
role=
"button"
>
<span
ng-click=
"select(staff, 'personel')"
>
{{staff[0]}}
</span>
<i
class=
"fa fa-fw fa-info-circle pull-right"
popover-placement=
"bottom"
uib-popover-template=
"userPopover.templateUrl"
ng-click=
"get_info('Personel', staff[2])"
></i></a>
</li>
</li>
</ul>
</ul>
</div>
</div>
...
...
app/components/dashboard/dashboard_controller.js
View file @
62f3f75d
...
@@ -8,9 +8,12 @@
...
@@ -8,9 +8,12 @@
'use strict'
;
'use strict'
;
angular
.
module
(
'ulakbus.dashboard'
,
[
'ngRoute'
])
angular
.
module
(
'ulakbus.dashboard'
,
[])
.
config
(
function
(
$uibTooltipProvider
)
{
$uibTooltipProvider
.
setTriggers
({
'click'
:
'mouseleave'
});
})
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
$timeout
,
$http
,
$cookies
,
RESTURL
)
{
.
controller
(
'DashCtrl'
,
function
(
$scope
,
$rootScope
,
$timeout
,
$http
,
$cookies
,
RESTURL
,
Generator
)
{
$scope
.
section
=
function
(
section_index
)
{
$scope
.
section
=
function
(
section_index
)
{
$rootScope
.
section
=
section_index
;
$rootScope
.
section
=
section_index
;
};
};
...
@@ -50,6 +53,18 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
...
@@ -50,6 +53,18 @@ angular.module('ulakbus.dashboard', ['ngRoute'])
return
$http
.
get
(
RESTURL
.
url
+
'ara/'
+
where
+
'/'
+
what
);
return
$http
.
get
(
RESTURL
.
url
+
'ara/'
+
where
+
'/'
+
what
);
};
};
$scope
.
userPopover
=
{
templateUrl
:
'components/dashboard/user-info.html'
};
$scope
.
get_info
=
function
(
type
,
key
)
{
Generator
.
get_list
({
url
:
'crud'
,
form_params
:
{
model
:
type
,
object_id
:
key
,
cmd
:
'show'
}})
.
then
(
function
(
data
)
{
$scope
.
userPopover
.
name
=
data
.
data
.
object
.
unicode
;
$scope
.
userPopover
.
tcno
=
data
.
data
.
object
.
tckn
;
//debugger;
})
};
$scope
.
select
=
function
(
who
,
type
)
{
$scope
.
select
=
function
(
who
,
type
)
{
$rootScope
.
$broadcast
(
'selectedUser'
,
{
name
:
who
[
0
],
tcno
:
who
[
1
],
key
:
who
[
2
]});
$rootScope
.
$broadcast
(
'selectedUser'
,
{
name
:
who
[
0
],
tcno
:
who
[
1
],
key
:
who
[
2
]});
// get 'who's related transactions and manipulate sidebar menu
// get 'who's related transactions and manipulate sidebar menu
...
...
app/components/dashboard/user-info.html
0 → 100644
View file @
62f3f75d
<div
style=
"width:400px;"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<img
src=
"img/sample-profile-pic.jpg"
alt=
"{{userPopover.name}}"
class=
"img-thumbnail"
>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<table
class=
"table table-condensed"
>
<tbody>
<tr>
<td>
Ad Soyad:
</td>
<td>
{{userPopover.name}}
</td>
</tr>
<tr>
<td>
TC Kimlik No:
</td>
<td>
{{userPopover.tcno}}
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
\ No newline at end of file
app/shared/templates/foreignKey.html
View file @
62f3f75d
<div
class=
"form-group {{form.htmlClass}} schema-form-select col-md-12"
<div
class=
"form-group {{form.htmlClass}} schema-form-select col-md-12"
ng-class=
"{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}"
>
ng-class=
"{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}"
>
<div
class=
"col-md-12"
>
<label
class=
"control-label {{form.labelHtmlClass}}"
ng-show=
"showTitle()"
>
<label
class=
"control-label {{form.labelHtmlClass}}"
ng-show=
"showTitle()"
>
{{form.title}}
{{form.title}}
</label>
</label>
<a
role=
"button"
><i
class=
"fa fa-plus-circle fa-fw"
add-modal-for-linked-model=
"{{form.formName}}"
></i></a>
<button
class=
"btn btn-default"
>
Ekle
<i
class=
"fa fa-plus-circle fa-fw"
add-modal-for-linked-model=
"{{form.formName}}"
></i></button>
<div
class=
"form-group input-group"
>
<div
class=
"form-group input-group"
>
<span
class=
"input-group-btn"
>
<span
class=
"input-group-btn"
>
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<ul
class=
"dropdown-menu"
>
<ul
class=
"dropdown-menu"
>
<li
class=
"text-center"
ng-if=
"form.gettingTitleMap"
><a><span
class=
"loader"
></span></a></li>
<li
class=
"text-center"
ng-if=
"form.gettingTitleMap"
><a><span
class=
"loader"
></span></a></li>
<li
ng-repeat=
"item in form.titleMap"
>
<li
ng-repeat=
"item in form.titleMap"
>
<a
ng-click=
"form.onDropdownSelect(item, form.
model_
name)"
>
{{item
<a
ng-click=
"form.onDropdownSelect(item, form.name)"
>
{{item
.name}}
</a>
.name}}
</a>
</li>
</li>
</ul>
</ul>
...
@@ -32,7 +32,7 @@
...
@@ -32,7 +32,7 @@
sf-changed=
"form"
sf-changed=
"form"
class=
"form-control {{form.fieldHtmlClass}}"
class=
"form-control {{form.fieldHtmlClass}}"
schema-validate=
"form"
schema-validate=
"form"
name=
"{{form.
model_
name}}"
/>
name=
"{{form.name}}"
/>
</div>
</div>
<div
ng-show=
"loadingTitleMap"
class=
"loader"
></div>
<div
ng-show=
"loadingTitleMap"
class=
"loader"
></div>
<div
ng-show=
"noResults"
>
<div
ng-show=
"noResults"
>
...
@@ -51,5 +51,4 @@
...
@@ -51,5 +51,4 @@
<!--</select>-->
<!--</select>-->
<div
class=
"help-block"
sf-message=
"form.description"
></div>
<div
class=
"help-block"
sf-message=
"form.description"
></div>
</div>
</div>
</div>
\ No newline at end of file
app/zetalib/form_service.js
View file @
62f3f75d
...
@@ -75,13 +75,101 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -75,13 +75,101 @@ angular.module('formService', ['ui.bootstrap'])
};
};
/**
/**
* @name group
* @name group
* @param
formObject
* @param
scope
* @description
* @description
* group function to group form layout by form meta data for layout
* group function to group form layout by form meta data for layout
*
* grouping will use an object like below when parsing its items:
*
* grouping = [
* {
* "groups": [
* {
* "group_title": "title1",
* "items": ["item1", "item2", "item3", "item4"],
* }
* ],
* "layout": "4",
* "collapse": False
* },
* {
* "groups": [
* {
* "group_title": "title2",
* "items": ["item5", "item6"],
* }
* ],
* "layout": "2",
* "collapse": False
* }]
*
* @returns {object}
* @returns {object}
*/
*/
generator
.
group
=
function
(
formObject
)
{
generator
.
group
=
function
(
scope
)
{
return
formObject
;
if
(
!
scope
.
grouping
)
{
return
scope
;}
var
newForm
=
[];
var
extractFormItem
=
function
(
itemList
)
{
var
extractedList
=
[];
angular
.
forEach
(
itemList
,
function
(
value
,
key
)
{
var
item
=
getFormItem
(
value
);
if
(
item
)
{
extractedList
.
push
(
item
);}
});
$log
.
debug
(
'extractedList: '
,
extractedList
);
return
extractedList
;
};
var
getFormItem
=
function
(
item
)
{
var
formItem
;
if
(
scope
.
form
.
indexOf
(
item
)
>
-
1
)
{
formItem
=
scope
.
form
[
scope
.
form
.
indexOf
(
item
)];
scope
.
form
.
splice
(
scope
.
form
.
indexOf
(
item
),
1
);
return
formItem
;
}
else
{
angular
.
forEach
(
scope
.
form
,
function
(
value
,
key
)
{
if
(
value
.
key
===
item
)
{
formItem
=
value
;
scope
.
form
.
splice
(
key
,
1
);
return
;
}
});
return
formItem
;
}
};
var
makeGroup
=
function
(
itemsToGroup
)
{
var
subItems
=
[];
angular
.
forEach
(
itemsToGroup
,
function
(
value
,
key
)
{
subItems
.
push
({
type
:
'fieldset'
,
items
:
extractFormItem
(
value
.
items
),
title
:
value
.
group_title
});
});
return
subItems
;
};
angular
.
forEach
(
scope
.
grouping
,
function
(
value
,
key
)
{
newForm
.
push
(
{
type
:
'fieldset'
,
items
:
makeGroup
(
value
.
groups
),
htmlClass
:
'col-md-'
+
value
.
layout
,
title
:
value
.
group_title
}
)
});
$log
.
debug
(
'grouped form: '
,
newForm
);
$log
.
debug
(
'rest of form: '
,
scope
.
form
);
$log
.
debug
(
'form united: '
,
newForm
.
concat
(
scope
.
form
));
scope
.
form
=
newForm
.
concat
(
scope
.
form
);
return
scope
;
};
};
/**
/**
* @name prepareFormItems
* @name prepareFormItems
...
@@ -277,17 +365,20 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -277,17 +365,20 @@ angular.module('formService', ['ui.bootstrap'])
// get selected item from titleMap using model value
// get selected item from titleMap using model value
if
(
scope
.
model
[
k
])
{
if
(
scope
.
model
[
k
])
{
generator
.
get_list
({
url
:
'crud'
,
form_params
:
{
model
:
v
.
model_name
,
object_id
:
scope
.
model
[
k
],
cmd
:
'show'
}})
generator
.
get_list
({
url
:
'crud'
,
form_params
:
{
model
:
v
.
model_name
,
object_id
:
scope
.
model
[
k
],
cmd
:
'show'
}
})
.
then
(
function
(
data
)
{
.
then
(
function
(
data
)
{
try
{
try
{
scope
.
$watch
(
document
.
querySelector
(
'input[name='
+
v
.
model_name
+
']'
),
scope
.
$watch
(
document
.
querySelector
(
'input[name='
+
v
.
model_name
+
']'
),
function
()
{
function
()
{
angular
.
element
(
document
.
querySelector
(
'input[name='
+
v
.
model_name
+
']'
)).
val
(
data
.
data
.
object
.
unicode
);
angular
.
element
(
document
.
querySelector
(
'input[name='
+
k
+
']'
)).
val
(
data
.
data
.
object
.
unicode
);
}
}
);
);
}
}
catch
(
e
)
{
catch
(
e
)
{
angular
.
element
(
document
.
querySelector
(
'input[name='
+
v
.
model_name
+
']'
)).
val
(
data
.
data
.
object
.
unicode
);
angular
.
element
(
document
.
querySelector
(
'input[name='
+
k
+
']'
)).
val
(
data
.
data
.
object
.
unicode
);
$log
.
debug
(
'exception'
,
e
);
$log
.
debug
(
'exception'
,
e
);
}
}
...
@@ -302,7 +393,8 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -302,7 +393,8 @@ angular.module('formService', ['ui.bootstrap'])
title
:
v
.
title
,
title
:
v
.
title
,
wf
:
v
.
wf
,
wf
:
v
.
wf
,
add_cmd
:
v
.
add_cmd
,
add_cmd
:
v
.
add_cmd
,
name
:
v
.
model_name
,
name
:
k
,
key
:
k
,
model_name
:
v
.
model_name
,
model_name
:
v
.
model_name
,
selected_item
:
{},
selected_item
:
{},
titleMap
:
[],
titleMap
:
[],
...
@@ -493,7 +585,7 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -493,7 +585,7 @@ angular.module('formService', ['ui.bootstrap'])
});
});
$log
.
debug
(
'scope at after prepareformitems'
,
scope
);
$log
.
debug
(
'scope at after prepareformitems'
,
scope
);
return
scope
;
return
generator
.
group
(
scope
)
;
};
};
/**
/**
* dateformatter handles all date fields and returns humanized and jquery datepicker format dates
* dateformatter handles all date fields and returns humanized and jquery datepicker format dates
...
@@ -510,22 +602,26 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -510,22 +602,26 @@ angular.module('formService', ['ui.bootstrap'])
return
newdatearray
.
join
(
'.'
);
return
newdatearray
.
join
(
'.'
);
}
}
};
};
generator
.
doItemAction
=
function
(
$scope
,
key
,
cmd
,
wf
,
mode
)
{
generator
.
doItemAction
=
function
(
$scope
,
key
,
todo
,
mode
)
{
// mode could be in ['normal', 'modal', 'new'] . the default mode is 'normal' and it loads data on same
// mode could be in ['normal', 'modal', 'new'] . the default mode is 'normal' and it loads data on same
// tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
// tab without modal. 'modal' will use modal to manipulate data and do all actions in that modal. 'new'
// will be open new page with response data
// will be open new page with response data
var
_do
=
{
var
_do
=
{
normal
:
function
()
{
normal
:
function
()
{
$log
.
debug
(
'normal mode starts'
);
$log
.
debug
(
'normal mode starts'
);
$scope
.
form_params
.
cmd
=
cmd
;
$scope
.
form_params
.
cmd
=
todo
.
cmd
;
if
(
wf
)
{
if
(
todo
.
wf
)
{
$scope
.
url
=
wf
;
$scope
.
url
=
todo
.
wf
;
$scope
.
form_params
.
wf
=
wf
;
$scope
.
form_params
.
wf
=
todo
.
wf
;
delete
$scope
.
token
;
delete
$scope
.
token
;
delete
$scope
.
form_params
.
model
;
delete
$scope
.
form_params
.
model
;
delete
$scope
.
form_params
.
cmd
delete
$scope
.
form_params
.
cmd
}
}
if
(
todo
.
object_key
)
{
$scope
.
form_params
[
todo
.
object_key
]
=
key
;
}
else
{
$scope
.
form_params
.
object_id
=
key
;
$scope
.
form_params
.
object_id
=
key
;
}
$scope
.
form_params
.
param
=
$scope
.
param
;
$scope
.
form_params
.
param
=
$scope
.
param
;
$scope
.
form_params
.
id
=
$scope
.
param_id
;
$scope
.
form_params
.
id
=
$scope
.
param_id
;
$scope
.
form_params
.
token
=
$scope
.
token
;
$scope
.
form_params
.
token
=
$scope
.
token
;
...
...
app/zetalib/form_service_test.js
View file @
62f3f75d
...
@@ -78,16 +78,34 @@ describe('form service module', function () {
...
@@ -78,16 +78,34 @@ describe('form service module', function () {
it
(
'should generate function returns when no forms'
,
inject
[
'Generator'
,
it
(
'should generate function returns when no forms'
,
inject
[
'Generator'
,
function
(
Generator
)
{
function
(
Generator
)
{
var
responseData
=
Generator
.
generate
({
testkey
:
'testvalue'
},
{
form
:{}});
var
responseData
=
Generator
.
generate
({
testkey
:
'testvalue'
},
{
form
:
{}});
expect
(
responseData
=
{
testkey
:
'testvalue'
});
expect
(
responseData
=
{
testkey
:
'testvalue'
});
}]
}]
);
);
it
(
'should prepare form items'
,
inject
(
[
'Generator'
,
it
(
'should prepare form items'
,
inject
(
function
(
Generator
)
{
function
(
Generator
,
$httpBackend
,
RESTURL
)
{
expect
(
Generator
.
prepareFormItems
).
not
.
toBe
(
null
);
expect
(
Generator
.
prepareFormItems
).
not
.
toBe
(
null
);
$httpBackend
.
expectPOST
(
RESTURL
.
url
+
'test'
,
{
cmd
:
'list'
,
model
:
"personel"
,
object_id
:
"5821bc25a90aa1"
})
.
respond
(
200
,
{
items
:
{
"client_cmd"
:
"list_objects"
,
"is_login"
:
true
,
"objects"
:
[
[
"Ad
\
u0131"
,
"Soyad
\
u0131"
,
"TC No"
,
"Durum"
],
[
"4MsKRH9435cdKOzKCITNPml5bhB"
,
"firstname"
,
"lastname"
,
"dksoap"
,
false
]
],
"token"
:
"0122b2843f504c15821bc25a90aa1370"
}
});
var
scope
=
{
var
scope
=
{
wf
:
'test'
,
form
:
[
'email'
,
'id'
,
'name'
,
'save'
,
'select'
,
'date'
,
'date2'
,
'text_general'
,
'model'
,
'node'
,
'listnode'
],
form
:
[
'email'
,
'id'
,
'name'
,
'save'
,
'select'
,
'date'
,
'date2'
,
'text_general'
,
'model'
,
'node'
,
'listnode'
],
schema
:
{
schema
:
{
properties
:
{
properties
:
{
...
@@ -99,9 +117,14 @@ describe('form service module', function () {
...
@@ -99,9 +117,14 @@ describe('form service module', function () {
date
:
{
title
:
'date'
,
type
:
'date'
},
date
:
{
title
:
'date'
,
type
:
'date'
},
date2
:
{
title
:
'date'
,
type
:
'date'
},
date2
:
{
title
:
'date'
,
type
:
'date'
},
text_general
:
{
title
:
'text_general'
,
type
:
'text_general'
},
text_general
:
{
title
:
'text_general'
,
type
:
'text_general'
},
model
:
{
title
:
'model'
,
type
:
'model'
},
model
:
{
title
:
'model'
,
type
:
'model'
,
model_name
:
'modelfield'
,
list_cmd
:
'list'
},
node
:
{
title
:
'Node'
,
type
:
'Node'
},
node
:
{
title
:
'Node'
,
type
:
'Node'
},
listnode
:
{
title
:
'ListNode'
,
type
:
'ListNode'
,
widget
:
'filter_interface'
,
schema
:
[{
'name'
:
'testname'
}]}
listnode
:
{
title
:
'ListNode'
,
type
:
'ListNode'
,
widget
:
'filter_interface'
,
schema
:
[{
'name'
:
'testname'
}]
}
},
required
:
[],
type
:
'object'
,
title
:
'servicetest'
},
required
:
[],
type
:
'object'
,
title
:
'servicetest'
},
},
model
:
{
model
:
{
...
@@ -118,24 +141,12 @@ describe('form service module', function () {
...
@@ -118,24 +141,12 @@ describe('form service module', function () {
form_params
:
{
param
:
'id'
,
param_id
:
'123'
}
form_params
:
{
param
:
'id'
,
param_id
:
'123'
}
};
};
var
form_json
=
{
form
:
[
'email'
,
'id'
,
'name'
],
schema
:
{
properties
:
{
email
:
{
title
:
'email'
,
type
:
'email'
},
id
:
{
title
:
'id'
,
type
:
'number'
},
name
:
{
title
:
'name'
,
type
:
'string'
}
},
required
:
[],
type
:
'object'
,
title
:
'servicetest'
},
model
:
{
email
:
'test@test.com'
,
id
:
2
,
name
:
'travolta'
},
form_params
:
{}
};
var
form_generated
=
Generator
.
prepareFormItems
(
scope
);
var
form_generated
=
Generator
.
prepareFormItems
(
scope
);
expect
(
form_generated
.
form
).
toBeDefined
();
expect
(
form_generated
.
form
).
toBeDefined
();
}])
expect
(
form_generated
.
form
[
7
].
type
).
toEqual
(
'template'
)
})
);
);
it
(
'should format date'
,
inject
([
'Generator'
,
it
(
'should format date'
,
inject
([
'Generator'
,
...
@@ -472,8 +483,8 @@ describe('form service module', function () {
...
@@ -472,8 +483,8 @@ describe('form service module', function () {
it
(
'should return diff array'
,
it
(
'should return diff array'
,
inject
(
function
(
Generator
)
{
inject
(
function
(
Generator
)
{
var
diff
=
Generator
.
get_diff_array
([
1
,
2
,
3
],
[
2
]);
var
diff
=
Generator
.
get_diff_array
([
1
,
2
,
3
],
[
2
]);
expect
(
diff
).
toEqual
([
1
,
3
]);
expect
(
diff
).
toEqual
([
1
,
3
]);
})
})
)
)
...
...
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