Skip to content

Commit c53592e

Browse files
committed
Added account languages.
1 parent 3b29d41 commit c53592e

File tree

11 files changed

+81
-29
lines changed

11 files changed

+81
-29
lines changed

angular/src/account/account.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
<router-outlet></router-outlet>
1111

12-
<!--<vc:account-languages></vc:account-languages>-->
12+
<account-languages></account-languages>
1313

14-
<!--<div class="row">
14+
<div class="row">
1515
<div class="col-xs-12 text-center" style="color: #e9e9e9">
16-
<small>&copy; @DateTime.Now.Year AbpProjectName. <b>Version </b> @AppVersionHelper.Version [@AppVersionHelper.ReleaseDate.ToString("yyyyMMdd")]</small>
16+
<small>&copy; {{currentYear}} AbpProjectName. <b>Version </b> {{versionText}}</small>
1717
</div>
18-
</div>-->
19-
18+
</div>
19+
2020
</div>

angular/src/account/account.component.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { Component, ViewContainerRef, OnInit, ViewEncapsulation } from '@angular/core';
1+
import { Component, ViewContainerRef, OnInit, ViewEncapsulation, Injector } from '@angular/core';
22
import { LoginService } from './login/login.service';
3-
import { AppConsts } from '@shared/AppConsts';
4-
5-
import * as moment from 'moment';
3+
import { AppComponentBase } from '@shared/app-component-base';
64

75
@Component({
86
templateUrl: './account.component.html',
@@ -11,15 +9,21 @@ import * as moment from 'moment';
119
],
1210
encapsulation: ViewEncapsulation.None
1311
})
14-
export class AccountComponent implements OnInit {
12+
export class AccountComponent extends AppComponentBase implements OnInit {
1513

1614
private viewContainerRef: ViewContainerRef;
1715

18-
currentYear: number = moment().year();
16+
versionText: string;
17+
currentYear: number;
1918

2019
public constructor(
20+
injector: Injector,
2121
private _loginService: LoginService
2222
) {
23+
super(injector);
24+
25+
this.currentYear = new Date().getFullYear();
26+
this.versionText = this.appSession.application.version + ' [' + this.appSession.application.releaseDate.format('YYYYDDMM') + ']';
2327
}
2428

2529
showTenantChange(): boolean {

angular/src/account/account.module.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CommonModule } from '@angular/common';
2-
import { NgModule, APP_INITIALIZER } from '@angular/core';
2+
import { NgModule } from '@angular/core';
33
import { FormsModule } from '@angular/forms';
44
import { HttpModule, JsonpModule } from '@angular/http';
55
import { ModalModule } from 'ngx-bootstrap';
@@ -10,14 +10,14 @@ import { AccountRoutingModule } from './account-routing.module';
1010

1111
import { ServiceProxyModule } from '@shared/service-proxies/service-proxy.module';
1212

13-
import { AppConsts } from '@shared/AppConsts';
1413
import { SharedModule } from '@shared/shared.module';
1514

1615
import { AccountComponent } from './account.component';
1716
import { TenantChangeComponent } from './tenant/tenant-change.component';
1817
import { TenantChangeModalComponent } from './tenant/tenant-change-modal.component';
1918
import { LoginComponent } from './login/login.component';
2019
import { RegisterComponent } from './register/register.component';
20+
import { AccountLanguagesComponent } from './layout/account-languages.component';
2121

2222
import { LoginService } from './login/login.service';
2323

@@ -38,7 +38,8 @@ import { LoginService } from './login/login.service';
3838
TenantChangeComponent,
3939
TenantChangeModalComponent,
4040
LoginComponent,
41-
RegisterComponent
41+
RegisterComponent,
42+
AccountLanguagesComponent
4243
],
4344
providers: [
4445
LoginService
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<ul class="account-language-switch-list text-center">
2+
<li *ngFor="let language of languages">
3+
<!-- TODO: Handle Return URL -->
4+
<a *ngIf="language.name != currentLanguage.name" href="javascript:void();" title="{{language.displayName}}" (click)="changeLanguage(language.name)"><i class="{{language.icon}}"></i></a>
5+
</li>
6+
</ul>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.account-language-switch-list {
2+
list-style: none;
3+
margin: 0px;
4+
padding: 10px;
5+
6+
> li {
7+
display: inline;
8+
margin: 0px;
9+
padding: 0px;
10+
}
11+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import { Component, OnInit, Injector } from '@angular/core';
2+
import { AppComponentBase } from '@shared/app-component-base';
3+
4+
@Component({
5+
selector: 'account-languages',
6+
templateUrl: './account-languages.component.html',
7+
styleUrls: [
8+
'./account-languages.component.less'
9+
]
10+
})
11+
export class AccountLanguagesComponent extends AppComponentBase implements OnInit {
12+
13+
languages: abp.localization.ILanguageInfo[];
14+
currentLanguage: abp.localization.ILanguageInfo;
15+
16+
constructor(
17+
injector: Injector
18+
) {
19+
super(injector);
20+
}
21+
22+
ngOnInit() {
23+
this.languages = this.localization.languages;
24+
this.currentLanguage = this.localization.currentLanguage;
25+
}
26+
27+
changeLanguage(languageName: string): void {
28+
abp.utils.setCookieValue(
29+
"Abp.Localization.CultureName",
30+
languageName,
31+
new Date(new Date().getTime() + 5 * 365 * 86400000), //5 year
32+
abp.appPath
33+
);
34+
35+
location.reload();
36+
}
37+
}

angular/src/account/register/register.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h4 class="text-center">{{l("Register")}}</h4>
4040

4141
<div class="form-actions">
4242
<button [disabled]="saving" [routerLink]="['../login']" type="button" class="btn btn-default">{{l("Back")}}</button>
43-
<button type="submit" class="btn btn-success uppercase" [disabled]="!registerForm.form.valid">{{l("Submit")}}</button>
43+
<button type="submit" class="btn btn-success" [disabled]="!registerForm.form.valid">{{l("Submit")}}</button>
4444
</div>
4545

4646
</form>

angular/src/account/tenant/tenant-change.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { AccountServiceProxy } from '@shared/service-proxies/service-proxies'
33
import { TenantChangeModalComponent } from './tenant-change-modal.component'
44
import { AppComponentBase } from '@shared/app-component-base';
5-
import { AppSessionService } from '@shared/session/app-session.service';
65

76
@Component({
87
selector: 'tenant-change',
@@ -17,16 +16,16 @@ export class TenantChangeComponent extends AppComponentBase implements OnInit {
1716

1817
constructor(
1918
injector: Injector,
20-
private _appSessionService: AppSessionService,
2119
private _accountService: AccountServiceProxy
2220
) {
2321
super(injector);
2422
}
2523

2624
ngOnInit() {
27-
if (this._appSessionService.tenant) {
28-
this.tenancyName = this._appSessionService.tenant.tenancyName;
29-
this.name = this._appSessionService.tenant.name;
25+
26+
if (this.appSession.tenant) {
27+
this.tenancyName = this.appSession.tenant.tenancyName;
28+
this.name = this.appSession.tenant.name;
3029
}
3130
}
3231

angular/src/app/layout/topbar-languageswitch.component.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { Component, OnInit, Injector, ViewEncapsulation } from '@angular/core';
2-
import { Router } from '@angular/router';
3-
import { AbpSessionService } from '@abp/session/abp-session.service';
42
import { AppComponentBase } from '@shared/app-component-base';
5-
import { AppAuthService } from '@shared/auth/app-auth.service';
63

74
@Component({
85
templateUrl: './topbar-languageswitch.component.html',
@@ -15,10 +12,7 @@ export class TopBarLanguageSwitchComponent extends AppComponentBase implements O
1512
currentLanguage: abp.localization.ILanguageInfo;
1613

1714
constructor(
18-
injector: Injector,
19-
private _sessionService: AbpSessionService,
20-
private _authService: AppAuthService,
21-
private _router: Router
15+
injector: Injector
2216
) {
2317
super(injector);
2418
}

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Mvc/wwwroot/view-resources/Views/Account/Login.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@
4040
$form.submit();
4141
});
4242

43-
$loginForm.find('input:first-child').focus();
43+
$loginForm.find('input[type=text]:first-child').focus();
4444
});

0 commit comments

Comments
 (0)