forked from contentacms/contenta_angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28115ea
commit e2af530
Showing
13 changed files
with
5,609 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { Routes } from '@angular/router'; | ||
import { HomeComponent } from './components/home/home.component'; | ||
import { FeaturesComponent } from './components/features/features.component' | ||
import { DynamicComponent } from './dynamic/dynamic.component'; | ||
|
||
export const routes: Routes = [ | ||
{ path: '', component: HomeComponent }, | ||
{ path: ':key', component: DynamicComponent }, | ||
{ path: 'features', component: FeaturesComponent }, | ||
{ path: 'recipes', loadChildren: './components/recipe/recipe.module#RecipeModule' } | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<md-list class="sidenav-menu"> | ||
<md-list-item *ngFor="let menu_item of menu; let i = index"> | ||
<a class="sidenav-menu-item" md-button [routerLink]="[menu_item.url]" (click)="changeRoute()"> | ||
<md-icon [color]="'primary'" class="menu-item-icon" [svgIcon]="menu_item.icon" [alt]="menu_item.name" [title]="menu_item.name"></md-icon> | ||
<md-icon [color]="'primary'" class="menu-item-icon" [svgIcon]="menu_item.icon" [title]="menu_item.name"></md-icon> | ||
<span>{{menu_item.name}}</span> | ||
</a> | ||
</md-list-item> | ||
<div class="separator"></div> | ||
<md-list-item> | ||
<a class="sidenav-menu-item" md-button href="https://github.com/contentacms/contenta_angular" target="_blank" (click)="changeRoute()"> | ||
<md-icon [color]="'secondary'" class="menu-item-icon" [svgIcon]="'code'" alt="Login" title="Login"></md-icon> | ||
<md-icon [color]="'secondary'" class="menu-item-icon" [svgIcon]="'code'" title="Login"></md-icon> | ||
<span>Github</span> | ||
</a> | ||
</md-list-item> | ||
</md-list> | ||
</md-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div *ngIf="itemContents | async as items"> | ||
<!--{{items | json}}--> | ||
<div *ngFor="let item of items"> | ||
<!--{{item | json}}--> | ||
<div *ngFor="let attrib of item.attributeList"> | ||
<strong>{{attrib.key}}:</strong><br/> <span [innerHTML]="attrib.value"></span> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
<ng-template #loading>Loading items.</ng-template> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { async, ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { DynamicComponent } from './dynamic.component'; | ||
|
||
describe('DynamicComponent', () => { | ||
let component: DynamicComponent; | ||
let fixture: ComponentFixture<DynamicComponent>; | ||
|
||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ DynamicComponent ] | ||
}) | ||
.compileComponents(); | ||
})); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(DynamicComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Http } from '@angular/http'; | ||
import { ActivatedRoute } from "@angular/router"; | ||
import { makeList } from "app/shared/stephen"; | ||
|
||
@Component({ | ||
selector: 'app-dynamic', | ||
templateUrl: './dynamic.component.html', | ||
styleUrls: ['./dynamic.component.scss'] | ||
}) | ||
export class DynamicComponent implements OnInit { | ||
itemContents; | ||
|
||
constructor(http: Http, route: ActivatedRoute) { | ||
this.itemContents = route.params.switchMap(params => | ||
http.get(`https://dev-contentacms.pantheonsite.io/api/${params['key']}`) | ||
.map(res => res.json().data) | ||
.map(list => { | ||
return list.map(obj => { | ||
if(obj) { | ||
console.log(obj); | ||
obj.attributeList = makeList(obj.attributes); | ||
} | ||
return obj; | ||
}); | ||
}) | ||
); | ||
} | ||
|
||
|
||
ngOnInit() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export function makeList(obj): any[] { | ||
if(!obj) { | ||
console.log("returning empty object",obj); | ||
return []; | ||
} | ||
console.log("obj is", obj); | ||
let list = []; | ||
for (let key of Object.keys(obj)) { | ||
list.push({ key: key, value: obj[key] }); | ||
} | ||
return list; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.