Narrative Web Feature requests : (#466)
Sort "Surname" web page by given name and birth date. Surname list doesn't use default name format Fixes #05315, #08067
This commit is contained in:
parent
d59fe6b2af
commit
43ef686622
@ -165,6 +165,18 @@ class BasePage: # pylint: disable=C1001
|
|||||||
name = _nd.display(person)
|
name = _nd.display(person)
|
||||||
return (name, person.get_gramps_id())
|
return (name, person.get_gramps_id())
|
||||||
|
|
||||||
|
def sort_on_given_and_birth(self, handle):
|
||||||
|
""" Used to sort on given name and birth date. """
|
||||||
|
person = self.r_db.get_person_from_handle(handle)
|
||||||
|
name = _nd.display_given(person)
|
||||||
|
bd_event = get_birth_or_fallback(self.r_db, person)
|
||||||
|
birth = ""
|
||||||
|
if bd_event:
|
||||||
|
birth_iso = str(bd_event.get_date_object()).replace('abt ', '')
|
||||||
|
# we need to remove abt, bef, aft, ...
|
||||||
|
birth = birth_iso.replace('aft ', '').replace('bef ', '')
|
||||||
|
return (name, birth)
|
||||||
|
|
||||||
def sort_on_grampsid(self, event_ref):
|
def sort_on_grampsid(self, event_ref):
|
||||||
"""
|
"""
|
||||||
Sort on gramps ID
|
Sort on gramps ID
|
||||||
|
@ -228,6 +228,8 @@ class PersonPages(BasePage):
|
|||||||
ppl_handle_list = sort_people(self.r_db, ppl_handle_list,
|
ppl_handle_list = sort_people(self.r_db, ppl_handle_list,
|
||||||
self.rlocale)
|
self.rlocale)
|
||||||
first = True
|
first = True
|
||||||
|
name_format = self.report.options['name_format']
|
||||||
|
nme_format = _nd.name_formats[name_format][1]
|
||||||
for (surname, handle_list) in ppl_handle_list:
|
for (surname, handle_list) in ppl_handle_list:
|
||||||
|
|
||||||
if surname and not surname.isspace():
|
if surname and not surname.isspace():
|
||||||
@ -237,6 +239,15 @@ class PersonPages(BasePage):
|
|||||||
letter = ' '
|
letter = ' '
|
||||||
surname = self._("<absent>")
|
surname = self._("<absent>")
|
||||||
|
|
||||||
|
# In case the user choose a format name like "*SURNAME*"
|
||||||
|
# We must display this field in upper case. So we use the
|
||||||
|
# english format of format_name to find if this is the case.
|
||||||
|
# name_format = self.report.options['name_format']
|
||||||
|
# nme_format = _nd.name_formats[name_format][1]
|
||||||
|
if "SURNAME" in nme_format:
|
||||||
|
surnamed = surname.upper()
|
||||||
|
else:
|
||||||
|
surnamed = surname
|
||||||
first_surname = True
|
first_surname = True
|
||||||
for person_handle in sorted(handle_list,
|
for person_handle in sorted(handle_list,
|
||||||
key=self.sort_on_name_and_grampsid):
|
key=self.sort_on_name_and_grampsid):
|
||||||
@ -261,12 +272,12 @@ class PersonPages(BasePage):
|
|||||||
{'surname' : surname,
|
{'surname' : surname,
|
||||||
'letter' : letter})
|
'letter' : letter})
|
||||||
tcell += Html(
|
tcell += Html(
|
||||||
"a", html_escape(surname), name=letter,
|
"a", html_escape(surnamed), name=letter,
|
||||||
id_=letter,
|
id_=letter,
|
||||||
title=ttle)
|
title=ttle)
|
||||||
elif first_surname:
|
elif first_surname:
|
||||||
first_surname = False
|
first_surname = False
|
||||||
tcell += Html("a", html_escape(surname),
|
tcell += Html("a", html_escape(surnamed),
|
||||||
title=self._("Surnames") + " " + surname)
|
title=self._("Surnames") + " " + surname)
|
||||||
else:
|
else:
|
||||||
tcell += " "
|
tcell += " "
|
||||||
|
@ -48,6 +48,7 @@ import logging
|
|||||||
# Gramps module
|
# Gramps module
|
||||||
#------------------------------------------------
|
#------------------------------------------------
|
||||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||||
|
from gramps.gen.display.name import displayer as _nd
|
||||||
from gramps.gen.plug.report import utils
|
from gramps.gen.plug.report import utils
|
||||||
from gramps.plugins.lib.libhtml import Html
|
from gramps.plugins.lib.libhtml import Html
|
||||||
|
|
||||||
@ -103,7 +104,17 @@ class SurnamePage(BasePage):
|
|||||||
body += surnamedetail
|
body += surnamedetail
|
||||||
|
|
||||||
# section title
|
# section title
|
||||||
surnamedetail += Html("h3", html_escape(surname), inline=True)
|
# In case the user choose a format name like "*SURNAME*"
|
||||||
|
# We must display this field in upper case. So we use
|
||||||
|
# the english format of format_name to find if this is
|
||||||
|
# the case.
|
||||||
|
name_format = self.report.options['name_format']
|
||||||
|
nme_format = _nd.name_formats[name_format][1]
|
||||||
|
if "SURNAME" in nme_format:
|
||||||
|
surnamed = surname.upper()
|
||||||
|
else:
|
||||||
|
surnamed = surname
|
||||||
|
surnamedetail += Html("h3", html_escape(surnamed), inline=True)
|
||||||
|
|
||||||
# feature request 2356: avoid genitive form
|
# feature request 2356: avoid genitive form
|
||||||
msg = self._("This page contains an index of all the individuals "
|
msg = self._("This page contains an index of all the individuals "
|
||||||
@ -149,7 +160,7 @@ class SurnamePage(BasePage):
|
|||||||
table += tbody
|
table += tbody
|
||||||
|
|
||||||
for person_handle in sorted(ppl_handle_list,
|
for person_handle in sorted(ppl_handle_list,
|
||||||
key=self.sort_on_name_and_grampsid):
|
key=self.sort_on_given_and_birth):
|
||||||
|
|
||||||
person = self.r_db.get_person_from_handle(person_handle)
|
person = self.r_db.get_person_from_handle(person_handle)
|
||||||
if person.get_change_time() > ldatec:
|
if person.get_change_time() > ldatec:
|
||||||
|
@ -54,6 +54,7 @@ from gramps.plugins.lib.libhtml import Html
|
|||||||
# specific narrative web import
|
# specific narrative web import
|
||||||
#------------------------------------------------
|
#------------------------------------------------
|
||||||
from gramps.plugins.webreport.basepage import BasePage
|
from gramps.plugins.webreport.basepage import BasePage
|
||||||
|
from gramps.gen.display.name import displayer as _nd
|
||||||
from gramps.plugins.webreport.common import (get_first_letters, _KEYPERSON,
|
from gramps.plugins.webreport.common import (get_first_letters, _KEYPERSON,
|
||||||
alphabet_navigation, html_escape,
|
alphabet_navigation, html_escape,
|
||||||
sort_people, name_to_md5,
|
sort_people, name_to_md5,
|
||||||
@ -155,6 +156,7 @@ class SurnameListPage(BasePage):
|
|||||||
hyper = Html("a", num_people, href=fname, title=num_people)
|
hyper = Html("a", num_people, href=fname, title=num_people)
|
||||||
tcell += hyper
|
tcell += hyper
|
||||||
|
|
||||||
|
name_format = self.report.options['name_format']
|
||||||
# begin table body
|
# begin table body
|
||||||
with Html("tbody") as tbody:
|
with Html("tbody") as tbody:
|
||||||
table += tbody
|
table += tbody
|
||||||
@ -210,10 +212,19 @@ class SurnameListPage(BasePage):
|
|||||||
tcell += " "
|
tcell += " "
|
||||||
prev_surname = surname
|
prev_surname = surname
|
||||||
|
|
||||||
|
# In case the user choose a format name like "*SURNAME*"
|
||||||
|
# We must display this field in upper case. So we use
|
||||||
|
# the english format of format_name to find if this is
|
||||||
|
# the case.
|
||||||
|
# name_format = self.report.options['name_format']
|
||||||
|
nme_format = _nd.name_formats[name_format][1]
|
||||||
|
if "SURNAME" in nme_format:
|
||||||
|
surnamed = surname.upper()
|
||||||
|
else:
|
||||||
|
surnamed = surname
|
||||||
trow += Html("td",
|
trow += Html("td",
|
||||||
self.surname_link(name_to_md5(surname),
|
self.surname_link(name_to_md5(surname),
|
||||||
#html_escape(surname)),
|
surnamed),
|
||||||
surname),
|
|
||||||
class_="ColumnSurname", inline=True)
|
class_="ColumnSurname", inline=True)
|
||||||
|
|
||||||
trow += Html("td", len(data_list),
|
trow += Html("td", len(data_list),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user