Lastmodified added.
This commit is contained in:
parent
63fcb42b8d
commit
1c693a796c
@ -21,3 +21,9 @@
|
||||
border-bottom: 1pt solid black;
|
||||
margin-bottom: 9pt;
|
||||
}
|
||||
|
||||
#topmenubuttons {
|
||||
border-bottom: 1pt solid black;
|
||||
padding-bottom: 5px;
|
||||
margin-bottom: 11pt;
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{post.title}}</h5>
|
||||
<h6 class="card-subtitle mb-2 text-muted">{{post.type}}</h6>
|
||||
<h6 class="card-subtitle mb-2 text-muted"><span class="badge badge-secondary">{{post.type}}</span> {{post.lastmodified}}</h6>
|
||||
<div class="card-text" #htmlcontainer></div>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,7 +1,5 @@
|
||||
<div class="card text-center">
|
||||
<div class="card-body">
|
||||
<p class="card-text">All the previously made posts are shown below.</p>
|
||||
</div>
|
||||
<div class="alert alert-secondary" role="alert">
|
||||
All the previously made posts are shown below.
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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...');
|
||||
|
||||
3
src/assets/post/blog/first/full.html
Normal file
3
src/assets/post/blog/first/full.html
Normal file
@ -0,0 +1,3 @@
|
||||
<p>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 <em>wrong</em>! 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.</p>
|
||||
|
||||
<p>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...</p>
|
||||
3
src/assets/post/blog/first/info.json
Normal file
3
src/assets/post/blog/first/info.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"title":"Who said Web 1.0 was dead anyway?"
|
||||
}
|
||||
@ -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"}]
|
||||
[{"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"}]
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user