feat(link shares): allows switching the initial view by passing a query parameter #2335
|
@ -144,7 +144,7 @@
|
|||
</td>
|
||||
<td>
|
||||
<div class="select">
|
||||
<select v-model="selectedView[s.id]" id="linkShareView">
|
||||
<select v-model="selectedView[s.id]">
|
||||
konrad marked this conversation as resolved
Outdated
|
||||
<option value="list">
|
||||
konrad marked this conversation as resolved
Outdated
dpschen
commented
Create the options with a computed base on the LIST_VIEWS. This way the options will always stay up-to-date in case we add a new view. Create the options with a computed base on the LIST_VIEWS. This way the options will always stay up-to-date in case we add a new view.
konrad
commented
Done. Done.
dpschen
commented
We should try to prevent dynamic message compilation. That's what I meant here: #2335 (comment) We should try to prevent dynamic message compilation.
See: https://vue-i18n.intlify.dev/guide/advanced/optimization.html#optimization
That's what I meant here: https://kolaente.dev/vikunja/frontend/pulls/2335#issuecomment-34925
konrad
commented
How would we do this then? Compute an object with the final messages? How would we do this then? Compute an object with the final messages?
dpschen
commented
Sorry overread your answer. Now thinking about it we cannot fullfill both goals (making the type of views update automatically and prevent dynamic message compilation). I would opt for what I said initially. Having a configurable option map:
By making the key from type Sorry overread your answer.
Now thinking about it we cannot fullfill both goals (making the type of views update automatically and prevent dynamic message compilation). I would opt for what I said initially. Having a configurable option map:
```ts
export const TASK_VIEW_OPTION_MAP : Record<TaskView, string> = {
list: t('list.list.title'),
gantt: t('list.gantt.title'),
table: t('list.table.title'),
kanban: t('list.kanban.title'),
}
```
By making the key from type `TaskView` we prevent at least misuse.
We need to rewrite this to a computed though so that it updates when the language changes.
konrad
commented
Here's what I came up with: That might not be the most ideal solution but is seems to work pretty good. Here's what I came up with: https://kolaente.dev/vikunja/frontend/commit/e67fc7fb7e1678b1b691fee77d3237b222ad50c6
That might not be the most ideal solution but is seems to work pretty good.
dpschen
commented
I think that’s the way to go. Picky: use an explaining variable name for the label and key in the template I think that’s the way to go.
Picky: use an explaining variable name for the label and key in the template
|
||||
{{ $t('list.list.title') }}
|
||||
</option>
|
||||
|
|
The id seems unused
Removed it. Was a leftover from an earlier version.