Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
console
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
console
Commits
d9540a39
Commit
d9540a39
authored
Jan 04, 2017
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面
parent
1c9f0dd3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
4 deletions
+84
-4
app/app-create.component.css
app/app-create.component.css
+10
-0
app/app-create.component.html
app/app-create.component.html
+23
-0
app/app-create.component.ts
app/app-create.component.ts
+26
-0
app/apps.component.css
app/apps.component.css
+5
-0
app/apps.component.html
app/apps.component.html
+4
-1
app/apps.component.ts
app/apps.component.ts
+12
-2
app/mycard.module.ts
app/mycard.module.ts
+4
-1
No files found.
app/app-create.component.css
0 → 100644
View file @
d9540a39
.example-full-width
{
width
:
100%
;
}
md-select
{
margin
:
16px
0
;
}
md-dialog-actions
{
text-align
:
right
;
}
\ No newline at end of file
app/app-create.component.html
0 → 100644
View file @
d9540a39
<h1
md-dialog-title
>
创建应用
</h1>
<form
class=
"example-form"
>
<md-dialog-content>
<md-input-container
class=
"example-full-width"
>
<input
md-input
placeholder=
"应用 ID (创建应用后无法修改)"
[(ngModel)]=
"id"
name=
"id"
>
</md-input-container>
<md-select
placeholder=
"主要语言"
[(ngModel)]=
"locale"
name=
"locale"
class=
"example-full-width"
>
<md-option
*ngFor=
"let l of locales"
[value]=
"l"
>
{{l}}
</md-option>
</md-select>
<md-input-container
class=
"example-full-width"
>
<input
md-input
placeholder=
"名称"
[(ngModel)]=
"name"
name=
"name"
>
</md-input-container>
</md-dialog-content>
</form>
<md-dialog-actions>
<button
md-button
md-dialog-close
>
取消
</button>
<button
md-button
(click)=
"submit(id, locale, name)"
>
确定
</button>
</md-dialog-actions>
\ No newline at end of file
app/app-create.component.ts
0 → 100644
View file @
d9540a39
/**
* Created by weijian on 2016/12/30.
*/
import
{
Component
}
from
'
@angular/core
'
;
import
{
MdDialogRef
}
from
'
@angular/material
'
;
import
App
from
'
../models/browserapp
'
;
@
Component
({
moduleId
:
module
.
id
,
templateUrl
:
'
app-create.component.html
'
,
styleUrls
:
[
'
app-create.component.css
'
],
})
export
class
AppCreateComponent
{
locales
=
[
'
zh-CN
'
,
'
zh-TW
'
,
'
en-US
'
,
'
ja-JP
'
];
locale
=
'
zh-CN
'
;
id
:
string
;
name
:
string
;
app
=
{
name
:
{}};
constructor
(
public
dialogRef
:
MdDialogRef
<
AppCreateComponent
>
)
{
}
submit
(
id
:
string
,
locale
:
string
,
name
:
string
)
{
this
.
dialogRef
.
close
(
new
App
({
id
:
id
,
name
:
{[
locale
]:
name
}}));
}
}
app/apps.component.css
View file @
d9540a39
.example-fab
{
position
:
absolute
;
right
:
20px
;
bottom
:
20px
;
}
\ No newline at end of file
app/apps.component.html
View file @
d9540a39
...
@@ -8,4 +8,7 @@
...
@@ -8,4 +8,7 @@
<span
class=
"demo-2"
>
-- {{app.id}}
</span>
<span
class=
"demo-2"
>
-- {{app.id}}
</span>
</p>
</p>
</md-list-item>
</md-list-item>
</md-nav-list>
</md-nav-list>
\ No newline at end of file
<button
md-fab
class=
"example-fab"
(click)=
"create_app()"
>
<md-icon>
add
</md-icon>
</button>
\ No newline at end of file
app/apps.component.ts
View file @
d9540a39
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
App
from
'
../models/app
'
;
import
App
from
'
../models/app
'
;
import
{
AppService
}
from
'
./app.service
'
;
import
{
AppService
}
from
'
./app.service
'
;
import
{
MdDialog
}
from
'
@angular/material
'
;
import
{
AppCreateComponent
}
from
'
./app-create.component
'
;
@
Component
({
@
Component
({
selector
:
'
apps
'
,
selector
:
'
apps
'
,
...
@@ -11,7 +13,7 @@ import {AppService} from './app.service';
...
@@ -11,7 +13,7 @@ import {AppService} from './app.service';
export
class
AppsComponent
implements
OnInit
{
export
class
AppsComponent
implements
OnInit
{
apps
:
App
[];
apps
:
App
[];
constructor
(
private
appService
:
AppService
)
{
constructor
(
private
appService
:
AppService
,
private
dialog
:
MdDialog
)
{
}
}
async
ngOnInit
()
{
async
ngOnInit
()
{
...
@@ -21,5 +23,13 @@ export class AppsComponent implements OnInit {
...
@@ -21,5 +23,13 @@ export class AppsComponent implements OnInit {
async
getApps
()
{
async
getApps
()
{
this
.
apps
=
await
this
.
appService
.
getApps
();
this
.
apps
=
await
this
.
appService
.
getApps
();
}
}
}
async
create_app
()
{
let
dialogRef
=
this
.
dialog
.
open
(
AppCreateComponent
);
let
app
:
App
|
undefined
=
await
dialogRef
.
afterClosed
().
toPromise
();
if
(
!
app
)
{
return
;
}
console
.
log
(
app
);
}
}
app/mycard.module.ts
View file @
d9540a39
...
@@ -21,14 +21,17 @@ import {AppDetailComponent} from './app-detail.component';
...
@@ -21,14 +21,17 @@ import {AppDetailComponent} from './app-detail.component';
import
{
AppComponent
}
from
'
./app.component
'
;
import
{
AppComponent
}
from
'
./app.component
'
;
import
{
AppLocalesComponent
}
from
'
./app-locales.component
'
;
import
{
AppLocalesComponent
}
from
'
./app-locales.component
'
;
import
{
AppPackagesComponent
}
from
'
./app-packages.component
'
;
import
{
AppPackagesComponent
}
from
'
./app-packages.component
'
;
import
{
AppCreateComponent
}
from
'
./app-create.component
'
;
@
NgModule
({
@
NgModule
({
imports
:
[
imports
:
[
BrowserModule
,
MaterialModule
.
forRoot
(),
FormsModule
,
RoutingModule
,
HttpModule
,
BrowserModule
,
MaterialModule
.
forRoot
(),
FormsModule
,
RoutingModule
,
HttpModule
,
],
],
declarations
:
[
AppsComponent
,
MyCardComponent
,
AppComponent
,
AppDetailComponent
,
AppLocalesComponent
,
AppPackagesComponent
],
declarations
:
[
AppsComponent
,
MyCardComponent
,
AppComponent
,
AppDetailComponent
,
AppLocalesComponent
,
AppPackagesComponent
,
AppCreateComponent
],
bootstrap
:
[
MyCardComponent
],
bootstrap
:
[
MyCardComponent
],
entryComponents
:
[
AppCreateComponent
],
providers
:
[
AppService
,
MdIconRegistry
],
providers
:
[
AppService
,
MdIconRegistry
],
})
})
export
class
AppModule
{
export
class
AppModule
{
...
...
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