Skip to content
Snippets Groups Projects
Commit 13203c93 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

edit button in list of subjects is standard 'a' tag

parent 5a120fcc
No related branches found
No related tags found
1 merge request!89edit button in list of subjects is standard 'a' tag
Pipeline #
......@@ -13,7 +13,7 @@ function createColumn(dataType, name, filter, visible, renderFunction) {
};
}
function getColumns(type) {
function getColumns(type, getSubjectEditUrl) {
var result = [];
// don't confuse end user
// result.push(createColumn("id", "Id", null, false));
......@@ -29,7 +29,9 @@ function getColumns(type) {
result.push(createColumn("information_sent", "Info sent", "yes_no_filter", true));
result.push(createColumn("type", "Type", "type_filter", true));
result.push(createColumn("id", "Edit", null, true, function (data, type, row, meta) {
return '<a href="#" type="button" class="btn btn-block btn-default">Edit</a>';
var url = getSubjectEditUrl(row.id.toString());
return '<a href="' + url + '" type="button" class="btn btn-block btn-default">Edit</a>';
}));
for (var i = 1; i <= 8; i++) {
var renderFunction = (function () {
......@@ -207,11 +209,6 @@ function createSubjectsTable(params) {
order: [[0, 'desc']]
});
$('#table tbody').on('click', 'a', function () {
var data = table.row($(this).parents('tr')).data();
window.location.href = getSubjectEditUrl(data.id.toString());
});
// Apply the search
table.columns().every(function () {
var that = this;
......
......@@ -53,13 +53,12 @@
{% endfor %}
createSubjectsTable({
getSubjectEditUrl: getSubjectEditUrl,
worker_locations: worker_locations,
subject_types_url: "{% url 'web.api.subject_types' %}",
locations_url: "{% url 'web.api.locations' %}",
subjects_url: "{% url 'web.api.subjects' list_type %}",
tableElement: document.getElementById("table"),
columns: getColumns("{{ list_type }}"),
columns: getColumns("{{ list_type }}", getSubjectEditUrl),
checkboxesElement: document.getElementById("visible-column-checkboxes")
})
;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment