diff options
Diffstat (limited to 'app/assets/javascripts/access_tokens/index.js')
-rw-r--r-- | app/assets/javascripts/access_tokens/index.js | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/app/assets/javascripts/access_tokens/index.js b/app/assets/javascripts/access_tokens/index.js index 9bdb2940956..319144193f1 100644 --- a/app/assets/javascripts/access_tokens/index.js +++ b/app/assets/javascripts/access_tokens/index.js @@ -1,11 +1,34 @@ import Vue from 'vue'; import ExpiresAtField from './components/expires_at_field.vue'; +const getInputAttrs = el => { + const input = el.querySelector('input'); + + return { + id: input.id, + name: input.name, + placeholder: input.placeholder, + }; +}; + const initExpiresAtField = () => { - // eslint-disable-next-line no-new - new Vue({ - el: document.querySelector('.js-access-tokens-expires-at'), - components: { ExpiresAtField }, + const el = document.querySelector('.js-access-tokens-expires-at'); + + if (!el) { + return null; + } + + const inputAttrs = getInputAttrs(el); + + return new Vue({ + el, + render(h) { + return h(ExpiresAtField, { + props: { + inputAttrs, + }, + }); + }, }); }; |