Commit c0a2bbd3 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

simplification UI suppression resources + synchor treeview sur renommage de collection

parent 4e8b9933
Loading
Loading
Loading
Loading
Loading
+17 −18
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ export default {

    currentCollection(){
        if (this.highlightedNode && this.highlightedNode.id !== this.currentCollection.id) {

          if (this.currentCollection.id == this.currentRootCollectionId) {//home clicked
            this.highlightedNode = null;
            document.querySelectorAll('.v-treeview-node--active')
@@ -78,8 +77,8 @@ export default {
            }
          }
        }
    }

    }
  },
  methods: {
    async collectionClicked(c) {
+1 −2
Original line number Diff line number Diff line
@@ -127,7 +127,6 @@
        </v-card-actions>
      </v-card>
    </v-expand-transition>

  </v-sheet>
</template>

@@ -230,7 +229,7 @@ export default {
            this.$store.dispatch('renameCollection', {collectionId : this.collection.id, name : val}).then(
                () => {
                  this.collection.title = val;
                  this.$emit('collection-renamed', this.collection)
                  //this.$emit('collection-renamed', this.collection)
                })
          },
          this.collection.title
+50 −21
Original line number Diff line number Diff line
@@ -97,18 +97,18 @@
                         @click="askRemove()">
              <v-list-item-title class="caption d-flex flex-row justify-space-between">
                <span>
                  <v-icon :color="ancestors.length>1 ? 'grey darken-1' : 'red'">
                  <v-icon color="grey darken-1">
                    mdi-delete
                  </v-icon>
                  <span v-if="ancestors.length>1">{{ $t('remove_from_collection') }}</span>
                  <span v-else>{{ $t('remove') }}</span>
<!--                  <span v-if="ancestors.length>1">{{ $t('remove_from_collection') }}</span>-->
                  <span>{{ $t('remove') }}</span>
                </span>
                <v-tooltip left>
                  <template v-slot:activator="{ on }">
                    <v-icon x-small class="ml-5" color="black" dark v-on="on">mdi-help</v-icon>
                  </template>
                  <span v-html="$t('remove_help')"/>
                </v-tooltip>
<!--                <v-tooltip left>-->
<!--                  <template v-slot:activator="{ on }">-->
<!--                    <v-icon x-small class="ml-5" color="black" dark v-on="on">mdi-help</v-icon>-->
<!--                  </template>-->
<!--                  <span v-html="$t('remove_help')"/>-->
<!--                </v-tooltip>-->
              </v-list-item-title>
            </v-list-item>

@@ -188,6 +188,23 @@
    <v-dialog v-model="editionMode" fullscreen class="ma-0 pa-0">
      <component :is="getResourceEditorComponent()" :resource="resource" @close="editionMode=false"/>
    </v-dialog>


    <!-- delete dialog -->
    <v-dialog v-model="deleteDialog" width="600">
      <v-card>
        <v-card-title>{{$t('remove')}} ?</v-card-title>
        <v-card-actions>
            <v-btn color="secondary" @click="deleteDialog=false;">{{$t('cancel')}}</v-btn>
            <v-btn color="primary" @click="removeActionClicked()">OK</v-btn>
        </v-card-actions>
        <v-checkbox v-if="ancestors.length>1"
                      class="ml-4"
                      :label="$t('multi_delete')" v-model="multiRemove"/>
      </v-card>
    </v-dialog>


  </v-sheet>
</template>

@@ -254,6 +271,8 @@ export default {
  data() {
    return {
      collectionsDialog: false,
      deleteDialog : false,
      multiRemove: false,
      ancestors: [],
      editionMode: false,
      isReplacing : false,
@@ -272,14 +291,22 @@ export default {
  methods: {

    askRemove() {
      console.log('ancestor length =' + this.ancestors.length)
        this.$jamaConfirm(
            this.$t('remove') + ' ?',
            (res) => {
              if (res)
                this.removeFromCollection()
            }
        )
      this.deleteDialog = true
        // this.$jamaConfirm(
        //     this.$t('remove') + ' ?',
        //     (res) => {
        //       if (res)
        //         this.removeFromCollection()
        //     }
        // )
    },

    removeActionClicked(){
      if(this.multiRemove)
        this.remove();
      else
        this.removeFromCollection();
      this.multiRemove = false;
    },

    remove() {
@@ -451,6 +478,7 @@ export default {
    "add_to_collection": "Add to a collection",
    "ancestor_collections": "Also in",
    "as_thumbnail": "Collection's thumbnail",
    "cancel" : "Cancel",
    "download": "Download source file",
    "edit_resource": "Edit resource",
    "file_type": "File type",
@@ -466,14 +494,15 @@ export default {
    "add_to_collection": "Ajouter à un dossier",
    "ancestor_collections": "Également dans les dossiers",
    "as_thumbnail": "Définir comme vignette de dossier",
    "cancel" : "Annuler",
    "download": "Télécharger la source",
    "edit_resource": "Éditer la ressource",
    "export" : "Exporter",
    "file_type": "Type de fichier",
    "multi_delete": "Supprimer la ressource des autres collections",
    "original_name": "Nom initial",
    "remove": "Supprimer",
    "remove_from_collection": "Retirer du dossier",
    "remove_help": "Vous ne pouvez que <b>retirer du dossier</b> si la ressource est dans plusieurs dossiers. <br/>Dans le cas contraire, vous ne pouvez que <b>supprimer</b>; la ressource apparaitra ensuite dans la corbeille.",
    "rename": "Renommer",
    "replace" : "Remplacer"
  }
+9 −1
Original line number Diff line number Diff line
@@ -379,7 +379,15 @@ export default new Vuex.Store({
        },

        async renameCollection(context, {collectionId, name}) {
            return JamaRPClient.renameCollection(collectionId, name);
            let r = await JamaRPClient.renameCollection(collectionId, name);

            if(r && collectionId === context.state.currentCollection.id){
                let c = {...context.state.currentCollection, title : name};
                context.commit('setCurrentCollection', c);
                let tc = findItem(collectionId, context.state.collectionsTree);
                tc.title = name;
            }
            return r;
        },

        async addCollection(context, {title, parentId}) {