Commit ed50f74d authored by 神楽坂玲奈's avatar 神楽坂玲奈

页面

parent db696688
.example-full-width { .example-full-width {
width: 100%; width: 100%;
} }
md-select {
margin: 16px 0;
}
\ No newline at end of file
<!--<h3 md-subheader>语言</h3>-->
<md-tab-group *ngIf="app"> <md-tab-group *ngIf="app">
<md-tab *ngFor="let locale of locales" [label]="locale"> <md-tab *ngFor="let locale of locales" [label]="locale">
<form class="example-form" style="margin-top:16px;"> <form class="example-form" style="margin-top:16px;">
...@@ -23,4 +21,10 @@ ...@@ -23,4 +21,10 @@
<button md-raised-button color="primary">提交</button> <button md-raised-button color="primary">提交</button>
</form> </form>
</md-tab> </md-tab>
<md-tab #translate label="添加翻译">
<md-select placeholder="语言" [(ngModel)]="locale" name="locale" class="example-full-width">
<md-option *ngFor="let l of untranslated_locales()" [value]="l">{{l}}</md-option>
</md-select>
</md-tab>
</md-tab-group> </md-tab-group>
\ No newline at end of file
import {Component, OnInit} from '@angular/core'; import {Component, OnInit, ViewChild} from '@angular/core';
import App, {I18n} from '../models/browserapp'; import App, {I18n} from '../models/browserapp';
import {AppService} from './app.service'; import {AppService} from './app.service';
import {ActivatedRoute, Params} from '@angular/router'; import {ActivatedRoute, Params} from '@angular/router';
import 'rxjs/Rx'; import 'rxjs/Rx';
import {MdIconRegistry} from '@angular/material'; import {MdIconRegistry, MdTab} from '@angular/material';
import {DomSanitizer} from '@angular/platform-browser'; import {DomSanitizer} from '@angular/platform-browser';
@Component({ @Component({
...@@ -15,6 +15,8 @@ export class AppLocalesComponent implements OnInit { ...@@ -15,6 +15,8 @@ export class AppLocalesComponent implements OnInit {
app: App; app: App;
locales: string[]; locales: string[];
news: I18n<string> = {}; news: I18n<string> = {};
@ViewChild('translate')
translate: MdTab;
constructor(private appService: AppService, private route: ActivatedRoute, iconRegistry: MdIconRegistry, sanitizer: DomSanitizer) { constructor(private appService: AppService, private route: ActivatedRoute, iconRegistry: MdIconRegistry, sanitizer: DomSanitizer) {
} }
...@@ -30,4 +32,8 @@ export class AppLocalesComponent implements OnInit { ...@@ -30,4 +32,8 @@ export class AppLocalesComponent implements OnInit {
} }
}); });
} }
untranslated_locales() {
return ['zh-CN', 'zh-TW', 'en-US', 'ja-JP'].filter(locale => !this.locales.includes(locale));
}
} }
.wrapper { .wrapper {
min-height: 1000px; min-height: 1000px;
padding-left: 20px; padding: 20px 20px 0 20px;
padding-top: 20px;
} }
md-sidenav { md-sidenav {
......
...@@ -38,4 +38,8 @@ export class AppsComponent implements OnInit { ...@@ -38,4 +38,8 @@ export class AppsComponent implements OnInit {
this.snackBar.open(error.toString()); this.snackBar.open(error.toString());
} }
} }
test(event: any) {
console.log(event);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment