Skip to content

Commit

Permalink
Custom Commands as a dedicated sidebar category, with Core being rena…
Browse files Browse the repository at this point in the history
…med to Core Config. (#1595)

* Made custom commands it's own category on sidebar and renamed Core to Core Config

* Made custom commands it's own category on sidebar and renamed Core to Core Config

---------

Co-authored-by: Ashish Jhanwar <ashishjh-bst@users.noreply.github.com>
  • Loading branch information
ashishjh-bst and ashishjh-bst authored Dec 21, 2023
1 parent aeddea8 commit 729ac0f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
10 changes: 5 additions & 5 deletions customcommands/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ var (
func (p *Plugin) InitWeb() {
web.AddHTMLTemplate("customcommands/assets/customcommands.html", PageHTMLMain)
web.AddHTMLTemplate("customcommands/assets/customcommands-editcmd.html", PageHTMLEditCmd)
web.AddSidebarItem(web.SidebarCategoryCore, &web.SidebarItem{
Name: "Custom commands",
web.AddSidebarItem(web.SidebarCategoryCustomCommands, &web.SidebarItem{
Name: "Commands",
URL: "customcommands",
Icon: "fas fa-closed-captioning",
Icon: "fas fa-code",
})

web.AddHTMLTemplate("customcommands/assets/customcommands_database.html", PageHTMLDatabase)
web.AddSidebarItem(web.SidebarCategoryCore, &web.SidebarItem{
Name: "Custom command database",
web.AddSidebarItem(web.SidebarCategoryCustomCommands, &web.SidebarItem{
Name: "Database",
URL: "customcommands/database",
Icon: "fas fa-database",
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/templates/cp_core_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{template "cp_head" .}}
<header class="page-header">
<h2>Core bot settings</h2>
<h2>Control panel access</h2>
</header>


Expand Down
11 changes: 11 additions & 0 deletions frontend/templates/cp_nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@
{{template "sidebar_item" (dict "ActiveGuild" $ag "Item" .)}}
{{end}}
</ul>
</li>
<li class="nav-parent">
<a class="nav-link" href="#">
<i class="fas fa-closed-captioning" aria-hidden="true"></i>
<span>Custom Commands</span>
</a>
<ul class="nav nav-children">
{{range (index .SidebarItems "CustomCommands")}}
{{template "sidebar_item" (dict "ActiveGuild" $ag "Item" .)}}
{{end}}
</ul>
</li>
<li class="nav-parent">
<a class="nav-link" href="#">
Expand Down
15 changes: 8 additions & 7 deletions web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ func setupRoutes() *goji.Mux {
}

AddSidebarItem(SidebarCategoryCore, &SidebarItem{
Name: "Core",
Name: "Control panel access",
URL: "core",
Icon: "fas fa-cog",
})
Expand Down Expand Up @@ -431,12 +431,13 @@ func loadCoreHTMLTemplate(path string) {
}

const (
SidebarCategoryTopLevel = "Top"
SidebarCategoryFeeds = "Feeds"
SidebarCategoryTools = "Tools"
SidebarCategoryFun = "Fun"
SidebarCategoryCore = "Core"
SidebarCategoryModeration = "Moderation"
SidebarCategoryTopLevel = "Top"
SidebarCategoryFeeds = "Feeds"
SidebarCategoryTools = "Tools"
SidebarCategoryFun = "Fun"
SidebarCategoryCore = "Core"
SidebarCategoryCustomCommands = "CustomCommands"
SidebarCategoryModeration = "Moderation"
)

type SidebarItem struct {
Expand Down

0 comments on commit 729ac0f

Please sign in to comment.