Skip to content

Commit

Permalink
feat(posts):tidy up the posts area
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Hodges committed Aug 29, 2017
1 parent d74ffca commit ffb7270
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 43 deletions.
7 changes: 2 additions & 5 deletions src/app/ngx-blog/components/post/post.component.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/ngx-blog/components/post/post.component.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions src/app/ngx-blog/components/post/post.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import 'prismjs/components/prism-typescript';

@Component({
selector: 'ngxb-post, [ngxb-post]',
// templateUrl: 'post.component.html',
template: `
<ng-content></ng-content>`,
encapsulation: ViewEncapsulation.None,
Expand All @@ -35,15 +34,14 @@ export class PostComponent implements OnInit, OnChanges, AfterViewInit {
constructor(public postsService: PostsService,
public element: ElementRef) { }

ngOnInit() { }
ngOnInit() { }

ngAfterViewInit() {
if (this.data) {
this.handleData();
return;
}
if (this.src) {
console.log('src: \n', this.src);
this.handleSrc();
return;
}
Expand All @@ -52,11 +50,11 @@ export class PostComponent implements OnInit, OnChanges, AfterViewInit {

// SimpleChanges parameter is required for AoT compilation (do not remove)
ngOnChanges(changes: SimpleChanges) {
if ('data' in changes) {
if (changes.data) {
this.handleData();
return;
}
if ('src' in changes) {
if (changes.src) {
this.handleSrc();
return;
}
Expand All @@ -80,7 +78,6 @@ export class PostComponent implements OnInit, OnChanges, AfterViewInit {
}

handleRaw(raw: string) {
// const markdown = this.prepare(raw);
const markdown = raw;
this.element.nativeElement.innerHTML = marked(markdown);
Prism.highlightAll(false);
Expand Down
9 changes: 0 additions & 9 deletions src/app/ngx-blog/components/posts/posts.component.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/ngx-blog/components/posts/posts.component.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions src/app/ngx-blog/components/posts/posts.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,12 @@ export class PostsComponent implements OnInit {

ngOnInit() {
this.postsService.getPosts().subscribe((e) => {
debugger;
console.log('%c*** COMP: PostsComponent | function ngOnInit ***', 'background-color: blue;color:white;font-style:bold;', e)
e.entries.map((p: any) => {
this.tap(p, 'p: ');
this.mainPosts.push({
title: p.post.attributes.title,
body: p.post.body
});
});
console.log('%c*** COMP: PostsComponent | function ngOnInit ***', 'background-color: blue;color:white;font-style:bold;', this.mainPosts)
});
}

tap(x: any, w?: string) {
console.log(`%c ${ w ? w : '*****'}`, 'background-color:yellow;color:black;font-style:bold;padding-right: 20px;', x);
return x;
};
}
5 changes: 1 addition & 4 deletions src/app/ngx-blog/services/posts.service.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/ngx-blog/services/posts.service.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions src/app/ngx-blog/services/posts.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ export class PostsService {

this.md.setOptions({
gfm: true,
breaks: true,
// highlight: function (code: any) {
// return require('highlightjs').highlightAuto(code).value;
// }
breaks: true
});
}

convert(markdown: string) {
debugger;
let raw = markdown.replace(/"/g, '');
// this.prepare(raw);
return this.md(raw);
}

Expand Down Expand Up @@ -62,7 +57,6 @@ export class PostsService {
}

extractData(response: Response) {
debugger;
return response.text() || '';
}

Expand Down

0 comments on commit ffb7270

Please sign in to comment.