Fix README, TODO and a mistake in MyGames
[vchess.git] / client / src / views / News.vue
index 2686552..f9e8adc 100644 (file)
@@ -1,8 +1,11 @@
 <template lang="pug">
 main
   input#modalNews.modal(type="checkbox")
-  div#newnewsDiv(role="dialog" data-checkbox="modalNews")
-    .card
+  div#newnewsDiv(
+    role="dialog"
+    data-checkbox="modalNews"
+  )
+    .card#writeNews
       label.modal-close(for="modalNews")
       textarea#newsContent(
         v-model="curnews.content"
@@ -13,18 +16,24 @@ 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#writeNews(
+      button#writeNewsBtn(
         v-if="devs.includes(st.user.id)"
         @click="showModalNews"
       )
         | {{ st.tr["Write news"] }}
-      .news(v-for="n,idx in newsList" :class="{margintop:idx>0}")
+      .news(
+        v-for="n,idx in newsList"
+        :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()")
+      button#loadMoreBtn(
+        v-if="hasMore"
+        @click="loadMore()"
+      )
         | {{ st.tr["Load more"] }}
 </template>
 
@@ -48,7 +57,7 @@ export default {
   },
   created: function() {
     ajax("/news", "GET", { cursor: this.cursor }, res => {
-      this.newsList = res.newsList.sort((n1, n2) => n1.added - n2.added);
+      this.newsList = res.newsList.sort((n1, n2) => n2.added - n1.added);
       const L = res.newsList.length;
       if (L > 0) this.cursor = this.newsList[0].id;
     });
@@ -142,27 +151,36 @@ export default {
 [type="checkbox"].modal+div .card
   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
+
+#writeNews
+  padding-top: 50px
+
+button#writeNewsBtn, button#loadMoreBtn
   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
+
+.margintop
+  margin-top: 25px
+  border-top: 1px solid grey
 @media screen and (max-width: 767px)
   .margintop
     margin-top: 10px