More factory fields + improved data display

This commit is contained in:
Jeffrey Biles
2020-03-17 14:01:56 -07:00
parent e2498155c5
commit 53383058d9
2 changed files with 24 additions and 7 deletions

View File

@@ -7,11 +7,14 @@ new Server({
}, },
factories: { factories: {
email: Factory.extend({ email: Factory.extend({
subject(i) { from(){
return `Email ${i}` return faker.internet.email()
},
subject() {
return faker.lorem.word()
}, },
body(){ body(){
return faker.lorem.sentence() return faker.lorem.paragraphs()
}, },
sentDate(){ sentDate(){
return faker.date.recent(20) return faker.date.recent(20)

View File

@@ -6,9 +6,11 @@
<tbody> <tbody>
<tr v-for="email in emails" :key="email.id" :class="[email.read ? 'read' : '']"> <tr v-for="email in emails" :key="email.id" :class="[email.read ? 'read' : '']">
<td><input type="checkbox" /></td> <td><input type="checkbox" /></td>
<td>{{email.subject}}</td> <td>{{email.from}}</td>
<td>{{email.body}}</td> <td>
<td>{{format(new Date(email.sentDate), 'HH:MM MMM do yyyy')}}</td> <p><strong>{{email.subject}}</strong> - {{email.body}}</p>
</td>
<td class="date">{{format(new Date(email.sentDate), 'MMM do yyyy')}}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -31,16 +33,28 @@
<style scoped> <style scoped>
table { table {
max-width: 800px; max-width: 1000px;
margin: auto; margin: auto;
border-collapse: collapse; border-collapse: collapse;
} }
tr.read { tr.read {
background-color: #EEE; background-color: #EEE;
} }
tr {
height: 40px;
}
td { td {
border-bottom: 1px solid black; border-bottom: 1px solid black;
padding: 5px; padding: 5px;
text-align: left; text-align: left;
} }
td p {
max-height: 1.2em;
overflow-y: hidden;
margin: 0;
}
td.date {
width: 120px;
}
</style> </style>