debian-mirror-gitlab/app/assets/javascripts/boards/components/modal/header.vue

83 lines
1.7 KiB
Vue
Raw Normal View History

2018-11-08 19:23:39 +05:30
<script>
2018-12-13 13:39:08 +05:30
import ModalFilters from './filters';
import ModalTabs from './tabs.vue';
import ModalStore from '../../stores/modal_store';
import modalMixin from '../../mixins/modal_mixins';
2018-11-08 19:23:39 +05:30
2018-12-13 13:39:08 +05:30
export default {
components: {
ModalTabs,
ModalFilters,
},
mixins: [modalMixin],
props: {
projectId: {
type: Number,
required: true,
2018-11-08 19:23:39 +05:30
},
2018-12-13 13:39:08 +05:30
milestonePath: {
type: String,
required: true,
2018-11-08 19:23:39 +05:30
},
2018-12-13 13:39:08 +05:30
labelPath: {
type: String,
required: true,
2018-11-08 19:23:39 +05:30
},
2018-12-13 13:39:08 +05:30
},
data() {
return ModalStore.store;
},
computed: {
selectAllText() {
if (ModalStore.selectedCount() !== this.issues.length || this.issues.length === 0) {
return 'Select all';
}
2018-11-08 19:23:39 +05:30
2018-12-13 13:39:08 +05:30
return 'Deselect all';
2018-11-08 19:23:39 +05:30
},
2018-12-13 13:39:08 +05:30
showSearch() {
return this.activeTab === 'all' && !this.loading && this.issuesCount > 0;
},
},
methods: {
toggleAll() {
this.$refs.selectAllBtn.blur();
2018-11-08 19:23:39 +05:30
2018-12-13 13:39:08 +05:30
ModalStore.toggleAll();
2018-11-08 19:23:39 +05:30
},
2018-12-13 13:39:08 +05:30
},
};
2018-11-08 19:23:39 +05:30
</script>
<template>
<div>
<header class="add-issues-header form-actions">
<h2>
Add issues
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
2019-01-03 12:48:30 +05:30
@click="toggleModal(false)"
2018-11-08 19:23:39 +05:30
>
<span aria-hidden="true">×</span>
</button>
</h2>
</header>
2019-01-03 12:48:30 +05:30
<modal-tabs v-if="!loading && issuesCount > 0"/>
<div
v-if="showSearch"
class="add-issues-search append-bottom-10">
2018-11-08 19:23:39 +05:30
<modal-filters :store="filter" />
<button
ref="selectAllBtn"
type="button"
class="btn btn-success btn-inverted prepend-left-10"
@click="toggleAll"
>
{{ selectAllText }}
</button>
</div>
</div>
</template>