Loading package.json +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ "name": "@certic/vue-jama", "version": "0.4.0", "scripts": { "serve": "vue-cli-service serve", "serve": "rimraf -rf ./node_modules/.cache/vue-loader && vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint", "build-lib": "vue-cli-service build --skip-plugins vuetify --target lib --name vue-jama src/index.js", Loading Loading @@ -41,7 +41,7 @@ "node": true }, "extends": [ "plugin:vue/essential", "plugin:vue/recommended", "eslint:recommended" ], "parserOptions": { Loading src/App.vue +11 −10 Original line number Diff line number Diff line <template> <div id="app" dark> <div id="app" dark > <template v-if="options.pickerMode"> <v-app> <vue-jama-picker Loading @@ -7,14 +10,12 @@ :width="'98%'" @closed="dialogClosed()" @resource-selected="resourceSelected" ></vue-jama-picker> /> </v-app> </template> <template v-else> <vue-jama-app :options="options"> </vue-jama-app> <vue-jama-app :options="options" /> </template> </div> </template> Loading @@ -25,7 +26,7 @@ import VueJamaPicker from "./components/VueJamaPicker"; import vuetify from './plugins/vuetify'; export default { name: 'app', name: 'App', vuetify, components: { VueJamaPicker, Loading src/components/CollectionsTree.vue +40 −24 Original line number Diff line number Diff line <template> <v-card flat class="rounded-0"> <v-toolbar :elevation="0" dark class="rounded-0 ma-0 pa-0"> <v-card flat class="rounded-0" > <v-toolbar :elevation="0" dark class="rounded-0 ma-0 pa-0" > <v-toolbar-title class="d-flex"> <v-btn text @click="loadHome()"> <v-btn text @click="loadHome()" > <v-icon> mdi-home </v-icon> Loading @@ -11,6 +21,7 @@ </v-toolbar-title> </v-toolbar> <v-treeview ref="collectionTreeView" dense Loading @@ -20,17 +31,20 @@ activatable item-text="title" class="jama-collection-tree" @update:active="activeItemChanged" return-object @update:active="activeItemChanged" > <template v-slot:label="{ item }"> <v-list-item dense class="ma-0 pa-0" :id="'tree-item-'+item.id"> <v-list-item :id="'tree-item-'+item.id" dense class="ma-0 pa-0" > <template> {{ item.title }} </template> </v-list-item> </template> </v-treeview> </v-card> </template> Loading @@ -45,9 +59,6 @@ export default { highlightedNode: null, } }, mounted() { this.fetchCollectionTree(this.currentRootCollectionId); }, computed: { collectionsTree: { get() { Loading @@ -56,6 +67,7 @@ export default { }, ...mapGetters(["collections", "currentRootCollectionId", "currentCollection"]) }, watch: { currentCollection() { Loading @@ -66,6 +78,10 @@ export default { } } }, mounted() { this.fetchCollectionTree(this.currentRootCollectionId); }, methods: { async collectionClicked(c) { this.highlightedNode = c; Loading src/components/JamaActionsToolbar.vue +127 −73 Original line number Diff line number Diff line <template> <v-container class="d-flex align-center mt-5"> <v-checkbox class="mt-0 pt-0" hide-details v-model="allSelected" @click="allSelectedClicked"></v-checkbox> <div v-if="hasSelection" class="d-flex align-center ma-1 pa-0"> <v-checkbox v-model="allSelected" class="mt-0 pt-0" hide-details @click="allSelectedClicked" /> <div v-if="hasSelection" class="d-flex align-center ma-1 pa-0" > <div class="pa-0 caption ma-0 ml-5 pa-0"> <span v-if="collectionsSelectionLength>0"> {{ collectionsSelectionLength }} {{ $tc('collection', collectionsSelectionLength) }} </span> <span class="ml-2" v-if="resourcesSelectionLength>0"> <span v-if="resourcesSelectionLength>0" class="ml-2" > {{ resourcesSelectionLength }} {{ $tc('resource', resourcesSelectionLength) }} </span> </div> Loading @@ -22,7 +33,9 @@ v-bind="attrs" v-on="on" > <v-icon color="dark-grey">mdi-dots-horizontal</v-icon> <v-icon color="dark-grey"> mdi-dots-horizontal </v-icon> </v-btn> </template> <v-list> Loading @@ -42,53 +55,92 @@ </v-menu> </div> <template v-else-if="sort"> <v-btn text small class="ml-4 text-lowercase" @click="sortOptionsClicked('title')"> <v-btn text small class="ml-4 text-lowercase" @click="sortOptionsClicked('title')" > Nom <v-icon v-if="sortOptions.type==='title' && sortOptions.order==='desc'">mdi-menu-down</v-icon> <v-icon v-if="sortOptions.type==='title' && sortOptions.order==='asc'">mdi-menu-up</v-icon> <v-icon v-if="sortOptions.type==='title' && sortOptions.order==='desc'"> mdi-menu-down </v-icon> <v-icon v-if="sortOptions.type==='title' && sortOptions.order==='asc'"> mdi-menu-up </v-icon> </v-btn> <v-btn text small class="ml-8 text-lowercase" @click="sortOptionsClicked('created_at')"> <v-btn text small class="ml-8 text-lowercase" @click="sortOptionsClicked('created_at')" > date de création <v-icon v-if="sortOptions.type==='created_at' && sortOptions.order==='desc'">mdi-menu-down</v-icon> <v-icon v-if="sortOptions.type==='created_at' && sortOptions.order==='asc'">mdi-menu-up</v-icon> <v-icon v-if="sortOptions.type==='created_at' && sortOptions.order==='desc'"> mdi-menu-down </v-icon> <v-icon v-if="sortOptions.type==='created_at' && sortOptions.order==='asc'"> mdi-menu-up </v-icon> </v-btn> <v-btn text small class="ml-8 text-lowercase" @click="sortOptionsClicked('updated_at')"> <v-btn text small class="ml-8 text-lowercase" @click="sortOptionsClicked('updated_at')" > date de modification <v-icon v-if="sortOptions.type==='updated_at' && sortOptions.order==='desc'">mdi-menu-down</v-icon> <v-icon v-if="sortOptions.type==='updated_at' && sortOptions.order==='asc'">mdi-menu-up</v-icon> <v-icon v-if="sortOptions.type==='updated_at' && sortOptions.order==='desc'"> mdi-menu-down </v-icon> <v-icon v-if="sortOptions.type==='updated_at' && sortOptions.order==='asc'"> mdi-menu-up </v-icon> </v-btn> </template> <!-- avoid graphic glitch --> <div v-else class="d-flex align-center ma-1 pa-0"> <div v-else class="d-flex align-center ma-1 pa-0" > <div class="pa-0 caption ma-0 ml-5 pa-0"> <span> </span> </div> </div> <v-dialog v-model="moveDialog" width="400"> <v-dialog v-model="moveDialog" width="400" > <v-card> <v-card-title>{{ $t('move_dialog_title') }}</v-card-title> <v-card-text> <collection-tree-select ref="treeViewSelect" @dest-selected="moveDestSelected" <collection-tree-select ref="treeViewSelect" :root="isTreeWithRoot" :ancestors="unavailableDests" @dest-selected="moveDestSelected" /> </v-card-text> <v-card-actions> <v-btn color="secondary" @click.stop="cancelMove()"> <v-btn color="secondary" @click.stop="cancelMove()" > Annuler </v-btn> <v-btn color="primary" :disabled="!moveDestId" @click.stop="moveSelection"> <v-btn color="primary" :disabled="!moveDestId" @click.stop="moveSelection" > Confirmer </v-btn> </v-card-actions> </v-card> </v-dialog> </v-container> </template> <script> Loading Loading @@ -128,41 +180,6 @@ export default { } }, watch: { currentCollection() { this.allSelected = false; this.batchMode = false; this.excludedCollectionIds = []; this.excludedResourceIds = []; this.$store.commit('setSelectedResources', []); this.$store.commit('setSelectedCollections', []); }, selectedCollections(after, before) { if (after.length < before.length) this.allSelected = false; if(this.batchMode) { let removed = before.filter(x => !after.includes(x)).map((e) => e.id); let added = after.filter(x => !before.includes(x)).map((e) => e.id); this.excludedCollectionIds = this.excludedCollectionIds.concat(removed); this.excludedCollectionIds = this.excludedCollectionIds.filter((c) => added.indexOf(c) < 0); } }, selectedResources(after, before) { if (after.length < before.length) this.allSelected = false; if(this.batchMode) { let removed = before.filter(x => !after.includes(x)).map((e) => e.id); let added = after.filter(x => !before.includes(x)).map((e) => e.id); this.excludedResourceIds = this.excludedResourceIds.concat(removed); this.excludedResourceIds = this.excludedResourceIds.filter((c) => added.indexOf(c) < 0); } } }, computed: { unavailableDests() {//where collections & resources cannot be moved Loading Loading @@ -215,6 +232,43 @@ export default { "selectedCollections"]) }, watch: { currentCollection() { this.allSelected = false; this.batchMode = false; this.excludedCollectionIds = []; this.excludedResourceIds = []; this.$store.commit('setSelectedResources', []); this.$store.commit('setSelectedCollections', []); }, selectedCollections(after, before) { if (after.length < before.length) this.allSelected = false; if(this.batchMode) { let removed = before.filter(x => !after.includes(x)).map((e) => e.id); let added = after.filter(x => !before.includes(x)).map((e) => e.id); this.excludedCollectionIds = this.excludedCollectionIds.concat(removed); this.excludedCollectionIds = this.excludedCollectionIds.filter((c) => added.indexOf(c) < 0); } }, selectedResources(after, before) { if (after.length < before.length) this.allSelected = false; if(this.batchMode) { let removed = before.filter(x => !after.includes(x)).map((e) => e.id); let added = after.filter(x => !before.includes(x)).map((e) => e.id); this.excludedResourceIds = this.excludedResourceIds.concat(removed); this.excludedResourceIds = this.excludedResourceIds.filter((c) => added.indexOf(c) < 0); } } }, methods: { allSelectedClicked() { Loading src/components/JamaAddResource.vue +54 −41 Original line number Diff line number Diff line <template> <div class="jama-upload-view" ref="element"> <div ref="element" class="jama-upload-view" > <!-- <span v-if="isUploading" class="jama-wait">--> <!-- Envoi en cours--> <!-- <progress></progress>--> Loading @@ -13,13 +15,24 @@ <!--<button v-else class="jama-add-btn" :title="$t('add_image')" @click="addResource()">--> <!--<img src="../assets/icons/image-white.svg" :alt="$t('add_image')"/>--> <!--</button>--> <v-btn small class="jama-add-btn" :title="$t('resource.add')" @click="addResource()"> <v-btn small class="jama-add-btn" :title="$t('resource.add')" @click="addResource()" > <v-icon>mdi-image-plus</v-icon> </v-btn> <input v-on:change="resourcesSelected()" ref="jama-input-resource" type="file" id="jama-input-resource" style="display: none;" multiple/> <input id="jama-input-resource" ref="jama-input-resource" type="file" style="display: none;" multiple @change="resourcesSelected()" > </div> </template> <script> Loading Loading
package.json +2 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ "name": "@certic/vue-jama", "version": "0.4.0", "scripts": { "serve": "vue-cli-service serve", "serve": "rimraf -rf ./node_modules/.cache/vue-loader && vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint", "build-lib": "vue-cli-service build --skip-plugins vuetify --target lib --name vue-jama src/index.js", Loading Loading @@ -41,7 +41,7 @@ "node": true }, "extends": [ "plugin:vue/essential", "plugin:vue/recommended", "eslint:recommended" ], "parserOptions": { Loading
src/App.vue +11 −10 Original line number Diff line number Diff line <template> <div id="app" dark> <div id="app" dark > <template v-if="options.pickerMode"> <v-app> <vue-jama-picker Loading @@ -7,14 +10,12 @@ :width="'98%'" @closed="dialogClosed()" @resource-selected="resourceSelected" ></vue-jama-picker> /> </v-app> </template> <template v-else> <vue-jama-app :options="options"> </vue-jama-app> <vue-jama-app :options="options" /> </template> </div> </template> Loading @@ -25,7 +26,7 @@ import VueJamaPicker from "./components/VueJamaPicker"; import vuetify from './plugins/vuetify'; export default { name: 'app', name: 'App', vuetify, components: { VueJamaPicker, Loading
src/components/CollectionsTree.vue +40 −24 Original line number Diff line number Diff line <template> <v-card flat class="rounded-0"> <v-toolbar :elevation="0" dark class="rounded-0 ma-0 pa-0"> <v-card flat class="rounded-0" > <v-toolbar :elevation="0" dark class="rounded-0 ma-0 pa-0" > <v-toolbar-title class="d-flex"> <v-btn text @click="loadHome()"> <v-btn text @click="loadHome()" > <v-icon> mdi-home </v-icon> Loading @@ -11,6 +21,7 @@ </v-toolbar-title> </v-toolbar> <v-treeview ref="collectionTreeView" dense Loading @@ -20,17 +31,20 @@ activatable item-text="title" class="jama-collection-tree" @update:active="activeItemChanged" return-object @update:active="activeItemChanged" > <template v-slot:label="{ item }"> <v-list-item dense class="ma-0 pa-0" :id="'tree-item-'+item.id"> <v-list-item :id="'tree-item-'+item.id" dense class="ma-0 pa-0" > <template> {{ item.title }} </template> </v-list-item> </template> </v-treeview> </v-card> </template> Loading @@ -45,9 +59,6 @@ export default { highlightedNode: null, } }, mounted() { this.fetchCollectionTree(this.currentRootCollectionId); }, computed: { collectionsTree: { get() { Loading @@ -56,6 +67,7 @@ export default { }, ...mapGetters(["collections", "currentRootCollectionId", "currentCollection"]) }, watch: { currentCollection() { Loading @@ -66,6 +78,10 @@ export default { } } }, mounted() { this.fetchCollectionTree(this.currentRootCollectionId); }, methods: { async collectionClicked(c) { this.highlightedNode = c; Loading
src/components/JamaActionsToolbar.vue +127 −73 Original line number Diff line number Diff line <template> <v-container class="d-flex align-center mt-5"> <v-checkbox class="mt-0 pt-0" hide-details v-model="allSelected" @click="allSelectedClicked"></v-checkbox> <div v-if="hasSelection" class="d-flex align-center ma-1 pa-0"> <v-checkbox v-model="allSelected" class="mt-0 pt-0" hide-details @click="allSelectedClicked" /> <div v-if="hasSelection" class="d-flex align-center ma-1 pa-0" > <div class="pa-0 caption ma-0 ml-5 pa-0"> <span v-if="collectionsSelectionLength>0"> {{ collectionsSelectionLength }} {{ $tc('collection', collectionsSelectionLength) }} </span> <span class="ml-2" v-if="resourcesSelectionLength>0"> <span v-if="resourcesSelectionLength>0" class="ml-2" > {{ resourcesSelectionLength }} {{ $tc('resource', resourcesSelectionLength) }} </span> </div> Loading @@ -22,7 +33,9 @@ v-bind="attrs" v-on="on" > <v-icon color="dark-grey">mdi-dots-horizontal</v-icon> <v-icon color="dark-grey"> mdi-dots-horizontal </v-icon> </v-btn> </template> <v-list> Loading @@ -42,53 +55,92 @@ </v-menu> </div> <template v-else-if="sort"> <v-btn text small class="ml-4 text-lowercase" @click="sortOptionsClicked('title')"> <v-btn text small class="ml-4 text-lowercase" @click="sortOptionsClicked('title')" > Nom <v-icon v-if="sortOptions.type==='title' && sortOptions.order==='desc'">mdi-menu-down</v-icon> <v-icon v-if="sortOptions.type==='title' && sortOptions.order==='asc'">mdi-menu-up</v-icon> <v-icon v-if="sortOptions.type==='title' && sortOptions.order==='desc'"> mdi-menu-down </v-icon> <v-icon v-if="sortOptions.type==='title' && sortOptions.order==='asc'"> mdi-menu-up </v-icon> </v-btn> <v-btn text small class="ml-8 text-lowercase" @click="sortOptionsClicked('created_at')"> <v-btn text small class="ml-8 text-lowercase" @click="sortOptionsClicked('created_at')" > date de création <v-icon v-if="sortOptions.type==='created_at' && sortOptions.order==='desc'">mdi-menu-down</v-icon> <v-icon v-if="sortOptions.type==='created_at' && sortOptions.order==='asc'">mdi-menu-up</v-icon> <v-icon v-if="sortOptions.type==='created_at' && sortOptions.order==='desc'"> mdi-menu-down </v-icon> <v-icon v-if="sortOptions.type==='created_at' && sortOptions.order==='asc'"> mdi-menu-up </v-icon> </v-btn> <v-btn text small class="ml-8 text-lowercase" @click="sortOptionsClicked('updated_at')"> <v-btn text small class="ml-8 text-lowercase" @click="sortOptionsClicked('updated_at')" > date de modification <v-icon v-if="sortOptions.type==='updated_at' && sortOptions.order==='desc'">mdi-menu-down</v-icon> <v-icon v-if="sortOptions.type==='updated_at' && sortOptions.order==='asc'">mdi-menu-up</v-icon> <v-icon v-if="sortOptions.type==='updated_at' && sortOptions.order==='desc'"> mdi-menu-down </v-icon> <v-icon v-if="sortOptions.type==='updated_at' && sortOptions.order==='asc'"> mdi-menu-up </v-icon> </v-btn> </template> <!-- avoid graphic glitch --> <div v-else class="d-flex align-center ma-1 pa-0"> <div v-else class="d-flex align-center ma-1 pa-0" > <div class="pa-0 caption ma-0 ml-5 pa-0"> <span> </span> </div> </div> <v-dialog v-model="moveDialog" width="400"> <v-dialog v-model="moveDialog" width="400" > <v-card> <v-card-title>{{ $t('move_dialog_title') }}</v-card-title> <v-card-text> <collection-tree-select ref="treeViewSelect" @dest-selected="moveDestSelected" <collection-tree-select ref="treeViewSelect" :root="isTreeWithRoot" :ancestors="unavailableDests" @dest-selected="moveDestSelected" /> </v-card-text> <v-card-actions> <v-btn color="secondary" @click.stop="cancelMove()"> <v-btn color="secondary" @click.stop="cancelMove()" > Annuler </v-btn> <v-btn color="primary" :disabled="!moveDestId" @click.stop="moveSelection"> <v-btn color="primary" :disabled="!moveDestId" @click.stop="moveSelection" > Confirmer </v-btn> </v-card-actions> </v-card> </v-dialog> </v-container> </template> <script> Loading Loading @@ -128,41 +180,6 @@ export default { } }, watch: { currentCollection() { this.allSelected = false; this.batchMode = false; this.excludedCollectionIds = []; this.excludedResourceIds = []; this.$store.commit('setSelectedResources', []); this.$store.commit('setSelectedCollections', []); }, selectedCollections(after, before) { if (after.length < before.length) this.allSelected = false; if(this.batchMode) { let removed = before.filter(x => !after.includes(x)).map((e) => e.id); let added = after.filter(x => !before.includes(x)).map((e) => e.id); this.excludedCollectionIds = this.excludedCollectionIds.concat(removed); this.excludedCollectionIds = this.excludedCollectionIds.filter((c) => added.indexOf(c) < 0); } }, selectedResources(after, before) { if (after.length < before.length) this.allSelected = false; if(this.batchMode) { let removed = before.filter(x => !after.includes(x)).map((e) => e.id); let added = after.filter(x => !before.includes(x)).map((e) => e.id); this.excludedResourceIds = this.excludedResourceIds.concat(removed); this.excludedResourceIds = this.excludedResourceIds.filter((c) => added.indexOf(c) < 0); } } }, computed: { unavailableDests() {//where collections & resources cannot be moved Loading Loading @@ -215,6 +232,43 @@ export default { "selectedCollections"]) }, watch: { currentCollection() { this.allSelected = false; this.batchMode = false; this.excludedCollectionIds = []; this.excludedResourceIds = []; this.$store.commit('setSelectedResources', []); this.$store.commit('setSelectedCollections', []); }, selectedCollections(after, before) { if (after.length < before.length) this.allSelected = false; if(this.batchMode) { let removed = before.filter(x => !after.includes(x)).map((e) => e.id); let added = after.filter(x => !before.includes(x)).map((e) => e.id); this.excludedCollectionIds = this.excludedCollectionIds.concat(removed); this.excludedCollectionIds = this.excludedCollectionIds.filter((c) => added.indexOf(c) < 0); } }, selectedResources(after, before) { if (after.length < before.length) this.allSelected = false; if(this.batchMode) { let removed = before.filter(x => !after.includes(x)).map((e) => e.id); let added = after.filter(x => !before.includes(x)).map((e) => e.id); this.excludedResourceIds = this.excludedResourceIds.concat(removed); this.excludedResourceIds = this.excludedResourceIds.filter((c) => added.indexOf(c) < 0); } } }, methods: { allSelectedClicked() { Loading
src/components/JamaAddResource.vue +54 −41 Original line number Diff line number Diff line <template> <div class="jama-upload-view" ref="element"> <div ref="element" class="jama-upload-view" > <!-- <span v-if="isUploading" class="jama-wait">--> <!-- Envoi en cours--> <!-- <progress></progress>--> Loading @@ -13,13 +15,24 @@ <!--<button v-else class="jama-add-btn" :title="$t('add_image')" @click="addResource()">--> <!--<img src="../assets/icons/image-white.svg" :alt="$t('add_image')"/>--> <!--</button>--> <v-btn small class="jama-add-btn" :title="$t('resource.add')" @click="addResource()"> <v-btn small class="jama-add-btn" :title="$t('resource.add')" @click="addResource()" > <v-icon>mdi-image-plus</v-icon> </v-btn> <input v-on:change="resourcesSelected()" ref="jama-input-resource" type="file" id="jama-input-resource" style="display: none;" multiple/> <input id="jama-input-resource" ref="jama-input-resource" type="file" style="display: none;" multiple @change="resourcesSelected()" > </div> </template> <script> Loading