Skip to content

Commit 00707dc

Browse files
Implement and style Login page
1 parent 932dd82 commit 00707dc

File tree

5 files changed

+114
-52
lines changed

5 files changed

+114
-52
lines changed

app/app.module.ts

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
1-
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
2-
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
3-
4-
import { AppRoutingModule } from "./app.routing";
5-
import { AppComponent } from "./app.component";
6-
import { CostModule } from "./tabs/cost/cost.module";
7-
8-
import { TabsComponent } from "./tabs/tabs.component";
9-
import { CostsComponent } from "./tabs/cost/costs.component";
10-
11-
@NgModule({
12-
bootstrap: [
13-
AppComponent
14-
],
15-
imports: [
16-
NativeScriptModule,
17-
AppRoutingModule,
18-
CostModule
19-
],
20-
declarations: [
21-
AppComponent,
22-
TabsComponent,
23-
CostsComponent
24-
],
25-
providers: [
26-
],
27-
schemas: [
28-
NO_ERRORS_SCHEMA
29-
]
30-
})
31-
32-
export class AppModule { }
1+
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
2+
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
3+
4+
import { AppRoutingModule } from "./app.routing";
5+
import { AppComponent } from "./app.component";
6+
import { CostModule } from "./tabs/cost/cost.module";
7+
8+
import { TabsComponent } from "./tabs/tabs.component";
9+
import { CostsComponent } from "./tabs/cost/costs.component";
10+
import { LoginComponent} from "./login/login.component";
11+
12+
@NgModule({
13+
bootstrap: [
14+
AppComponent
15+
],
16+
imports: [
17+
NativeScriptModule,
18+
AppRoutingModule,
19+
CostModule
20+
],
21+
declarations: [
22+
AppComponent,
23+
TabsComponent,
24+
CostsComponent,
25+
LoginComponent
26+
],
27+
providers: [
28+
],
29+
schemas: [
30+
NO_ERRORS_SCHEMA
31+
]
32+
})
33+
34+
export class AppModule { }

app/app.routing.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
import { NgModule } from "@angular/core";
2-
import { NativeScriptRouterModule } from "nativescript-angular/router";
3-
import { Routes } from "@angular/router";
4-
5-
import { TabsComponent } from "./tabs/tabs.component";
6-
import { CostsComponent } from "./tabs/cost/costs.component";
7-
import { CostDetailComponent } from "./tabs/cost/detail/cost-detail.component";
8-
import { CostEditComponent } from "./tabs/cost/edit/cost-edit.component";
9-
10-
const routes: Routes = [
11-
{ path: '', component: TabsComponent },
12-
// { path: "costs", component: CostsComponent },
13-
{ path: "cost/:id", component: CostDetailComponent },
14-
{ path: "cost-edit/:id", component: CostEditComponent }
15-
];
16-
17-
@NgModule({
18-
imports: [ NativeScriptRouterModule.forRoot(routes) ],
19-
exports: [ NativeScriptRouterModule ]
20-
})
1+
import { NgModule } from "@angular/core";
2+
import { NativeScriptRouterModule } from "nativescript-angular/router";
3+
import { Routes } from "@angular/router";
4+
5+
import { TabsComponent } from "./tabs/tabs.component";
6+
import { CostsComponent } from "./tabs/cost/costs.component";
7+
import { CostDetailComponent } from "./tabs/cost/detail/cost-detail.component";
8+
import { CostEditComponent } from "./tabs/cost/edit/cost-edit.component";
9+
import { LoginComponent } from "./login/login.component";
10+
11+
const routes: Routes = [
12+
{ path: "", component: LoginComponent },
13+
{ path: 'tabs', component: TabsComponent },
14+
//{ path: "costs", component: CostsComponent },
15+
{ path: "cost/:id", component: CostDetailComponent },
16+
{ path: "cost-edit/:id", component: CostEditComponent }
17+
];
18+
19+
@NgModule({
20+
imports: [ NativeScriptRouterModule.forRoot(routes) ],
21+
exports: [ NativeScriptRouterModule ]
22+
})
2123
export class AppRoutingModule { }

app/login/login.component.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.login-view
2+
{
3+
padding-left: 40;
4+
padding-right: 40;
5+
}
6+
7+
.btn-login
8+
{
9+
background-color: #7ada2f;
10+
color: aliceblue;
11+
}

app/login/login.component.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<ActionBar title="Money Tracker "
2+
class="action-bar">
3+
</ActionBar>
4+
5+
<StackLayout verticalAlignment="center" class="login-view" >
6+
<StackLayout>
7+
<Label text="Email" class="label font-weight-bold m-b-5"></Label>
8+
<TextField keyboardType="email"autocorrect="false"></TextField>
9+
</StackLayout>
10+
<StackLayout class="input-field">
11+
<Label text="Password" class="label font-weight-bold m-b-5"></Label>
12+
<TextField secure="true"></TextField>
13+
</StackLayout>
14+
<Button class="btn-login" text="Login" (tap)="login()"></Button>
15+
<Label [nsRouterLink]="['/register']" text="Not a member? Register here." class="text-center footnote"></Label>
16+
</StackLayout>

app/login/login.component.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Component, OnInit } from "@angular/core";
2+
import { RouterExtensions } from "nativescript-angular/router";
3+
import * as ApplicationSettings from "application-settings";
4+
5+
@Component({
6+
moduleId: module.id,
7+
selector: "ns-login",
8+
templateUrl: "login.component.html",
9+
styleUrls: ["login.component.css"]
10+
})
11+
export class LoginComponent implements OnInit {
12+
13+
public input: any;
14+
15+
public constructor(private router: RouterExtensions) {
16+
this.input = {
17+
"email": "",
18+
"password": ""
19+
}
20+
}
21+
22+
public ngOnInit() {
23+
//if(ApplicationSettings.getBoolean("authenticated", false)) {
24+
// this.router.navigate(["/secure"], { clearHistory: true });
25+
//}
26+
}
27+
28+
public login() {
29+
this.router.navigate(["/tabs"], { clearHistory: true });
30+
}
31+
}

0 commit comments

Comments
 (0)