Просмотр исходного кода

adapt TextCard to display Textprod objects

axolotle 3 лет назад
Родитель
Сommit
1efcfda37d
4 измененных файлов с 38 добавлено и 22 удалено
  1. 0 4
      src/App.vue
  2. 15 1
      src/api/queries/TextCard.gql
  3. 17 5
      src/components/text/TextCard.vue
  4. 6 12
      src/pages/Library.vue

+ 0 - 4
src/App.vue

@@ -29,10 +29,6 @@
     <main id="main">
       <router-view />
     </main>
-
-    <footer>
-      <p>footer</p>
-    </footer>
   </div>
 </template>
 

+ 15 - 1
src/api/queries/TextCard.gql

@@ -25,7 +25,21 @@ query TextRef ($id: Int!) {
       # degres_detrangement: Int
       notes {
         note
-        numero
+        number: numero
+      }
+    }
+
+    ... on Textprod {
+      tags: tagsprod {
+        id
+        name
+      }
+      notes {
+        note
+        number: numero
+        links: liens {
+          id
+        }
       }
     }
   }

+ 17 - 5
src/components/text/TextCard.vue

@@ -4,9 +4,14 @@
       <div v-if="text" class="container-fill">
         <b-card-header header-tag="header">
           <h4>
-            <span>{{ text.authors | list }},</span>
-            <span>{{ text.title }},</span>
-            <span>{{ text.edition }}</span>
+            <template v-if="text.type === 'Textref'">
+              <span>{{ text.authors | list }},</span>
+              <span>{{ text.title }},</span>
+              <span>{{ text.edition }}</span>
+            </template>
+            <template v-else>
+              {{ text.title }}
+            </template>
           </h4>
 
           <b-nav class="ml-auto flex-nowrap">
@@ -20,7 +25,7 @@
           </b-nav>
         </b-card-header>
 
-        <b-card-body v-html="text.content" />
+        <b-card-body v-html="text.content" class="overflow-auto" />
 
         <b-card-footer>
           <b-badge
@@ -36,7 +41,10 @@
           >
             Textes rebonds
           </b-button>
-          <b-popover :target="'bounces-' + text.id" triggers="click" placement="top">
+          <b-popover
+            v-if="text.bounces"
+            :target="'bounces-' + text.id" triggers="click" placement="top"
+          >
             <div v-for="bounce in text.bounces" :key="bounce.id">
               <h6>
                 <span>{{ bounce.authors | list }},</span>
@@ -82,6 +90,10 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+article {
+  height: 100%;
+  // max-height: 100%;
+}
 header {
   display: flex;
 

+ 6 - 12
src/pages/Library.vue

@@ -1,13 +1,7 @@
 <template>
-  <component-debug :component="this" class="view">
-    <div class="py-3">
-      <b-button @click="openText">
-        add text 50
-      </b-button>
-    </div>
-
+  <div class="h-100">
     <!-- BACKGROUND (mode) -->
-    <component :is="mode" />
+    <!-- <component :is="mode" /> -->
 
     <!-- FOREGROUND (texts) -->
     <section v-for="group in groups" :key="group.id" class="split-screen">
@@ -16,7 +10,7 @@
         <text-card v-for="id in group.prod" :key="id" :id="id" />
       </div>
     </section>
-  </component-debug>
+  </div>
 </template>
 
 <script>
@@ -28,9 +22,9 @@ export default {
   name: 'Library',
 
   components: {
-    CardList,
-    CardMap,
-    TreeMap,
+    // CardList,
+    // CardMap,
+    // TreeMap,
     TextCard
   },