Skip to content

Commit

Permalink
[productions] Allow to chose the first page displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
frankrousseau committed Dec 11, 2023
1 parent da75688 commit df06f80
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 19 deletions.
14 changes: 11 additions & 3 deletions src/components/pages/OpenProductions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -226,22 +226,30 @@ export default {
},
sectionPath(production, section) {
const routeName = production.homepage || section
const route = {
name: section,
name: routeName,
params: {
production_id: production.id
},
query: {}
}
if (production.production_type === 'tvshow') {
route.name = `episode-${section}`
route.name = `episode-${routeName}`
if (section !== 'edits') {
route.params.episode_id = production.first_episode_id
} else {
route.params.episode_id = 'all'
}
}
if (['assets', 'shots', 'edits'].includes(section)) {
const isEntityPage = [
'assets',
'shots',
'edits',
'sequences',
'episodes'
].includes(routeName)
if (isEntityPage) {
route.query.search = ''
}
return route
Expand Down
40 changes: 25 additions & 15 deletions src/components/pages/production/ProductionParameters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<div class="mr1">
<date-field
ref="startDateField"
class="mb0"
:label="$t('productions.fields.start_date')"
:short-date="true"
v-model="form.start_date"
Expand All @@ -22,28 +23,41 @@
<div>
<date-field
ref="endDateField"
class="mb0"
:label="$t('productions.fields.end_date')"
:short-date="true"
v-model="form.end_date"
/>
</div>
</div>
<combobox

<combobox-styled
ref="productionTypeField"
localeKeyPrefix="productions.type."
class="mb2"
locale-key-prefix="productions.type."
:label="$t('productions.fields.type')"
:options="productionTypeOptions"
@enter="runConfirmation"
v-model="form.production_type"
/>

<combobox-styled
ref="homepage"
class="mb2"
locale-key-prefix="productions.homepage."
:label="$t('productions.fields.homepage')"
:options="homepageOptions"
@enter="runConfirmation"
v-model="form.homepage"
v-if="currentProduction && currentProduction.id"
/>

<text-field
ref="nbEpisodesField"
type="number"
:step="1"
:label="$t('productions.fields.nb_episodes')"
@enter="runConfirmation"
v-focus
v-model="form.nb_episodes"
v-if="currentProduction && currentProduction.id && isLocalTVShow"
/>
Expand All @@ -63,39 +77,34 @@
:step="0.001"
:label="$t('productions.fields.fps')"
@enter="runConfirmation"
v-focus
v-model="form.fps"
v-if="currentProduction && currentProduction.id"
/>
<text-field
ref="ratioField"
:label="$t('productions.fields.ratio')"
@enter="runConfirmation"
v-focus
v-model="form.ratio"
v-if="currentProduction && currentProduction.id"
/>
<text-field
ref="resolutionField"
:label="$t('productions.fields.resolution')"
@enter="runConfirmation"
v-focus
v-model="form.resolution"
v-if="currentProduction && currentProduction.id"
/>
<combobox-boolean
ref="isClientsIsolatedField"
:label="$t('productions.fields.is_clients_isolated')"
@enter="runConfirmation"
v-focus
v-model="form.is_clients_isolated"
v-if="currentProduction && currentProduction.id"
/>
<combobox-boolean
ref="isPreviewDownloadAllowed"
:label="$t('productions.fields.is_preview_download_allowed')"
@enter="runConfirmation"
v-focus
v-model="form.is_preview_download_allowed"
v-if="currentProduction && currentProduction.id"
/>
Expand All @@ -105,11 +114,9 @@
:step="1"
:label="$t('productions.fields.max_retakes')"
@enter="runConfirmation"
v-focus
v-model="form.max_retakes"
v-if="currentProduction && currentProduction.id"
/>

<div v-if="currentProduction && currentProduction.id">
<label class="label">{{ $t('productions.picture') }}</label>
<file-upload
Expand Down Expand Up @@ -140,10 +147,10 @@
<script>
import { mapGetters, mapActions } from 'vuex'
import { formatSimpleDate, parseSimpleDate } from '@/lib/time'
import { PRODUCTION_TYPE_OPTIONS } from '@/lib/productions'
import { PRODUCTION_TYPE_OPTIONS, HOME_PAGE_OPTIONS } from '@/lib/productions'
import Combobox from '@/components/widgets/Combobox'
import ComboboxBoolean from '@/components/widgets/ComboboxBoolean'
import ComboboxStyled from '@/components/widgets/ComboboxStyled'
import DateField from '@/components/widgets/DateField'
import FileUpload from '@/components/widgets/FileUpload'
import TextField from '@/components/widgets/TextField'
Expand All @@ -152,8 +159,8 @@ import ButtonSimple from '@/components/widgets/ButtonSimple.vue'
export default {
name: 'production-parameters',
components: {
Combobox,
ComboboxBoolean,
ComboboxStyled,
DateField,
FileUpload,
TextField,
Expand All @@ -167,6 +174,7 @@ export default {
isError: false,
isLocalTVShow: false,
productionTypeOptions: PRODUCTION_TYPE_OPTIONS,
homepageOptions: HOME_PAGE_OPTIONS,
form: {
name: '',
start_date: new Date(),
Expand Down Expand Up @@ -259,7 +267,8 @@ export default {
? 'true'
: 'false',
ratio: this.currentProduction.ratio,
resolution: this.currentProduction.resolution
resolution: this.currentProduction.resolution,
homepage: this.currentProduction.homepage
}
} else {
this.form = {
Expand All @@ -274,7 +283,8 @@ export default {
is_preview_download_allowed: 'false',
fps: '',
ratio: '',
resolution: ''
resolution: '',
homepage: HOME_PAGE_OPTIONS[0].value
}
}
},
Expand Down
6 changes: 6 additions & 0 deletions src/lib/productions.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ export const PRODUCTION_STYLE_OPTIONS = [
{ label: 'ar', value: 'ar' }
]

export const HOME_PAGE_OPTIONS = [
{ label: 'assets', value: 'assets' },
{ label: 'shots', value: 'shots' },
{ label: 'sequences', value: 'sequences' }
]

export function getTaskTypePriorityOfProd(taskType, production) {
if (!taskType) {
return 1
Expand Down
10 changes: 10 additions & 0 deletions src/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ export default {
open_productions: 'My Productions',
picture: 'Change picture',
title: 'Productions',

creation: {
add_assets: 'Add assets (optional)',
add_asset_types: 'Add asset types',
Expand Down Expand Up @@ -865,6 +866,7 @@ export default {
title: 'My Productions',
welcome: 'Welcome to Kitsu'
},

fields: {
end_date: 'End date',
episode_span: 'Episode spacing',
Expand All @@ -874,13 +876,15 @@ export default {
max_retakes: 'Maximum number of retakes',
name: 'Name',
nb_episodes: 'Number of episodes',
homepage: 'Homepage (first page displayed)',
ratio: 'Ratio',
resolution: 'Resolution',
start_date: 'Start date',
status: 'Status',
style: 'Style',
type: 'Type'
},

metadata: {
add_explaination: 'Add specific data required by this project.',
add_failed: 'An error occurred while adding metadata to your project.',
Expand All @@ -904,6 +908,12 @@ export default {
title: 'Brief'
},

homepage: {
'assets': 'Assets',
'shots': 'Shots',
'sequences': 'sequences',
},

parameters: {
title: 'Parameters',
save: {
Expand Down
3 changes: 2 additions & 1 deletion src/store/api/productions.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export default {
episode_span: production.episode_span,
is_clients_isolated: production.is_clients_isolated === 'true',
is_preview_download_allowed:
production.is_preview_download_allowed === 'true'
production.is_preview_download_allowed === 'true',
homepage: production.homepage
}
return client.pput(`/api/data/projects/${production.id}`, data)
},
Expand Down

0 comments on commit df06f80

Please sign in to comment.