├── Brewery ├── src │ ├── assets │ │ ├── .gitkeep │ │ └── logo.png │ ├── app │ │ ├── app.component.css │ │ ├── about │ │ │ ├── about.component.css │ │ │ ├── about.component.html │ │ │ ├── about.component.ts │ │ │ └── about.component.spec.ts │ │ ├── cart │ │ │ ├── cart.component.css │ │ │ ├── cart.component.html │ │ │ ├── cart.component.ts │ │ │ └── cart.component.spec.ts │ │ ├── index.ts │ │ ├── beer-list │ │ │ ├── beer-list.component.css │ │ │ ├── beer.ts │ │ │ ├── mocks.ts │ │ │ ├── beer-list.component.spec.ts │ │ │ ├── beer-list.component.ts │ │ │ └── beer-list.component.html │ │ ├── app.component.ts │ │ ├── app.routes.ts │ │ ├── cart.service.spec.ts │ │ ├── beer-data.service.spec.ts │ │ ├── beer-data.service.ts │ │ ├── app.module.ts │ │ ├── app.component.spec.ts │ │ ├── cart.service.ts │ │ └── app.component.html │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── styles.css │ ├── images │ │ ├── blonde.png │ │ ├── porter.jpg │ │ └── barley_wine.jpg │ ├── typings.d.ts │ ├── main.ts │ ├── tsconfig.json │ ├── polyfills.ts │ ├── index.html │ └── test.ts ├── e2e │ ├── app.po.ts │ ├── app.e2e-spec.ts │ └── tsconfig.json ├── .editorconfig ├── .gitignore ├── protractor.conf.js ├── README.md ├── karma.conf.js ├── angular-cli.json ├── package.json └── tslint.json ├── Retro.md └── README.md /Brewery/src/assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Brewery/src/app/app.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Brewery/src/app/about/about.component.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Brewery/src/app/cart/cart.component.css: -------------------------------------------------------------------------------- 1 | th, td { 2 | text-align: center 3 | } -------------------------------------------------------------------------------- /Brewery/src/app/index.ts: -------------------------------------------------------------------------------- 1 | export * from './app.component'; 2 | export * from './app.module'; 3 | -------------------------------------------------------------------------------- /Brewery/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /Brewery/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unicen/Angular2-Seminario/HEAD/Brewery/src/favicon.ico -------------------------------------------------------------------------------- /Brewery/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /Brewery/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unicen/Angular2-Seminario/HEAD/Brewery/src/assets/logo.png -------------------------------------------------------------------------------- /Brewery/src/images/blonde.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unicen/Angular2-Seminario/HEAD/Brewery/src/images/blonde.png -------------------------------------------------------------------------------- /Brewery/src/images/porter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unicen/Angular2-Seminario/HEAD/Brewery/src/images/porter.jpg -------------------------------------------------------------------------------- /Brewery/src/images/barley_wine.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unicen/Angular2-Seminario/HEAD/Brewery/src/images/barley_wine.jpg -------------------------------------------------------------------------------- /Brewery/src/app/beer-list/beer-list.component.css: -------------------------------------------------------------------------------- 1 | .clearance { 2 | border: 6px solid lightgreen; 3 | } 4 | 5 | .smallInput{ 6 | width: 30px; 7 | } -------------------------------------------------------------------------------- /Brewery/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | // Typings reference file, you can add your own global typings here 2 | // https://www.typescriptlang.org/docs/handbook/writing-declaration-files.html 3 | -------------------------------------------------------------------------------- /Brewery/src/app/beer-list/beer.ts: -------------------------------------------------------------------------------- 1 | export class Beer { 2 | name: string; 3 | style: string; 4 | price: number; 5 | stock: number; 6 | image: string; 7 | clearance: boolean; 8 | quantity: number; 9 | } -------------------------------------------------------------------------------- /Brewery/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-brewery', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.css'] 7 | }) 8 | export class AppComponent { 9 | } 10 | -------------------------------------------------------------------------------- /Brewery/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, element, by } from 'protractor'; 2 | 3 | export class BreweryPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Brewery/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /Brewery/src/app/about/about.component.html: -------------------------------------------------------------------------------- 1 |
2 | Brewery, Inc.
3 | Calle Falsa 123
4 | Tandil, Bs As 7000
5 | P: (123) 456-7890 6 |
7 | 8 |
9 | Roberto Petruzza (Brewmaster)
10 | roberto.petruzza@brewery.com 11 |
-------------------------------------------------------------------------------- /Brewery/src/app/about/about.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'about-brewery', 5 | templateUrl: './about.component.html', 6 | styleUrls: ['./about.component.css'] 7 | }) 8 | export class AboutComponent implements OnInit { 9 | 10 | constructor() { } 11 | 12 | ngOnInit() { 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Brewery/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { BreweryPage } from './app.po'; 2 | 3 | describe('brewery App', function() { 4 | let page: BreweryPage; 5 | 6 | beforeEach(() => { 7 | page = new BreweryPage(); 8 | }); 9 | 10 | it('should display message saying app works', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('app works!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /Brewery/src/app/app.routes.ts: -------------------------------------------------------------------------------- 1 | import { Routes } from '@angular/router'; 2 | import { BeerListComponent } from './beer-list/beer-list.component' 3 | import { AboutComponent } from './about/about.component' 4 | 5 | export const appRoutes: Routes = [ 6 | { path: '', component: BeerListComponent }, 7 | { path: 'beers', component: BeerListComponent }, 8 | { path: 'about', component: AboutComponent }, 9 | ]; 10 | -------------------------------------------------------------------------------- /Brewery/src/main.ts: -------------------------------------------------------------------------------- 1 | import './polyfills.ts'; 2 | 3 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 4 | import { enableProdMode } from '@angular/core'; 5 | import { environment } from './environments/environment'; 6 | import { AppModule } from './app/'; 7 | 8 | if (environment.production) { 9 | enableProdMode(); 10 | } 11 | 12 | platformBrowserDynamic().bootstrapModule(AppModule); 13 | -------------------------------------------------------------------------------- /Brewery/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "outDir": "../dist/out-tsc-e2e", 10 | "sourceMap": true, 11 | "target": "es5", 12 | "typeRoots": [ 13 | "../node_modules/@types" 14 | ] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Brewery/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // The file contents for the current environment will overwrite these during build. 2 | // The build system defaults to the dev environment which uses `environment.ts`, but if you do 3 | // `ng build --env=prod` then `environment.prod.ts` will be used instead. 4 | // The list of which env maps to which file can be found in `angular-cli.json`. 5 | 6 | export const environment = { 7 | production: false 8 | }; 9 | -------------------------------------------------------------------------------- /Brewery/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "", 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": ["es6", "dom"], 8 | "mapRoot": "./", 9 | "module": "es6", 10 | "moduleResolution": "node", 11 | "outDir": "../dist/out-tsc", 12 | "sourceMap": true, 13 | "target": "es5", 14 | "typeRoots": [ 15 | "../node_modules/@types" 16 | ] 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Brewery/src/app/cart.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async, inject } from '@angular/core/testing'; 4 | import { CartService } from './cart.service'; 5 | 6 | describe('CartService', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | providers: [CartService] 10 | }); 11 | }); 12 | 13 | it('should ...', inject([CartService], (service: CartService) => { 14 | expect(service).toBeTruthy(); 15 | })); 16 | }); 17 | -------------------------------------------------------------------------------- /Brewery/src/app/beer-data.service.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async, inject } from '@angular/core/testing'; 4 | import { BeerDataService } from './beer-data.service'; 5 | 6 | describe('BeerDataService', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | providers: [BeerDataService] 10 | }); 11 | }); 12 | 13 | it('should ...', inject([BeerDataService], (service: BeerDataService) => { 14 | expect(service).toBeTruthy(); 15 | })); 16 | }); 17 | -------------------------------------------------------------------------------- /Brewery/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # IDEs and editors 12 | /.idea 13 | /.vscode 14 | .project 15 | .classpath 16 | .c9/ 17 | *.launch 18 | .settings/ 19 | 20 | # misc 21 | /.sass-cache 22 | /connect.lock 23 | /coverage/* 24 | /libpeerconnection.log 25 | npm-debug.log 26 | testem.log 27 | /typings 28 | 29 | # e2e 30 | /e2e/*.js 31 | /e2e/*.map 32 | 33 | #System Files 34 | .DS_Store 35 | Thumbs.db 36 | -------------------------------------------------------------------------------- /Brewery/src/app/beer-list/mocks.ts: -------------------------------------------------------------------------------- 1 | import { Beer } from './beer'; 2 | export const BEERS : Beer[] = [{ 3 | "name": "Negra Fuerte", 4 | "style": "Porter", 5 | "price": 20, 6 | "stock": 2, 7 | "image": '/images/porter.jpg', 8 | "clearance": true, 9 | "quantity": 0 10 | }, 11 | { 12 | "name": "Red Red Wine", 13 | "style": "Barley Wine", 14 | "price": 40, 15 | "stock": 3, 16 | "image": '/images/barley_wine.jpg', 17 | "clearance": false, 18 | "quantity": 0 19 | }, 20 | { 21 | "name": "La Rubia", 22 | "style": "Golden Ale", 23 | "price": 23.5, 24 | "stock": 0, 25 | "image": '/images/blonde.png', 26 | "clearance": false, 27 | "quantity": 0 28 | }]; -------------------------------------------------------------------------------- /Brewery/src/app/beer-data.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http } from '@angular/http'; 3 | import { Beer } from './beer-list/beer'; 4 | import 'rxjs/add/operator/map'; 5 | 6 | @Injectable() 7 | export class BeerDataService { 8 | 9 | constructor(private http: Http) { } 10 | 11 | getBeers(){ 12 | return this.http.get('https://brewery-angular.firebaseio.com/beers.json') 13 | .map(response => 14 | { 15 | let beers = response.json(); 16 | return Object.keys(beers).map(key => Object.assign({ key }, beers[key])); 17 | }); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /Brewery/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | // This file includes polyfills needed by Angular 2 and is loaded before 2 | // the app. You can add your own extra polyfills to this file. 3 | import 'core-js/es6/symbol'; 4 | import 'core-js/es6/object'; 5 | import 'core-js/es6/function'; 6 | import 'core-js/es6/parse-int'; 7 | import 'core-js/es6/parse-float'; 8 | import 'core-js/es6/number'; 9 | import 'core-js/es6/math'; 10 | import 'core-js/es6/string'; 11 | import 'core-js/es6/date'; 12 | import 'core-js/es6/array'; 13 | import 'core-js/es6/regexp'; 14 | import 'core-js/es6/map'; 15 | import 'core-js/es6/set'; 16 | import 'core-js/es6/reflect'; 17 | 18 | import 'core-js/es7/reflect'; 19 | import 'zone.js/dist/zone'; 20 | -------------------------------------------------------------------------------- /Brewery/src/app/cart/cart.component.html: -------------------------------------------------------------------------------- 1 |
2 |
Carrito de la Felicidad
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
CervezaCantidadTotal
{{beer.name}}{{beer.quantity}}{{totalPrice(beer)| currency:'USD':true:'1.2-2'}}
20 |

Total: {{total()| currency:'USD':true:'1.2-2'}}

21 |
22 |
23 | -------------------------------------------------------------------------------- /Brewery/src/app/cart/cart.component.ts: -------------------------------------------------------------------------------- 1 | import {Component, OnInit} from "@angular/core"; 2 | import {CartService} from "../cart.service"; 3 | 4 | @Component({ 5 | selector: 'beer-cart', 6 | templateUrl: './cart.component.html', 7 | styleUrls: ['./cart.component.css'] 8 | }) 9 | export class CartComponent implements OnInit { 10 | 11 | beers = []; 12 | 13 | constructor(private cartService: CartService) { 14 | } 15 | 16 | ngOnInit() { 17 | 18 | // Subscribe to cartService changes 19 | this.cartService.items.subscribe(data => { 20 | this.beers = data; 21 | }); 22 | } 23 | 24 | totalPrice(beer) { 25 | return beer.price * beer.quantity; 26 | } 27 | 28 | total() { 29 | let total = 0; 30 | this.beers.forEach(beer => total += this.totalPrice(beer)); 31 | return total 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Retro.md: -------------------------------------------------------------------------------- 1 | ## Buenas 2 | * Traer a Nico, un profesional. 3 | * Hacer en vivo los ejercicios suma!. 4 | * Filimnas bien preparadas. 5 | * Repondemos a la lista. 6 | * Ejemplos practicos "Metaforicos" "Criollo". 7 | * Posibilidad de elegir entre varias opciones de Seminario. 8 | * Github y los branches/ 9 | * TUDAI años luz de Ingenieria. 10 | 11 | ## Malas 12 | * Viernes mal dia para clases tan tarde. 13 | * AI: No dar clases Viernes. 14 | * No tener una semana en el medio sin hacer nada 15 | * AI: Planificar semanas consecutivas 16 | * Dar el practio anteulimo dia. 17 | * AI: Dar mas tiempo para hacerlo, Darlo al principio. 18 | * Un solo mail a la lista: 19 | * AI: Inculcar el mandar mail al momento que me bloqueo. 20 | * Horarios a ultimo momento. 21 | * AI: Planificar los horarios con mas tiempo 22 | 23 | ## Empezar a hacer 24 | * Grabar clases -------------------------------------------------------------------------------- /Brewery/src/app/cart/cart.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | import { By } from '@angular/platform-browser'; 4 | import { DebugElement } from '@angular/core'; 5 | 6 | import { CartComponent } from './cart.component'; 7 | 8 | describe('CartComponent', () => { 9 | let component: CartComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [ CartComponent ] 15 | }) 16 | .compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(CartComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /Brewery/src/app/about/about.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | import { By } from '@angular/platform-browser'; 4 | import { DebugElement } from '@angular/core'; 5 | 6 | import { AboutComponent } from './about.component'; 7 | 8 | describe('AboutComponent', () => { 9 | let component: AboutComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [ AboutComponent ] 15 | }) 16 | .compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(AboutComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /Brewery/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/docs/referenceConf.js 3 | 4 | /*global jasmine */ 5 | var SpecReporter = require('jasmine-spec-reporter'); 6 | 7 | exports.config = { 8 | allScriptsTimeout: 11000, 9 | specs: [ 10 | './e2e/**/*.e2e-spec.ts' 11 | ], 12 | capabilities: { 13 | 'browserName': 'chrome' 14 | }, 15 | directConnect: true, 16 | baseUrl: 'http://localhost:4200/', 17 | framework: 'jasmine', 18 | jasmineNodeOpts: { 19 | showColors: true, 20 | defaultTimeoutInterval: 30000, 21 | print: function() {} 22 | }, 23 | useAllAngular2AppRoots: true, 24 | beforeLaunch: function() { 25 | require('ts-node').register({ 26 | project: 'e2e' 27 | }); 28 | }, 29 | onPrepare: function() { 30 | jasmine.getEnv().addReporter(new SpecReporter()); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /Brewery/src/app/beer-list/beer-list.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 3 | import { By } from '@angular/platform-browser'; 4 | import { DebugElement } from '@angular/core'; 5 | 6 | import { BeerListComponent } from './beer-list.component'; 7 | 8 | describe('BeerListComponent', () => { 9 | let component: BeerListComponent; 10 | let fixture: ComponentFixture; 11 | 12 | beforeEach(async(() => { 13 | TestBed.configureTestingModule({ 14 | declarations: [ BeerListComponent ] 15 | }) 16 | .compileComponents(); 17 | })); 18 | 19 | beforeEach(() => { 20 | fixture = TestBed.createComponent(BeerListComponent); 21 | component = fixture.componentInstance; 22 | fixture.detectChanges(); 23 | }); 24 | 25 | it('should create', () => { 26 | expect(component).toBeTruthy(); 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /Brewery/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Brewery 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Loading... 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Brewery/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { NgModule } from '@angular/core'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { HttpModule } from '@angular/http'; 5 | import { RouterModule } from '@angular/router'; 6 | 7 | import { AppComponent } from './app.component'; 8 | import { BeerListComponent } from './beer-list/beer-list.component'; 9 | import { BeerDataService } from './beer-data.service'; 10 | import { CartService } from './cart.service'; 11 | import { appRoutes } from './app.routes'; 12 | import { AboutComponent } from './about/about.component'; 13 | import { CartComponent } from './cart/cart.component'; 14 | 15 | @NgModule({ 16 | declarations: [ 17 | AppComponent, 18 | BeerListComponent, 19 | AboutComponent, 20 | CartComponent 21 | ], 22 | imports: [ 23 | BrowserModule, 24 | FormsModule, 25 | HttpModule, 26 | RouterModule.forRoot(appRoutes) 27 | ], 28 | providers: [ BeerDataService, CartService ], 29 | bootstrap: [AppComponent] 30 | }) 31 | export class AppModule { } 32 | -------------------------------------------------------------------------------- /Brewery/src/test.ts: -------------------------------------------------------------------------------- 1 | import './polyfills.ts'; 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare var __karma__: any; 17 | declare var require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | let context = require.context('./', true, /\.spec\.ts/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /Brewery/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable:no-unused-variable */ 2 | 3 | import { TestBed, async } from '@angular/core/testing'; 4 | import { AppComponent } from './app.component'; 5 | 6 | describe('AppComponent', () => { 7 | beforeEach(() => { 8 | TestBed.configureTestingModule({ 9 | declarations: [ 10 | AppComponent 11 | ], 12 | }); 13 | }); 14 | 15 | it('should create the app', async(() => { 16 | let fixture = TestBed.createComponent(AppComponent); 17 | let app = fixture.debugElement.componentInstance; 18 | expect(app).toBeTruthy(); 19 | })); 20 | 21 | it(`should have as title 'app works!'`, async(() => { 22 | let fixture = TestBed.createComponent(AppComponent); 23 | let app = fixture.debugElement.componentInstance; 24 | expect(app.title).toEqual('app works!'); 25 | })); 26 | 27 | it('should render title in a h1 tag', async(() => { 28 | let fixture = TestBed.createComponent(AppComponent); 29 | fixture.detectChanges(); 30 | let compiled = fixture.debugElement.nativeElement; 31 | expect(compiled.querySelector('h1').textContent).toContain('app works!'); 32 | })); 33 | }); 34 | -------------------------------------------------------------------------------- /Brewery/README.md: -------------------------------------------------------------------------------- 1 | # Brewery 2 | 3 | This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.21. 4 | 5 | ## Development server 6 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 7 | 8 | ## Code scaffolding 9 | 10 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class`. 11 | 12 | ## Build 13 | 14 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. 15 | 16 | ## Running unit tests 17 | 18 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 19 | 20 | ## Running end-to-end tests 21 | 22 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 23 | Before running the tests make sure you are serving the app via `ng serve`. 24 | 25 | ## Deploying to Github Pages 26 | 27 | Run `ng github-pages:deploy` to deploy to Github Pages. 28 | 29 | ## Further help 30 | 31 | To get more help on the `angular-cli` use `ng --help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 32 | -------------------------------------------------------------------------------- /Brewery/src/app/beer-list/beer-list.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { Beer } from './beer'; 3 | import { BeerDataService } from '../beer-data.service'; 4 | import { CartService } from '../cart.service'; 5 | 6 | 7 | 8 | @Component({ 9 | selector: 'beer-list', 10 | templateUrl: './beer-list.component.html', 11 | styleUrls: ['./beer-list.component.css'] 12 | }) 13 | export class BeerListComponent implements OnInit { 14 | beers : Beer[]; 15 | 16 | constructor(private beerDataService : BeerDataService, private cartService: CartService) { } 17 | 18 | ngOnInit() { 19 | this.beerDataService.getBeers().subscribe(beers => this.beers=beers); 20 | } 21 | 22 | upQuantity(beer){ 23 | if(beer.quantity < beer.stock && beer.stock != 0) beer.quantity++; 24 | } 25 | 26 | downQuantity(beer){ 27 | if(beer.quantity != 0) beer.quantity--; 28 | } 29 | 30 | verifyBeerQuantity(beer){ 31 | if(beer.quantity > beer.stock) { 32 | alert("No hay suficientes cervezas en stock"); 33 | } 34 | if(beer.quantity < 0) { 35 | alert("No se pueden encargar cervezas negativas "); 36 | } 37 | beer.quantity = 0; 38 | } 39 | 40 | addCart(beer: Beer) { 41 | this.cartService.addToCart(beer); 42 | beer.stock -= beer.quantity; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Brewery/src/app/cart.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Http } from '@angular/http'; 3 | import { Beer } from './beer-list/beer'; 4 | import 'rxjs/add/operator/map'; 5 | import {BehaviorSubject, Observable} from "rxjs"; 6 | 7 | @Injectable() 8 | export class CartService { 9 | 10 | private _items: Beer[] = []; 11 | private _itemsSubject: BehaviorSubject = new BehaviorSubject(this._items); 12 | public items: Observable = this._itemsSubject.asObservable(); 13 | 14 | 15 | constructor() { } 16 | 17 | addToCart(beer: Beer) { 18 | 19 | // Clone beer object into newBeer 20 | let newBeer = Object.assign({}, beer); 21 | 22 | // Iterate items looking for current beer there 23 | // If beer is already in cart, then increment quantity 24 | let alreadyInCart = false; 25 | this._items.forEach( (b: Beer) => { 26 | if (b.name == newBeer.name) { 27 | alreadyInCart = true; 28 | b.quantity += newBeer.quantity; 29 | } 30 | }); 31 | 32 | // If beer doesnt exist in cart, then add it 33 | if (!alreadyInCart) 34 | this._items.push(newBeer); 35 | 36 | 37 | // this._items.push(beer); 38 | this._itemsSubject.next(this._items); 39 | } 40 | 41 | getItems() { 42 | return this._items; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Brewery/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/0.13/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', 'angular-cli'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-remap-istanbul'), 12 | require('angular-cli/plugins/karma') 13 | ], 14 | files: [ 15 | { pattern: './src/test.ts', watched: false } 16 | ], 17 | preprocessors: { 18 | './src/test.ts': ['angular-cli'] 19 | }, 20 | mime: { 21 | 'text/x-typescript': ['ts','tsx'] 22 | }, 23 | remapIstanbulReporter: { 24 | reports: { 25 | html: 'coverage', 26 | lcovonly: './coverage/coverage.lcov' 27 | } 28 | }, 29 | angularCli: { 30 | config: './angular-cli.json', 31 | environment: 'dev' 32 | }, 33 | reporters: config.angularCli && config.angularCli.codeCoverage 34 | ? ['progress', 'karma-remap-istanbul'] 35 | : ['progress'], 36 | port: 9876, 37 | colors: true, 38 | logLevel: config.LOG_INFO, 39 | autoWatch: true, 40 | browsers: ['Chrome'], 41 | singleRun: false 42 | }); 43 | }; 44 | -------------------------------------------------------------------------------- /Brewery/src/app/app.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 22 |
23 |
24 |
25 |
26 | 27 |
28 |
29 | 30 |
31 |
32 |
33 |
Todos los derechos reservados Brewery Inc.®
34 |
35 |
-------------------------------------------------------------------------------- /Brewery/angular-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "project": { 3 | "version": "1.0.0-beta.21", 4 | "name": "brewery" 5 | }, 6 | "apps": [ 7 | { 8 | "root": "src", 9 | "outDir": "dist", 10 | "assets": [ 11 | "assets", 12 | "favicon.ico" 13 | ], 14 | "index": "index.html", 15 | "main": "main.ts", 16 | "test": "test.ts", 17 | "tsconfig": "tsconfig.json", 18 | "prefix": "app", 19 | "mobile": false, 20 | "styles": [ 21 | "styles.css" 22 | ], 23 | "scripts": [], 24 | "environments": { 25 | "source": "environments/environment.ts", 26 | "dev": "environments/environment.ts", 27 | "prod": "environments/environment.prod.ts" 28 | } 29 | } 30 | ], 31 | "addons": [], 32 | "packages": [], 33 | "e2e": { 34 | "protractor": { 35 | "config": "./protractor.conf.js" 36 | } 37 | }, 38 | "test": { 39 | "karma": { 40 | "config": "./karma.conf.js" 41 | } 42 | }, 43 | "defaults": { 44 | "styleExt": "css", 45 | "prefixInterfaces": false, 46 | "inline": { 47 | "style": false, 48 | "template": false 49 | }, 50 | "spec": { 51 | "class": false, 52 | "component": true, 53 | "directive": true, 54 | "module": false, 55 | "pipe": true, 56 | "service": true 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Brewery/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "brewery", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "angular-cli": {}, 6 | "scripts": { 7 | "start": "ng serve", 8 | "lint": "tslint \"src/**/*.ts\"", 9 | "test": "ng test", 10 | "pree2e": "webdriver-manager update", 11 | "e2e": "protractor" 12 | }, 13 | "private": true, 14 | "dependencies": { 15 | "@angular/common": "2.2.1", 16 | "@angular/compiler": "2.2.1", 17 | "@angular/core": "2.2.1", 18 | "@angular/forms": "2.2.1", 19 | "@angular/http": "2.2.1", 20 | "@angular/platform-browser": "2.2.1", 21 | "@angular/platform-browser-dynamic": "2.2.1", 22 | "@angular/router": "3.2.1", 23 | "core-js": "^2.4.1", 24 | "rxjs": "5.0.0-beta.12", 25 | "ts-helpers": "^1.1.1", 26 | "zone.js": "^0.6.23" 27 | }, 28 | "devDependencies": { 29 | "@angular/compiler-cli": "2.2.1", 30 | "@types/jasmine": "2.5.38", 31 | "@types/node": "^6.0.42", 32 | "angular-cli": "1.0.0-beta.21", 33 | "codelyzer": "~1.0.0-beta.3", 34 | "jasmine-core": "2.5.2", 35 | "jasmine-spec-reporter": "2.5.0", 36 | "karma": "1.2.0", 37 | "karma-chrome-launcher": "^2.0.0", 38 | "karma-cli": "^1.0.1", 39 | "karma-jasmine": "^1.0.2", 40 | "karma-remap-istanbul": "^0.2.1", 41 | "protractor": "4.0.9", 42 | "ts-node": "1.2.1", 43 | "tslint": "3.13.0", 44 | "typescript": "~2.0.3", 45 | "webdriver-manager": "10.2.5" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Brewery/src/app/beer-list/beer-list.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 32 | 37 | 38 | 39 |
NombreTipoPrecioStock
{{beer.name}}{{beer.style}}{{beer.price| currency:'USD':true:'1.2-2'}} 22 |
23 | 26 | 27 | 30 |
31 |
33 | 36 |
40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Seminario Angular - TUDAI 2 | Este es el repositorio del Seminario de Angular para la Tecnicatura Universitaria en Desarrollo de Aplicaciones Informáticas (TUDAI). 3 | Este curso es una introducción al desarrollo de Single Page Applications usando Angular 2. 4 | 5 | ## Docentes 6 | * [Nicolas Tourne](https://twitter.com/nicotourne) 7 | * [Ignacio Jonas](https://about.me/ignaciojonas) 8 | * [Javier Dottori]() 9 | 10 | ## Slides & Branches 11 | ### 01 - Introducción 12 | * [Slides](https://docs.google.com/presentation/d/1_Zm9ZlUYcz9kNVSzgtaryKhXnuSWzvyO3RVe3QEK2ks/edit?usp=sharing) 13 | * [Code](https://github.com/Unicen/Angular2-Seminario/tree/01_Intro) 14 | 15 | ### 02 - Components 16 | * [Slides](https://docs.google.com/presentation/d/1_xREpDIHOWvecO9xsAz7WrA1FQJ04CFitg-0xacF3fw/edit?usp=sharing) 17 | * [Code](https://github.com/Unicen/Angular2-Seminario/tree/02_Components) 18 | 19 | ### 03 - Directives & Pipes 20 | * [Slides](https://docs.google.com/presentation/d/1DlRPM_a9rex1cee7DjNaF5GO0hS-tU1sptKN_I2h57g/edit?usp=sharing) 21 | * [Code](https://github.com/Unicen/Angular2-Seminario/tree/03_DirectivePipes) 22 | 23 | ### 04 - Mocks, Models & Property Binding 24 | * [Slides](https://docs.google.com/presentation/d/1SLxcq-00R0gLpewNJNd0xxSuM9dykb872AKT6JJw3Tk/edit?usp=sharing) 25 | * [Code](https://github.com/Unicen/Angular2-Seminario/tree/04_MocksObjectsBinding) 26 | 27 | ### 05 - Event Binding + 2 Ways Data Binding 28 | * [Slides](https://docs.google.com/presentation/d/1d_hnboeegOZWvvoC5L0SaizP_NlgMRC0OQOMOuubAvc/edit?usp=sharing) 29 | * [Code](https://github.com/Unicen/Angular2-Seminario/tree/05_EventBinding2WaysDB) 30 | 31 | ### 06 - Services + Dependency Injection 32 | * [Slides](https://docs.google.com/presentation/d/1qkRcDKGSy13aoRIlwgL9eYQmYMIjKOvO1mhCjSaT3OE/edit?usp=sharing) 33 | * [Code](https://github.com/Unicen/Angular2-Seminario/tree/06_ServicesDependencyInjection) 34 | 35 | ### 07 - Routing 36 | * [Slides](https://docs.google.com/presentation/d/10u4OlxhFj-4SqLKXfFeBJvKdf5KN2tr0pCtFK5euDVA/edit?usp=sharing) 37 | * [Code](https://github.com/Unicen/Angular2-Seminario/tree/07_Routing) 38 | 39 | ### 08 - Comunicacion entre componentes 40 | * [Slides](https://docs.google.com/presentation/d/1g__35jk7ggIlUvdAl5rWAEo5Ktyznhx6u-bo3d-Lb98/edit?usp=sharing) 41 | * [Code](https://github.com/Unicen/Angular2-Seminario/tree/08_CommunicationBetweenComponents) 42 | 43 | ## Trabajo Final 44 | * [Consigna](https://docs.google.com/document/d/11ZEeVvf1n37qCO13aRqEjJDzejOsOWcKBhptKzrwlnI/edit?usp=sharing) 45 | 46 | Anotarse en la planilla: 47 | * [Grupos](https://docs.google.com/spreadsheets/d/18jOuTjCw0pjbFHZ7guB2FJc7wtS_lYXxLp0eDElIxqo/edit?usp=sharing) 48 | 49 | La entrega es mañana 3-Marzo en el horario de la clase. -------------------------------------------------------------------------------- /Brewery/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rulesDirectory": [ 3 | "node_modules/codelyzer" 4 | ], 5 | "rules": { 6 | "class-name": true, 7 | "comment-format": [ 8 | true, 9 | "check-space" 10 | ], 11 | "curly": true, 12 | "eofline": true, 13 | "forin": true, 14 | "indent": [ 15 | true, 16 | "spaces" 17 | ], 18 | "label-position": true, 19 | "label-undefined": true, 20 | "max-line-length": [ 21 | true, 22 | 140 23 | ], 24 | "member-access": false, 25 | "member-ordering": [ 26 | true, 27 | "static-before-instance", 28 | "variables-before-functions" 29 | ], 30 | "no-arg": true, 31 | "no-bitwise": true, 32 | "no-console": [ 33 | true, 34 | "debug", 35 | "info", 36 | "time", 37 | "timeEnd", 38 | "trace" 39 | ], 40 | "no-construct": true, 41 | "no-debugger": true, 42 | "no-duplicate-key": true, 43 | "no-duplicate-variable": true, 44 | "no-empty": false, 45 | "no-eval": true, 46 | "no-inferrable-types": true, 47 | "no-shadowed-variable": true, 48 | "no-string-literal": false, 49 | "no-switch-case-fall-through": true, 50 | "no-trailing-whitespace": true, 51 | "no-unused-expression": true, 52 | "no-unused-variable": true, 53 | "no-unreachable": true, 54 | "no-use-before-declare": true, 55 | "no-var-keyword": true, 56 | "object-literal-sort-keys": false, 57 | "one-line": [ 58 | true, 59 | "check-open-brace", 60 | "check-catch", 61 | "check-else", 62 | "check-whitespace" 63 | ], 64 | "quotemark": [ 65 | true, 66 | "single" 67 | ], 68 | "radix": true, 69 | "semicolon": [ 70 | "always" 71 | ], 72 | "triple-equals": [ 73 | true, 74 | "allow-null-check" 75 | ], 76 | "typedef-whitespace": [ 77 | true, 78 | { 79 | "call-signature": "nospace", 80 | "index-signature": "nospace", 81 | "parameter": "nospace", 82 | "property-declaration": "nospace", 83 | "variable-declaration": "nospace" 84 | } 85 | ], 86 | "variable-name": false, 87 | "whitespace": [ 88 | true, 89 | "check-branch", 90 | "check-decl", 91 | "check-operator", 92 | "check-separator", 93 | "check-type" 94 | ], 95 | 96 | "directive-selector-prefix": [true, "app"], 97 | "component-selector-prefix": [true, "app"], 98 | "directive-selector-name": [true, "camelCase"], 99 | "component-selector-name": [true, "kebab-case"], 100 | "directive-selector-type": [true, "attribute"], 101 | "component-selector-type": [true, "element"], 102 | "use-input-property-decorator": true, 103 | "use-output-property-decorator": true, 104 | "use-host-property-decorator": true, 105 | "no-input-rename": true, 106 | "no-output-rename": true, 107 | "use-life-cycle-interface": true, 108 | "use-pipe-transform-interface": true, 109 | "component-class-suffix": true, 110 | "directive-class-suffix": true, 111 | "templates-use-public": true, 112 | "invoke-injectable": true 113 | } 114 | } 115 | --------------------------------------------------------------------------------