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