9 Commits

Author SHA1 Message Date
134730396a add A5 booklet option
All checks were successful
Go / build (push) Successful in 12m13s
2025-06-29 14:00:29 +02:00
5f53d66bc4 add missing css shadows
All checks were successful
Go / build (push) Successful in 12m33s
2025-05-11 14:46:16 +02:00
459c873986 main view add shadow
All checks were successful
Go / build (push) Successful in 12m50s
2025-05-11 14:19:10 +02:00
ef2e6c99a7 default trifold top bind
All checks were successful
Go / build (push) Successful in 12m37s
2025-04-22 17:36:04 +02:00
e29287c29d trifold add right binding
Some checks failed
Go / build (push) Has been cancelled
not sure if this is correct for ever flyer
2025-04-22 17:19:06 +02:00
f55470636f Merge pull request 'trifold+sort+fixes' (#24) from trifold into master
All checks were successful
Go / build (push) Successful in 12m30s
Reviewed-on: #24
2025-04-21 12:46:35 +02:00
8f89c14961 issue #20 add sort, not yet in view
All checks were successful
Go / build (push) Successful in 12m10s
2025-04-21 12:11:44 +02:00
6f5c0354cc fix #23 viewing non existing item breaks view
Some checks failed
Go / build (push) Has been cancelled
2025-04-21 12:09:39 +02:00
6ef7c53001 feat #19 Flyer - Tri fold?
add trifold option to items
2025-04-21 11:33:18 +02:00
8 changed files with 104 additions and 43 deletions

View File

@@ -260,14 +260,16 @@ func (rc *shopItemController) ShopItemView(c *gin.Context) {
shopItem, err := repositories.ShopItems.GetById(c.Param("id"))
if err != nil {
c.HTML(http.StatusBadRequest, "shopitem.html", gin.H{"data": gin.H{"error": err}})
c.HTML(http.StatusBadRequest, "error.html", gin.H{"data": gin.H{"error": "Item does not exist"}})
return
}
//TODO: get tags by item
tags, err := repositories.Tags.GetAll()
if err != nil {
c.HTML(http.StatusBadRequest, "shopitem.html", gin.H{"data": gin.H{"error": err}})
c.HTML(http.StatusBadRequest, "error.html", gin.H{"data": gin.H{"error": err}})
return
}
data := CreateSessionData(c, gin.H{
@@ -275,10 +277,6 @@ func (rc *shopItemController) ShopItemView(c *gin.Context) {
"tags": tags,
})
if err != nil {
c.HTML(http.StatusBadRequest, "shopitem.html", data)
}
c.HTML(http.StatusOK, "shopitem.html", data)
}

View File

@@ -333,8 +333,20 @@ func (rc *UserController) InviteHandler(c *gin.Context) {
}
func (rc *UserController) MainView(c *gin.Context) {
shopItems, _ := repositories.ShopItems.GetAll()
fmt.Println(len(shopItems))
itemOrder := c.Query("order")
var shopItems []models.ShopItem
if itemOrder == "newestFirst" {
shopItems, _ = repositories.ShopItems.GetAllNewestFirst()
} else if itemOrder == "oldestFirst" {
shopItems, _ = repositories.ShopItems.GetAllNewestLast()
} else if itemOrder == "az" {
shopItems, _ = repositories.ShopItems.GetAllLexicalFirst()
} else if itemOrder == "za" {
shopItems, _ = repositories.ShopItems.GetAllLexicalLast()
} else {
shopItems, _ = repositories.ShopItems.GetAllNewestFirst()
}
data := CreateSessionData(c, gin.H{
"title": "shopItem Page",

View File

@@ -9,12 +9,16 @@ import (
type PrintOption string
const (
CoverPage PrintOption = "-o FrontCoverPage=Printed -o FrontCoverTray=BypassTray"
Colored PrintOption = "-o SelectColor=Color"
Grayscale PrintOption = "-o SelectColor=Grayscale"
LongEdge PrintOption = ""
ShortEdge PrintOption = "-o Binding=TopBinding"
CreateBooklet PrintOption = "-o Combination=Booklet -o PageSize=A5"
CoverPage PrintOption = "-o FrontCoverPage=Printed -o FrontCoverTray=BypassTray"
Colored PrintOption = "-o SelectColor=Color"
Grayscale PrintOption = "-o SelectColor=Grayscale"
LongEdge PrintOption = ""
ShortEdge PrintOption = "-o Binding=TopBinding"
CreateBooklet PrintOption = "-o MediaType=Thick1 -o Combination=Booklet -o PageSize=A5"
TriFold PrintOption = "-o Fold=TriFold -o Binding=TopBinding"
LongEdgeA5 PrintOption = "-o PageSize=A5"
ShortEdgeA5 PrintOption = "-o Binding=TopBinding -o PageSize=A5"
CreateBookletA5 PrintOption = "-o Combination=Booklet -o PageSize=A6"
)
type PrintJob struct {
@@ -24,6 +28,10 @@ type PrintJob struct {
}
func GetPrintMode(mode string) PrintOption {
if mode == "CreateBooklet" {
return CreateBooklet
}
if mode == "LongEdge" {
return LongEdge
}
@@ -32,6 +40,22 @@ func GetPrintMode(mode string) PrintOption {
return ShortEdge
}
if mode == "CreateBookletA5" {
return CreateBookletA5
}
if mode == "LongEdgeA5" {
return LongEdgeA5
}
if mode == "ShortEdgeA5" {
return ShortEdgeA5
}
if mode == "TriFold" {
return TriFold
}
return CreateBooklet
}

View File

@@ -11,6 +11,11 @@ import (
type ShopItemRepository interface {
Create(models.ShopItem) (models.ShopItem, error)
GetAll() ([]models.ShopItem, error)
GetAllSorted(string) ([]models.ShopItem, error)
GetAllNewestFirst() ([]models.ShopItem, error)
GetAllNewestLast() ([]models.ShopItem, error)
GetAllLexicalFirst() ([]models.ShopItem, error)
GetAllLexicalLast() ([]models.ShopItem, error)
GetAllPublic() ([]models.ShopItem, error)
GetById(string) (models.ShopItem, error)
GetNextOfId(string) (models.ShopItem, error)
@@ -47,6 +52,29 @@ func (r *GORMShopItemRepository) GetAll() ([]models.ShopItem, error) {
return shopItems, result.Error
}
func (r *GORMShopItemRepository) GetAllSorted(sortString string) ([]models.ShopItem, error) {
var shopItems []models.ShopItem
result := r.DB.Preload("Tags").Preload("Variants").Order(sortString).Find(&shopItems)
return shopItems, result.Error
}
func (r *GORMShopItemRepository) GetAllNewestFirst() ([]models.ShopItem, error) {
return r.GetAllSorted("created_at desc")
}
func (r *GORMShopItemRepository) GetAllNewestLast() ([]models.ShopItem, error) {
return r.GetAllSorted("created_at asc")
}
func (r *GORMShopItemRepository) GetAllLexicalFirst() ([]models.ShopItem, error) {
return r.GetAllSorted("name asc")
}
func (r *GORMShopItemRepository) GetAllLexicalLast() ([]models.ShopItem, error) {
return r.GetAllSorted("name desc")
}
func (r *GORMShopItemRepository) GetAllPublic() ([]models.ShopItem, error) {
var shopItems []models.ShopItem
result := r.DB.Preload("Tags").Preload("Variants").Where("is_public = 1").Find(&shopItems)

View File

@@ -810,26 +810,10 @@ video {
grid-template-columns: repeat(12, minmax(0, 1fr));
}
.grid-cols-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-cols-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-cols-6 {
grid-template-columns: repeat(6, minmax(0, 1fr));
}
.grid-cols-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-rows-6 {
grid-template-rows: repeat(6, minmax(0, 1fr));
}
.flex-col {
flex-direction: column;
}
@@ -1245,16 +1229,6 @@ video {
background-color: rgb(24 24 27 / var(--tw-bg-opacity, 1));
}
.bg-green-500 {
--tw-bg-opacity: 1;
background-color: rgb(34 197 94 / var(--tw-bg-opacity, 1));
}
.bg-gray-700 {
--tw-bg-opacity: 1;
background-color: rgb(55 65 81 / var(--tw-bg-opacity, 1));
}
.fill-red-50 {
fill: #fef2f2;
}
@@ -1754,6 +1728,23 @@ video {
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
.shadow-xl {
--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
.shadow-2xl {
--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
}
.shadow-red-900 {
--tw-shadow-color: #7f1d1d;
--tw-shadow: var(--tw-shadow-colored);
}
.outline {
outline-style: solid;
}

View File

@@ -131,6 +131,10 @@
<option selected value="CreateBooklet">Create Booklet</option>
<option value="LongEdge">Long Edge</option>
<option value="ShortEdge">Short Edge</option>
<option value="CreateBookletA5">CreateBooklet A5</option>
<option value="LongEdgeA5">Long Edge A5</option>
<option value="ShortEdgeA5">Short Edge A5</option>
<option value="TriFold">Tri-Fold (Flyer)</option>
</select>

View File

@@ -74,6 +74,10 @@
<option value="CreateBooklet">CreateBooklet</option>
<option value="LongEdge">Long Edge</option>
<option value="ShortEdge">Short Edge</option>
<option value="CreateBookletA5">CreateBooklet A5</option>
<option value="LongEdgeA5">Long Edge A5</option>
<option value="ShortEdgeA5">Short Edge A5</option>
<option value="TriFold">Tri-Fold (Flyer)</option>
</select>

View File

@@ -1,14 +1,14 @@
<div class="bg-white">
<div class="mx-auto max-w-2xl px-4 py-16 sm:px-6 sm:py-24 lg:max-w-7xl">
<h2 class="text-2xl font-bold tracking-tight text-gray-900">Available Zines</h2>
<h2 class="text-2xl font-bold tracking-tight text-gray-900">Available Zines</h2>
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for names..">
<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for names..">
<div class="mt-6 grid grid-cols-1 gap-x-6 gap-y-10 md:grid-cols-2 xl:grid-cols-4">
{{ range .data.shopItems }}
<div class="myClass group relative">
<a href="/shopitems/{{ .ID }}">
<img loading="lazy" src="/{{ .Image }}" alt="Product Image" class="aspect-4/5 mx-auto rounded bg-gray-200 object-cover group-hover:opacity-75 lg:aspect-auto lg:h-80">
<img loading="lazy" src="/{{ .Image }}" alt="Product Image" class="shadow-2xl aspect-4/5 mx-auto rounded bg-gray-200 object-cover group-hover:opacity-75 lg:aspect-auto lg:h-80">
</a>
<div class="mt-4 flex justify-between">
<div>