Add name slug for categories and remove unused function
This commit is contained in:
parent
495ddf5d93
commit
d35f1e90cf
1 changed files with 5 additions and 10 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
when defined(js):
|
when defined(js):
|
||||||
import sugar, httpcore, options, json
|
import sugar, httpcore, options, json, strutils
|
||||||
import dom except Event
|
import dom except Event
|
||||||
|
|
||||||
include karax/prelude
|
include karax/prelude
|
||||||
|
|
@ -15,10 +15,8 @@ when defined(js):
|
||||||
loading: bool
|
loading: bool
|
||||||
status: HttpCode
|
status: HttpCode
|
||||||
|
|
||||||
proc getSelectedCategory*(state: CategoryPicker): Option[Category] =
|
proc slug(name: string): string =
|
||||||
if state.list.isSome:
|
name.strip().replace(" ", "-").toLowerAscii
|
||||||
return some(state.list.get().categories[state.selectedCategoryID])
|
|
||||||
return none[Category]()
|
|
||||||
|
|
||||||
proc onCategoryList(state: CategoryPicker): proc (httpStatus: int, response: kstring) =
|
proc onCategoryList(state: CategoryPicker): proc (httpStatus: int, response: kstring) =
|
||||||
return proc (httpStatus: int, response: kstring) =
|
return proc (httpStatus: int, response: kstring) =
|
||||||
|
|
@ -81,9 +79,6 @@ when defined(js):
|
||||||
ul(class="menu"):
|
ul(class="menu"):
|
||||||
for category in list:
|
for category in list:
|
||||||
li(class="menu-item"):
|
li(class="menu-item"):
|
||||||
a(class="category-" & $category.id,
|
a(class="category-" & $category.id & " " & category.name.slug,
|
||||||
onClick=onCategoryClick(state, category)):
|
onClick=onCategoryClick(state, category)):
|
||||||
render(category)
|
render(category)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue