Preserve current tab for page reload in profile view
also makes sharing links better etc.
This commit is contained in:
parent
d409e1d088
commit
50dafc91d4
|
@ -540,6 +540,7 @@
|
||||||
|
|
||||||
<%def name="render_personal_tab()">
|
<%def name="render_personal_tab()">
|
||||||
<b-tab-item label="Personal"
|
<b-tab-item label="Personal"
|
||||||
|
value="personal"
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
icon="check">
|
icon="check">
|
||||||
<personal-tab :person="person"
|
<personal-tab :person="person"
|
||||||
|
@ -554,7 +555,10 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="render_member_tab()">
|
<%def name="render_member_tab()">
|
||||||
<b-tab-item label="Member" icon-pack="fas" :icon="members.length ? 'check' : null">
|
<b-tab-item label="Member"
|
||||||
|
value="member"
|
||||||
|
icon-pack="fas"
|
||||||
|
:icon="members.length ? 'check' : null">
|
||||||
|
|
||||||
<div v-if="members.length">
|
<div v-if="members.length">
|
||||||
|
|
||||||
|
@ -641,7 +645,10 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="render_customer_tab()">
|
<%def name="render_customer_tab()">
|
||||||
<b-tab-item label="Customer" icon-pack="fas" :icon="customers.length ? 'check' : null">
|
<b-tab-item label="Customer"
|
||||||
|
value="customer"
|
||||||
|
icon-pack="fas"
|
||||||
|
:icon="customers.length ? 'check' : null">
|
||||||
|
|
||||||
<div v-if="customers.length">
|
<div v-if="customers.length">
|
||||||
|
|
||||||
|
@ -983,6 +990,7 @@
|
||||||
|
|
||||||
<%def name="render_employee_tab()">
|
<%def name="render_employee_tab()">
|
||||||
<b-tab-item label="Employee"
|
<b-tab-item label="Employee"
|
||||||
|
value="employee"
|
||||||
icon-pack="fas"
|
icon-pack="fas"
|
||||||
:icon="employee.current ? 'check' : null">
|
:icon="employee.current ? 'check' : null">
|
||||||
<employee-tab :employee="employee"
|
<employee-tab :employee="employee"
|
||||||
|
@ -995,7 +1003,9 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="render_user_tab()">
|
<%def name="render_user_tab()">
|
||||||
<b-tab-item label="User" ${'icon="check" icon-pack="fas"' if person.users else ''|n}>
|
<b-tab-item label="User"
|
||||||
|
value="user"
|
||||||
|
${'icon="check" icon-pack="fas"' if person.users else ''|n}>
|
||||||
% if person.users:
|
% if person.users:
|
||||||
<p>${person} is associated with <strong>${len(person.users)}</strong> user account(s)</p>
|
<p>${person} is associated with <strong>${len(person.users)}</strong> user account(s)</p>
|
||||||
<br />
|
<br />
|
||||||
|
@ -1064,7 +1074,9 @@
|
||||||
<%def name="render_profile_info_template()">
|
<%def name="render_profile_info_template()">
|
||||||
<script type="text/x-template" id="profile-info-template">
|
<script type="text/x-template" id="profile-info-template">
|
||||||
<div>
|
<div>
|
||||||
<b-tabs v-model="activeTab" type="is-boxed">
|
<b-tabs v-model="activeTab"
|
||||||
|
type="is-boxed"
|
||||||
|
@input="activeTabChanged">
|
||||||
${self.render_profile_tabs()}
|
${self.render_profile_tabs()}
|
||||||
</b-tabs>
|
</b-tabs>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1641,7 +1653,11 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
let ProfileInfoData = {
|
let ProfileInfoData = {
|
||||||
activeTab: 0,
|
% if buefy_0_8:
|
||||||
|
activeTab: location.hash ? parseInt(location.hash.substring(1)) : undefined,
|
||||||
|
% else:
|
||||||
|
activeTab: location.hash ? location.hash.substring(1) : undefined,
|
||||||
|
% endif
|
||||||
person: ${json.dumps(person_data)|n},
|
person: ${json.dumps(person_data)|n},
|
||||||
customers: ${json.dumps(customers_data)|n},
|
customers: ${json.dumps(customers_data)|n},
|
||||||
member: null, // TODO
|
member: null, // TODO
|
||||||
|
@ -1658,18 +1674,33 @@
|
||||||
mixins: [FormPosterMixin],
|
mixins: [FormPosterMixin],
|
||||||
computed: {},
|
computed: {},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
personUpdated(person) {
|
personUpdated(person) {
|
||||||
this.person = person
|
this.person = person
|
||||||
},
|
},
|
||||||
|
|
||||||
employeeUpdated(employee) {
|
employeeUpdated(employee) {
|
||||||
this.employee = employee
|
this.employee = employee
|
||||||
},
|
},
|
||||||
|
|
||||||
employeeHistoryUpdated(employeeHistory) {
|
employeeHistoryUpdated(employeeHistory) {
|
||||||
this.employeeHistory = employeeHistory
|
this.employeeHistory = employeeHistory
|
||||||
},
|
},
|
||||||
|
|
||||||
changeContentTitle(newTitle) {
|
changeContentTitle(newTitle) {
|
||||||
this.$emit('change-content-title', newTitle)
|
this.$emit('change-content-title', newTitle)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
activeTabChanged(value) {
|
||||||
|
% if buefy_0_8:
|
||||||
|
location.hash = value.toString()
|
||||||
|
% else:
|
||||||
|
location.hash = value
|
||||||
|
% endif
|
||||||
|
this.activeTabChangedExtra(value)
|
||||||
|
},
|
||||||
|
|
||||||
|
activeTabChangedExtra(value) {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue