Implemented tech section of portfolio projects
Added order for portfolio projects
This commit is contained in:
@@ -58,6 +58,7 @@ Return:
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
id: "blogID",
|
id: "blogID",
|
||||||
|
staticPage: false, // static pages don't show up alongside other blog pages.
|
||||||
createTime: 0, // creation time in Unix format
|
createTime: 0, // creation time in Unix format
|
||||||
updateTime: 0, // last update time in Unix format
|
updateTime: 0, // last update time in Unix format
|
||||||
author: "authorID",
|
author: "authorID",
|
||||||
@@ -170,6 +171,7 @@ Return:
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
title: "Darkstorm Server",
|
title: "Darkstorm Server",
|
||||||
|
order: 0,
|
||||||
repository: "https://github.com/CalebQ42/darkstorm-server",
|
repository: "https://github.com/CalebQ42/darkstorm-server",
|
||||||
description: "The backend that runs runs my website and APIs",
|
description: "The backend that runs runs my website and APIs",
|
||||||
technologies: [ // May be empty
|
technologies: [ // May be empty
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
|
|
||||||
type PortfolioProject struct {
|
type PortfolioProject struct {
|
||||||
Title string `json:"_id" bson:"_id"`
|
Title string `json:"_id" bson:"_id"`
|
||||||
|
Order int `json:"order" bson:"order"`
|
||||||
Repository string `json:"repository" bson:"repository"`
|
Repository string `json:"repository" bson:"repository"`
|
||||||
Description string `json:"description" bson:"description"`
|
Description string `json:"description" bson:"description"`
|
||||||
Technologies []string `json:"technologies" bson:"technologies"`
|
Technologies []string `json:"technologies" bson:"technologies"`
|
||||||
@@ -26,7 +27,7 @@ func (b *BlogApp) Projects(languageFilter string) ([]PortfolioProject, error) {
|
|||||||
if languageFilter != "" {
|
if languageFilter != "" {
|
||||||
filter["language.language"] = languageFilter
|
filter["language.language"] = languageFilter
|
||||||
}
|
}
|
||||||
res, err := b.portfolioCol.Find(context.Background(), filter, options.Find().SetSort(bson.M{"_id": 1}))
|
res, err := b.portfolioCol.Find(context.Background(), filter, options.Find().SetSort(bson.M{"order": 1}))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const (
|
|||||||
portfolioTitle = "<h2 class='portfolio-title'>%v</h2>"
|
portfolioTitle = "<h2 class='portfolio-title'>%v</h2>"
|
||||||
portfolioLink = "<p class='portfolio-link'><a href='%v'>%v</a>"
|
portfolioLink = "<p class='portfolio-link'><a href='%v'>%v</a>"
|
||||||
portfolioLanguage = "<p class='portfolio-language'><b>%v</b>: %v</p>"
|
portfolioLanguage = "<p class='portfolio-language'><b>%v</b>: %v</p>"
|
||||||
|
portfolioTech = "<p class='portfolio-tech'><b>Tech: </b>%v</p>"
|
||||||
portfolioDesc = "<p class='portfolio-description'>%v</p>"
|
portfolioDesc = "<p class='portfolio-description'>%v</p>"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -42,6 +43,7 @@ func portfolioRequest(w http.ResponseWriter, r *http.Request) {
|
|||||||
langs[l.Language] = struct{}{}
|
langs[l.Language] = struct{}{}
|
||||||
out += fmt.Sprintf(portfolioLanguage, l.Language, l.Dates)
|
out += fmt.Sprintf(portfolioLanguage, l.Language, l.Dates)
|
||||||
}
|
}
|
||||||
|
out += fmt.Sprintf(portfolioTech, strings.Join(p.Technologies, ", "))
|
||||||
out += fmt.Sprintf(portfolioDesc, p.Description)
|
out += fmt.Sprintf(portfolioDesc, p.Description)
|
||||||
}
|
}
|
||||||
langKeys := make([]string, 0, len(langs))
|
langKeys := make([]string, 0, len(langs))
|
||||||
|
|||||||
Reference in New Issue
Block a user