fix: hide type tabs when embedded in home page
This commit is contained in:
@@ -17,7 +17,7 @@ const HomePage = {
|
|||||||
document.querySelectorAll('#home-content .tab-nav button').forEach(b => { b.onclick = () => App.navigate('home', b.dataset.tab); });
|
document.querySelectorAll('#home-content .tab-nav button').forEach(b => { b.onclick = () => App.navigate('home', b.dataset.tab); });
|
||||||
const ct = document.getElementById('home-tab');
|
const ct = document.getElementById('home-tab');
|
||||||
if (t === 'tracking') this.renderTracking(ct);
|
if (t === 'tracking') this.renderTracking(ct);
|
||||||
else TicketCreate.render(ct, { type: t, prefill: {}, backLink: null });
|
else TicketCreate.render(ct, { type: t, prefill: {}, backLink: null, hideTabs: true });
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTracking(ct) {
|
renderTracking(ct) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const TicketCreate = {
|
const TicketCreate = {
|
||||||
files: [],
|
files: [],
|
||||||
|
|
||||||
render(container, { type, prefill, backLink }) {
|
render(container, { type, prefill, backLink, hideTabs }) {
|
||||||
const user = Auth.user();
|
const user = Auth.user();
|
||||||
const isReport = type === 'report';
|
const isReport = type === 'report';
|
||||||
const isSuggestion = type === 'suggestion';
|
const isSuggestion = type === 'suggestion';
|
||||||
@@ -10,11 +10,11 @@ const TicketCreate = {
|
|||||||
this.files = [];
|
this.files = [];
|
||||||
|
|
||||||
container.innerHTML = `
|
container.innerHTML = `
|
||||||
<div class="tab-nav" id="type-tabs">
|
${hideTabs ? '' : `<div class="tab-nav" id="type-tabs">
|
||||||
<button class="${isReport?'active':''}" data-type="report">举报</button>
|
<button class="${isReport?'active':''}" data-type="report">举报</button>
|
||||||
<button class="${isSuggestion?'active':''}" data-type="suggestion">建议</button>
|
<button class="${isSuggestion?'active':''}" data-type="suggestion">建议</button>
|
||||||
<button class="${isAppeal?'active':''}" data-type="appeal">申诉</button>
|
<button class="${isAppeal?'active':''}" data-type="appeal">申诉</button>
|
||||||
</div>
|
</div>`}
|
||||||
<form id="ticket-form" enctype="multipart/form-data">
|
<form id="ticket-form" enctype="multipart/form-data">
|
||||||
<input type="hidden" name="type" value="${type}">
|
<input type="hidden" name="type" value="${type}">
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user