Add order in tables
This commit is contained in:
parent
f7c8fa4539
commit
647aaa29b0
2 changed files with 5 additions and 5 deletions
|
|
@ -17,7 +17,7 @@ func Lists(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
var lists []models.List
|
||||
result := db.Find(&lists)
|
||||
result := db.Order("name collate nocase asc").Find(&lists)
|
||||
|
||||
if result.Error != nil && !errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
|
|
@ -54,7 +54,7 @@ func ListShow(c *fiber.Ctx) error {
|
|||
)
|
||||
|
||||
var listItems []models.ListItem
|
||||
db.Find(&listItems, "list_id = ?", id)
|
||||
db.Order("value collate nocase asc").Find(&listItems, "list_id = ?", id)
|
||||
|
||||
return c.Render("list", fiber.Map{
|
||||
"PageTitle": title,
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ func Sections(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
var sections []models.Section
|
||||
result := db.Preload("ParentSection").Find(§ions)
|
||||
result := db.Order("name collate nocase asc").Preload("ParentSection").Find(§ions)
|
||||
|
||||
if result.Error != nil && !errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return err
|
||||
|
|
@ -117,7 +117,7 @@ func SectionAdd(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
var sections []models.Section
|
||||
db.Find(§ions)
|
||||
db.Order("name collate nocase asc").Find(§ions)
|
||||
|
||||
return c.Render("section_form", fiber.Map{
|
||||
"PageTitle": "Ajouter une section",
|
||||
|
|
@ -200,7 +200,7 @@ func SectionEdit(c *fiber.Ctx) error {
|
|||
}
|
||||
|
||||
var sections []models.Section
|
||||
db.Find(§ions, "id <> ?", section.ID)
|
||||
db.Order("name collate nocase asc").Find(§ions, "id <> ?", section.ID)
|
||||
|
||||
return c.Render("section_form", fiber.Map{
|
||||
"PageTitle": title,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue