feat: remove global RELATIVE_PATH

v1.18.x
Barış Soner Uşaklı 5 years ago
parent 3cd3b7a172
commit 19c448612d

@ -5,7 +5,6 @@
"socket": true, "socket": true,
"ajaxify": true, "ajaxify": true,
"config": true, "config": true,
"RELATIVE_PATH": true,
"utils": true, "utils": true,
"overrides": true, "overrides": true,
"componentHandler": true, "componentHandler": true,

@ -63,7 +63,6 @@
"socket": true, "socket": true,
"ajaxify": true, "ajaxify": true,
"config": true, "config": true,
"RELATIVE_PATH": true,
"utils": true, "utils": true,
"overrides": true, "overrides": true,
"componentHandler": true, "componentHandler": true,

@ -521,12 +521,14 @@ define('admin/dashboard', ['semver', 'Chart', 'translator', 'benchpress'], funct
function buildTopicsLegend() { function buildTopicsLegend() {
var legend = $('#topics-legend').html(''); var legend = $('#topics-legend').html('');
var html = ''; var html = '';
topics.forEach(function (topic, i) { topics.forEach(function (t, i) {
var label = topic.count === '0' ? topic.title : '<a title="' + topic.title + '"href="' + RELATIVE_PATH + '/topic/' + topic.tid + '" target="_blank"> ' + topic.title + '</a>'; var label = t.count === '0' ?
t.title :
'<a title="' + t.title + '"href="' + config.relative_path + '/topic/' + t.tid + '" target="_blank"> ' + t.title + '</a>';
html += '<li>' + html += '<li>' +
'<div style="background-color: ' + topicColors[i] + ';"></div>' + '<div style="background-color: ' + topicColors[i] + ';"></div>' +
'<span> (' + topic.count + ') ' + label + '</span>' + '<span> (' + t.count + ') ' + label + '</span>' +
'</li>'; '</li>';
}); });
legend.translateHtml(html); legend.translateHtml(html);

@ -203,7 +203,7 @@ define('admin/extend/widgets', ['jqueryui'], function () {
return widget; return widget;
} }
$.get(RELATIVE_PATH + '/api/admin/extend/widgets', function (data) { $.get(config.relative_path + '/api/admin/extend/widgets', function (data) {
var areas = data.areas; var areas = data.areas;
for (var i = 0; i < areas.length; i += 1) { for (var i = 0; i < areas.length; i += 1) {

@ -235,7 +235,7 @@ define('forum/topic', [
history.replaceState({ history.replaceState({
url: newUrl + search, url: newUrl + search,
}, null, window.location.protocol + '//' + window.location.host + RELATIVE_PATH + '/' + newUrl + search); }, null, window.location.protocol + '//' + window.location.host + config.relative_path + '/' + newUrl + search);
} }
currentUrl = newUrl; currentUrl = newUrl;
}, 500); }, 500);

@ -8,10 +8,8 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<script> <script>
var RELATIVE_PATH = "{relative_path}";
var config = JSON.parse('{{configJSON}}'); var config = JSON.parse('{{configJSON}}');
var app = { var app = {
template: "{template.name}",
user: JSON.parse('{{userJSON}}'), user: JSON.parse('{{userJSON}}'),
config: JSON.parse(decodeURIComponent("{{adminConfigJSON}}")), config: JSON.parse(decodeURIComponent("{{adminConfigJSON}}")),
flags: {}, flags: {},

Loading…
Cancel
Save