Przeglądaj źródła

added note picto to medium Card responding to note creation on modalCard

bach 3 lat temu
rodzic
commit
e0f8b123f9

Plik diff jest za duży
+ 0 - 0
web/themes/custom/materiotheme/assets/dist/main.js


+ 11 - 0
web/themes/custom/materiotheme/vuejs/api/gql/article.fragment.gql

@@ -28,10 +28,21 @@ fragment ArticleFields on Article {
     id
     title
     short_description
+    reference
     images {
       url
       style_cardmedium_url
       style_hd_url
+    }
+  	samples{
+      showroom{
+        name
+        id
+      }
+      location
+    }
+    note{
+      id
     }
   }
   images {

+ 13 - 1
web/themes/custom/materiotheme/vuejs/components/Content/Card.vue

@@ -131,6 +131,7 @@ export default {
   },
   methods: {
     ...mapActions({
+      // refreshItem: 'Search/refreshItem',
       createFlagColl: 'User/createFlagColl',
       flagUnflag: 'User/flagUnflag'
     }),
@@ -190,7 +191,18 @@ export default {
       if(this.isloggedin){
         this.$modal.show(
           ModalCard,
-          { item: this.item },
+          {
+            item: this.item,
+            // not really an event
+            // more a callback function passed as prop to the component
+            addNoteId:(id) => {
+              // no needs to refresh the entire item via searchresults
+              // plus if we are in article, there is not searchresults
+              // this.refreshItem({id: this.item.id})
+              // instead create the note id directly
+              this.item.note = {id: id}
+            }
+          },
           {
             name: `modal-${this.item.id}`,
             draggable: true,

+ 7 - 4
web/themes/custom/materiotheme/vuejs/components/Content/ModalCard.vue

@@ -285,7 +285,7 @@ const _debounce = require('lodash/debounce')
 
 export default {
   name: "ModalCard",
-  props: ['item'],
+  props: ['item', 'addNoteId'],
   mixins: [cardMixins],
   components: {
     LinkedMaterialCard
@@ -335,7 +335,7 @@ export default {
   },
   methods: {
     ...mapActions({
-      refreshItem: 'Search/refreshItem',
+      // refreshItem: 'Search/refreshItem',
       createFlagColl: 'User/createFlagColl',
       flagUnflag: 'User/flagUnflag'
     }),
@@ -467,8 +467,11 @@ export default {
           console.log('createNote REST data', data)
           this.note_nid = data.nid[0].value
           // call search results refresh of the item to display that note is now existing for this item
-          // TODO: do the same for article linked materials
-          this.refreshItem({id: this.item.id})
+          // this.refreshItem({id: this.item.id})
+          // no needs to refresh the entire item via searchresults
+          // plus if we are in article, there is not searchresults
+          // instead call the callbackfunction from teh parent to add directly the note id
+          this.addNoteId(this.note_nid)
         })
         .catch(error => {
           console.warn('Issue with createNote', error)

+ 3 - 1
web/themes/custom/materiotheme/vuejs/store/modules/search.js

@@ -52,7 +52,9 @@ export default {
       // find the right index
       const index = state.items.findIndex(i => i.id === item.id)
       // update the array
-      Vue.set(state.items, index, item)
+      if (index !== -1) {
+        Vue.set(state.items, index, item)
+      }
       // console.log("mutation updateItem state.items", state.items)
     },
     resetItems (state) {

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików