diff --git a/js/components/options_input.js b/js/components/options_input.js new file mode 100644 index 00000000..eb16f706 --- /dev/null +++ b/js/components/options_input.js @@ -0,0 +1,16 @@ +export default { + name: 'optionsinput', + + props: { + name: String + }, + + methods: { + onInput: function (e) { + this.$root.$emit('field-change', { + value: e.target.value, + name: this.name + }) + } + } +} diff --git a/js/index.js b/js/index.js index b13d1a6a..1259a285 100644 --- a/js/index.js +++ b/js/index.js @@ -1,12 +1,14 @@ import classes from '../styles/atat.scss' import Vue from 'vue/dist/vue' +import optionsinput from './components/options_input' import textinput from './components/text_input' const app = new Vue({ el: '#app-root', components: { - textinput + optionsinput, + textinput, }, methods: { closeModal: function(name) { diff --git a/templates/components/options_input.html b/templates/components/options_input.html index dbd01947..f183cca4 100644 --- a/templates/components/options_input.html +++ b/templates/components/options_input.html @@ -1,32 +1,33 @@ {% from "components/icon.html" import Icon %} {% macro OptionsInput(field, inline=False) -%} -
+ +
-
- - {{ field.label | striptags}} +
+ + {{ field.label | striptags}} - {% if field.description %} - {{ field.description | safe }} - {% endif %} + {% if field.description %} + {{ field.description | safe }} + {% endif %} + + {% if field.errors %} + {{ Icon('alert') }} + {% endif %} + + + {{ field() }} {% if field.errors %} - {{ Icon('alert') }} + {% for error in field.errors %} + {{ error }} + {% endfor %} {% endif %} - - - {{ field() }} - - {% if field.errors %} - {% for error in field.errors %} - {{ error }} - {% endfor %} - {% endif %} - -
-
+ +
+ {%- endmacro %}