Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito
Commits
42024978
Commit
42024978
authored
Dec 27, 2023
by
shadMod
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added navs to get all categories
added generate_navbar() to show all categories Fixes:
#38
parent
022769a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
uitwww/src/news/views.py
uitwww/src/news/views.py
+18
-2
No files found.
uitwww/src/news/views.py
View file @
42024978
...
@@ -27,14 +27,17 @@ CACHE_FILE = "news-cache.json"
...
@@ -27,14 +27,17 @@ CACHE_FILE = "news-cache.json"
class
News
:
class
News
:
@
staticmethod
def
__init__
(
self
,
debug
:
bool
=
False
):
def
prepare_blueprint
(
app
):
self
.
navs
=
[]
def
prepare_blueprint
(
self
,
app
):
"""
"""
Prepare a blueprint with the news pages
Prepare a blueprint with the news pages
"""
"""
bp
=
flask
.
Blueprint
(
"news"
,
__name__
)
bp
=
flask
.
Blueprint
(
"news"
,
__name__
)
nw_cl
=
GetNews
(
os
.
path
.
join
(
app
.
instance_path
,
"news"
))
nw_cl
=
GetNews
(
os
.
path
.
join
(
app
.
instance_path
,
"news"
))
self
.
navs
=
nw_cl
.
category
@
bp
.
route
(
"/"
)
@
bp
.
route
(
"/"
)
@
cache
.
enable
@
cache
.
enable
...
@@ -57,3 +60,16 @@ class News:
...
@@ -57,3 +60,16 @@ class News:
)
)
return
bp
return
bp
def
generate_navbar
(
self
):
"""Generate the sub-navbar for /news"""
result
=
[]
for
name
in
self
.
navs
:
result
.
append
(
{
"name"
:
name
.
capitalize
(),
"endpoint"
:
"news.list"
,
"endpoint-args"
:
{
"category"
:
name
},
}
)
return
result
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment