Commit 4b80ef62 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

debug metadata-editor (erreur lié au lint) + ajout drag and drop sur les ressources

parent 588ab0d1
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -123,8 +123,6 @@
            @tag-added="tagAdded"
          />

          <!--          <JamaMetadataEditor :item="collection"/>-->

          <component
            :is="getMetadataComponent"
            :item="collection"
+12 −38
Original line number Diff line number Diff line
@@ -33,42 +33,6 @@
  </v-hover>
</template>


<!--<template>-->
<!--  <v-hover>-->
<!--    <template v-slot:default="{ hover }">-->
<!--      <v-card :id="collection.title" draggable height="200"-->
<!--              :title="collection.title"-->
<!--              class="clickable d-flex flex-column justify-space-between collection-tile"-->
<!--              :data-metas="metaAttrValues"-->
<!--              :elevation="hover ? 24 : 1"-->
<!--              @dragstart="dragStarted($event)"-->
<!--              @click="select()"-->
<!--              @dragover.prevent-->
<!--              @drop.prevent="dropped($event)">-->
<!--        <v-icon color="amber lighten-1">mdi-folder</v-icon>-->
<!--        <div  v-if="collection.represented_by" class="collection-avatar">-->
<!--          <v-avatar-->
<!--                    size="72"-->
<!--                    class="profile"-->
<!--                    tile-->
<!--          >-->
<!--            <img-->
<!--                alt="Avatar"-->
<!--                :src="collection.represented_by.urls.m"-->
<!--            >-->
<!--          </v-avatar>-->
<!--        </div>-->

<!--        <v-card-title class="grey&#45;&#45;text body-2">-->
<!--          {{ label }}-->
<!--        </v-card-title>-->
<!--      </v-card>-->
<!--    </template>-->
<!--  </v-hover>-->
<!--</template>-->


<script>

export default {
@@ -106,15 +70,25 @@ export default {
      try {
        let source = JSON.parse(evt.dataTransfer.getData("text/html"))
        if (source) {
          if(source.type === 'collection') {
            this.$emit('move-collection', source, this.collection);
          }
          else{
            this.$emit('move-resource', source, this.collection);
          }
        }
      } catch (e) {
        console.error(e);
      }
      return false;
    },
    dragStarted(evt) {
      evt.dataTransfer.setData('text/html', JSON.stringify({id: this.collection.id, title: this.collection.title}));
      evt.dataTransfer.setData('text/html',
          JSON.stringify({
            type: 'collection',
            id: this.collection.id,
            title: this.collection.title
          }));
    }
  }
}
+30 −3
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
                :collection="collection"
                @collection-selected="collectionSelected"
                @move-collection="moveCollection"
                @move-resource="moveResource"
              />
            </v-col>

@@ -91,8 +92,8 @@ export default {
  },

  props: {
    currentCollection: {type : Object, default : null},
    currentResource: {type :Object, default : null},
    // currentCollection: {type : Object, default : null},
    // currentResource: {type :Object, default : null},
    dnd: { //drag and drop allowed
      type: Boolean,
      default: false
@@ -124,7 +125,14 @@ export default {
      const {xl, lg, sm, xs} = this.$vuetify.breakpoint;
      return xl ? 2 : lg ? 3 : sm ? 6 : xs ? 12 : 4
    },
    ...mapGetters(["isPickerMode", "sortOptions", "collections", "resources","selectedCollections","selectedResources"])
    ...mapGetters([
      "isPickerMode",
      "sortOptions",
      "collections",
      "resources",
      "selectedCollections",
      "selectedResources",
      "currentCollection"])
  },

  methods: {
@@ -145,6 +153,19 @@ export default {
      )
    },

    moveResource(resource, target) {
      this.$jamaConfirm(
          this.$t('resource.move', [resource.title, target.title]),
          (res) => {
            if (res) {
              this.$jamaClient.moveItems(this.currentCollection.id, target.id, [], [resource.id]).then(() => {
                this.$emit('resource-moved', resource, target)
              })
            }
          }
      )
    },

    aboutResource(resource) {
      this.$emit('about-selected', resource)
    },
@@ -205,11 +226,17 @@ export default {
  "en": {
    "collection": {
      "move": "Move collection \"{0}\" to \"{1}\" ?"
    },
    "resource": {
      "move": "Move resource \"{0}\" to \"{1}\" ?"
    }
  },
  "fr": {
    "collection": {
      "move": "Souhaitez-vous déplacer le dossier \"{0}\" vers \"{1}\" ?"
    },
    "resource": {
      "move": "Souhaitez-vous déplacer la ressource \"{0}\" vers \"{1}\" ?"
    }
  }
}
+8 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
        :elevation="active || hover ? 24 : 1"
        :title="resource.title"
        :data-metas="metaAttrValues"
        @dragstart="dragStarted($event)"
        @click="select()"
      >
        <v-img
@@ -119,6 +120,13 @@ export default {
          return 'mdi-file'

      }
    },

    dragStarted(evt) {
      evt.dataTransfer.setData('text/html', JSON.stringify({
        id: this.resource.id,
        title: this.resource.title,
        type: 'resource'}));
    }


+38 −13
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@
                    @collection-selected="collectionSelected"
                    @resource-selected="resourceSelected"
                    @collection-moved="reloadCurrentCollection"
                    @resource-moved="reloadCurrentCollection"
                    @sort-options-changed="reloadCurrentCollection"
                    @resource-dropped="resourceDropped"
                  />
@@ -600,6 +601,29 @@ export default {
    Vue.prototype.$jamaAlert = this.jamaAlert
    Vue.prototype.$jamaPrompt = this.jamaPrompt
    Vue.prototype.$jamaConfirm = this.jamaConfirm

    document.addEventListener('keydown', (e) => {
      if (!this.currentResource)
        return;
      let offset = null;
      switch (e.key) {
        case "ArrowLeft":
          offset = -1;
          break;
        case "ArrowRight":
          offset = 1
          break;
        default :
          return;
      }

      if(offset){
        let target = this.resources[this.currentResourceIndex + offset];
        if (target)
         document.querySelector('#jama-resource-tile-' + target.id).click();
      }

    })
  },

  methods: {
@@ -842,6 +866,7 @@ export default {

<style lang="scss" scoped>
@import '../assets/css/_variables.scss';

h1 > a {
  vertical-align: top;
}
Loading