Skip to content

Commit

Permalink
Fixes for creating new strain / plants (#22)
Browse files Browse the repository at this point in the history
Fix for #20
Merge dependabot updates
  • Loading branch information
dwot authored Feb 1, 2025
1 parent 4a0ab1f commit adf3a41
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.16
0.1.17
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ require (
github.com/fogleman/gg v1.3.0
github.com/gin-contrib/sessions v1.0.2
github.com/gin-gonic/gin v1.10.0
github.com/golang-migrate/migrate/v4 v4.18.1
github.com/nicksnyder/go-i18n/v2 v2.4.1
github.com/golang-migrate/migrate/v4 v4.18.2
github.com/nicksnyder/go-i18n/v2 v2.5.0
github.com/sirupsen/logrus v1.9.3
golang.org/x/crypto v0.32.0
golang.org/x/image v0.23.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBEx
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/golang-migrate/migrate/v4 v4.18.1 h1:JML/k+t4tpHCpQTCAD62Nu43NUFzHY4CV3uAuvHGC+Y=
github.com/golang-migrate/migrate/v4 v4.18.1/go.mod h1:HAX6m3sQgcdO81tdjn5exv20+3Kb13cmGli1hrD6hks=
github.com/golang-migrate/migrate/v4 v4.18.2 h1:2VSCMz7x7mjyTXx3m2zPokOY82LTRgxK1yQYKo6wWQ8=
github.com/golang-migrate/migrate/v4 v4.18.2/go.mod h1:2CM6tJvn2kqPXwnXO/d3rAQYiyoIm180VsO8PRX6Rpk=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
Expand Down Expand Up @@ -78,8 +78,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nicksnyder/go-i18n/v2 v2.4.1 h1:zwzjtX4uYyiaU02K5Ia3zSkpJZrByARkRB4V3YPrr0g=
github.com/nicksnyder/go-i18n/v2 v2.4.1/go.mod h1:++Pl70FR6Cki7hdzZRnEEqdc2dJt+SAGotyFg/SvZMk=
github.com/nicksnyder/go-i18n/v2 v2.5.0 h1:3wH1gpaekcgGuwzWdSu7JwJhH9Tk87k1ezt0i1p2/Is=
github.com/nicksnyder/go-i18n/v2 v2.5.0/go.mod h1:DrhgsSDZxoAfvVrBVLXoxZn/pN5TXqaDbq7ju94viiQ=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
1 change: 0 additions & 1 deletion web/templates/pages/plants.html
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ <h5 class="modal-title" id="addPlantModalLabel">{{ .lcl.add_new_plant }}</h5>
});

addPlantModal.addEventListener("show.bs.modal", () => {
setDefaultDate();
resetZoneSelection();
resetStrainSelection();
});
Expand Down
32 changes: 30 additions & 2 deletions web/templates/pages/strains.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ <h5 class="modal-title" id="editStrainModalLabel">{{ .lcl.edit_strain }}</h5>
sativaLabel.textContent = `Sativa: ${sativa}%`;
});

// If no breeders exist, show the new breeder input by default
if (document.getElementById("breederSelect").length === 1) {
newBreederInput.classList.remove("d-none");
}

addStrainForm.addEventListener("submit", (e) => {
e.preventDefault();

Expand Down Expand Up @@ -422,9 +427,28 @@ <h5 class="modal-title" id="editStrainModalLabel">{{ .lcl.edit_strain }}</h5>

function renderStrainsTable(data) {
const editStrainModal = new bootstrap.Modal(document.getElementById("editStrainModal"));
const filteredData = filterStrains(data, searchInput.value);
let filteredData = filterStrains(data, searchInput.value);

strainsContainer.innerHTML = `
//If filteredData is null, reset with empty map object
if (filteredData == null) {
strainsContainer.innerHTML = `
<table class="table table-striped table-bordered table-hover">
<thead class="table-dark">
<tr>
<th scope="col" data-key="name" data-type="text" class="sortable ${currentSort.key === "name" ? (currentSort.isAscending ? "asc" : "desc") : ""}">{{ .lcl.title_strain }} <i class="fa-solid fa-sort"></i></th>
<th scope="col" data-key="breeder" data-type="text" class="sortable ${currentSort.key === "breeder" ? (currentSort.isAscending ? "asc" : "desc") : ""}">{{ .lcl.breeder }} <i class="fa-solid fa-sort"></i></th>
<th scope="col" data-key="indica" data-type="numeric" class="sortable ${currentSort.key === "indica" ? (currentSort.isAscending ? "asc" : "desc") : ""}">{{ .lcl.title_is }} <i class="fa-solid fa-sort"></i></th>
<th scope="col" data-key="autoflower" data-type="text" class="sortable ${currentSort.key === "autoflower" ? (currentSort.isAscending ? "asc" : "desc") : ""}">{{ .lcl.title_auto }} <i class="fa-solid fa-sort"></i></th>
<th scope="col" data-key="seed_count" data-type="numeric" class="sortable ${currentSort.key === "seed_count" ? (currentSort.isAscending ? "asc" : "desc") : ""}">{{ .lcl.seed_count }} <i class="fa-solid fa-sort"></i></th>
<th scope="col">Edit </th>
</tr>
</thead>
<tbody>
</tbody>
</table>
`;
} else {
strainsContainer.innerHTML = `
<table class="table table-striped table-bordered table-hover">
<thead class="table-dark">
<tr>
Expand Down Expand Up @@ -454,6 +478,10 @@ <h5 class="modal-title" id="editStrainModalLabel">{{ .lcl.edit_strain }}</h5>
</tbody>
</table>
`;
}




// Add click listeners for sorting
document.querySelectorAll(".sortable").forEach(header => {
Expand Down

0 comments on commit adf3a41

Please sign in to comment.