Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mods menu #25

Merged
merged 2 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/components/ServerItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="content">
<div class="columns">
<div class="column is-three-quarters">
<div class="title">{{ server.name }}</div>
<div class="title">#{{ server.id }} {{ server.name }}</div>
</div>
<div class="column">
<span style="width: 100%" :class="['tag', serverStatus.color]">{{ serverStatus.text }}</span>
Expand All @@ -30,6 +30,20 @@
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
<label class="label">Плагины</label>
</div>
<div class="field-body">
<div class="field">
<div class="content">
<dl>
<li v-for="mod in server.mods" :key="mod.id">{{ mod.name }}</li>
</dl>
</div>
</div>
</div>
</div>
</div>
<div class="field is-horizontal">
<div class="field-label is-small">
Expand Down
33 changes: 33 additions & 0 deletions src/components/ServerModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,26 @@
</div>
</div>

<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">Плагины</label>
</div>
<div class="field-body">
<ul>
<li
class="control"
v-for="mod in mods"
v-bind:key="mod.id"
>
<label class="checkbox">
<input type="checkbox" :value="mod.id" v-model="form.mods">
{{ mod.name }}
</label>
</li>
</ul>
</div>
</div>

<div class="is-flex is-justify-content-flex-end">
<button
:class="['button is-success', {'is-loading': pending}]"
Expand Down Expand Up @@ -90,11 +110,13 @@ export default defineComponent({
return {
games: [],
versions: [],
mods: [],
loading: false,
pending: false,
form: {
game_id: null,
version_id: null,
mods: [],
}
}
},
Expand All @@ -119,6 +141,17 @@ export default defineComponent({
this.loading = false
} else {
this.versions = []
this.mods = []
}
},
async 'form.version_id'(val) {
if (val) {
this.loading = true
const response = await this.$http.get(`/games/${this.form.game_id}/versions/${val}/mods/`)
this.mods = response.data
this.loading = false
} else {
this.mods = []
}
},
},
Expand Down