|
@@ -4,6 +4,8 @@
|
|
section.hero div.hero-body {
|
|
section.hero div.hero-body {
|
|
align-items: baseline;
|
|
align-items: baseline;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ .albumsModal .columns .column { padding: .25rem; }
|
|
</style>
|
|
</style>
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
@import '~/assets/styles/_colors.scss';
|
|
@import '~/assets/styles/_colors.scss';
|
|
@@ -16,22 +18,40 @@
|
|
<div class="container">
|
|
<div class="container">
|
|
<div class="columns">
|
|
<div class="columns">
|
|
<div class="column is-narrow">
|
|
<div class="column is-narrow">
|
|
- <Sidebar/>
|
|
|
|
|
|
+ <Sidebar />
|
|
</div>
|
|
</div>
|
|
<div class="column">
|
|
<div class="column">
|
|
<h2 class="subtitle">Your uploaded files</h2>
|
|
<h2 class="subtitle">Your uploaded files</h2>
|
|
<hr>
|
|
<hr>
|
|
- <!--
|
|
|
|
- <h1 class="title">Uploads</h1>
|
|
|
|
- <h2 class="subtitle">Keep track of all your uploads in here</h2>
|
|
|
|
- <hr>
|
|
|
|
- -->
|
|
|
|
<Grid v-if="files.length"
|
|
<Grid v-if="files.length"
|
|
:files="files" />
|
|
:files="files" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+
|
|
|
|
+ <b-modal :active.sync="isAlbumsModalActive"
|
|
|
|
+ :width="640"
|
|
|
|
+ scroll="keep">
|
|
|
|
+ <div class="card albumsModal">
|
|
|
|
+ <div class="card-content">
|
|
|
|
+ <div class="content">
|
|
|
|
+ <h3 class="subtitle">Select the albums this file should be a part of</h3>
|
|
|
|
+ <hr>
|
|
|
|
+ <div class="columns is-multiline">
|
|
|
|
+ <div v-for="(album, index) in albums"
|
|
|
|
+ :key="index"
|
|
|
|
+ class="column is-3">
|
|
|
|
+ <div class="field">
|
|
|
|
+ <b-checkbox :value="isAlbumSelected(album.id)"
|
|
|
|
+ @input="albumCheckboxClicked($event, album.id)">{{ album.name }}</b-checkbox>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </b-modal>
|
|
</section>
|
|
</section>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -45,7 +65,12 @@ export default {
|
|
Grid
|
|
Grid
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
- return { files: [] };
|
|
|
|
|
|
+ return {
|
|
|
|
+ files: [],
|
|
|
|
+ albums: [],
|
|
|
|
+ isAlbumsModalActive: false,
|
|
|
|
+ showingModalForFile: null
|
|
|
|
+ };
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
config() {
|
|
config() {
|
|
@@ -57,6 +82,7 @@ export default {
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
this.getFiles();
|
|
this.getFiles();
|
|
|
|
+ this.getAlbums();
|
|
this.$ga.page({
|
|
this.$ga.page({
|
|
page: '/dashboard',
|
|
page: '/dashboard',
|
|
title: 'Dashboard',
|
|
title: 'Dashboard',
|
|
@@ -64,14 +90,44 @@ export default {
|
|
});
|
|
});
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ isAlbumSelected(id) {
|
|
|
|
+ if (!this.showingModalForFile) return;
|
|
|
|
+ const found = this.showingModalForFile.albums.find(el => el.id === id);
|
|
|
|
+ return found ? found.id ? true : false : false;
|
|
|
|
+ },
|
|
|
|
+ openAlbumModal(file) {
|
|
|
|
+ this.showingModalForFile = file;
|
|
|
|
+ this.isAlbumsModalActive = true;
|
|
|
|
+ },
|
|
|
|
+ async albumCheckboxClicked(value, id) {
|
|
|
|
+ try {
|
|
|
|
+ const response = await this.axios.post(`${this.config.baseURL}/file/album/${value ? 'add' : 'del'}`, {
|
|
|
|
+ albumId: id,
|
|
|
|
+ fileId: this.showingModalForFile.id
|
|
|
|
+ });
|
|
|
|
+ this.$toast.open(response.data.message);
|
|
|
|
+
|
|
|
|
+ // Not the prettiest solution to refetch on each click but it'll do for now
|
|
|
|
+ this.getFiles();
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$onPromiseError(error);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
async getFiles() {
|
|
async getFiles() {
|
|
try {
|
|
try {
|
|
const response = await this.axios.get(`${this.config.baseURL}/files`);
|
|
const response = await this.axios.get(`${this.config.baseURL}/files`);
|
|
this.files = response.data.files;
|
|
this.files = response.data.files;
|
|
- console.log(this.files);
|
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
console.error(error);
|
|
console.error(error);
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ async getAlbums() {
|
|
|
|
+ try {
|
|
|
|
+ const response = await this.axios.get(`${this.config.baseURL}/albums/dropdown`);
|
|
|
|
+ this.albums = response.data.albums;
|
|
|
|
+ } catch (error) {
|
|
|
|
+ this.$onPromiseError(error);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|