Commit e1ef5874 authored by Morten Nordseth's avatar Morten Nordseth
Browse files

bad smell - frontend

parent 7a9acb27
Pipeline #128493 canceled with stages
......@@ -42,7 +42,6 @@ function sortAlphabetically(){
var sortByFavoritesThenByName = function(a, b) {
let aIsFave = a.children[0].children[1].classList.contains("fas");
let bIsFave = b.children[0].children[1].classList.contains("fas");
console.log(aIsFave, bIsFave)
if(aIsFave && !bIsFave) return -1;
else if(!aIsFave && bIsFave) return 1;
else return a.children[0].children[0].innerHTML.toLowerCase().localeCompare(b.children[0].children[0].innerHTML.toLowerCase());
......
......@@ -18,7 +18,7 @@ function generateForm(){
function handleEditUserButtonClick(){
setReadOnly(false, "#form-userprofile");
document.querySelector("#inputUsername").readOnly = true; // username field should still be readonly
document.querySelector("#inputUsername").readOnly = true;
cancelButton = document.querySelector("#btn-cancel-profile");
saveButton = document.querySelector("#btn-ok-profile");
......
......@@ -31,8 +31,6 @@ function renderWorkouts(workouts) {
}
function renderExerciseOptions(exerciseTypes, favorites) {
console.log(exerciseTypes);
console.log(favorites);
const selectElement = document.querySelector("#exercise-filter-select");
if(favorites !== undefined){
let user_id = JSON.parse(atob(("; "+document.cookie).split("; access=").pop().split(";").shift().split(".")[1]))["user_id"];
......@@ -129,7 +127,6 @@ window.addEventListener("DOMContentLoaded", async () => {
const urlParams = new URLSearchParams(window.location.search);
if (urlParams.has('ordering')) {
let aSort = null;
ordering = urlParams.get('ordering');
if (ordering == "name" || ordering == "owner" || ordering == "date") {
let aSort = document.querySelector(`a[href="?ordering=${ordering}"`);
......@@ -140,7 +137,6 @@ window.addEventListener("DOMContentLoaded", async () => {
let currentSort = document.querySelector("#current-sort");
currentSort.innerHTML = (ordering.startsWith("-") ? "Descending" : "Ascending") + " " + ordering.replace("-", "");
// grab username
if (ordering.includes("owner")) {
ordering += "__username";
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment