Incremental updates for css tweaks, showing validated info, family details and attempts for proper url handling

svn: r13631
This commit is contained in:
Doug Blank 2009-11-19 02:41:37 +00:00
parent 1846c513cf
commit f3d85ec0f4
13 changed files with 218 additions and 109 deletions

View File

@ -200,6 +200,17 @@ a:visited {
#data { #data {
background-color: white; background-color: white;
border-style: solid;
border-color: #7D5925;
border-width:1px 1px 1px 1px;
}
table tr.even {
background-color: #FFF2C5;
}
table tr.odd {
background-color: #ffffe7;
} }
/* Navigation /* Navigation

View File

@ -53,9 +53,9 @@
<div id="footer"> <div id="footer">
{% block footer %} {% block footer %}
<p id="createdate"> <p id="createdate">
Gramps-Connect Gramps Connect, tools for genealogy collaborations
</p> </p>
<p id="copyright">&copy; 2009 <a href="http://www.gramps-project.org/">www.gramps-project.net</a> <p id="copyright">&copy; 2009 <a href="http://www.gramps-project.org/">www.gramps-project.org</a>
</p> </p>
{% endblock %} {% endblock %}
</div> </div>

View File

@ -18,13 +18,14 @@
<p id="description"> <p id="description">
Database information:</p> Database information:</p>
<table class="infolist"> <table class="infolist surname">
<tr> <tr>
<th>Item</th> <th>Item</th>
<th>Count</th> <th>Count</th>
</tr> </tr>
{% for view in views %} {% for view in views %}
<tr><td align="left"><a href="/{{view.1}}">{{view.0}}</a></td> <tr class="{% cycle odd,even %}">
<td align="left"><a href="/{{view.1}}">{{view.0}}</a></td>
<td align="right"><a href="/{{view.1}}">{{view.2.objects.count}}</td> <td align="right"><a href="/{{view.1}}">{{view.2.objects.count}}</td>
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -1,6 +1,6 @@
{% extends "gramps-base.html" %} {% extends "gramps-base.html" %}
{% block title %}Gramps-Connect - {{cview}} detail {% endblock %} {% block title %}Gramps-Connect: {{cview}} detail {% endblock %}
{% block heading %}Gramps-Connect - {{cview}} detail {% endblock %} {% block heading %}Gramps-Connect: {{cview}} detail {% endblock %}
{% block content %} {% block content %}

View File

@ -6,7 +6,7 @@
<table cellspacing="0" class="infolist surname"> <table cellspacing="0" class="infolist surname">
<thead> <thead>
<tr> <tr>
<th>Family #</th> <th>#</th>
<th>ID</th> <th>ID</th>
<th>Father</th> <th>Father</th>
<th>Mother</th> <th>Mother</th>
@ -16,10 +16,10 @@
<tbody> <tbody>
{% for family in page.object_list %} {% for family in page.object_list %}
<tr class="{% cycle odd,even %}"> <tr class="{% cycle odd,even %}">
<td>{{ forloop.counter|row_count:page }}</td> <td><a href="/{{view}}/{{family.handle|escape}}" class="noThumb">{{ forloop.counter|row_count:page }}</a></td>
<td><a href="/{{view}}/{{family.handle|escape}}" class="noThumb"><span class="grampsid">[{{family.gramps_id}}]</span></a> <td><a href="/{{view}}/{{family.handle|escape}}" class="noThumb"><span class="grampsid">[{{family.gramps_id}}]</span></a>
<td><a href="/person/{{family.father.handle|escape}}">{{family.father.name_set|make_name:user}}</a> <td><a href="/{{view}}/{{family.handle|escape}}">{{family.father.name_set|make_name:user}}</a>
<td><a href="/person/{{family.mother.handle|escape}}">{{family.mother.name_set|make_name:user}}</a> <td><a href="/{{view}}/{{family.handle|escape}}">{{family.mother.name_set|make_name:user}}</a>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<td><a href="/{{view}}/{{family.handle|escape}}">{{family.family_rel_type|escape}}</a> <td><a href="/{{view}}/{{family.handle|escape}}">{{family.family_rel_type|escape}}</a>
{% else %} {% else %}

View File

@ -27,12 +27,21 @@
<td class="ColumnAttribute">Name:</td> <td class="ColumnAttribute">Name:</td>
<td class="ColumnValue" id="data"><a href="/person/{{family.mother.handle}}">{{family.mother.name_set|make_name:user}} [{{family.mother.gramps_id|escape}}]</a></td> <td class="ColumnValue" id="data"><a href="/person/{{family.mother.handle}}">{{family.mother.name_set|make_name:user}} [{{family.mother.gramps_id|escape}}]</a></td>
</tr> </tr>
{% if user.is_authenticated or not family.father.handle|probably_alive %}
<tr> <tr>
<td class="ColumnAttribute">Birth:</td> <td class="ColumnAttribute">Birth:</td>
<td class="ColumnValue" id="data">{{family.father|person_get_birth_date}}</td> <td class="ColumnValue" id="data">{{family.father|person_get_birth_date}}</td>
<td class="ColumnAttribute">Birth:</td> <td class="ColumnAttribute">Birth:</td>
<td class="ColumnValue" id="data">{{family.mother|person_get_birth_date}}</td> <td class="ColumnValue" id="data">{{family.mother|person_get_birth_date}}</td>
</tr> </tr>
{% else %}
<tr>
<td class="ColumnAttribute">Birth:</td>
<td class="ColumnValue" id="data">[Private]</td>
<td class="ColumnAttribute">Birth:</td>
<td class="ColumnValue" id="data">[Private]</td>
</tr>
{% endif %}
<tr> <tr>
<td class="ColumnAttribute">Death:</td> <td class="ColumnAttribute">Death:</td>
<td class="ColumnValue" id="data">{{family.father|person_get_death_date}}</td> <td class="ColumnValue" id="data">{{family.father|person_get_death_date}}</td>

View File

@ -1,8 +1,8 @@
{% extends "gramps-base.html" %} {% extends "gramps-base.html" %}
{% load my_tags %} {% load my_tags %}
{% block title %}Gramps-Connect - {{cview}} view {% endblock %} {% block title %}Gramps-Connect: {{cview}} view {% endblock %}
{% block heading %}Gramps Connect - {{cview}} view {% endblock %} {% block heading %}Gramps Connect: {{cview}} view {% endblock %}
{% block content %} {% block content %}

View File

@ -1,8 +1,8 @@
{% extends "gramps-base.html" %} {% extends "gramps-base.html" %}
{% load my_tags %} {% load my_tags %}
{% block title %}Gramps-Connect - {{cview}} detail {% endblock %} {% block title %}Gramps-Connect: {{cview}} detail {% endblock %}
{% block heading %}Gramps-Connect - {{cview}} detail {% endblock %} {% block heading %}Gramps-Connect: {{cview}} detail {% endblock %}
{% block content %} {% block content %}

View File

@ -3,10 +3,10 @@
{% block table_data %} {% block table_data %}
<table cellspacing="0" class="infolist IndividualList"> <table cellspacing="0" class="infolist surname">
<thead> <thead>
<tr> <tr>
<th>Person #</th> <th>#</th>
<th>Name</th> <th>Name</th>
<th>ID</th> <th>ID</th>
<th>Gender</th> <th>Gender</th>
@ -20,17 +20,18 @@
<tbody> <tbody>
{% for name in page.object_list %} {% for name in page.object_list %}
<tr class="{% cycle odd,even %}"> <tr class="{% cycle odd,even %}">
<td>{{ forloop.counter|row_count:page }}</td> <td><a href="{{name.person.handle|escape}}/" class="noThumb">{{ forloop.counter|row_count:page }}</a>
<td><a href="/{{view}}/{{name.person.handle|escape}}/" class="noThumb">{{name|make_name:user}}</a>
</td> </td>
<td><a href="/{{view}}/{{name.person.handle|escape}}" class="grampsid">[{{name.person.gramps_id|escape}}]</a></td> <td><a href="{{name.person.handle|escape}}/" class="noThumb">{{name|make_name:user}}</a>
<td><a href="/{{view}}/{{name.person.handle|escape}}" class="noThumb">{{name.person.gender_type|escape}}</a></td> </td>
<td><a href="{{name.person.handle|escape}}/" class="grampsid">[{{name.person.gramps_id|escape}}]</a></td>
<td><a href="{{name.person.handle|escape}}/" class="noThumb">{{name.person.gender_type|escape}}</a></td>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<td><a href="/{{view}}/{{name.person.handle|escape}}" class="noThumb">{{name.person|person_get_birth_date}}</a></td> <td><a href="{{name.person.handle|escape}}/" class="noThumb">{{name.person|person_get_birth_date}}</a></td>
<td><a href="/{{view}}/{{name.person.handle|escape}}" class="noThumb">{{name.person|person_get_death_date}}</a></td> <td><a href="{{name.person.handle|escape}}/" class="noThumb">{{name.person|person_get_death_date}}</a></td>
{% else %} {% else %}
<td><a href="/{{view}}/{{name.person.handle|escape}}/" class="noThumb">[Private]</a> <td><a href="{{name.person.handle|escape}}/" class="noThumb">[Private]</a>
<td><a href="/{{view}}/{{name.person.handle|escape}}/" class="noThumb">[Private]</a> <td><a href="{{name.person.handle|escape}}/" class="noThumb">[Private]</a>
{% endif %} {% endif %}
</tr> </tr>
{% endfor %} {% endfor %}

View File

@ -15,13 +15,18 @@
<div id="summaryarea"> <div id="summaryarea">
<table class="infolist"> {% comment %} 5 cols {% endcomment %} <table class="infolist"> {% comment %} 5 cols {% endcomment %}
<tbody> <tbody>
{% if user.is_authenticated %}
<tr> <tr>
<td class="ColumnAttribute">Family:</td> <td class="ColumnAttribute">Family:</td>
<td class="ColumnValue" id="data">{{person.name_set|preferred:"surname"}}</td> <td class="ColumnValue" id="data">{{person.name_set|preferred:"surname"}}</td>
<td class="ColumnAttribute">Prefix:</td> <td class="ColumnAttribute">Prefix:</td>
<td class="ColumnValue" id="data">{{person.name_set|preferred:"prefix"}}</td> <td class="ColumnValue" id="data">{{person.name_set|preferred:"prefix"}}</td>
<td rowspan="3" colspan="2" style="border:solid 2px #7D5925;">Image:</td> <td rowspan="5" colspan="2" style="border:solid 2px #7D5925;">Image:</td>
</tr> </tr>
<td class="ColumnAttribute" colspan="2"></td>
<td class="ColumnAttribute">Suffix:</td>
<td class="ColumnValue" id="data">{{person.name_set|preferred:"suffix"}}</td>
<tr> <tr>
<td class="ColumnAttribute">Given:</td> <td class="ColumnAttribute">Given:</td>
<td class="ColumnValue" id="data">{{person.name_set|preferred:"first_name"}}</td> <td class="ColumnValue" id="data">{{person.name_set|preferred:"first_name"}}</td>
@ -34,6 +39,11 @@
<td class="ColumnAttribute">Patronymic:</td> <td class="ColumnAttribute">Patronymic:</td>
<td class="ColumnValue" id="data">{{person.name_set|preferred:"patronymic"}}</td> <td class="ColumnValue" id="data">{{person.name_set|preferred:"patronymic"}}</td>
</tr> </tr>
</tr>
<td class="ColumnAttribute" colspan="2"></td>
<td class="ColumnAttribute">Title:</td>
<td class="ColumnValue" id="data">{{person.name_set|preferred:"title"}}</td>
<tr>
<tr> <tr>
<td class="ColumnAttribute">Gender:</td> <td class="ColumnAttribute">Gender:</td>
<td class="ColumnValue" id="data">{{person.gender_type|escape}}</td> <td class="ColumnValue" id="data">{{person.gender_type|escape}}</td>
@ -44,9 +54,50 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</div>
{% else %}
<tr>
<td class="ColumnAttribute">Family:</td>
<td class="ColumnValue" id="data">{{person.name_set|preferred:"surname"}}</td>
<td class="ColumnAttribute">Prefix:</td>
<td class="ColumnValue" id="data">[Private]</td>
<td rowspan="5" colspan="2" style="border:solid 2px #7D5925;">Image:</td>
</tr>
<td class="ColumnAttribute" colspan="2"></td>
<td class="ColumnAttribute">Suffix:</td>
<td class="ColumnValue" id="data">[Private]</td>
<tr>
<td class="ColumnAttribute">Given:</td>
<td class="ColumnValue" id="data">[Private]</td>
<td class="ColumnAttribute">Call Name:</td>
<td class="ColumnValue" id="data">[Private]</td>
</tr>
<tr>
<td class="ColumnAttribute">Type:</td>
<td class="ColumnValue" id="data">{{person.name_set|preferred:"name_type"}}</td>
<td class="ColumnAttribute">Patronymic:</td>
<td class="ColumnValue" id="data">[Private]</td>
</tr>
</tr>
<td class="ColumnAttribute" colspan="2"></td>
<td class="ColumnAttribute">Title:</td>
<td class="ColumnValue" id="data">[Private]</td>
<tr>
<tr>
<td class="ColumnAttribute">Gender:</td>
<td class="ColumnValue" id="data">{{person.gender_type|escape}}</td>
<td class="ColumnAttribute">ID:</td>
<td class="ColumnValue" id="data">{{person.gramps_id|escape}}</td>
<td class="ColumnAttribute">Marker:</td>
<td class="ColumnValue" id="data"></td>
</tr>
</tbody>
</table>
{% endif %}
</div>
</div>
<!-- Tabs --> <!-- Tabs -->
<h2 class="demoHeaders">Tabs</h2> <h2 class="demoHeaders">Tabs</h2>

View File

@ -14,6 +14,9 @@ for filter_name in util_filters:
func.is_safe = True func.is_safe = True
register.filter(filter_name, func) register.filter(filter_name, func)
probably_alive.is_safe = True
register.filter('probably_alive', probably_alive)
person_get_birth_date.is_safe = True person_get_birth_date.is_safe = True
register.filter('person_get_birth_date', person_get_birth_date) register.filter('person_get_birth_date', person_get_birth_date)

View File

@ -33,5 +33,27 @@ urlpatterns += patterns('',
(r'^login/$', 'django.contrib.auth.views.login'), (r'^login/$', 'django.contrib.auth.views.login'),
(r'^logout/$', logout_page), (r'^logout/$', logout_page),
(r'^(?P<view>(\w+))/$', view), (r'^(?P<view>(\w+))/$', view),
url(r'^person/(?P<handle>(\w+))/$', view_detail,
{"view": "person"}, name="view-person-detail"),
(r'^(?P<view>(\w+))/(?P<handle>(\w+))/$', view_detail), (r'^(?P<view>(\w+))/(?P<handle>(\w+))/$', view_detail),
) )
# In urls:
# urlpatterns = patterns('',
# url(r'^archive/(\d{4})/$', archive, name="full-archive"),
# url(r'^archive-summary/(\d{4})/$', archive, {'summary': True}, "arch-summary"),
# )
# In template:
# {% url arch-summary 1945 %}
# {% url full-archive 2007 %}
#{% url path.to.view as the_url %}
#{% if the_url %}
# <a href="{{ the_url }}">Link to optional stuff</a>
#{% endif %}
# In code:
#from django.core.urlresolvers import reverse
#
#def myview(request):
# return HttpResponseRedirect(reverse('arch-summary', args=[1945]))

View File

@ -69,19 +69,20 @@ def person_event_table(djperson, user):
_("Date"), _("Date"),
_("Place"), _("Place"),
_("Role")) _("Role"))
obj_type = ContentType.objects.get_for_model(djperson) if user.is_authenticated():
event_ref_list = models.EventRef.objects.filter( obj_type = ContentType.objects.get_for_model(djperson)
object_id=djperson.id, event_ref_list = models.EventRef.objects.filter(
object_type=obj_type).order_by("order") object_id=djperson.id,
event_list = [(obj.ref_object, obj) for obj in event_ref_list] object_type=obj_type).order_by("order")
for (djevent, event_ref) in event_list: event_list = [(obj.ref_object, obj) for obj in event_ref_list]
table.row( for (djevent, event_ref) in event_list:
djevent.description, table.row(
table.db.get_event_from_handle(djevent.handle), djevent.description,
djevent.gramps_id, table.db.get_event_from_handle(djevent.handle),
display_date(djevent), djevent.gramps_id,
get_title(djevent.place), display_date(djevent),
str(event_ref.role_type)) get_title(djevent.place),
str(event_ref.role_type))
return table.get_html() return table.get_html()
def person_name_table(djperson, user): def person_name_table(djperson, user):
@ -91,20 +92,21 @@ def person_name_table(djperson, user):
_("Group As"), _("Group As"),
_("Source"), _("Source"),
_("Note Preview")) _("Note Preview"))
for name in djperson.name_set.all(): if user.is_authenticated():
obj_type = ContentType.objects.get_for_model(name) for name in djperson.name_set.all():
sourceq = dji.SourceRef.filter(object_type=obj_type, obj_type = ContentType.objects.get_for_model(name)
object_id=name.id).count() > 0 sourceq = dji.SourceRef.filter(object_type=obj_type,
note_refs = dji.NoteRef.filter(object_type=obj_type, object_id=name.id).count() > 0
object_id=name.id) note_refs = dji.NoteRef.filter(object_type=obj_type,
note = "" object_id=name.id)
if note_refs.count() > 0: note = ""
note = dji.Note.get(id=note_refs[0].object_id).text[:50] if note_refs.count() > 0:
table.row(make_name(name, user), note = dji.Note.get(id=note_refs[0].object_id).text[:50]
str(name.name_type), table.row(make_name(name, user),
name.group_as, str(name.name_type),
["No", "Yes"][sourceq], name.group_as,
note) ["No", "Yes"][sourceq],
note)
return table.get_html() return table.get_html()
def person_source_table(djperson, user): def person_source_table(djperson, user):
@ -113,16 +115,17 @@ def person_source_table(djperson, user):
_("Title"), _("Title"),
_("Author"), _("Author"),
_("Page")) _("Page"))
obj_type = ContentType.objects.get_for_model(djperson) if user.is_authenticated():
source_refs = dji.SourceRef.filter(object_type=obj_type, obj_type = ContentType.objects.get_for_model(djperson)
object_id=djperson.id) source_refs = dji.SourceRef.filter(object_type=obj_type,
for source_ref in source_refs: object_id=djperson.id)
source = table.db.get_source_from_handle(source_ref.ref_object.handle) for source_ref in source_refs:
table.row(source, source = table.db.get_source_from_handle(source_ref.ref_object.handle)
source_ref.ref_object.title, table.row(source,
source_ref.ref_object.author, source_ref.ref_object.title,
source_ref.page, source_ref.ref_object.author,
) source_ref.page,
)
return table.get_html() return table.get_html()
def person_attribute_table(djperson, user): def person_attribute_table(djperson, user):
@ -130,12 +133,13 @@ def person_attribute_table(djperson, user):
table.columns(_("Type"), table.columns(_("Type"),
_("Value"), _("Value"),
) )
obj_type = ContentType.objects.get_for_model(djperson) if user.is_authenticated():
attributes = dji.Attribute.filter(object_type=obj_type, obj_type = ContentType.objects.get_for_model(djperson)
object_id=djperson.id) attributes = dji.Attribute.filter(object_type=obj_type,
for attribute in attributes: object_id=djperson.id)
table.row(attribute.attribute_type.name, for attribute in attributes:
attribute.value) table.row(attribute.attribute_type.name,
attribute.value)
return table.get_html() return table.get_html()
def person_address_table(djperson, user): def person_address_table(djperson, user):
@ -145,14 +149,15 @@ def person_address_table(djperson, user):
_("City"), _("City"),
_("State"), _("State"),
_("Country")) _("Country"))
for address in djperson.address_set.all().order_by("order"): if user.is_authenticated():
locations = address.location_set.all().order_by("order") for address in djperson.address_set.all().order_by("order"):
for location in locations: locations = address.location_set.all().order_by("order")
table.row(display_date(address), for location in locations:
location.street, table.row(display_date(address),
location.city, location.street,
location.state, location.city,
location.country) location.state,
location.country)
return table.get_html() return table.get_html()
def person_note_table(djperson, user): def person_note_table(djperson, user):
@ -161,15 +166,16 @@ def person_note_table(djperson, user):
_("ID"), _("ID"),
_("Type"), _("Type"),
_("Note")) _("Note"))
obj_type = ContentType.objects.get_for_model(djperson) if user.is_authenticated():
note_refs = dji.NoteRef.filter(object_type=obj_type, obj_type = ContentType.objects.get_for_model(djperson)
object_id=djperson.id) note_refs = dji.NoteRef.filter(object_type=obj_type,
for note_ref in note_refs: object_id=djperson.id)
note = table.db.get_note_from_handle( for note_ref in note_refs:
note_ref.ref_object.handle) note = table.db.get_note_from_handle(
table.row(table.db.get_note_from_handle(note.handle), note_ref.ref_object.handle)
str(note_ref.ref_object.note_type), table.row(table.db.get_note_from_handle(note.handle),
note_ref.ref_object.text[:50]) str(note_ref.ref_object.note_type),
note_ref.ref_object.text[:50])
return table.get_html() return table.get_html()
def person_gallery_table(djperson, user): def person_gallery_table(djperson, user):
@ -184,11 +190,12 @@ def person_internet_table(djperson, user):
table.columns(_("Type"), table.columns(_("Type"),
_("Path"), _("Path"),
_("Description")) _("Description"))
urls = dji.Url.filter(person=djperson) if user.is_authenticated():
for url in urls: urls = dji.Url.filter(person=djperson)
table.row(str(url.url_type), for url in urls:
url.path, table.row(str(url.url_type),
url.desc) url.path,
url.desc)
return table.get_html() return table.get_html()
def person_association_table(djperson, user): def person_association_table(djperson, user):
@ -196,10 +203,11 @@ def person_association_table(djperson, user):
table.columns(_("Name"), table.columns(_("Name"),
_("ID"), _("ID"),
_("Association")) _("Association"))
gperson = table.db.get_person_from_handle(djperson.handle) if user.is_authenticated():
associations = gperson.get_person_ref_list() gperson = table.db.get_person_from_handle(djperson.handle)
for association in associations: associations = gperson.get_person_ref_list()
table.row() for association in associations:
table.row()
return table.get_html() return table.get_html()
def person_lds_table(djperson, user): def person_lds_table(djperson, user):
@ -209,14 +217,15 @@ def person_lds_table(djperson, user):
_("Status"), _("Status"),
_("Temple"), _("Temple"),
_("Place")) _("Place"))
obj_type = ContentType.objects.get_for_model(djperson) if user.is_authenticated():
ldss = djperson.lds_set.all().order_by("order") obj_type = ContentType.objects.get_for_model(djperson)
for lds in ldss: ldss = djperson.lds_set.all().order_by("order")
table.row(str(lds.lds_type), for lds in ldss:
display_date(lds), table.row(str(lds.lds_type),
str(lds.status), display_date(lds),
lds.temple, str(lds.status),
get_title(lds.place)) lds.temple,
get_title(lds.place))
return table.get_html() return table.get_html()
def person_reference_table(djperson, user): def person_reference_table(djperson, user):
@ -224,11 +233,12 @@ def person_reference_table(djperson, user):
table.columns(_("Type"), table.columns(_("Type"),
_("ID"), _("ID"),
_("Name")) _("Name"))
references = dji.PersonRef.filter(ref_object=djperson) if user.is_authenticated():
for reference in references: references = dji.PersonRef.filter(ref_object=djperson)
table.row(str(reference.ref_object), for reference in references:
reference.ref_object.gramps_id, table.row(str(reference.ref_object),
make_name(reference.ref_object.name_set, user)) reference.ref_object.gramps_id,
make_name(reference.ref_object.name_set, user))
return table.get_html() return table.get_html()
def family_children_table(djfamily, user): def family_children_table(djfamily, user):
@ -242,6 +252,7 @@ def family_children_table(djfamily, user):
_("Maternal"), _("Maternal"),
_("Birth Date"), _("Birth Date"),
) )
#if user.is_authenticated():
#for djfamily: #for djfamily:
# table.row("test") # table.row("test")
return table.get_html() return table.get_html()