mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
Merge branch 'person_renderbox_thirdparty_onthefly' into post-prototypage
This commit is contained in:
@@ -27,15 +27,18 @@
|
||||
|
||||
</div>
|
||||
|
||||
<p v-if="this.options.addInfo == true" class="moreinfo">
|
||||
<p v-if="options.addInfo == true" class="moreinfo">
|
||||
<i :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
|
||||
<time v-if="person.birthdate" datetime="{{ person.birthdate }}" title="{{ birthdate }}">
|
||||
{{ $t(getGender) + ' ' + $d(birthdate, 'text') }}
|
||||
<time v-if="person.birthdate && !person.deathdate" datetime="{{ person.birthdate }}" title="{{ birthdate }}">
|
||||
{{ $t(getGenderTranslation) + ' ' + $d(birthdate, 'text') }}
|
||||
</time>
|
||||
<time v-else-if="person.deathdate" datetime="{{ person.deathdate }}" title="{{ person.deathdate }}">
|
||||
<time v-else-if="person.birthdate && person.deathdate" datetime="{{ person.deathdate }}" title="{{ person.deathdate }}">
|
||||
{{ birthdate }} - {{ deathdate }}
|
||||
</time>
|
||||
<!-- <span class="age">{{ person.age }}</span> -->
|
||||
<time v-else-if="person.deathdate" datetime="{{ person.deathdate }}" title="{{ person.deathdate }}">
|
||||
{{ $t('renderbox.deathdate') + ' ' + deathdate }}
|
||||
</time>
|
||||
<span v-if="options.addAge && person.birthdate" class="age">{{ getAge }} {{ $t('renderbox.years_old')}}</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -118,7 +121,7 @@ export default {
|
||||
},
|
||||
props: ['person', 'options', 'render'],
|
||||
computed: {
|
||||
getGender: function() {
|
||||
getGenderTranslation: function() {
|
||||
return this.person.gender == 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
|
||||
},
|
||||
isMultiline: function() {
|
||||
@@ -132,13 +135,24 @@ export default {
|
||||
return this.person.gender == 'woman' ? 'fa-venus' : this.person.gender == 'man' ? 'fa-mars' : 'fa-neuter';
|
||||
},
|
||||
birthdate: function(){
|
||||
var date = new Date(this.person.birthdate.datetime);
|
||||
return dateToISO(date);
|
||||
if(this.person.birthdate !== null){
|
||||
const date = new Date(this.person.birthdate.datetime);
|
||||
return dateToISO(date)
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
deathdate: function(){
|
||||
if (typeof this.person.deathdate !== 'undefined') {
|
||||
var date = new Date(this.person.deathdate.datetime);
|
||||
return dateToISO(date);
|
||||
// TODO FIX edition conflict: if null or undefined ?
|
||||
// if (typeof this.person.deathdate !== 'undefined') {
|
||||
// var date = new Date(this.person.deathdate.datetime);
|
||||
// return dateToISO(date);
|
||||
//}
|
||||
if(this.person.deathdate !== null){
|
||||
const date = new Date(this.person.deathdate.datetime);
|
||||
return date.toLocaleDateString("fr-FR");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
},
|
||||
altNameLabel: function(){
|
||||
@@ -151,8 +165,25 @@ export default {
|
||||
return this.person.altNames[i].key
|
||||
}
|
||||
},
|
||||
getUrl() {
|
||||
return `/fr/person/${this.person.id}/general`;
|
||||
getUrl: function() {
|
||||
return `/fr/person/${this.person.id}/general`;
|
||||
},
|
||||
getAge: function(){
|
||||
if(this.person.birthdate && !this.person.deathdate){
|
||||
const birthday = new Date(this.person.birthdate.datetime)
|
||||
const now = new Date()
|
||||
return (now.getFullYear() - birthday.getFullYear())
|
||||
} else if(this.person.birthdate && this.person.deathdate){
|
||||
const birthday = new Date(this.person.birthdate.datetime)
|
||||
const deathdate = new Date(this.person.deathdate.datetime)
|
||||
return (deathdate.getFullYear() - birthday.getFullYear())
|
||||
} else if(!this.person.birthdate && this.person.deathdate.datetime) {
|
||||
// todo: change this
|
||||
return "Age unknown"
|
||||
} else {
|
||||
// todo: change this
|
||||
return "Age unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,6 +219,12 @@ div.flex-table {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.age{
|
||||
margin-left: 0.5em;
|
||||
&:before { content: '('; }
|
||||
&:after { content: ')'; }
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user