fix: normalizar sync de google sheets para todos los dias, reparar 500 en ciclos lectivos, selector de ciclo lectivo en comisiones y opciones --keep-db --keep-users en install.sh
This commit is contained in:
@@ -156,8 +156,32 @@ const translateHelper = function(s) {
|
||||
return s || '';
|
||||
};
|
||||
|
||||
const urlForHelper = function(endpoint, params = {}) {
|
||||
if (!endpoint) return '#';
|
||||
const parts = endpoint.split('.');
|
||||
const blueprint = parts.length > 1 ? parts[0] : '';
|
||||
const action = parts.length > 1 ? parts[1] : parts[0];
|
||||
let pathStr = `/${blueprint}/${action}`.replace(/^\/\//, '/').replace(/\/$/, '');
|
||||
if (params && typeof params === 'object') {
|
||||
const q = [];
|
||||
for (const [k, v] of Object.entries(params)) {
|
||||
if (k === 'id' || k === 'pk') {
|
||||
pathStr += `/${v}`;
|
||||
} else {
|
||||
q.push(`${encodeURIComponent(k)}=${encodeURIComponent(v)}`);
|
||||
}
|
||||
}
|
||||
if (q.length > 0) {
|
||||
pathStr += (pathStr.includes('?') ? '&' : '?') + q.join('&');
|
||||
}
|
||||
}
|
||||
return pathStr;
|
||||
};
|
||||
|
||||
env.addGlobal('_', translateHelper);
|
||||
env.addFilter('_', translateHelper);
|
||||
env.addGlobal('url_for', urlForHelper);
|
||||
env.addFilter('url_for', urlForHelper);
|
||||
|
||||
app.set('view engine', 'html');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user