BigW Consortium Gitlab

empty_state.js 1.76 KB
Newer Older
1 2
import Vue from 'vue';

3
const ModalStore = gl.issueBoards.ModalStore;
Phil Hughes committed
4

5 6 7 8 9 10 11 12 13
gl.issueBoards.ModalEmptyState = Vue.extend({
  mixins: [gl.issueBoards.ModalMixins],
  data() {
    return ModalStore.store;
  },
  props: {
    image: {
      type: String,
      required: true,
Phil Hughes committed
14
    },
15 16 17
    newIssuePath: {
      type: String,
      required: true,
18
    },
19 20 21 22 23 24 25 26 27 28
  },
  computed: {
    contents() {
      const obj = {
        title: 'You haven\'t added any issues to your project yet',
        content: `
          An issue can be a bug, a todo or a feature request that needs to be
          discussed in a project. Besides, issues are searchable and filterable.
        `,
      };
Phil Hughes committed
29

30 31 32 33 34 35 36
      if (this.activeTab === 'selected') {
        obj.title = 'You haven\'t selected any issues yet';
        obj.content = `
          Go back to <strong>Open issues</strong> and select some issues
          to add to your board.
        `;
      }
Phil Hughes committed
37

38
      return obj;
Phil Hughes committed
39
    },
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
  },
  template: `
    <section class="empty-state">
      <div class="row">
        <div class="col-xs-12 col-sm-6 col-sm-push-6">
          <aside class="svg-content" v-html="image"></aside>
        </div>
        <div class="col-xs-12 col-sm-6 col-sm-pull-6">
          <div class="text-content">
            <h4>{{ contents.title }}</h4>
            <p v-html="contents.content"></p>
            <a
              :href="newIssuePath"
              class="btn btn-success btn-inverted"
              v-if="activeTab === 'all'">
              New issue
            </a>
            <button
              type="button"
              class="btn btn-default"
              @click="changeTab('all')"
              v-if="activeTab === 'selected'">
              Open issues
            </button>
Phil Hughes committed
64 65
          </div>
        </div>
66 67 68 69
      </div>
    </section>
  `,
});