Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RLG Maker
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Romain DELEAU
RLG Maker
Commits
2d53dd1f
Commit
2d53dd1f
authored
Dec 08, 2023
by
Romain DELEAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy role
parent
163aa336
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
119 additions
and
5 deletions
+119
-5
app.module.ts
src/app/app.module.ts
+3
-1
copy-role-success.component.html
...ckbars/copy-role-success/copy-role-success.component.html
+1
-0
copy-role-success.component.scss
...ckbars/copy-role-success/copy-role-success.component.scss
+6
-0
copy-role-success.component.spec.ts
...ars/copy-role-success/copy-role-success.component.spec.ts
+23
-0
copy-role-success.component.ts
...nackbars/copy-role-success/copy-role-success.component.ts
+15
-0
role.component.html
src/app/pieces/role/role.component.html
+7
-1
role.component.ts
src/app/pieces/role/role.component.ts
+27
-3
copy-role.service.spec.ts
src/app/services/copyRole/copy-role.service.spec.ts
+16
-0
copy-role.service.ts
src/app/services/copyRole/copy-role.service.ts
+15
-0
en.json
src/assets/lang/en.json
+3
-0
fr.json
src/assets/lang/fr.json
+3
-0
No files found.
src/app/app.module.ts
View file @
2d53dd1f
...
...
@@ -51,6 +51,7 @@ import { FinishTutorialComponent } from './components/snackbars/finish-tutorial/
import
{
VerifyGameFailSnackbarComponent
}
from
'./components/snackbars/verify-game-fail-snackbar/verify-game-fail-snackbar.component'
;
import
{
VerifyDialogComponent
}
from
'./components/dialogs/verify-dialog/verify-dialog.component'
;
import
{
RoleNameDuplicateComponent
}
from
'./components/snackbars/role-name-duplicate/role-name-duplicate.component'
;
import
{
CopyRoleSuccessComponent
}
from
'./components/snackbars/copy-role-success/copy-role-success.component'
;
export
function
HttpLoaderFactory
(
http
:
HttpClient
)
{
return
new
TranslateHttpLoader
(
http
);
...
...
@@ -93,7 +94,8 @@ export function HttpLoaderFactory(http: HttpClient) {
FinishTutorialComponent
,
VerifyGameFailSnackbarComponent
,
VerifyDialogComponent
,
RoleNameDuplicateComponent
RoleNameDuplicateComponent
,
CopyRoleSuccessComponent
],
imports
:
[
BrowserModule
,
...
...
src/app/components/snackbars/copy-role-success/copy-role-success.component.html
0 → 100644
View file @
2d53dd1f
<span
matSnackBarLabel
>
{{'role_copy_snackbar' | translate}}
</span>
\ No newline at end of file
src/app/components/snackbars/copy-role-success/copy-role-success.component.scss
0 → 100644
View file @
2d53dd1f
::ng-deep
.mat-snack-bar-container
{
background-color
:
#1ba345
;
color
:
white
;
box-shadow
:
0px
0px
15px
5px
#1ba345
;
text-align
:
center
;
}
\ No newline at end of file
src/app/components/snackbars/copy-role-success/copy-role-success.component.spec.ts
0 → 100644
View file @
2d53dd1f
import
{
ComponentFixture
,
TestBed
}
from
'@angular/core/testing'
;
import
{
CopyRoleSuccessComponent
}
from
'./copy-role-success.component'
;
describe
(
'CopyRoleSuccessComponent'
,
()
=>
{
let
component
:
CopyRoleSuccessComponent
;
let
fixture
:
ComponentFixture
<
CopyRoleSuccessComponent
>
;
beforeEach
(
async
()
=>
{
await
TestBed
.
configureTestingModule
({
declarations
:
[
CopyRoleSuccessComponent
]
})
.
compileComponents
();
fixture
=
TestBed
.
createComponent
(
CopyRoleSuccessComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'should create'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
src/app/components/snackbars/copy-role-success/copy-role-success.component.ts
0 → 100644
View file @
2d53dd1f
import
{
Component
,
OnInit
}
from
'@angular/core'
;
@
Component
({
selector
:
'app-copy-role-success'
,
templateUrl
:
'./copy-role-success.component.html'
,
styleUrls
:
[
'./copy-role-success.component.scss'
]
})
export
class
CopyRoleSuccessComponent
implements
OnInit
{
constructor
()
{
}
ngOnInit
():
void
{
}
}
src/app/pieces/role/role.component.html
View file @
2d53dd1f
...
...
@@ -10,6 +10,12 @@ matTooltipPosition="left" [matTooltipDisabled]="!tooltipService.activatedTooltip
<mat-icon
fontIcon=
"add"
(
click
)="
onClickAdd
()"
[
matTooltip
]="
translate
.
instant
('
role_add_tooltip
')"
matTooltipPosition=
"above"
[
matTooltipDisabled
]="!
tooltipService
.
activatedTooltips
"
></mat-icon>
<mat-icon
fontIcon=
"content_copy"
(
click
)="
onClickCopy
()"
[
matTooltip
]="
translate
.
instant
('
role_copy_tooltip
')"
matTooltipPosition=
"above"
[
matTooltipDisabled
]="!
tooltipService
.
activatedTooltips
"
></mat-icon>
<mat-icon
fontIcon=
"content_paste"
(
click
)="
onClickPaste
()"
*
ngIf=
"copyRoleService.role && mission != copyRoleService.mission"
[
matTooltip
]="
translate
.
instant
('
role_paste_tooltip
')"
matTooltipPosition=
"above"
[
matTooltipDisabled
]="!
tooltipService
.
activatedTooltips
"
></mat-icon>
<mat-icon
fontIcon=
"backspace"
(
click
)="
onClickErase
()"
[
matTooltip
]="
translate
.
instant
('
clearPiece_tooltip
')"
matTooltipPosition=
"above"
[
matTooltipDisabled
]="!
tooltipService
.
activatedTooltips
"
></mat-icon>
...
...
@@ -25,7 +31,7 @@ matTooltipPosition="left" [matTooltipDisabled]="!tooltipService.activatedTooltip
<img
src=
"./assets/background-images/role2_opacity0.png"
draggable=
"false"
*
ngIf=
"i == 1"
/>
<div
class=
"piece-form-intitule"
>
<label
for=
"intitule"
>
{{'role_intitule_label' | translate}}
</label>
<input
name=
"intitule"
type=
"text"
[(
ngModel
)]="
role
.
intitule
"
(
change
)="
changeIntitule
($
event
)
;
validTutorialPhase4
();"
[
placeholder
]="
translate
.
instant
('
role_intitule_placeholder
')"
<input
name=
"intitule"
type=
"text"
[(
ngModel
)]="
role
.
intitule
"
(
change
)="
intituleIsAlreadyUsed
();
editTrace
($
event
,
'
name
');
;
validTutorialPhase4
();"
[
placeholder
]="
translate
.
instant
('
role_intitule_placeholder
')"
[
matTooltip
]="
translate
.
instant
('
role_intitule_tooltip
')"
matTooltipPosition=
"above"
[
matTooltipDisabled
]="!
tooltipService
.
activatedTooltips
"
/>
</div>
...
...
src/app/pieces/role/role.component.ts
View file @
2d53dd1f
...
...
@@ -23,6 +23,9 @@ import { TranslateService } from '@ngx-translate/core';
import
{
TutorialService
}
from
'src/app/services/tutorial/tutorial.service'
;
import
{
MatSnackBar
}
from
'@angular/material/snack-bar'
;
import
{
RoleNameDuplicateComponent
}
from
'src/app/components/snackbars/role-name-duplicate/role-name-duplicate.component'
;
import
{
CopyRoleService
}
from
'src/app/services/copyRole/copy-role.service'
;
import
{
Task
}
from
'src/app/class/task/task'
;
import
{
CopyRoleSuccessComponent
}
from
'src/app/components/snackbars/copy-role-success/copy-role-success.component'
;
@
Component
({
selector
:
'app-role'
,
...
...
@@ -37,7 +40,7 @@ export class RoleComponent implements OnInit {
@
Input
()
i
:
number
=
0
;
@
Input
()
missionIndex
:
number
=
0
;
constructor
(
protected
pieceDetailsService
:
PieceDetailsService
,
protected
tooltipService
:
TooltipService
,
public
dialog
:
MatDialog
,
private
minimapService
:
MinimapService
,
protected
translate
:
TranslateService
,
private
tutorialService
:
TutorialService
,
private
_snackBar
:
MatSnackBar
,)
{
}
constructor
(
protected
pieceDetailsService
:
PieceDetailsService
,
protected
tooltipService
:
TooltipService
,
public
dialog
:
MatDialog
,
private
minimapService
:
MinimapService
,
protected
translate
:
TranslateService
,
private
tutorialService
:
TutorialService
,
private
_snackBar
:
MatSnackBar
,
protected
copyRoleService
:
CopyRoleService
)
{
}
ngOnInit
():
void
{
this
.
mission
.
equalizeLengths
();
...
...
@@ -64,6 +67,28 @@ export class RoleComponent implements OnInit {
});
}
onClickCopy
():
void
{
this
.
copyRoleService
.
role
=
Object
.
assign
({},
this
.
role
);
this
.
copyRoleService
.
role
.
questName
=
''
;
this
.
copyRoleService
.
role
.
description
=
''
;
this
.
copyRoleService
.
role
.
educationnalObjectives
=
[];
this
.
copyRoleService
.
role
.
rewards
=
[];
this
.
copyRoleService
.
role
.
ressources
=
this
.
role
.
ressources
.
map
((
ressourceData
:
any
)
=>
Object
.
assign
(
new
Ressource
(),
ressourceData
));
this
.
copyRoleService
.
role
.
supplementaryRoles
=
this
.
role
.
supplementaryRoles
.
map
((
supplementaryRoleData
:
any
)
=>
Object
.
assign
(
new
SupplementaryRole
(),
supplementaryRoleData
));
this
.
copyRoleService
.
role
.
tasks
=
[[
new
Task
(
'normal'
)],
[]];
this
.
copyRoleService
.
role
.
chronologie
=
[];
this
.
copyRoleService
.
mission
=
this
.
mission
;
this
.
_snackBar
.
openFromComponent
(
CopyRoleSuccessComponent
,
{
duration
:
5000
});
}
onClickPaste
():
void
{
this
.
role
=
Object
.
assign
({},
this
.
copyRoleService
.
role
);
this
.
role
.
ressources
=
(
this
.
copyRoleService
.
role
as
Role
).
ressources
.
map
((
ressourceData
:
any
)
=>
Object
.
assign
(
new
Ressource
(),
ressourceData
));
this
.
role
.
supplementaryRoles
=
(
this
.
copyRoleService
.
role
as
Role
).
supplementaryRoles
.
map
((
supplementaryRoleData
:
any
)
=>
Object
.
assign
(
new
SupplementaryRole
(),
supplementaryRoleData
));
this
.
role
.
tasks
=
[[
new
Task
(
'normal'
)],
[]];
this
.
intituleIsAlreadyUsed
();
}
onClickErase
():
void
{
const
dialogRef
=
this
.
dialog
.
open
(
CleanDialogComponent
,
{
data
:
this
.
translate
.
instant
(
'role_clean'
)
+
' '
+
(
this
.
role
.
intitule
?
'<'
+
this
.
role
.
intitule
+
'>'
:
(
this
.
i
+
1
))
});
dialogRef
.
afterClosed
().
subscribe
(
result
=>
{
...
...
@@ -296,13 +321,12 @@ export class RoleComponent implements OnInit {
}
}
changeIntitule
(
event
:
any
):
void
{
intituleIsAlreadyUsed
(
):
void
{
this
.
mission
.
roles
.
forEach
(
role
=>
{
if
(
role
!=
this
.
role
&&
role
.
intitule
==
this
.
role
.
intitule
)
{
this
.
_snackBar
.
openFromComponent
(
RoleNameDuplicateComponent
,
{
duration
:
5000
});
this
.
role
.
intitule
=
''
;
}
});
this
.
editTrace
(
event
,
'name'
);
}
}
src/app/services/copyRole/copy-role.service.spec.ts
0 → 100644
View file @
2d53dd1f
import
{
TestBed
}
from
'@angular/core/testing'
;
import
{
CopyRoleService
}
from
'./copy-role.service'
;
describe
(
'CopyRoleService'
,
()
=>
{
let
service
:
CopyRoleService
;
beforeEach
(()
=>
{
TestBed
.
configureTestingModule
({});
service
=
TestBed
.
inject
(
CopyRoleService
);
});
it
(
'should be created'
,
()
=>
{
expect
(
service
).
toBeTruthy
();
});
});
src/app/services/copyRole/copy-role.service.ts
0 → 100644
View file @
2d53dd1f
import
{
Injectable
}
from
'@angular/core'
;
import
{
Mission
}
from
'src/app/class/mission/mission'
;
import
{
Role
}
from
'src/app/class/role/role'
;
@
Injectable
({
providedIn
:
'root'
})
export
class
CopyRoleService
{
role
:
Role
|
null
=
null
;
mission
:
Mission
|
null
=
null
;
constructor
()
{
}
}
src/assets/lang/en.json
View file @
2d53dd1f
...
...
@@ -153,6 +153,9 @@
"role_supplementaryRole_rule_label"
:
"Rules"
,
"role_supplementaryRole_rule_tooltip"
:
"Rules specific to this role (does it have any constraints or additional rights or access?)"
,
"role_supplementaryRole_delete"
:
"this Additional role"
,
"role_copy_tooltip"
:
"Copy the content"
,
"role_copy_snackbar"
:
"Role copied, go to another mission to paste it."
,
"role_paste_tooltip"
:
"Paste the content"
,
"steps_mission"
:
"Chronology of the mission"
,
"steps_role"
:
"Chronology of the role"
,
...
...
src/assets/lang/fr.json
View file @
2d53dd1f
...
...
@@ -153,6 +153,9 @@
"role_supplementaryRole_rule_label"
:
"Règles"
,
"role_supplementaryRole_rule_tooltip"
:
"Règles spécifiques à ce rôle (a-t-il des contraintes ou des droits, accès supplémentaires ?)"
,
"role_supplementaryRole_delete"
:
"ce Rôle supplémentaire"
,
"role_copy_tooltip"
:
"Copier le contenu"
,
"role_copy_snackbar"
:
"Role copié, rendez-vous dans une autre mission pour le coller"
,
"role_paste_tooltip"
:
"Coller le contenu"
,
"steps_mission"
:
"Chronologie de la mission"
,
"steps_role"
:
"Chronologie du rôle"
,
...
...
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