tiki/model/view_id.go
2026-03-23 21:50:12 -04:00

42 lines
1.2 KiB
Go

package model
import (
"strings"
)
// ViewID identifies a view type
type ViewID string
// view identifiers
const (
TaskDetailViewID ViewID = "task_detail"
TaskEditViewID ViewID = "task_edit"
PluginViewIDPrefix ViewID = "plugin:" // Prefix for plugin views
)
// built-in view names and descriptions for the header info section
const (
TaskDetailViewName = "Tiki Detail"
TaskDetailViewDesc = "tiki overview. Quick edit, edit dependencies, tags or edit source file"
TaskEditViewName = "Task Edit"
TaskEditViewDesc = "Cycle through fields to edit title, status, priority and other"
DepsEditorViewName = "Dependencies"
DepsEditorViewDesc = "Move a tiki to Blocks to make it block edited tiki. Move it to Depends to make edited tiki depend on it"
)
// IsPluginViewID checks if a ViewID is for a plugin view
func IsPluginViewID(id ViewID) bool {
return strings.HasPrefix(string(id), string(PluginViewIDPrefix))
}
// GetPluginName extracts the plugin name from a plugin ViewID
func GetPluginName(id ViewID) string {
return strings.TrimPrefix(string(id), string(PluginViewIDPrefix))
}
// MakePluginViewID creates a ViewID for a plugin with the given name
func MakePluginViewID(name string) ViewID {
return ViewID(string(PluginViewIDPrefix) + name)
}