Skip to content

Commit 4c48b64

Browse files
author
Dan Hersam
committed
Show job text in ItemView rather than Item.
I think this makes it cleaner, and job text isn't shown in the NewsView. Also, using v-if rather than v-show since item type won't change at runtime.
1 parent 32c1600 commit 4c48b64

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/components/Item.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
| <a :href="'#/item/' + item.id">{{item.descendants}} {{item.descendants | pluralize 'comment'}}</a>
1818
</span>
1919
</p>
20-
<p class="jobtext" v-show="isJob" v-html="item.text"></p>
2120
</div>
2221
</template>
2322

@@ -40,9 +39,6 @@ export default {
4039
},
4140
showDomain () {
4241
return this.item.type === 'story'
43-
},
44-
isJob () {
45-
return this.item.type === 'job'
4642
}
4743
}
4844
}
@@ -73,9 +69,4 @@ export default {
7369
color $gray
7470
.subtext a:hover
7571
text-decoration underline
76-
.jobtext
77-
color $gray
78-
padding-top 5px
79-
.jobtext p
80-
margin 10px 0
8172
</style>

src/components/ItemView.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<template>
22
<div class="item-view" v-show="item">
33
<item :item="item"></item>
4+
<p class="jobtext" v-if="isJob" v-html="item.text"></p>
45
<ul class="poll-options" v-if="pollOptions">
56
<li v-for="option in pollOptions">
67
<p>{{option.text}}</p>
@@ -13,7 +14,7 @@
1314
:comment="comment">
1415
</comment>
1516
</ul>
16-
<p v-show="!comments.length && item.type !== 'job'">No comments yet.</p>
17+
<p v-show="!comments.length && !isJob">No comments yet.</p>
1718
</div>
1819
</template>
1920

@@ -50,6 +51,12 @@ export default {
5051
: null
5152
}))
5253
}
54+
},
55+
56+
computed: {
57+
isJob () {
58+
return this.item.type === 'job'
59+
}
5360
}
5461
}
5562
</script>
@@ -73,4 +80,9 @@ export default {
7380
.subtext
7481
color $gray
7582
font-size 11px
83+
.jobtext
84+
color $gray
85+
margin-top 0
86+
.jobtext p
87+
margin 10px 0
7688
</style>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy