Browse Source

Added timestamp to all cards shown

master
Matei-Alexandru Gardus 9 months ago
parent
commit
a6738074d7
No known key found for this signature in database
5 changed files with 8 additions and 1 deletions
  1. 4
    0
      public/stylesheets/style.css
  2. 1
    1
      routes/cards.js
  3. 1
    0
      schema.js
  4. 1
    0
      views/card.hbs
  5. 1
    0
      views/index.hbs

+ 4
- 0
public/stylesheets/style.css View File

@@ -15,6 +15,10 @@ a {
15 15
   padding-bottom: 50px;  
16 16
 }
17 17
 
18
+.card-timestamp {
19
+  font-size: 0.75rem;
20
+}
21
+
18 22
 .main-header {
19 23
   font-size: 75px;
20 24
 }

+ 1
- 1
routes/cards.js View File

@@ -23,7 +23,7 @@ router.get('/example', function(req, res, next) {
23 23
 router.get('/:id', function(req, res, next) {
24 24
   schema.Card.findOne({'ID': req.params.id}, function(err, result) {
25 25
     if (result != null) {
26
-      res.render('card', {title: res.title + ' - My CV Feed', card: result});
26
+      res.render('card', {title: result.title + ' - My CV Feed', card: result});
27 27
     } else {
28 28
       next();
29 29
     }

+ 1
- 0
schema.js View File

@@ -13,6 +13,7 @@ let cardSchema = new mongoose.Schema({
13 13
     ID: String,
14 14
     title: String,
15 15
     description: String,
16
+    date: Date,
16 17
     content: String,
17 18
     imageURL: String,
18 19
 });

+ 1
- 0
views/card.hbs View File

@@ -6,6 +6,7 @@
6 6
             <div class="card-body text-center">
7 7
                 <h2 class="card-title">{{card.title}}</h2>
8 8
                 <p class="card-text">{{card.content}}</p>
9
+                <p class="card-text text-right text-muted card-timestamp">{{card.date}}</p>
9 10
             </div>
10 11
         </div>
11 12
     </div>

+ 1
- 0
views/index.hbs View File

@@ -34,6 +34,7 @@
34 34
         <div class="card-body text-center">
35 35
             <h5 class="card-title">{{this.title}}</h5>
36 36
             <p class="card-text">{{this.description}}</p>
37
+            <p class="card-text text-right text-muted card-timestamp">{{this.date}}</p>
37 38
             <a href="/card/{{this.ID}}" class="btn btn-primary">Click for details</a>
38 39
         </div>
39 40
     </div>

Loading…
Cancel
Save