Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 06233429
authored
Mar 31, 2018
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tested and working
1 parent
a7a7f15f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
10 deletions
code/moya-angular/src/app/components/moya-locale/moya-locale.service.ts
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/UserBeanLocal.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/UserBean.java
code/moya-web/src/main/java/fi/codecrew/moya/rest/v3/LocaleRestViewV3.java
code/moya-angular/src/app/components/moya-locale/moya-locale.service.ts
View file @
0623342
...
...
@@ -28,14 +28,14 @@ export class MoyaLocaleService {
const
locale
=
untypedLocale
as
MoyaLocale
;
if
(
locale
.
userLocale
)
{
if
(
locale
&&
locale
.
userLocale
)
{
return
locale
.
userLocale
;
}
let
cooki
eLocale
=
localStorage
.
getItem
(
LOCALSTORAGE_NAME
);
let
storag
eLocale
=
localStorage
.
getItem
(
LOCALSTORAGE_NAME
);
if
(
cooki
eLocale
)
{
return
cooki
eLocale
;
if
(
storag
eLocale
)
{
return
storag
eLocale
;
}
if
(
locale
.
eventLocale
)
{
...
...
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/UserBeanLocal.java
View file @
0623342
...
...
@@ -47,7 +47,7 @@ public interface UserBeanLocal {
String
getUsersLocale
();
void
setUsersLocale
(
String
locale
);
boolean
setUsersLocale
(
String
locale
);
List
<
EventUser
>
getUsers
();
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/UserBean.java
View file @
0623342
...
...
@@ -189,16 +189,17 @@ public class UserBean implements UserBeanLocal {
}
@Override
public
void
setUsersLocale
(
String
locale
)
{
public
boolean
setUsersLocale
(
String
locale
)
{
if
(
permbean
.
getCurrentUser
().
isAnonymous
())
{
return
;
return
false
;
}
// Attach user to database
User
u
=
userFacade
.
reload
(
permbean
.
getCurrentUser
().
getUser
());
u
.
setLocale
(
locale
);
return
true
;
}
@Override
...
...
code/moya-web/src/main/java/fi/codecrew/moya/rest/v3/LocaleRestViewV3.java
View file @
0623342
...
...
@@ -36,8 +36,10 @@ public class LocaleRestViewV3 {
@POST
@Path
(
"/"
)
public
Response
setCurrentLocale
(
LocalePojoV3
locale
)
{
userBean
.
setUsersLocale
(
locale
.
userLocale
);
if
(
userBean
.
setUsersLocale
(
locale
.
userLocale
))
{
return
Response
.
ok
().
build
();
}
return
Response
.
status
(
420
).
build
();
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment