Fix missing routes incompatible with a subpath
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($.isController('error_templates')) {
|
||||
$('#add-attribute').find('button').on('click', function () {
|
||||
$.ajax('//' + location.host + location.pathname + '/attribute.json', {
|
||||
const button = $('#add-attribute').find('button')
|
||||
button.on('click', function () {
|
||||
$.ajax(Routes.attribute_error_template_path(button.data('template-id')), {
|
||||
method: 'POST',
|
||||
data: {
|
||||
_method: 'PUT',
|
||||
@@ -15,4 +16,4 @@ $(document).on('turbolinks:load', function() {
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@@ -100,7 +100,7 @@ $(document).on('turbolinks:load', function() {
|
||||
tooltip.style("display", "none");
|
||||
})
|
||||
.on("click", function (_event, d) {
|
||||
Turbolinks.visit("/exercises/" + d.exercise_id + "/statistics");
|
||||
Turbolinks.visit(Routes.statistics_exercise_path(d.exercise_id));
|
||||
})
|
||||
.attr("x", function (d) {
|
||||
return x(d.index);
|
||||
|
@@ -1,13 +1,14 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var grid = $('#tag-grid');
|
||||
const grid = $('#tag-grid');
|
||||
|
||||
if ($.isController('external_users') && grid.isPresent()) {
|
||||
var spinner = $('#loading');
|
||||
var noElements = $('#no-elements');
|
||||
const spinner = $('#loading');
|
||||
const user_id = spinner.data('user-id');
|
||||
const noElements = $('#no-elements');
|
||||
|
||||
var buildTagContainer = function(tag) {
|
||||
const buildTagContainer = function(tag) {
|
||||
return '\
|
||||
<a href="' + location.href +'/statistics?tag=' + tag.id + '">\
|
||||
<a href="' + Routes.statistics_external_user_path(user_id, {tag: tag.id}) + '">\
|
||||
<div class="tag">\
|
||||
<div class="name">' + tag.key + '</div>\
|
||||
<div class="progress">\
|
||||
@@ -17,7 +18,7 @@ $(document).on('turbolinks:load', function() {
|
||||
</a>';
|
||||
};
|
||||
|
||||
var jqxhr = $.ajax('//' + location.host + location.pathname + '/tag_statistics', {
|
||||
const jqxhr = $.ajax(Routes.tag_statistics_external_user_path(user_id), {
|
||||
dataType: 'json',
|
||||
method: 'GET'
|
||||
});
|
||||
@@ -26,7 +27,7 @@ $(document).on('turbolinks:load', function() {
|
||||
if (response.length === 0) {
|
||||
noElements.show();
|
||||
} else {
|
||||
var elements = response.map(buildTagContainer);
|
||||
const elements = response.map(buildTagContainer);
|
||||
grid.append(elements);
|
||||
}
|
||||
});
|
||||
|
@@ -49,7 +49,7 @@ $(document).on('turbolinks:load', function() {
|
||||
|
||||
var refreshData = function (callback) {
|
||||
var params = new URLSearchParams(window.location.search.slice(1));
|
||||
var jqxhr = $.ajax('/statistics/graphs/' + prefix + '-activity-history.json', {
|
||||
var jqxhr = $.ajax(Routes[`statistics_graphs_${prefix}_activity_history_path`](), {
|
||||
dataType: 'json',
|
||||
data: {from: params.get('from'), to: params.get('to'), interval: params.get('interval')},
|
||||
method: 'GET'
|
||||
|
@@ -101,7 +101,7 @@ $(document).on('turbolinks:load', function() {
|
||||
});
|
||||
}
|
||||
|
||||
manageGraph('user-activity', '/statistics/graphs/user-activity', 10);
|
||||
manageGraph('rfc-activity', '/statistics/graphs/rfc-activity', 30);
|
||||
manageGraph('user-activity', Routes.statistics_graphs_user_activity_path(), 10);
|
||||
manageGraph('rfc-activity', Routes.statistics_graphs_rfc_activity_path(), 30);
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user