admin

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ACTION_TREEEDITOR_HANDLE = "treeditor_handle"
View Source
const ActionModalPageFilterShow = "modal_menu_filter_show"
View Source
const VIEW_MENU_ITEMS = "menu_items"
View Source
const VIEW_SETTINGS = "settings"

Variables

This section is empty.

Functions

func NewMenuCreateController

func NewMenuCreateController(ui UiInterface) *menuCreateController

func NewMenuDeleteController

func NewMenuDeleteController(ui UiInterface) *menuDeleteController

func NewMenuManagerController

func NewMenuManagerController(ui UiInterface) *menuManagerController

func NewMenuUpdateController

func NewMenuUpdateController(ui UiInterface) *menuUpdateController

Types

type Node

type Node struct {
	ID       string
	Name     string
	ParentID string
	Sequence int
	PageID   string
	URL      string
	Target   string
}

type Tree

type Tree struct {
	// contains filtered or unexported fields
}

func NewTreeFromJSON

func NewTreeFromJSON(jsonString string) (*Tree, error)

func NewTreeFromMenuItems

func NewTreeFromMenuItems(menuItems []cmsstore.MenuItemInterface) *Tree

func (*Tree) Add

func (tree *Tree) Add(parentID string, node Node)

func (*Tree) AddMenuItem

func (tree *Tree) AddMenuItem(parentID string, menuItem cmsstore.MenuItemInterface)

AddBlock adds a new ui.BlockInterface to the Tree

func (*Tree) Children

func (tree *Tree) Children(parentID string) []Node

Children returns the children of the Node with the given parentID

func (*Tree) Clone

func (tree *Tree) Clone(node Node) Node

Clone creates a shallow clone of a Node (no children)

This is used to create a clone of a Node, so that the original Node is not modified, but we can modify the clone safely

Remember to update the ID, Sequence, and ParentID of the copy with new values

func (*Tree) Duplicate

func (tree *Tree) Duplicate(blockID string)

Duplicate creates a deep clone of a Node (with children) and adds it to the tree, under the same parent

Business Logic: - travserses the tree to find all blocks to be duplicated - makes a map with current IDs as keys, newly generated IDs as values - clones each block, and replaces the ID with the new ID - assignes the correct mapped IDs and ParentIDs - adds the cloned blocks to the tree directly (using list) - moves the duplicated block under the block being duplicated

func (*Tree) Exists

func (tree *Tree) Exists(nodeID string) bool

func (*Tree) Find

func (tree *Tree) Find(nodeID string) *Node

func (*Tree) FindNextSibling

func (tree *Tree) FindNextSibling(nodeID string) *Node

func (*Tree) FindPreviousSibling

func (tree *Tree) FindPreviousSibling(nodeID string) *Node

func (*Tree) List

func (tree *Tree) List() []Node

func (*Tree) MoveDown

func (tree *Tree) MoveDown(nodeID string)

func (*Tree) MoveToParent

func (tree *Tree) MoveToParent(nodeID string, parentID string)

func (*Tree) MoveToPosition

func (tree *Tree) MoveToPosition(nodeID string, parentID string, position int)

func (*Tree) MoveUp

func (tree *Tree) MoveUp(nodeID string)

func (*Tree) Parent

func (tree *Tree) Parent(nodeID string) *Node

func (*Tree) RecalculateSequences

func (tree *Tree) RecalculateSequences(blockID string)

func (*Tree) Remove

func (tree *Tree) Remove(nodeID string)

Remove removes the block with the given id

Buisiness Logic: - checks if the block exists, if not, do nothing - removes the block from the list - recalculates the sequences of the parent's children

func (*Tree) RemoveOrphans

func (tree *Tree) RemoveOrphans()

RemoveOrphans removes all orphaned blocks that have no parent

Buisiness Logic: - finds and creates a new list without orphaned blocks - non orphaned blocks are the ones that have a parent or root blocks - updates the list with the new list

Parameters: - none

Returns: - none

func (*Tree) ToJSON

func (tree *Tree) ToJSON() (jsonString string, err error)

func (*Tree) Traverse

func (tree *Tree) Traverse(blockID string) []Node

func (*Tree) Update

func (tree *Tree) Update(node Node)

type UiInterface

type UiInterface interface {
	shared.UiInterface
	MenuCreate(w http.ResponseWriter, r *http.Request)
	MenuManager(w http.ResponseWriter, r *http.Request)
	MenuDelete(w http.ResponseWriter, r *http.Request)
	MenuUpdate(w http.ResponseWriter, r *http.Request)
}

func UI

func UI(config shared.UiConfig) UiInterface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL