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
b66cd988
Commit
b66cd988
authored
Dec 15, 2015
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more than one same linked model on same form
parent
299b8a16
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
56 deletions
+40
-56
auth_service.js
app/components/auth/auth_service.js
+3
-30
foreignKey.html
app/shared/templates/foreignKey.html
+2
-2
form_service.js
app/zetalib/form_service.js
+3
-3
form_service_test.js
app/zetalib/form_service_test.js
+32
-21
No files found.
app/components/auth/auth_service.js
View file @
b66cd988
...
@@ -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,45 +29,18 @@ auth.factory('LoginService', function ($http, $rootScope, $location, $log, Sessi
...
@@ -29,45 +29,18 @@ 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
);
};
};
return
loginService
;
return
loginService
;
});
// 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/shared/templates/foreignKey.html
View file @
b66cd988
...
@@ -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"
>
...
...
app/zetalib/form_service.js
View file @
b66cd988
...
@@ -282,12 +282,12 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -282,12 +282,12 @@ angular.module('formService', ['ui.bootstrap'])
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 +302,7 @@ angular.module('formService', ['ui.bootstrap'])
...
@@ -302,7 +302,7 @@ 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
,
model_name
:
v
.
model_name
,
model_name
:
v
.
model_name
,
selected_item
:
{},
selected_item
:
{},
titleMap
:
[],
titleMap
:
[],
...
...
app/zetalib/form_service_test.js
View file @
b66cd988
...
@@ -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