diff --git a/Cargo.lock b/Cargo.lock index 2651cb0..d5c7876 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2166,7 +2166,7 @@ checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" [[package]] name = "stl" -version = "2.6.0" +version = "2.6.1" dependencies = [ "bincode", "chrono", @@ -2190,7 +2190,7 @@ dependencies = [ [[package]] name = "stl_cli" -version = "2.6.0" +version = "2.6.1" dependencies = [ "chrono", "futures", @@ -2209,7 +2209,7 @@ dependencies = [ [[package]] name = "stl_lib" -version = "2.6.0" +version = "2.6.1" dependencies = [ "chrono", "serde", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index ed20b59..091f5dc 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stl_cli" -version = "2.6.0" +version = "2.6.1" authors = ["Joakim Hulthe "] license = "MPL-2.0" edition = "2018" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 997d337..772f3d2 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "stl_lib" -version = "2.6.0" +version = "2.6.1" authors = ["Joakim Hulthe "] license = "MPL-2.0" edition = "2018" diff --git a/server/Cargo.toml b/server/Cargo.toml index 6247e39..3f1a784 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "stl" description = "studielogg aka scuffed toggl" -version = "2.6.0" +version = "2.6.1" authors = ["Joakim Hulthe "] license = "MPL-2.0" edition = "2018" diff --git a/server/static/styles/common.css b/server/static/styles/common.css index 451078f..2e0ebcc 100644 --- a/server/static/styles/common.css +++ b/server/static/styles/common.css @@ -231,3 +231,6 @@ ul.striped_list > li:nth-child(odd) ul li:nth-child(odd) { background-color:#30 opacity: 1; } +.display_none { + display: none; +} diff --git a/server/templates/category_entry.hbs b/server/templates/category_entry.hbs index a885d55..e74a98f 100644 --- a/server/templates/category_entry.hbs +++ b/server/templates/category_entry.hbs @@ -5,16 +5,19 @@ > {{this.category.name}}
- {{#if this.category.started}}
- {{/if}} diff --git a/server/templates/index.hbs b/server/templates/index.hbs index cc4af2d..605052a 100644 --- a/server/templates/index.hbs +++ b/server/templates/index.hbs @@ -14,17 +14,21 @@ function toggle_category(id) { // Find out whether the button is in active (play) or inactive (paused) state let toggled_class = "category_button_toggled"; - let cl = document.getElementById("toggle-button-" + id).classList; - let active = cl.contains(toggled_class); + let display_none_class = "display_none"; + let toggle_cl = document.getElementById("toggle-button-" + id).classList; + let bump_cl = document.getElementById("bump-button-" + id).classList; + let active = toggle_cl.contains(toggled_class); // Get the corresponding route to activate/inactivate the category let url; if(active) { url = "/api/category/" + id + "/end_session"; - cl.remove(toggled_class); + toggle_cl.remove(toggled_class); + bump_cl.add(display_none_class); } else { url = "/api/category/" + id + "/start_session"; - cl.add(toggled_class); + toggle_cl.add(toggled_class); + bump_cl.remove(display_none_class); } //var params = "lorem=ipsum&name=alpha"; @@ -36,8 +40,10 @@ xhr.onreadystatechange = function() { if(xhr.readyState === XMLHttpRequest.DONE) { - console.log(xhr.status, xhr.responseText); - document.location.reload(false /* don't reset scroll position */); + if(xhr.status != 200) { + console.error("xhr error", xhr.status, xhr.responseText); + document.location.reload(false /* don't reset scroll position */); + } } };