Changeset View
Changeset View
Standalone View
Standalone View
src/resources/js/app.js
Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | methods: { | ||||
const error_page = `<div id="error-page"><div class="code">${code}</div><div class="message">${msg}</div></div>` | const error_page = `<div id="error-page"><div class="code">${code}</div><div class="message">${msg}</div></div>` | ||||
$('#app').children(':not(nav)').remove() | $('#app').children(':not(nav)').remove() | ||||
$('#app').append(error_page) | $('#app').append(error_page) | ||||
}, | }, | ||||
errorHandler(error) { | errorHandler(error) { | ||||
this.stopLoading() | this.stopLoading() | ||||
if (error.response.status === 401) { | if (!error.response) { | ||||
// TODO: probably network connection error | |||||
} else if (error.response.status === 401) { | |||||
this.logoutUser() | this.logoutUser() | ||||
} else { | } else { | ||||
this.errorPage(error.response.status, error.response.statusText) | this.errorPage(error.response.status, error.response.statusText) | ||||
} | } | ||||
}, | }, | ||||
price(price) { | price(price) { | ||||
return (price/100).toLocaleString('de-DE', { style: 'currency', currency: 'CHF' }) | return (price/100).toLocaleString('de-DE', { style: 'currency', currency: 'CHF' }) | ||||
}, | |||||
domainStatusClass(domain) { | |||||
bohlender: looks like component specific UI code to me.
could you explain why this is in app.js and not in… | |||||
Done Inline ActionsI put shared code in app.js, so if something is (going to be) used in multiple components I put it here. These methods are then available "automatically" in all components. machniak: I put shared code in app.js, so if something is (going to be) used in multiple components I put… | |||||
if (domain.isDeleted) { | |||||
return 'text-muted' | |||||
} | |||||
if (domain.isSuspended) { | |||||
return 'text-warning' | |||||
} | |||||
if (!domain.isVerified || !domain.isLdapReady || !domain.isConfirmed) { | |||||
return 'text-danger' | |||||
} | |||||
return 'text-success' | |||||
}, | |||||
domainStatusText(domain) { | |||||
if (domain.isDeleted) { | |||||
return 'Deleted' | |||||
} | |||||
if (domain.isSuspended) { | |||||
return 'Suspended' | |||||
} | |||||
if (!domain.isVerified || !domain.isLdapReady || !domain.isConfirmed) { | |||||
return 'Not Ready' | |||||
} | |||||
return 'Active' | |||||
}, | |||||
userStatusClass(user) { | |||||
if (user.isDeleted) { | |||||
return 'text-muted' | |||||
} | |||||
if (user.isSuspended) { | |||||
return 'text-warning' | |||||
} | |||||
if (!user.isImapReady || !user.isLdapReady) { | |||||
return 'text-danger' | |||||
} | |||||
return 'text-success' | |||||
}, | |||||
userStatusText(user) { | |||||
if (user.isDeleted) { | |||||
return 'Deleted' | |||||
} | |||||
if (user.isSuspended) { | |||||
return 'Suspended' | |||||
} | |||||
if (!user.isImapReady || !user.isLdapReady) { | |||||
return 'Not Ready' | |||||
} | |||||
return 'Active' | |||||
} | } | ||||
} | } | ||||
}) | }) |
looks like component specific UI code to me.
could you explain why this is in app.js and not in the component?
This is more about me learning where to put things rather than a complaint.