Compare commits
2 Commits
fe305528ee
...
2a0a582d7b
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a0a582d7b | |||
| 562dadbf4a |
|
|
@ -49,6 +49,7 @@ function wikiGraph(selector, options) {
|
||||||
if (props.nodes.length) {
|
if (props.nodes.length) {
|
||||||
let nodeId = props.nodes[0]
|
let nodeId = props.nodes[0]
|
||||||
let node = nodes.get(nodeId)
|
let node = nodes.get(nodeId)
|
||||||
|
// TODO: Reload directly in this same page
|
||||||
window.location.href = '/edit/' + node.label
|
window.location.href = '/edit/' + node.label
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
6
graph.go
6
graph.go
|
|
@ -80,7 +80,7 @@ func (gb *graphBuilder) RemoveNode(name string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gb *graphBuilder) RemoveNodeWithSuffix(suffix string) {
|
func (gb *graphBuilder) RemoveNodeWithSuffix(suffix string) {
|
||||||
for k, _ := range gb.nodeMap {
|
for k := range gb.nodeMap {
|
||||||
if strings.HasSuffix(k, suffix) {
|
if strings.HasSuffix(k, suffix) {
|
||||||
delete(gb.nodeMap, k)
|
delete(gb.nodeMap, k)
|
||||||
}
|
}
|
||||||
|
|
@ -141,6 +141,7 @@ func prepareNodes(nodeMap NodeMap, apply func(node Node) Node) []Node {
|
||||||
nodes = append(nodes, apply(Node{
|
nodes = append(nodes, apply(Node{
|
||||||
Id: node.Id,
|
Id: node.Id,
|
||||||
Label: node.Label,
|
Label: node.Label,
|
||||||
|
Title: node.Title,
|
||||||
Color: node.Color,
|
Color: node.Color,
|
||||||
Opacity: node.Opacity,
|
Opacity: node.Opacity,
|
||||||
}))
|
}))
|
||||||
|
|
@ -160,7 +161,8 @@ func (gb *graphBuilder) prepareNodeMap() {
|
||||||
func (gb *graphBuilder) addNode(key string, color string) int {
|
func (gb *graphBuilder) addNode(key string, color string) int {
|
||||||
if _, e := gb.nodeMap[key]; !e {
|
if _, e := gb.nodeMap[key]; !e {
|
||||||
color := color
|
color := color
|
||||||
gb.nodeMap[key] = Node{gb.nodeCount, key, &color, 1}
|
title:= strings.Replace(key, "_", " ", -1)
|
||||||
|
gb.nodeMap[key] = Node{gb.nodeCount, key, title, &color, 1}
|
||||||
gb.nodeCount += 1
|
gb.nodeCount += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
5
main.go
5
main.go
|
|
@ -146,6 +146,7 @@ type indexPage struct {
|
||||||
type Node struct {
|
type Node struct {
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
|
Title string `json:"title"`
|
||||||
Color *string `json:"color"`
|
Color *string `json:"color"`
|
||||||
Opacity float64 `json:"opacity"`
|
Opacity float64 `json:"opacity"`
|
||||||
}
|
}
|
||||||
|
|
@ -485,7 +486,7 @@ func getPageBase(repo PagesRepository, t time.Time) pageBaseInfo {
|
||||||
pageBase := pageBaseInfo{
|
pageBase := pageBaseInfo{
|
||||||
BaseURL: clientID,
|
BaseURL: clientID,
|
||||||
RedirectURI: redirectURI,
|
RedirectURI: redirectURI,
|
||||||
Days: prepareDays(mp, t),
|
Days: prepareDays(repo, t),
|
||||||
Month: t.Month().String(),
|
Month: t.Month().String(),
|
||||||
Year: t.Year(),
|
Year: t.Year(),
|
||||||
}
|
}
|
||||||
|
|
@ -1176,7 +1177,7 @@ func main() {
|
||||||
|
|
||||||
// Keep a copy of the nodes, buildFromCenter appends to the nodeMap
|
// Keep a copy of the nodes, buildFromCenter appends to the nodeMap
|
||||||
var nodes []string
|
var nodes []string
|
||||||
for k, _ := range gb.nodeMap {
|
for k := range gb.nodeMap {
|
||||||
nodes = append(nodes, k)
|
nodes = append(nodes, k)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user