fix deleting courses, purge redundant code, old jquery. Closes #27

This commit is contained in:
Felix Schulze 2019-11-05 23:26:42 +01:00
parent cf9da44d33
commit 7b84cc6372
2 changed files with 3 additions and 26 deletions

View File

@ -1,35 +1,12 @@
$(document).ready(function() { $(document).ready(function() {
$('.select_programme').change(function() {
var myText = $(".select_programme option:selected").text();
var options = '<select class="grade" style="margin-left:20px;"><option value="0">IG<\/option><option value="10" selected>G<\/option><option value="15">VG<\/option><option value="20">MVG<\/option><\/select>';
$('.courses').html('')
$.each(json[myText], function(i, object) {
var row = null;
$.each(object, function(property, value) {
if (property == 'Subject') {
row = '<div><input type="text" value="' + value + '" style="width:200px;">';
//$('.courses').append('<input type="text" value="'+value+'" style="width:200px;">');
} else {
row = row + '<input type="text" class="points" value="' + value + '" style="width:100px; margin-left:20px">';
row = row + options;
row = row + '<a class="delete_row" style="margin-left:20px;">Ta bort rad<\/a><\/div>';
//$('.courses').append('<input type="text" class="score" value="'+value+'" style="width:100px; margin-left:20px">');
//$('.courses').append(options);
$('.courses').append(row);
}
});
});
$('.courses').append('');
$('.courses').append('');
});
$('form').change(function() { $('form').change(function() {
raknaUtMeritvarde(); raknaUtMeritvarde();
}); });
$('.add_row').on('click', function() { $('.add_row').live('click', function() {
$('div.sample_row > div').clone().appendTo('form.courses'); $('div.sample_row > div').clone().appendTo('form.courses');
raknaUtMeritvarde(); raknaUtMeritvarde();
}); });
$('.delete_row').on('click', function() { $('.delete_row').live('click', function() {
$(this).parent().slideUp(function() { $(this).parent().slideUp(function() {
$(this).remove(); $(this).remove();
raknaUtMeritvarde(); raknaUtMeritvarde();

View File

@ -2,7 +2,7 @@
echo " echo "
<script defer> <script defer>
"; ";
readfile("https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"); readfile("https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js");
readfile("https://code.getmdl.io/1.3.0/material.min.js"); readfile("https://code.getmdl.io/1.3.0/material.min.js");
readfile("https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/js/materialize.min.js"); readfile("https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/js/materialize.min.js");
readfile("assets/js/loader.min.js"); readfile("assets/js/loader.min.js");