+
+
\ No newline at end of file
diff --git a/themes/grass/layouts/partials/grass-download.html b/themes/grass/layouts/partials/grass-download.html
new file mode 100644
index 00000000..cd573898
--- /dev/null
+++ b/themes/grass/layouts/partials/grass-download.html
@@ -0,0 +1,11 @@
+
+
Download GRASS GIS for {{ .os }}
+
Click the button below to download the latest {{ .os }} version of GRASS GIS.
OSGeo4W is an installer for a broad set of open source geospatial software packages including GRASS GIS as well as many other packages (QGIS, GDAL/OGR, and more).
Note: If you compiled locally before building the Docker image, you may encounter problems as the local configuration and the locally compiled files are copied to and used in the Docker image. To make sure you don't have this issue, clean all the compiled files from the source code:
+
+
make distclean
+
+
+
-
+
From 0fdc4282ca92a243b7def12caa91076088ab012f Mon Sep 17 00:00:00 2001
From: Corey White
Date: Fri, 24 Jan 2025 14:48:57 -0500
Subject: [PATCH 8/9] Removed alert when copy button is clicked
---
themes/grass/layouts/partials/code-copy.html | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/themes/grass/layouts/partials/code-copy.html b/themes/grass/layouts/partials/code-copy.html
index 3b1ab5df..ef65ff71 100644
--- a/themes/grass/layouts/partials/code-copy.html
+++ b/themes/grass/layouts/partials/code-copy.html
@@ -2,9 +2,7 @@
$(document).ready(function() {
$("#{{ .id }}").on('click', function() {
const code = $(this).prev().text();
- navigator.clipboard.writeText(code).then(() => {
- alert(code);
- }).catch(err => {
+ navigator.clipboard.writeText(code).catch(err => {
console.error('Error in copying text: ', err);
});
});
From 1d8f972b01e72f6226eb12abe735a49273ae66eb Mon Sep 17 00:00:00 2001
From: Corey White
Date: Fri, 24 Jan 2025 16:37:25 -0500
Subject: [PATCH 9/9] Fixed download tabs
---
config.toml | 1 +
themes/grass/assets/css/style.css | 16 ++-
themes/grass/assets/js/script.js | 111 ++++++++++++-------
themes/grass/layouts/learn/download.html | 16 +--
themes/grass/layouts/partials/code-copy.html | 2 +-
themes/grass/layouts/partials/head.html | 1 +
6 files changed, 95 insertions(+), 52 deletions(-)
diff --git a/config.toml b/config.toml
index 37c112df..49b55ffc 100644
--- a/config.toml
+++ b/config.toml
@@ -18,6 +18,7 @@ blackColor = "#000000"
greyColor = "#6b6b6b"
greyColorLight = "#CCCCCC"
greyColorDark = "#A0A0A0"
+codeBackgroundColor = "##040404"
[sitemap]
changefreq = "monthly"
diff --git a/themes/grass/assets/css/style.css b/themes/grass/assets/css/style.css
index 6fe3df07..32be160c 100644
--- a/themes/grass/assets/css/style.css
+++ b/themes/grass/assets/css/style.css
@@ -1210,19 +1210,17 @@ li.parent a {
}
.edt {
- font-family: open_sansregular; !important;
+ font-family: open_sansregular;
}
nobullets {
list-style-type: none;
}
+
/*
-.hljs {
- background:#c5c8c6;
- color: #1d1f21;
-}
+.
.hljs-keyword{
@@ -1463,8 +1461,14 @@ code{
.code-container {
position: relative;
- background-color: #777;
+ background: var(--code-background-color);
}
+
+/* .hljs {
+ background: var(--code-background-color) !important;
+ color: #1d1f21;
+} */
+
.btn-clipboard {
position: absolute;
top: .5rem;
diff --git a/themes/grass/assets/js/script.js b/themes/grass/assets/js/script.js
index e36a2d00..48d4fa58 100644
--- a/themes/grass/assets/js/script.js
+++ b/themes/grass/assets/js/script.js
@@ -65,7 +65,6 @@
function detectOSFromUserAgent() {
return new Promise((resolve) => {
const userAgent = window.navigator.userAgent;
-
if (userAgent.includes("Win")) resolve("Windows");
else if (userAgent.includes("Mac")) resolve("macOS");
else if (userAgent.includes("Linux")) resolve("Linux");
@@ -75,46 +74,84 @@
});
}
+ function configureDownloadButton(os, replaceHash = true) {
+ const button = $(".grass-os-download-button");
+ switch (os) {
+ case "Windows":
+ console.log("Setting Windows");
+ button.text("Download for Windows");
+ button.data("os", "windows");
+ $('#downloadTab a[href="#windows"]').tab('show');
+ if (window.location.pathname === "/learn/download/") {
+ history.replaceState(null, null, "#windows");
+ }
+ break;
+ case "macOS":
+ button.text("Download for macOS");
+ button.data("os", "mac");
+ $('#downloadTab a[href="#mac"]').tab('show');
+ if (window.location.pathname === "/learn/download/") {
+ history.replaceState(null, null, "#mac");
+ }
+ break;
+ case "Linux":
+ button.text("Download for Linux");
+ button.data("os", "linux");
+ $('#downloadTab a[href="#linux"]').tab('show');
+ if (window.location.pathname === "/learn/download/") {
+ history.replaceState(null, null, "#linux");
+ }
+ break;
+ case "Docker":
+ button.text("Docker Container");
+ button.data("os", "docker");
+ $('#downloadTab a[href="#docker"]').tab('show');
+ if (window.location.pathname === "/learn/download/") {
+ history.replaceState(null, null, "#docker");
+ }
+ break;
+ default:
+ button.text("Download");
+ button.data("os", "unknown");
+ break;
+ }
+ }
+
$(document).ready(function() {
+
+ // Handle download page tab change
+ $('#downloadTab a').on('click', function(e) {
+ e.preventDefault();
+ console.log("Download button clicked", e, this);
+ // Activate the clicked tab
+ $(this).tab('show');
+ const hash = e.target.hash;
+ const os = e.target.innerText;
+ configureDownloadButton(os);
+ // history.replaceState(null, null, hash);
+ });
+
// Detect the user's OS and update the download button text
(async () => {
- const os = await detectOSFromUserAgent();
- const button = $(".grass-os-download-button");
-
- // Add text and data based on the user's OS
- switch (os) {
- case "Windows":
- button.text("Download for Windows");
- button.data("os", "windows");
- // TODO: This doesn't work
- // $('a[data-toggle="tab"]').on("shown.bs.tab", (e) => {
- // history.replaceState(null, null, "#windows");
- // window.location.hash = "#windows";
- // });
- if (window.location.pathname === "/learn/download/") {
- history.replaceState(null, null, "#windows");
- }
- break;
- case "macOS":
- button.text("Download for macOS");
- button.data("os", "mac");
- $('#downloadTab a[href="#mac"]').tab('show');
- if (window.location.pathname === "/learn/download/") {
- history.replaceState(null, null, "#mac");
- }
- break;
- case "Linux":
- button.text("Download for Linux");
- button.data("os", "linux");
- if (window.location.pathname === "/learn/download/") {
- history.replaceState(null, null, "#linux");
- }
- break;
- default:
- button.text("Download");
- button.data("os", "unknown");
- break;
+ let os = "Unknown OS";
+ // If the user has already selected a tab, don't change it
+ const hash = window.location.hash;
+ if (hash) {
+ const tab = $(`#downloadTab a[href="${hash}"]`)
+ console.log("Open Tab", tab);
+ os = tab.text(); // Get the OS from the tab text
+ console.log("Open Tab OS", os);
+
+ }
+ else {
+ // No hash, so detect the OS and select the appropriate tab
+ os = await detectOSFromUserAgent();
+ console.log("No Hash", os);
}
+ // Configure the download button
+ // Add text and data based on the user's OS
+ configureDownloadButton(os);
+
})(jQuery);
});
diff --git a/themes/grass/layouts/learn/download.html b/themes/grass/layouts/learn/download.html
index fd72db94..ed84289d 100644
--- a/themes/grass/layouts/learn/download.html
+++ b/themes/grass/layouts/learn/download.html
@@ -29,7 +29,7 @@
Build a docker image using the downloaded source code (run this in the directory containing the source code):
A. Docker image without graphical user interface - wxGUI
-
docker build -t grassgis .
+
docker build -t grassgis .
A test run (assuming you have the existing GRASS GIS test location; it can be downloaded from
here)
-
# case 1: launching in the grassdata directory in which the location is stored:
+
# case 1: launching in the grassdata directory in which the location is stored:
docker run -it --rm --user=$(id -u):$(id -g) --volume $(pwd):/data \
--env HOME=/data/ grassgis grass --text nc_basic_spm_grass7/user1 \
--exec g.region -p
@@ -131,7 +131,7 @@
A. Docker image without graphical user interface - wxGUITo run the tests (again assuming local location):
-
# case 1: launching in the grassdata directory in which the location is stored:
+
# case 1: launching in the grassdata directory in which the location is stored:
docker run -it --rm --user=$(id -u):$(id -g) --volume $(pwd):/data \
--env HOME=/data/ grassgis grass --text nc_basic_spm_grass7/user1 \
--exec g.region -p
@@ -146,11 +146,11 @@
A. Docker image without graphical user interface - wxGUIB. Docker image with graphical user interface - wxGUI
B. Docker image with graphical user interface - wxGUI
Note: If you compiled locally before building the Docker image, you may encounter problems as the local configuration and the locally compiled files are copied to and used in the Docker image. To make sure you don't have this issue, clean all the compiled files from the source code: