Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
L
luna
Project
Project
Details
Activity
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
ops
luna
Commits
889c877e
Unverified
Commit
889c877e
authored
Mar 20, 2018
by
liuzheng712
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add a dialog when change language
parent
74b8c3f0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
5 deletions
+53
-5
app.module.ts
src/app/app.module.ts
+3
-2
changeLanWarning.html
src/app/elements/nav/changeLanWarning.html
+9
-0
nav.component.ts
src/app/elements/nav/nav.component.ts
+41
-3
No files found.
src/app/app.module.ts
View file @
889c877e
...
...
@@ -24,7 +24,7 @@ import {DialogService, ElementDialogAlertComponent} from './elements/dialog/dial
import
{
ElementFooterComponent
}
from
'./elements/footer/footer.component'
;
import
{
ElementTermComponent
}
from
'./elements/term/term.component'
;
import
{
ElementInteractiveComponent
}
from
'./elements/interactive/interactive.component'
;
import
{
ElementNavComponent
}
from
'./elements/nav/nav.component'
;
import
{
ChangLanWarningDialogComponent
,
ElementNavComponent
}
from
'./elements/nav/nav.component'
;
import
{
ElementPopupComponent
}
from
'./elements/popup/popup.component'
;
import
{
ElementRdpComponent
}
from
'./elements/rdp/rdp.component'
;
import
{
ElementServerMenuComponent
}
from
'./elements/server-menu/server-menu.component'
;
...
...
@@ -83,7 +83,7 @@ import {ConnectPageComponent} from './connect-page/connect-page.component';
],
declarations
:
[
AppComponent
,
ElementNavComponent
,
ElementNavComponent
,
ChangLanWarningDialogComponent
,
ElementFooterComponent
,
ElementPopupComponent
,
ElementTermComponent
,
...
...
@@ -128,6 +128,7 @@ import {ConnectPageComponent} from './connect-page/connect-page.component';
entryComponents
:
[
CleftbarDialogComponent
,
ElementDialogAlertComponent
,
ChangLanWarningDialogComponent
,
],
bootstrap
:
[
AppComponent
],
providers
:
[
...
...
src/app/elements/nav/changeLanWarning.html
0 → 100644
View file @
889c877e
<h1
mat-dialog-title
>
{{"Warning"|trans}}
</h1>
<h2>
{{"The page will be reload, can you acceptable?"|trans}}
</h2>
<div
style=
"float: right"
>
<button
mat-raised-button
(
click
)="
onNoClick
()"
>
{{"Cancel"|trans}}
</button>
<button
mat-raised-button
color=
"primary"
[
mat-dialog-close
]="
selected
"
cdkFocusInitial
>
{{"Confirm"|trans}}
</button>
</div>
src/app/elements/nav/nav.component.ts
View file @
889c877e
...
...
@@ -5,12 +5,14 @@
* @date 2017-11-07
* @author liuzheng <liuzheng712@gmail.com>
*/
import
{
Component
,
OnInit
}
from
'@angular/core'
;
import
{
Component
,
Inject
,
OnInit
}
from
'@angular/core'
;
import
{
AppService
,
HttpService
,
LocalStorageService
,
LogService
}
from
'../../app.service'
;
import
{
CleftbarComponent
}
from
'../../ControlPage/cleftbar/cleftbar.component'
;
import
{
ControlComponent
,
NavList
}
from
'../../ControlPage/control/control.component'
;
import
{
DataStore
,
i18n
}
from
'../../globals'
;
import
*
as
jQuery
from
'jquery/dist/jquery.min.js'
;
import
{
MAT_DIALOG_DATA
,
MatDialog
,
MatDialogRef
}
from
'@angular/material'
;
import
{
FormControl
,
Validators
}
from
'@angular/forms'
;
// import * as layer from 'layui-layer/src/layer.js';
declare
let
layer
:
any
;
...
...
@@ -21,6 +23,7 @@ declare let layer: any;
})
export
class
ElementNavComponent
implements
OnInit
{
DataStore
=
DataStore
;
ChangeLanWarningDialog
:
any
;
static
Hide
()
{
jQuery
(
'app-element-nav'
).
hide
();
...
...
@@ -29,12 +32,19 @@ export class ElementNavComponent implements OnInit {
constructor
(
private
_appService
:
AppService
,
private
_http
:
HttpService
,
private
_logger
:
LogService
,
public
_dialog
:
MatDialog
,
private
_localStorage
:
LocalStorageService
)
{
this
.
_logger
.
log
(
'nav.ts:NavComponent'
);
this
.
getnav
();
}
ngOnInit
()
{
this
.
ChangeLanWarningDialog
=
this
.
_dialog
.
open
(
ChangLanWarningDialogComponent
,
{
height
:
'200px'
,
width
:
'300px'
,
});
}
click
(
event
)
{
...
...
@@ -95,11 +105,21 @@ export class ElementNavComponent implements OnInit {
break
;
}
case
'English'
:
{
this
.
English
();
this
.
ChangeLanWarningDialog
.
afterClosed
().
subscribe
(
result
=>
{
if
(
result
)
{
this
.
English
();
}
});
break
;
}
case
'Chinese'
:
{
this
.
Language
(
'cn'
);
this
.
ChangeLanWarningDialog
.
afterClosed
().
subscribe
(
result
=>
{
if
(
result
)
{
this
.
Language
(
'cn'
);
}
});
break
;
}
default
:
{
...
...
@@ -304,3 +324,21 @@ export class ElementNavComponent implements OnInit {
location
.
reload
();
}
}
@
Component
({
selector
:
'app-element-nav-dialog'
,
templateUrl
:
'changeLanWarning.html'
,
})
export
class
ChangLanWarningDialogComponent
implements
OnInit
{
constructor
(
public
dialogRef
:
MatDialogRef
<
ChangLanWarningDialogComponent
>
)
{
}
ngOnInit
()
{
}
onNoClick
():
void
{
this
.
dialogRef
.
close
();
}
}
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