Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
Merge branch 'development' of https://github.com/oasp-forge/oasp4js-rev
Browse files Browse the repository at this point in the history
… into development
  • Loading branch information
cbeldacap committed Aug 29, 2016
2 parents 174c57f + aac6595 commit 756357a
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 54 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<h2>Tables</h2>
<div>
<filter-panel (filterValues) = "searchFilters($event)">
<label> Number </label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

<ul *ngIf="logged" class = "header-tabs">
<li role = "presentation">
<a> Tables </a>
<a [routerLink]="['/Tables']"> Tables </a>
</li>
<li role = "presentation">
<a> Kitchen </a>
<a [routerLink]="['/Kitchen']"> Kitchen </a>
</li>
</ul>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Component } from '@angular/core';
import { EventEmitter } from '@angular/core';
import {languages} from '../../../resources/languages/Languages.resource'
import {ROUTER_DIRECTIVES} from "@angular/router";

@Component({
selector: 'header',
templateUrl: 'app/components/header/view/Header.component.html',
inputs: ["logged", "username"],
outputs: ["logOffEvent"]
outputs: ["logOffEvent"],
directives: [ROUTER_DIRECTIVES]
})

export class HeaderComponent {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>KITCHEN</h1>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {Component} from '@angular/core'

@Component({
selector:'kitchen',
templateUrl:'app/components/kitchen/view/Kitchen.component.html'
})

export class KitchenComponent{
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
</th>
</thead>
<tbody>
<tr *ngFor="let obj of rowsData" #row (click)=clickedRow(obj)>
<tr *ngFor="let obj of rowsData"
(click)=clickedRow(obj)>
<td *ngFor= "let attribute of attributeNames"
[class.selected]="selection === obj">
{{ obj[attribute] }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,47 @@ import {GridtableService} from '../service/Grid-table.service'

export class GridTableComponent implements OnChanges{

headers;
attributeNames;
dataInput;

public rowsData = [];
public attributesNames = [];
public tableHeaders = [];

public selection;
objSelected = new EventEmitter();

public sortIconStyle = ["glyphicon glyphicon-chevron-down","glyphicon glyphicon-chevron-down","glyphicon glyphicon-chevron-down"];

constructor(private gridtableService : GridtableService){
}

ngOnChanges(){
this.attributesNames = this.attributeNames;
this.tableHeaders = this.headers;
this.rowsData = this.dataInput;
}

sortColumn(column:number, name:string){

if(this.sortIconStyle[column] === "glyphicon glyphicon-chevron-up"){
this.sortIconStyle[column] = "glyphicon glyphicon-chevron-down";
this.rowsData = this.gridtableService.getTablesOrderBy(-1, name, this.rowsData);
} else {
this.sortIconStyle[0] = "glyphicon glyphicon-chevron-down";
this.sortIconStyle[1] = "glyphicon glyphicon-chevron-down";
this.sortIconStyle[2] = "glyphicon glyphicon-chevron-down";
this.sortIconStyle[column] = "glyphicon glyphicon-chevron-up";
this.rowsData = this.gridtableService.getTablesOrderBy(1, name, this.rowsData);
headers;
attributeNames;
dataInput;

public rowsData = [];
public attributesNames = [];
public tableHeaders = [];

public selection;
objSelected = new EventEmitter();

public sortIconStyle = ["glyphicon glyphicon-chevron-down","glyphicon glyphicon-chevron-down","glyphicon glyphicon-chevron-down"];

constructor(private gridtableService : GridtableService){
}

ngOnChanges(){
this.attributesNames = this.attributeNames;
this.tableHeaders = this.headers;
this.rowsData = this.dataInput;
}

sortColumn(column:number, name:string){
if(this.sortIconStyle[column] === "glyphicon glyphicon-chevron-up"){
this.sortIconStyle[column] = "glyphicon glyphicon-chevron-down";
this.rowsData = this.gridtableService.getTablesOrderBy(-1, name, this.rowsData);
} else {
this.sortIconStyle[0] = "glyphicon glyphicon-chevron-down";
this.sortIconStyle[1] = "glyphicon glyphicon-chevron-down";
this.sortIconStyle[2] = "glyphicon glyphicon-chevron-down";
this.sortIconStyle[column] = "glyphicon glyphicon-chevron-up";
this.rowsData = this.gridtableService.getTablesOrderBy(1, name, this.rowsData);
}
}
}

clickedRow(valor){
if(this.selection === valor){
this.selection = undefined;
} else {
this.selection = valor;
clickedRow(valor){
if(this.selection === valor){
this.selection = undefined;
} else {
this.selection = valor;
}
this.objSelected.emit(this.selection);
}
this.objSelected.emit(this.selection);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ export class PaginationComponent{
this.rowsPerPage = this.initRowsPerPage;
}

// This should be server-side
this.showList = this.list.slice(this.rowsPerPage * (this.currentPage - 1), this.rowsPerPage * (this.currentPage - 1) + this.rowsPerPage);
this.numberPages = Math.ceil(this.list.length / this.rowsPerPage);
this.paginationList.emit(this.showList);
// -------

if(this.showList.length <= 0){
this.changePage(this.currentPage - 1, 0);
Expand All @@ -61,6 +63,7 @@ export class PaginationComponent{
this.pageView = view;
}

// This should be server-side
if(this.rowsPerPage * (this.currentPage - 1) < this.rowsPerPage){
this.showList = this.list.slice(0, this.rowsPerPage);
} else{
Expand Down
7 changes: 3 additions & 4 deletions oasp4js-sample/src/app/oasp4js-sample.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<header [logged]="login" [username] ="usuario.username" (logOffEvent)="login = $event"></header>
<header [logged]="login" [username] ="usuario.username" (logOffEvent)="login = logOut($event)"></header>

<div class = "app-body">
<!-- LOGIN -->
Expand All @@ -7,9 +7,8 @@
</div>

<!-- APPLICATION -->
<div *ngIf="login">
<h2>Tables</h2>
<crud></crud>
<div [hidden]="!login">
<router-outlet></router-outlet>
</div>
</div>

Expand Down
17 changes: 16 additions & 1 deletion oasp4js-sample/src/app/oasp4js-sample.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,41 @@ import { Component } from '@angular/core';
import { HeaderComponent} from './components/header/view/Header.component';
import { LoginComponent} from './components/login/view/Login.component';
import { CrudComponent } from './components/crud/view/Crud.component'
import { KitchenComponent } from './components/kitchen/view/Kitchen.component'

import { User } from './models/user/User.model'

import {ROUTER_DIRECTIVES, Router, Routes} from "@angular/router";

@Routes([
{ path: '', component: CrudComponent },
{ path: '/Tables', component: CrudComponent },
{ path: '/Kitchen', component: KitchenComponent }
])

@Component({
moduleId: module.id,
selector: 'oasp4js-sample-app',
templateUrl: 'oasp4js-sample.component.html',
styleUrls: ['oasp4js-sample.component.css'],
directives: [LoginComponent, HeaderComponent, CrudComponent]
directives: [LoginComponent, HeaderComponent, CrudComponent, ROUTER_DIRECTIVES]
})


export class Oasp4jsSampleAppComponent{
title = "oasp4js-sample works!";
public login:boolean;
public usuario: User = new User(0,"","");

constructor(private router: Router){}

enviar(value){
setTimeout( ()=>{this.login = value;},1);
this.router.navigate(['/Tables']);
}

logOut(){
this.login = false;
this.router.navigate(['']);
}
}
8 changes: 4 additions & 4 deletions oasp4js-sample/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { bootstrap } from '@angular/platform-browser-dynamic';
// import {bootstrap} from 'angular2/platform/browser'
import { enableProdMode } from '@angular/core';
import { ROUTER_PROVIDERS, ROUTER_DIRECTIVES } from '@angular/router';
import { Oasp4jsSampleAppComponent, environment } from './app/';
//import {disableDeprecatedForms, provideForms} from "@angular/forms";

if (environment.production) {
enableProdMode();
}

bootstrap(Oasp4jsSampleAppComponent/*,[
disableDeprecatedForms(),
provideForms()
]*/);

bootstrap(Oasp4jsSampleAppComponent, [ROUTER_PROVIDERS, ROUTER_DIRECTIVES])
.catch(err => console.error(err));

0 comments on commit 756357a

Please sign in to comment.