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
97fdc4aa
Commit
97fdc4aa
authored
Dec 01, 2023
by
shadMod
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added dynamic news in Home Page
parent
da85d408
Pipeline
#355
passed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
21 deletions
+20
-21
uitwww/pages.py
uitwww/pages.py
+14
-7
uitwww/templates/pages/index.html
uitwww/templates/pages/index.html
+6
-14
No files found.
uitwww/pages.py
View file @
97fdc4aa
...
...
@@ -75,14 +75,20 @@ def prepare_blueprint(app):
"""
Prepare a blueprint with all the pages
"""
bp
=
flask
.
Blueprint
(
"pages"
,
__name__
)
data_path
=
os
.
path
.
expanduser
(
os
.
path
.
abspath
(
"data"
))
path
=
os
.
path
.
join
(
data_path
,
"downloads.toml"
)
distros
=
toml
.
load
(
path
)[
'distros'
]
distros
.
pop
(
'desktop'
)
distros
.
pop
(
'live-server'
)
def
list_news
():
news_path
=
os
.
path
.
join
(
data_path
,
"news"
,
"2023"
)
_list_news
=
[
x
.
replace
(
'.md'
,
''
)
for
x
in
os
.
listdir
(
news_path
)[:
4
]]
return
_list_news
def
list_distro
():
path
=
os
.
path
.
join
(
data_path
,
"downloads.toml"
)
distros
=
toml
.
load
(
path
)[
'distros'
]
distros
.
pop
(
'desktop'
)
distros
.
pop
(
'live-server'
)
return
distros
# Dynamically generate all the pages
for
url
,
tmpl
in
get_pages_list
(
app
).
items
():
...
...
@@ -93,7 +99,8 @@ def prepare_blueprint(app):
def
_
(
_tmpl
=
tmpl
):
return
flask
.
render_template
(
_tmpl
,
distros
=
distros
news
=
list_news
(),
distros
=
list_distro
()
)
return
bp
uitwww/templates/pages/index.html
View file @
97fdc4aa
{# Source code of the Ubuntu-it website
# Copyright (C) 2015 Pietro Albini
<pietroalbini
@
ubuntu
.
com
>
# Copyright (C) 2021 Alessandro Viprati
<vipri
.
alessandro
@
gmail
.
com
>
# Copyright (C) 2023 shadMod
# Copyright (C) 2023 shadMod
<mattia
.
a
@
shadmod
.
com
>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
...
...
@@ -14,7 +14,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.
If not, see
<http:
//
www
.
gnu
.
org
/
licenses
/>
.
# along with this program. If not, see
<http:
//
www
.
gnu
.
org
/
licenses
/>
.
#}
{% extends "layout.html" %}
...
...
@@ -107,21 +107,13 @@ Home page
Ultime novità
</h2>
<ul
class=
"item-list"
>
{% for news in news %}
<li>
<a
href=
"{{ url_for('pages.derivate_index') }}"
>
Newsletter Italiana #Ubuntu - 2023.030
</a>
</li>
<li>
<a
href=
"{{ url_for('pages.derivate_index') }}"
>
Newsletter Italiana #Ubuntu - 2023.029
</a>
</li>
<li>
<a
href=
"{{ url_for('pages.derivate_index') }}"
>
Newsletter Italiana #Ubuntu - 2023.028
<a
href=
"{{ url_for('news.detail', year='2023', filename=news) }}"
>
Newsletter Italiana #Ubuntu - 2023.{{ news }}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
...
...
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