Procházet zdrojové kódy

Adding options to app inputtypes

Ecconia před 7 roky
rodič
revize
e444b3d00f

+ 2 - 1
src/components/ApplicationInputSwitch.vue

@@ -1,6 +1,6 @@
 <template>
 	<div>
-		<LimitedTextField v-if="type === 'text-box-limited'" :highlight="highlight"/>
+		<LimitedTextField v-if="type === 'text-box-limited'" :highlight="highlight" :options="options"/>
 		<TextField v-else-if="type === 'text-box'" />
 		<LineInput v-else-if="type === 'line'" />
 
@@ -17,6 +17,7 @@
 		props: [
 			'type',
 			'highlight',
+			'options',
 		],
 		components: {
 			LimitedTextField,

+ 4 - 3
src/components/inputtypes/LimitedTextField.vue

@@ -1,7 +1,7 @@
 <template>
 	<div class="width">
 		<textarea v-bind:class="{ textarea: true, not_enough: highlight && !isEnough, enough: highlight && isEnough }" type="text" v-model="inputText" />
-		<SimpleProgressBar class="progbar" :count="len" max="270" steps="10"/>
+		<SimpleProgressBar class="progbar" :count="len" :max="options.min" :steps="options.steps"/>
 	</div>
 </template>
 
@@ -16,12 +16,13 @@
 		},
 
 		props: [
-			'highlight'
+			'highlight',
+			'options'
 		],
 
 		computed: {
 			isEnough() {
-				return this.inputText.length >= 270
+				return this.inputText.length >= this.options.min
 			},
 			len() {
 				return this.inputText.length

+ 1 - 1
src/views/CreateApplication.vue

@@ -7,7 +7,7 @@
 				<h3 class="question">- {{ element.text }}</h3>
 				<span v-if="element.optional"> (Optional)</span>
 				<br>
-				<ApplicationInputSwitch class="textfield" :highlight="highlight" :type="element.type"></ApplicationInputSwitch>
+				<ApplicationInputSwitch class="textfield" :highlight="highlight" :type="element.type" :options="element.options"></ApplicationInputSwitch>
 				<span class="hint">{{ element.hint }}</span>
 			</div>
 			<button @click="update">Create/Update</button>