@windward/games 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,122 +1,118 @@
1
1
  <template>
2
2
  <div>
3
- <v-form ref="form" v-model="valid" v-if="!loading">
4
- <v-container class="pa-0">
5
- <v-text-field
6
- ref="title"
7
- v-model="block.metadata.config.title"
8
- :counter="50"
9
- outlined
10
- :autofocus="true"
11
- :label="
12
- $t(
13
- 'windward.games.components.settings.bucket_game.form.title'
14
- )
15
- "
16
- :disabled="render"
17
- ></v-text-field>
18
- <v-textarea
19
- outlined
20
- auto-grow
21
- v-model="block.metadata.config.instructions"
22
- :counter="255"
23
- :label="
24
- $t(
25
- 'windward.games.components.settings.bucket_game.form.instructions'
26
- )
27
- "
28
- :disabled="render"
29
- ></v-textarea>
30
- </v-container>
31
- <v-divider class="my-4 primary"></v-divider>
32
- <v-container class="pa-0">
33
- <p class="mb-0">
34
- {{
35
- $t(
36
- 'windward.games.components.settings.crossword.crossword_items'
37
- )
38
- }}
39
- </p>
40
- <p class="p-label-crosswords">
3
+ <v-container class="pa-0">
4
+ <v-text-field
5
+ ref="title"
6
+ v-model="block.metadata.config.title"
7
+ :counter="50"
8
+ :rules="validation.titleRule"
9
+ outlined
10
+ :autofocus="true"
11
+ :label="
12
+ $t(
13
+ 'windward.games.components.settings.bucket_game.form.title'
14
+ )
15
+ "
16
+ :disabled="render"
17
+ ></v-text-field>
18
+ <v-textarea
19
+ outlined
20
+ auto-grow
21
+ v-model="block.metadata.config.instructions"
22
+ :rules="validation.instructionRule"
23
+ :counter="255"
24
+ :label="
25
+ $t(
26
+ 'windward.games.components.settings.bucket_game.form.instructions'
27
+ )
28
+ "
29
+ :disabled="render"
30
+ ></v-textarea>
31
+ </v-container>
32
+ <v-divider class="my-4 primary"></v-divider>
33
+ <v-container class="pa-0">
34
+ <p class="mb-0">
35
+ {{
36
+ $t(
37
+ 'windward.games.components.settings.crossword.crossword_items'
38
+ )
39
+ }}
40
+ </p>
41
+ <p class="p-label-crosswords">
42
+ {{
43
+ $t(
44
+ 'windward.games.components.settings.crossword.min_length'
45
+ )
46
+ }}
47
+ </p>
48
+ <SortableExpansionPanel
49
+ v-model="block.metadata.config.words"
50
+ :disabled="render"
51
+ @click:close="onDelete($event)"
52
+ >
53
+ <template #header="{ item, index }">
41
54
  {{
42
- $t(
43
- 'windward.games.components.settings.crossword.min_length'
44
- )
55
+ item.word !== ''
56
+ ? item.word
57
+ : $t(
58
+ 'windward.games.components.settings.bucket_game.form.enter_text'
59
+ )
45
60
  }}
46
- </p>
47
- <SortableExpansionPanel
48
- v-model="block.metadata.config.words"
49
- :disabled="render"
50
- @click:close="onDelete($event)"
51
- >
52
- <template #header="{ item, index }">
53
- {{
54
- item.word !== ''
55
- ? item.word
56
- : $t(
57
- 'windward.games.components.settings.bucket_game.form.enter_text'
58
- )
59
- }}
60
- </template>
61
- <template #body="{ item, index }">
62
- <v-container>
63
- <p class="p-label mb-0">
64
- {{
65
- $t(
66
- 'windward.games.components.settings.crossword.word'
67
- )
68
- }}
69
- </p>
70
- <v-textarea
71
- v-model="
72
- block.metadata.config.words[index].word
73
- "
74
- outlined
75
- :counter="20"
76
- maxlength="20"
77
- :autofocus="true"
78
- class="pt-4"
79
- :disabled="render"
80
- ></v-textarea>
81
- <p class="p-label mb-0">
82
- {{
83
- $t(
84
- 'windward.games.components.settings.crossword.clue'
85
- )
86
- }}
87
- </p>
88
- <v-textarea
89
- v-model="
90
- block.metadata.config.words[index].clue
91
- "
92
- outlined
93
- :counter="155"
94
- maxlength="155"
95
- class="pt-4"
96
- :disabled="render"
97
- ></v-textarea>
98
- </v-container>
99
- </template>
100
- </SortableExpansionPanel>
101
- <v-container class="pa-0">
102
- <v-row justify="center" class="my-4">
103
- <v-btn
104
- color="primary"
105
- elevation="0"
61
+ </template>
62
+ <template #body="{ item, index }">
63
+ <v-container>
64
+ <p class="p-label mb-0">
65
+ {{
66
+ $t(
67
+ 'windward.games.components.settings.crossword.word'
68
+ )
69
+ }}
70
+ </p>
71
+ <v-text-field
72
+ v-model="block.metadata.config.words[index].word"
73
+ outlined
74
+ :counter="20"
75
+ :rules="validation.wordRule"
76
+ :autofocus="true"
77
+ class="pt-4"
106
78
  :disabled="render"
107
- @click="onAddElement"
108
- >
109
- <v-icon>mdi-plus</v-icon>
79
+ ></v-text-field>
80
+ <p class="p-label mb-0">
110
81
  {{
111
82
  $t(
112
- 'windward.games.components.settings.bucket_game.form.add_answer'
83
+ 'windward.games.components.settings.crossword.clue'
113
84
  )
114
85
  }}
115
- </v-btn>
116
- </v-row>
117
- </v-container>
86
+ </p>
87
+ <v-textarea
88
+ v-model="block.metadata.config.words[index].clue"
89
+ outlined
90
+ :counter="155"
91
+ :rules="validation.clueRule"
92
+ class="pt-4"
93
+ :disabled="render"
94
+ ></v-textarea>
95
+ </v-container>
96
+ </template>
97
+ </SortableExpansionPanel>
98
+ <v-container class="pa-0">
99
+ <v-row justify="center" class="my-4">
100
+ <v-btn
101
+ color="primary"
102
+ elevation="0"
103
+ :disabled="render"
104
+ @click="onAddElement"
105
+ >
106
+ <v-icon>mdi-plus</v-icon>
107
+ {{
108
+ $t(
109
+ 'windward.games.components.settings.bucket_game.form.add_answer'
110
+ )
111
+ }}
112
+ </v-btn>
113
+ </v-row>
118
114
  </v-container>
119
- </v-form>
115
+ </v-container>
120
116
  <div v-if="loading" class="text-center">
121
117
  <v-progress-circular
122
118
  :size="70"
@@ -174,6 +170,40 @@ export default {
174
170
  return {
175
171
  valid: true,
176
172
  loading: false,
173
+ validation: {
174
+ titleRule: [
175
+ (v) =>
176
+ v.length <= 50 ||
177
+ this.$t(
178
+ 'windward.games.shared.settings.errors.input_limitations',
179
+ [50]
180
+ ),
181
+ ],
182
+ instructionRule: [
183
+ (v) =>
184
+ v.length <= 255 ||
185
+ this.$t(
186
+ 'windward.games.shared.settings.errors.input_limitations',
187
+ [255]
188
+ ),
189
+ ],
190
+ wordRule: [
191
+ (v) =>
192
+ v.length <= 20 ||
193
+ this.$t(
194
+ 'windward.games.shared.settings.errors.input_limitations',
195
+ [20]
196
+ ),
197
+ ],
198
+ clueRule: [
199
+ (v) =>
200
+ v.length <= 155 ||
201
+ this.$t(
202
+ 'windward.games.shared.settings.errors.input_limitations',
203
+ [155]
204
+ ),
205
+ ],
206
+ },
177
207
  }
178
208
  },
179
209
  methods: {