Narweb: Add family map to family pages (#1021)
* Narweb: Add family map to family pages * Narweb: adapt css files to have a better look. Fixes #011614
This commit is contained in:
parent
ce6f435cd4
commit
2ce32d8c6b
@ -749,6 +749,9 @@ div.grampsstylednote p {
|
|||||||
a.familymap {
|
a.familymap {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
a.family_map {
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Subsection : References
|
/* Subsection : References
|
||||||
----------------------------------------------------- */
|
----------------------------------------------------- */
|
||||||
|
@ -595,6 +595,9 @@ div#IndividualDetail table.infolist tbody tr td.ColumnAttribute {
|
|||||||
#familymap a.familymap {
|
#familymap a.familymap {
|
||||||
margin-left:20px;
|
margin-left:20px;
|
||||||
}
|
}
|
||||||
|
a.family_map {
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Surnames
|
/* Surnames
|
||||||
----------------------------------------------------- */
|
----------------------------------------------------- */
|
||||||
|
@ -810,6 +810,9 @@ div.grampsstylednote p {
|
|||||||
a.familymap {
|
a.familymap {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
a.family_map {
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Subsection : Source References
|
/* Subsection : Source References
|
||||||
----------------------------------------------------- */
|
----------------------------------------------------- */
|
||||||
|
@ -807,6 +807,9 @@ div.grampsstylednote p {
|
|||||||
a.familymap {
|
a.familymap {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
a.family_map {
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Subsection : Source References
|
/* Subsection : Source References
|
||||||
----------------------------------------------------- */
|
----------------------------------------------------- */
|
||||||
|
@ -808,6 +808,9 @@ div.grampsstylednote p {
|
|||||||
a.familymap {
|
a.familymap {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
a.family_map {
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Subsection : Source References
|
/* Subsection : Source References
|
||||||
----------------------------------------------------- */
|
----------------------------------------------------- */
|
||||||
|
@ -809,6 +809,9 @@ div.grampsstylednote p {
|
|||||||
a.familymap {
|
a.familymap {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
a.family_map {
|
||||||
|
margin-left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Subsection : Source References
|
/* Subsection : Source References
|
||||||
----------------------------------------------------- */
|
----------------------------------------------------- */
|
||||||
|
@ -736,6 +736,9 @@ h4 + div.grampsstylednote, a.familymap {
|
|||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
a.family_map {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
i.NoteType {
|
i.NoteType {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: .8em;
|
font-size: .8em;
|
||||||
|
@ -594,6 +594,9 @@ table.IndividualList tbody tr td.ColumnName a:hover {
|
|||||||
#familymap a.familymap {
|
#familymap a.familymap {
|
||||||
margin-left:20px;
|
margin-left:20px;
|
||||||
}
|
}
|
||||||
|
a.family_map {
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Subsections : Attributes
|
/* Subsections : Attributes
|
||||||
----------------------------------------------------- */
|
----------------------------------------------------- */
|
||||||
|
@ -2421,9 +2421,10 @@ class BasePage: # pylint: disable=C1001
|
|||||||
@param: handle -- The family handle
|
@param: handle -- The family handle
|
||||||
@param: url -- url to be linked
|
@param: url -- url to be linked
|
||||||
"""
|
"""
|
||||||
dummy_handle = handle
|
self.report.fam_link[handle] = url
|
||||||
return Html("a", self._("Family Map"), href=url,
|
return Html("a", self._("Family Map"), href=url,
|
||||||
title=self._("Family Map"), class_="familymap", inline=True)
|
title=self._("Family Map"), class_="familymap",
|
||||||
|
inline=True)
|
||||||
|
|
||||||
def display_spouse(self, partner, family, place_lat_long):
|
def display_spouse(self, partner, family, place_lat_long):
|
||||||
"""
|
"""
|
||||||
|
@ -49,7 +49,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.lib import (EventType, Family)
|
from gramps.gen.lib import (EventType, Family, Name)
|
||||||
from gramps.gen.plug.report import Bibliography
|
from gramps.gen.plug.report import Bibliography
|
||||||
from gramps.plugins.lib.libhtml import Html
|
from gramps.plugins.lib.libhtml import Html
|
||||||
|
|
||||||
@ -57,9 +57,11 @@ 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, sort_people,
|
alphabet_navigation, sort_people,
|
||||||
primary_difference, first_letter,
|
primary_difference, first_letter,
|
||||||
|
html_escape,
|
||||||
FULLCLEAR, get_index_letter)
|
FULLCLEAR, get_index_letter)
|
||||||
|
|
||||||
_ = glocale.translation.sgettext
|
_ = glocale.translation.sgettext
|
||||||
@ -381,6 +383,37 @@ class FamilyPages(BasePage):
|
|||||||
self.display_attr_list(attrlist, attrtable)
|
self.display_attr_list(attrlist, attrtable)
|
||||||
relationshipdetail += attrsection
|
relationshipdetail += attrsection
|
||||||
|
|
||||||
|
# for use in family map pages...
|
||||||
|
if self.report.options["familymappages"]:
|
||||||
|
name_format = self.report.options['name_format']
|
||||||
|
fhandle = mhandle = father = mother = None
|
||||||
|
relationshipdetail += Html("h4", _("Family map"), inline=True)
|
||||||
|
mapdetail = Html("br")
|
||||||
|
fhandle = family.get_father_handle()
|
||||||
|
for handle, dummy_url in self.report.fam_link.items():
|
||||||
|
if fhandle == handle:
|
||||||
|
father = self.r_db.get_person_from_handle(fhandle)
|
||||||
|
break
|
||||||
|
if father:
|
||||||
|
primary_name = father.get_primary_name()
|
||||||
|
name = Name(primary_name)
|
||||||
|
name.set_display_as(name_format)
|
||||||
|
fname = html_escape(_nd.display_name(name))
|
||||||
|
mapdetail += self.family_map_link_for_parent(fhandle, fname)
|
||||||
|
mapdetail += Html("br")
|
||||||
|
mhandle = family.get_mother_handle()
|
||||||
|
for handle, dummy_url in self.report.fam_link.items():
|
||||||
|
if mhandle == handle:
|
||||||
|
mother = self.r_db.get_person_from_handle(mhandle)
|
||||||
|
break
|
||||||
|
if mother:
|
||||||
|
primary_name = mother.get_primary_name()
|
||||||
|
name = Name(primary_name)
|
||||||
|
name.set_display_as(name_format)
|
||||||
|
mname = html_escape(_nd.display_name(name))
|
||||||
|
mapdetail += self.family_map_link_for_parent(mhandle, mname)
|
||||||
|
relationshipdetail += mapdetail
|
||||||
|
|
||||||
# source references
|
# source references
|
||||||
srcrefs = self.display_ind_sources(family)
|
srcrefs = self.display_ind_sources(family)
|
||||||
if srcrefs:
|
if srcrefs:
|
||||||
@ -394,3 +427,15 @@ class FamilyPages(BasePage):
|
|||||||
# send page out for processing
|
# send page out for processing
|
||||||
# and close the file
|
# and close the file
|
||||||
self.xhtml_writer(familydetailpage, output_file, sio, ldatec)
|
self.xhtml_writer(familydetailpage, output_file, sio, ldatec)
|
||||||
|
|
||||||
|
def family_map_link_for_parent(self, handle, name):
|
||||||
|
"""
|
||||||
|
Creates a link to the family map for the father or the mother
|
||||||
|
|
||||||
|
@param: handle -- The person handle
|
||||||
|
@param: name -- The name for this person to display
|
||||||
|
"""
|
||||||
|
url = self.report.fam_link[handle]
|
||||||
|
title = self._("Family Map for %s") % name
|
||||||
|
return Html("a", title, href=url,
|
||||||
|
title=title, class_="family_map", inline=True)
|
||||||
|
@ -270,6 +270,7 @@ class NavWebReport(Report):
|
|||||||
self.bkref_dict = None
|
self.bkref_dict = None
|
||||||
self.rel_class = None
|
self.rel_class = None
|
||||||
self.tab = None
|
self.tab = None
|
||||||
|
self.fam_link = {}
|
||||||
if self.options['securesite']:
|
if self.options['securesite']:
|
||||||
self.secure_mode = HTTPS
|
self.secure_mode = HTTPS
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user