BigW Consortium Gitlab

environment_actions.js.es6 1.23 KB
Newer Older
Filipa Lacerda committed
1
/*= require vue */
2 3 4 5 6
/* global Vue */

(() => {
  window.gl = window.gl || {};
  window.gl.environmentsList = window.gl.environmentsList || {};
Filipa Lacerda committed
7

8 9 10 11 12
  window.gl.environmentsList.ActionsComponent = Vue.component('actions-component', {
    props: {
      actions: {
        type: Array,
        required: false,
Filipa Lacerda committed
13 14
        default: () => [],
      },
Filipa Lacerda committed
15

16 17 18 19
      playIconSvg: {
        type: String,
        required: false,
      },
20
    },
Filipa Lacerda committed
21

22 23 24 25
    template: `
      <div class="inline">
        <div class="dropdown">
          <a class="dropdown-new btn btn-default" data-toggle="dropdown">
Filipa Lacerda committed
26 27
            <span class="js-dropdown-play-icon-container" v-html="playIconSvg"></span>
            <i class="fa fa-caret-down"></i>
28
          </a>
Filipa Lacerda committed
29

30 31
          <ul class="dropdown-menu dropdown-menu-align-right">
            <li v-for="action in actions">
Filipa Lacerda committed
32 33 34 35
              <a :href="action.play_path"
                data-method="post"
                rel="nofollow"
                class="js-manual-action-link">
Filipa Lacerda committed
36

Filipa Lacerda committed
37
                <span class="js-action-play-icon-container" v-html="playIconSvg"></span>
Filipa Lacerda committed
38

Filipa Lacerda committed
39 40 41
                <span>
                  {{action.name}}
                </span>
42 43 44 45 46
              </a>
            </li>
          </ul>
        </div>
      </div>
Filipa Lacerda committed
47 48 49
    `,
  });
})();