Fix notifications in case of new corr move
[vchess.git] / client / src / views / News.vue
index e23a6e2..8f03b3a 100644 (file)
@@ -13,17 +13,17 @@ main
       #dialog.text-center {{ st.tr[infoMsg] }}
   .row
     .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
-      button(
+      button#writeNews(
         v-if="devs.includes(st.user.id)"
         @click="showModalNews"
       )
         | {{ st.tr["Write news"] }}
-      .news(v-for="n in sortedNewsList")
-        h4 {{ formatDatetime(n.added) }}
-        p(v-html="parseHtml(n.content)")
+      .news(v-for="n,idx in sortedNewsList" :class="{margintop:idx>0}")
+        span.ndt {{ formatDatetime(n.added) }}
         div(v-if="devs.includes(st.user.id)")
           button(@click="editNews(n)") {{ st.tr["Edit"] }}
           button(@click="deleteNews(n)") {{ st.tr["Delete"] }}
+        p(v-html="parseHtml(n.content)")
       button(v-if="hasMore" @click="loadMore()")
         | {{ st.tr["Load more"] }}
 </template>
@@ -65,7 +65,9 @@ export default {
   methods: {
     formatDatetime: function(dt) {
       const dtObj = new Date(dt);
-      return getDate(dtObj) + " " + getTime(dtObj);
+      const timePart = getTime(dtObj);
+      // Show minutes but not seconds:
+      return getDate(dtObj) + " " + timePart.substr(0,timePart.lastIndexOf(":"));
     },
     parseHtml: function(txt) {
       return !txt.match(/<[/a-zA-Z]+>/)
@@ -157,10 +159,27 @@ export default {
   max-width: 767px
   max-height: 100%
 textarea#newsContent
+  margin: 0
   width: 100%
   min-height: 200px
   max-height: 100%
 #dialog
   padding: 5px
   color: blue
+button#writeNews
+  margin-top: 0
+  margin-bottom: 0
+span.ndt
+  color: darkblue
+  padding: 0 5px 0 var(--universal-margin)
+.margintop
+  margin-top: 25px
+  border-top: 1px solid grey
+.news
+  padding-top: 10px
+  & > div
+    display: inline-block
+@media screen and (max-width: 767px)
+  .margintop
+    margin-top: 10px
 </style>