From 1c693a796c9d5909577d8f36ccf7c9c876f22491 Mon Sep 17 00:00:00 2001 From: Joachim Nielandt Date: Wed, 3 Jan 2018 21:22:15 +0100 Subject: [PATCH] Lastmodified added. --- src/app/app.component.css | 6 ++++++ src/app/components/post/post.component.html | 2 +- src/app/components/posts/posts.component.html | 6 ++---- src/app/model/post.ts | 7 +++---- src/app/services/dataloader.service.ts | 5 +++-- src/assets/post/blog/first/full.html | 3 +++ src/assets/post/blog/first/info.json | 3 +++ src/assets/posts.json | 2 +- src/scripts/compileposts.py | 12 ++++++++++-- 9 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 src/assets/post/blog/first/full.html create mode 100644 src/assets/post/blog/first/info.json diff --git a/src/app/app.component.css b/src/app/app.component.css index 468ddf7..c4af6e9 100644 --- a/src/app/app.component.css +++ b/src/app/app.component.css @@ -21,3 +21,9 @@ border-bottom: 1pt solid black; margin-bottom: 9pt; } + +#topmenubuttons { + border-bottom: 1pt solid black; + padding-bottom: 5px; + margin-bottom: 11pt; +} \ No newline at end of file diff --git a/src/app/components/post/post.component.html b/src/app/components/post/post.component.html index 0516ac9..3b354f0 100644 --- a/src/app/components/post/post.component.html +++ b/src/app/components/post/post.component.html @@ -1,7 +1,7 @@
{{post.title}}
-
{{post.type}}
+
{{post.type}} {{post.lastmodified}}
\ No newline at end of file diff --git a/src/app/components/posts/posts.component.html b/src/app/components/posts/posts.component.html index 26fa7ba..63c2a60 100644 --- a/src/app/components/posts/posts.component.html +++ b/src/app/components/posts/posts.component.html @@ -1,7 +1,5 @@ -
-
-

All the previously made posts are shown below.

-
+ diff --git a/src/app/model/post.ts b/src/app/model/post.ts index 354d4fa..e0b99ac 100644 --- a/src/app/model/post.ts +++ b/src/app/model/post.ts @@ -1,12 +1,11 @@ -export class Post { - +export class Post { + + lastmodified: Date; type: string; title: any; id:String; - date:Date; constructor(id:String) { - this.date = new Date(); this.id = id; } } diff --git a/src/app/services/dataloader.service.ts b/src/app/services/dataloader.service.ts index 01cb198..7f35f07 100644 --- a/src/app/services/dataloader.service.ts +++ b/src/app/services/dataloader.service.ts @@ -19,9 +19,10 @@ export class DataloaderService { let post:any = posts[index]; // console.log('got this key: '+post); // console.log(post); - let temp:Post = new Post(post.post.id); - temp.title = post.post.title; + let temp:Post = new Post(post.id); + temp.title = post.info.title; temp.type = post.type; + temp.lastmodified = new Date(post.lastmodified*1000); res.push(temp); } // console.log('these are the posts...'); diff --git a/src/assets/post/blog/first/full.html b/src/assets/post/blog/first/full.html new file mode 100644 index 0000000..c71a3c6 --- /dev/null +++ b/src/assets/post/blog/first/full.html @@ -0,0 +1,3 @@ +

It's been on my mind for a while now to create an oldschool homepage. So, here it is. An homage to the old and tried Web 1.0, whoever thought static webpages were done and dusted is wrong! This will be a collection of some technical things I want to remind myself about so I don't have to look them up again and again, miscellaneous pictures of projects (in-progress or done) or anything that comes to mind I'd like to share on something other than the usual social media suspects.

+ +

Besides, it's nice to have an Angular2/Bootstrap playground to test some stuff out. I'll probably update this thing once in a while. Maybe even use a database, wouldn't that be something...

\ No newline at end of file diff --git a/src/assets/post/blog/first/info.json b/src/assets/post/blog/first/info.json new file mode 100644 index 0000000..7abe17e --- /dev/null +++ b/src/assets/post/blog/first/info.json @@ -0,0 +1,3 @@ +{ + "title":"Who said Web 1.0 was dead anyway?" +} \ No newline at end of file diff --git a/src/assets/posts.json b/src/assets/posts.json index 84c47f3..e455f4b 100644 --- a/src/assets/posts.json +++ b/src/assets/posts.json @@ -1 +1 @@ -[{"post": {"id": "test", "title": "Test title"}, "type": "project"}, {"post": {"id": "cupboard1", "title": "cupboard"}, "type": "project"}, {"post": {"id": "lxdarch", "title": "some things about lxc in arch"}, "type": "tech"}] \ No newline at end of file +[{"info": {"title": "Test title"}, "lastmodified": 1514908964.183, "post": [], "type": "project", "id": "test"}, {"info": {"title": "cupboard"}, "lastmodified": 1514918689.4108193, "post": [], "type": "project", "id": "cupboard1"}, {"info": {"title": "some things about lxc in arch"}, "lastmodified": 1514918926.0, "post": [], "type": "tech", "id": "lxdarch"}, {"info": {"title": "Who said Web 1.0 was dead anyway?"}, "lastmodified": 1515009160.0915291, "post": [], "type": "blog", "id": "first"}] \ No newline at end of file diff --git a/src/scripts/compileposts.py b/src/scripts/compileposts.py index 62c0e60..68af682 100644 --- a/src/scripts/compileposts.py +++ b/src/scripts/compileposts.py @@ -25,12 +25,20 @@ for type in types: with open(infofile) as j: tt = j.read() d = json.loads(tt) - d['id'] = post; temp = {}; temp['type'] = type; + temp['id'] = post; if 'post' not in temp: temp['post'] = []; - temp['post'] = d; + temp['info'] = d; + + # figure out the last change of any file in the folder + lastchange = 0; + contents = os.listdir(postdir); + for contentfile in contents: + lastchange = max(lastchange,os.path.getmtime(postdir+"/"+contentfile)) + temp['lastmodified'] = lastchange; + jsonresult.append(temp); # completely append the info.json file