diff --git a/src/components/ModelCard.vue b/src/components/ModelCard.vue index 6202d5a29e8e0b0eab8978a197d0bb51ef2fc9d3..26263a236477a60991eb52dac8e5baec6503bad2 100644 --- a/src/components/ModelCard.vue +++ b/src/components/ModelCard.vue @@ -2,21 +2,24 @@ <a class="box" v-on:click="onClick"> <article class="media"> <figure></figure> - </article> - <div class="media-content"> - <div class="content"> - <p> - <strong>{{model.name}}</strong> - <br> - <small>{{model.author.username}}</small> - <small>{{new Date(model.modificationDate).toLocaleDateString()}}</small> - <br> - {{model.shortDescription}} - </p> - <b-taglist> - <b-tag v-for="tag in model.tags" v-bind:key="tag.name" type="is-info">{{tag.name}}</b-tag> - </b-taglist> + <div class="media-content"> + <div class="content"> + <p> + <strong>{{model.name}}</strong> + <br> + <small>{{model.author.username}}</small> - <small>{{new Date(model.modificationDate).toLocaleDateString()}}</small> + <br> + {{model.shortDescription}} + </p> + <b-taglist> + <b-tag v-for="tag in model.tags" v-bind:key="tag.name" type="is-info">{{tag.name}}</b-tag> + </b-taglist> + </div> + </div> + <div class="media-right"> + <h2 class="title is-4">{{model.votes}} votes</h2> </div> - </div> + </article> </a> </template> diff --git a/src/views/Account.vue b/src/views/Account.vue index 67c5b826ccb88c30919469facc563106a9e421e5..ce6f3e30774d493d8e951475549acff8c133bc50 100644 --- a/src/views/Account.vue +++ b/src/views/Account.vue @@ -48,7 +48,7 @@ export default { }, data () { return { - account: '' + account: {} } }, async mounted () { diff --git a/src/views/Model.vue b/src/views/Model.vue index caa5690a3be524994429570c813bc31dd9f6e409..7b15081bde338de0ee14162b0f8f9635fbd7a319 100644 --- a/src/views/Model.vue +++ b/src/views/Model.vue @@ -27,16 +27,23 @@ <small>Last modification: </small><strong>{{new Date(model.modificationDate).toLocaleDateString()}}</strong> <br> <br> - <b-button type="is-primary" size="is-medium" icon-left="download" @click="downloadModel(model.id)"> + <b-button type="is-primary" size="is-medium" icon-left="download"> Download model </b-button> + <a + class="button is-primary is-medium" + icon-left="download" + :href="downloadUrl" + download> + Download model + </a> <hr> <strong>{{model.customLayers.length}} customs layers</strong> <br> <template v-for="layer in model.customLayers"> - <b-button class="customLayer" type="is-primary" icon-left="download" v-bind:key="layer.name" @click="downloadLayer(layer.id)"> - Download {{layer.name}} - </b-button> + <b-button class="customLayer" type="is-primary" icon-left="download" v-bind:key="layer.name" @click="downloadLayer(layer.id)"> + Download {{layer.name}} + </b-button> </template> </div> </div> @@ -72,7 +79,8 @@ export default { model: '', isError: false, isLoading: true, - isAuthor: false + isAuthor: false, + downloadUrl: null } }, computed: { @@ -91,6 +99,8 @@ export default { const userRole = await localStorage.getItem('user_role') if (userRole === 'ROLE_ADMIN') this.isAuthor = true + + this.downloadUrl = this.$serverurl + 'models/download?id=' + this.model.id }, methods: { async getModel (id) {