-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from LighthouseBlog/feature/layout
Feature/layout
- Loading branch information
Showing
26 changed files
with
417 additions
and
127 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ typings/ | |
npm-debug.log | ||
dist/ | ||
|
||
*.pem | ||
*.pem | ||
*.rdb |
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,10 @@ | ||
import { Author } from './Author'; | ||
export class Article { | ||
_id: number; | ||
title: string; | ||
description: string; | ||
datePosted: string; | ||
datePosted: Date; | ||
text: string; | ||
author: string; | ||
author: Author; | ||
tags: Array<string>; | ||
} |
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,5 @@ | ||
export class ArticleList { | ||
_id: number; | ||
title: string; | ||
tags: Array<string>; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Http, Response, RequestOptions, Headers } from '@angular/http'; | ||
|
||
import { Observable } from 'rxjs/Observable'; | ||
import 'rxjs/add/operator/catch'; | ||
import 'rxjs/add/operator/map'; | ||
|
||
import { AuthenticationService } from '../_services/authentication.service'; | ||
import { Article } from '../_models/Article'; | ||
import { environment } from '../../environments/environment'; | ||
|
||
@Injectable() | ||
export class TagService { | ||
|
||
private tagUrl = environment.URL + '/tags/'; | ||
|
||
constructor( | ||
private http: Http, | ||
private auth: AuthenticationService | ||
) { } | ||
|
||
getAllTags(): Observable<Array<String>> { | ||
return this.http.get(this.tagUrl) | ||
.map(this.extractData) | ||
.catch(this.handleError); | ||
} | ||
|
||
getArticlesByTag(tag: string): Observable<Article> { | ||
return this.http.get(this.tagUrl + tag) | ||
.map(this.extractData) | ||
.catch(this.handleError); | ||
} | ||
|
||
private extractData(res: Response) { | ||
const body = res.json(); | ||
return body.data || { }; | ||
} | ||
|
||
private handleError (error: Response | any) { | ||
// In a real world app, you might use a remote logging infrastructure | ||
let errMsg: string; | ||
if (error instanceof Response) { | ||
const body = error.json() || ''; | ||
const err = body.error || JSON.stringify(body); | ||
errMsg = `${error.status} - ${error.statusText || ''} ${err}`; | ||
} else { | ||
errMsg = error.message ? error.message : error.toString(); | ||
} | ||
console.error(errMsg); | ||
return Observable.throw(errMsg); | ||
} | ||
|
||
} |
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,19 +1,87 @@ | ||
<div class="articles"> | ||
<mat-grid-list cols="4"> | ||
<mat-grid-tile *ngFor="let article of articles | async"> | ||
<mat-card class="example-card"> | ||
<mat-card-header> | ||
<mat-card-title>{{article?.title}}</mat-card-title> | ||
</mat-card-header> | ||
<mat-card-content> | ||
<p> | ||
{{article?.description}} | ||
</p> | ||
</mat-card-content> | ||
<mat-card-actions> | ||
<button mat-button (click)="selectedArticle(article)"> READ </button> | ||
</mat-card-actions> | ||
</mat-card> | ||
</mat-grid-tile> | ||
</mat-grid-list> | ||
<section class="section"> | ||
<div class="container"> | ||
<div class="columns"> | ||
<div class="column is-two-thirds"> | ||
<mat-card class="article" *ngFor="let article of articles | async"> | ||
<mat-card-header> | ||
<mat-card-title> | ||
{{article?.title}} | ||
</mat-card-title> | ||
<mat-card-subtitle> | ||
By {{article?.author?.name}}, {{article?.datePosted | date:'longDate'}} | ||
</mat-card-subtitle> | ||
</mat-card-header> | ||
<img class="cover-photo" mat-card-image *ngIf="article?.coverPhoto" src="{{article?.coverPhoto}}" /> | ||
<mat-card-content> | ||
{{article?.description}} | ||
</mat-card-content> | ||
<mat-card-actions align="end"> | ||
<button mat-button (click)="selectedArticle(article)"> Continue Reading... </button> | ||
</mat-card-actions> | ||
</mat-card> | ||
</div> | ||
<div class="column"> | ||
<mat-card class="card-sections"> | ||
<mat-card-header> | ||
<mat-card-title>Search Articles By Title</mat-card-title> | ||
</mat-card-header> | ||
<mat-card-content> | ||
<mat-input-container class="title-search"> | ||
<input matInput type="text" placeholder="Articles" [matAutocomplete]="auto" #title (keyup)="filterArticles(title.value)"/> | ||
<mat-autocomplete #auto="matAutocomplete"> | ||
<mat-option class="article-option" *ngFor="let article of filteredArticles | async" [value]="article.title" (onSelectionChange)="articleSelected(article)"> | ||
{{ article.title }} | ||
</mat-option> | ||
</mat-autocomplete> | ||
</mat-input-container> | ||
</mat-card-content> | ||
</mat-card> | ||
<mat-card class="card-sections"> | ||
<mat-card-header> | ||
<mat-card-title>About</mat-card-title> | ||
</mat-card-header> | ||
<mat-card-content> | ||
<p> | ||
This site was developed by <a href="https://github.com/pastorsj" target="_blank">Sam Pastoriza</a> | ||
and <a href="https://github.com/Prescientje" target="_blank">James Edwards</a>. | ||
We wanted a blog that was self sustaining and easily modifiable. | ||
We are using the Angular framework developed by Google and a combination of | ||
Angular Material and Bulma to style and layout the site respectively. An express based | ||
backend application utilizes MongoDb and Redis to store data on users and articles. The | ||
blog is completely open-sourced on GitHub and contributers are more than welcome. The end goal | ||
is a fully functional blog mainly covering technical topics, but can be reused | ||
as a base for other blogs. | ||
</p> | ||
</mat-card-content> | ||
<mat-card-footer> | ||
<mat-list> | ||
<mat-list-item class="repo"> | ||
<mat-icon mat-list-icon>developer_board</mat-icon> | ||
<a mat-list-item href="https://github.com/LighthouseBlog/Blog"> Blog </a> | ||
</mat-list-item> | ||
<mat-list-item class="repo"> | ||
<mat-icon mat-list-icon>developer_board</mat-icon> | ||
<a mat-list-item href="https://github.com/pastorsj/blog-api"> Backend Api </a> | ||
</mat-list-item> | ||
</mat-list> | ||
</mat-card-footer> | ||
</mat-card> | ||
<mat-card class="card-sections"> | ||
<mat-card-header> | ||
<mat-card-title>Tags</mat-card-title> | ||
</mat-card-header> | ||
<mat-card-content> | ||
<tag *ngFor="let tag of tags | async" | ||
(click)="getArticlesByTag(tag)" | ||
[tag]="tag" | ||
[fontSize]="tagData[tag]" | ||
[maxSize]="maxSize"> | ||
</tag> | ||
</mat-card-content> | ||
</mat-card> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
</div> |
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,4 +1,26 @@ | ||
.articles { | ||
margin-left: 3vw; | ||
margin-top: 2vh; | ||
} | ||
|
||
.repo:hover { | ||
background-color: #bdbdbd; | ||
} | ||
|
||
.card-sections { | ||
margin-bottom: 20px; | ||
} | ||
|
||
.title-search { | ||
width: 100%; | ||
max-height: 100px; | ||
} | ||
|
||
.article-option { | ||
font-size: 10pt; | ||
} | ||
|
||
.cover-photo { | ||
max-width: 100%; | ||
height: auto; | ||
} |
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
Oops, something went wrong.