I want to modify the code of the narrated web site plugin, where do I even begin?
I have tried looking into gramps/plugins/webreport/narrativeweb.py but modifying it doesn’t seem to affect the behaviour of the program. Would be thankful if anyone knew what to do.
This is mainly for personal use because I want the website to look different.
If I wanted to modify the Narrated Website Report, I’d probably start by cloning the Built-in files and subsection of the registration file as an Addon with a unique ID.
If you are talking about the skin of the Reports, you’d probably start with changing CSS. There’s another thread about that: “Narrated Web Site StyleSheet doesn’t apply”
If you are looking at changing content, you’d want to start by looking at the GitHub Pull Requests and MantisBT issues related to this Narrated Website Report.
Reviewing the objective Serge targets and the code changes necessary to implement is a good onboarding task.
I think it will be a very hard task.
If you want to reduce the size of the pages, it will be impossible.
You have another web report called dynamic web, but the problem is similar.
With the dynamic web report, you have very big files too which are stored in the web server. I think this report is something you would prefer.
orig_event_handle_list = list(orig_event_handle_list)
for page_num in range(total_pages):
event_handle_list = orig_event_handle_list[
page_num * records_per_page : (page_num + 1) * records_per_page
]
if page_num == 0:
file_name = "events"
else:
file_name = f"events-{page_num + 1}"
print(f"Creating file: {file_name}.html with {len(event_handle_list)} events")
output_file, sio = self.report.create_file(file_name)
result = self.write_header(self._("Events"))
eventslistpage, dummy_head, dummy_body, outerwrapper = result
# begin events list division
with Html("div", class_="content", id="EventList") as eventlist:
# Pagination links
pagination_links = Html("div", class_="pagination", style="display: block; margin-top: 10px;")
for i in range(total_pages):
link_text = f"-{i + 1}-"
if i == 0:
href = "index.html"
else:
href = f"events-{i + 1}.html"
link_classes = "page-link"
if i == page_num:
link_classes += " active"
link = Html(
"a",
link_text,
href=href,
class_=link_classes,
inline=True,
)
pagination_links += link
table += pagination_links
@SNoiraud now Narrated web site glitches - this is impossible to use in current state. Can you help with this? The pages should be paginated - I think this is a good solution.
How familiar are you with Addons development? Knowing what you’ve done, and what troubleshooting steps you’ve taken might help someone steer you in the right direction.
The problem is not with the pages themselves but with the indexes.
The indexes are related to the language (ICU: I"International Components for Unicode")
The best way would be to create a first index with all the necessary letters like now.
Then for each letter, we will have a page.
The problem will persist if you have 10,000 marriages or deaths.
We could create another index. The question is how many items per page?
I can look at that. The best way would be to create a feature request.
Yeah, I’ve removed Letters’ navigation with pagination and removed the Letter column. This is okay for myself, but I dont know If this is OK for others users. But what the easiest we could do - add an option in settings: letters navigation OR pagination. At least users with 10k+ DBs can swith to pagination. In this case the pages work fast. My current result looks so:
In this case all the items should be sorted by letter and only then paginated. For example first 25 pages will have only B letter - Births, then 26-s page will have two letters B and for example C - citations. And next X pages will be only C, and so on. So, I think it is also possible to combine letters with pagination. Click on any letter will open page, where that letter appears at first. And also page numbers will be also available. A lot of changes. I think additional switcher in settings between letters and pagination is not so difficult than combined
Update: I have written python code that heavily rearranges the entire site instead of modifying the script itself and it’s working like a charm, thanks for the input everyone!