Webapp refinements

svn: r18588
This commit is contained in:
Doug Blank 2011-12-12 23:21:13 +00:00
parent 42c397f830
commit e705da749c
17 changed files with 85 additions and 18 deletions

View File

@ -0,0 +1,5 @@
{% load my_tags %}
{% filter breadcrumb %}
{% format "/browse|Browse,/%s|%s,/%s/%s|%s [%s]" view tviews view object.handle tview object.gramps_id %}
{% endfilter %}

View File

@ -13,7 +13,7 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/source|Sources"|breadcrumb}} {% include "detail_breadcrumb.html" %}
<h3>{{source.title|escape}}</h3> <h3>{{source.title|escape}}</h3>
<div id="summaryarea"> <div id="summaryarea">

View File

@ -11,7 +11,9 @@
</script> </script>
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/event|Events"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<div id="summaryarea"> <div id="summaryarea">
<table class="infolist"> <table class="infolist">
<trbody> <trbody>

View File

@ -11,7 +11,8 @@
</script> </script>
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/family|Families"|breadcrumb}}
{% include "detail_breadcrumb.html" %}
<h3>{{family.father|make_name:user}} and {{family.mother|make_name:user}}</h3> <h3>{{family.father|make_name:user}} and {{family.mother|make_name:user}}</h3>

View File

@ -10,7 +10,7 @@
}); });
</script> </script>
{{ "/browse|Browse,/media|Media"|breadcrumb}} {% include "detail_breadcrumb.html" %}
<table> <table>
<tr> <tr>

View File

@ -12,7 +12,10 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/person|People,/person/{0}|Person"|breadcrumb:person.handle}} {% filter breadcrumb %}
{% format "/browse|Browse,/person|People,/person/%s|Person [%s],/person/%s/name/%s|Name #%s" object.handle object.gramps_id object.handle order order %}
{% endfilter %}
<h3>{{person|make_name:user}} [{{person.gramps_id}}]</h3> <h3>{{person|make_name:user}} [{{person.gramps_id}}]</h3>
<div id="summaryarea"> <div id="summaryarea">

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/note|Notes"|breadcrumb}} {% include "detail_breadcrumb.html" %}
<div id="summaryarea"> <div id="summaryarea">
<table class="infolist"> <table class="infolist">

View File

@ -9,7 +9,9 @@
<div id="description" style="padding: 10pt 10pt 10pt 10pt;"> <div id="description" style="padding: 10pt 10pt 10pt 10pt;">
<form name="SearchForm"> <form name="SearchForm">
{% if tview != "Report" %} {% if tview != "Report" %}
{{ "/browse|Browse"|breadcrumb}} {% filter breadcrumb %}
{% format "/browse|Browse,/%s|%s" view tviews %}
{% endfilter %}
{% endif %} {% endif %}
<input type="submit" value="Search:"></input> <input type="submit" value="Search:"></input>
<input autocomplete="off" name="search" id="get_focus" type="text" size="50" value="{{search}}"></input> <input autocomplete="off" name="search" id="get_focus" type="text" size="50" value="{{search}}"></input>

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/person|People"|breadcrumb}} {% include "detail_breadcrumb.html" %}
<div id="summaryarea"> <div id="summaryarea">
<table class="infolist"> {% comment %} 5 cols {% endcomment %} <table class="infolist"> {% comment %} 5 cols {% endcomment %}
@ -30,7 +30,7 @@
{% endif %} {% endif %}
<tr> <tr>
<td colspan="4">{{nameform|render_name:user}} [{{person.gramps_id}}]</td> <td colspan="4">{{nameform|render_name:user}}</td>
<td class="ColumnAttribute" align="right">{{nameform.name_type.label}}:</td> <td class="ColumnAttribute" align="right">{{nameform.name_type.label}}:</td>
<td class="ColumnValue" id="data">{% render nameform.name_type user action %}</td> <td class="ColumnValue" id="data">{% render nameform.name_type user action %}</td>
</tr> </tr>

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/place|Places"|breadcrumb}} {% include "detail_breadcrumb.html" %}
<div id="summaryarea"> <div id="summaryarea">

View File

@ -5,7 +5,7 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/report|Reports"|breadcrumb}} {% include "detail_breadcrumb.html" %}
<div id="summaryarea"> <div id="summaryarea">

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/repository|Repositories"|breadcrumb}} {% include "detail_breadcrumb.html" %}
<div id="summaryarea"> <div id="summaryarea">

View File

@ -13,7 +13,7 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/source|Sources"|breadcrumb}} {% include "detail_breadcrumb.html" %}
<h3>{{source.title|escape}}</h3> <h3>{{source.title|escape}}</h3>
<div id="summaryarea"> <div id="summaryarea">

View File

@ -12,7 +12,7 @@
<div class="content" id="IndividualDetail"> <div class="content" id="IndividualDetail">
{{ "/browse|Browse,/tag|Tags"|breadcrumb}} {% include "detail_breadcrumb.html" %}
<div id="summaryarea"> <div id="summaryarea">

View File

@ -149,11 +149,33 @@ def breadcrumb(path, arg=None):
retval = "" retval = ""
for item in path.split(","): for item in path.split(","):
p, name = item.split("|") p, name = item.split("|")
retval += '<a href="%s">%s</a> > ' % (p, name) if retval != "":
retval += " > "
retval += '<a href="%s"><b>%s</b></a>' % (p, name)
return "<p>%s</p>" % retval return "<p>%s</p>" % retval
breadcrumb.is_safe = True breadcrumb.is_safe = True
register.filter('breadcrumb', breadcrumb) register.filter('breadcrumb', breadcrumb)
def format(string, arg0=None, arg1=None, arg2=None, arg3=None, arg4=None, arg5=None, arg6=None):
if arg0 is None:
return string
elif arg1 is None:
return string % arg0
elif arg2 is None:
return string % (arg0, arg1)
elif arg3 is None:
return string % (arg0, arg1, arg2)
elif arg4 is None:
return string % (arg0, arg1, arg2, arg3)
elif arg5 is None:
return string % (arg0, arg1, arg2, arg3, arg4)
elif arg6 is None:
return string % (arg0, arg1, arg2, arg3, arg4, arg5)
else:
return string % (arg0, arg1, arg2, arg3, arg4, arg5, arg6)
format.is_safe = True
register.simple_tag(format)
def currentSection(view1, view2): # tview, menu def currentSection(view1, view2): # tview, menu
if view1.strip().lower() in [view[1] for view in VIEWS] and view2 == "browse": if view1.strip().lower() in [view[1] for view in VIEWS] and view2 == "browse":
return "class=CurrentSection" return "class=CurrentSection"

View File

@ -236,10 +236,12 @@ def view_name_detail(request, handle, order, action="view"):
context = RequestContext(request) context = RequestContext(request)
context["action"] = action context["action"] = action
context["tview"] = _('Name') context["tview"] = _('Name')
context["tviews"] = _('Names')
context["view"] = 'name' context["view"] = 'name'
context["handle"] = handle context["handle"] = handle
context["id"] = id context["id"] = id
context["person"] = person context["person"] = person
context["object"] = person
context["form"] = form context["form"] = form
context["order"] = name.order context["order"] = name.order
context["next"] = "/person/%s/name/%d" % (person.handle, name.order) context["next"] = "/person/%s/name/%d" % (person.handle, name.order)
@ -358,6 +360,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_event_detail.html' view_template = 'view_event_detail.html'
context["tview"] = _("Event") context["tview"] = _("Event")
context["tviews"] = _("Events")
elif view == "family": elif view == "family":
try: try:
obj = Family.objects.get(handle=handle) obj = Family.objects.get(handle=handle)
@ -365,6 +368,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_family_detail.html' view_template = 'view_family_detail.html'
context["tview"] = _("Family") context["tview"] = _("Family")
context["tviews"] = _("Families")
elif view == "media": elif view == "media":
try: try:
obj = Media.objects.get(handle=handle) obj = Media.objects.get(handle=handle)
@ -372,6 +376,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_media_detail.html' view_template = 'view_media_detail.html'
context["tview"] = _("Media") context["tview"] = _("Media")
context["tviews"] = _("Media")
elif view == "note": elif view == "note":
try: try:
obj = Note.objects.get(handle=handle) obj = Note.objects.get(handle=handle)
@ -379,7 +384,12 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_note_detail.html' view_template = 'view_note_detail.html'
context["tview"] = _("Note") context["tview"] = _("Note")
context["tviews"] = _("Notes")
elif view == "person": elif view == "person":
try:
obj = Person.objects.get(handle=handle)
except:
raise Http404(_("Requested %s does not exist.") % view)
return view_person_detail(request, view, handle, action) return view_person_detail(request, view, handle, action)
elif view == "place": elif view == "place":
try: try:
@ -388,6 +398,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_place_detail.html' view_template = 'view_place_detail.html'
context["tview"] = _("Place") context["tview"] = _("Place")
context["tviews"] = _("Places")
elif view == "repository": elif view == "repository":
try: try:
obj = Repository.objects.get(handle=handle) obj = Repository.objects.get(handle=handle)
@ -395,6 +406,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_repository_detail.html' view_template = 'view_repository_detail.html'
context["tview"] = _("Repository") context["tview"] = _("Repository")
context["tviews"] = _("Repositories")
elif view == "citation": elif view == "citation":
try: try:
obj = Citation.objects.get(handle=handle) obj = Citation.objects.get(handle=handle)
@ -402,6 +414,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_citation_detail.html' view_template = 'view_citation_detail.html'
context["tview"] = _("Citation") context["tview"] = _("Citation")
context["tviews"] = _("Citations")
elif view == "source": elif view == "source":
try: try:
obj = Source.objects.get(handle=handle) obj = Source.objects.get(handle=handle)
@ -409,6 +422,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_source_detail.html' view_template = 'view_source_detail.html'
context["tview"] = _("Source") context["tview"] = _("Source")
context["tviews"] = _("Sources")
elif view == "tag": elif view == "tag":
try: try:
obj = Tag.objects.get(handle=handle) obj = Tag.objects.get(handle=handle)
@ -416,6 +430,7 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_tag_detail.html' view_template = 'view_tag_detail.html'
context["tview"] = _("Tag") context["tview"] = _("Tag")
context["tviews"] = _("Tags")
elif view == "report": elif view == "report":
try: try:
obj = Report.objects.get(handle=handle) obj = Report.objects.get(handle=handle)
@ -423,14 +438,18 @@ def view_detail(request, view, handle, action="view"):
raise Http404(_("Requested %s does not exist.") % view) raise Http404(_("Requested %s does not exist.") % view)
view_template = 'view_report_detail.html' view_template = 'view_report_detail.html'
context["tview"] = _("Report") context["tview"] = _("Report")
context["tviews"] = _("Reports")
else: else:
raise Http404(_("Requested page type not known")) raise Http404(_("Requested page type not known"))
context[view] = obj context[view] = obj
context["object"] = obj
context["next"] = "/%s/%s" % (view, obj.handle) context["next"] = "/%s/%s" % (view, obj.handle)
return render_to_response(view_template, context) return render_to_response(view_template, context)
def view_person_detail(request, view, handle, action="view"): def view_person_detail(request, view, handle, action="view"):
context = RequestContext(request) context = RequestContext(request)
context["tview"] = _("Person")
context["tviews"] = _("People")
if handle == "add": if handle == "add":
if request.POST.has_key("action"): if request.POST.has_key("action"):
action = request.POST.get("action") action = request.POST.get("action")
@ -526,13 +545,16 @@ def view_person_detail(request, view, handle, action="view"):
context["personform"] = pf context["personform"] = pf
context["nameform"] = nf context["nameform"] = nf
context["person"] = person context["person"] = person
context["object"] = person
context["next"] = "/person/%s" % person.handle context["next"] = "/person/%s" % person.handle
view_template = 'view_person_detail.html' view_template = 'view_person_detail.html'
return render_to_response(view_template, context) return render_to_response(view_template, context)
def view(request, view): def view(request, view):
context = RequestContext(request)
search = "" search = ""
if view == "event": if view == "event":
context["tviews"] = _("Events")
if request.user.is_authenticated(): if request.user.is_authenticated():
private = Q() private = Q()
else: else:
@ -552,6 +574,7 @@ def view(request, view):
view_template = 'view_events.html' view_template = 'view_events.html'
total = Event.objects.all().count() total = Event.objects.all().count()
elif view == "family": elif view == "family":
context["tviews"] = _("Families")
if request.user.is_authenticated(): if request.user.is_authenticated():
if request.GET.has_key("search"): if request.GET.has_key("search"):
search = request.GET.get("search") search = request.GET.get("search")
@ -605,6 +628,7 @@ def view(request, view):
view_template = 'view_families.html' view_template = 'view_families.html'
total = Family.objects.all().count() total = Family.objects.all().count()
elif view == "media": elif view == "media":
context["tviews"] = _("Media")
if request.user.is_authenticated(): if request.user.is_authenticated():
private = Q() private = Q()
else: else:
@ -622,6 +646,7 @@ def view(request, view):
view_template = 'view_media.html' view_template = 'view_media.html'
total = Media.objects.all().count() total = Media.objects.all().count()
elif view == "note": elif view == "note":
context["tviews"] = _("Notes")
if request.user.is_authenticated(): if request.user.is_authenticated():
private = Q() private = Q()
else: else:
@ -641,6 +666,7 @@ def view(request, view):
view_template = 'view_notes.html' view_template = 'view_notes.html'
total = Note.objects.all().count() total = Note.objects.all().count()
elif view == "person": elif view == "person":
context["tviews"] = _("People")
if request.user.is_authenticated(): if request.user.is_authenticated():
if request.GET.has_key("search"): if request.GET.has_key("search"):
search = request.GET.get("search") search = request.GET.get("search")
@ -688,6 +714,7 @@ def view(request, view):
view_template = 'view_people.html' view_template = 'view_people.html'
total = Name.objects.all().count() total = Name.objects.all().count()
elif view == "place": elif view == "place":
context["tviews"] = _("Places")
if request.user.is_authenticated(): if request.user.is_authenticated():
private = Q() private = Q()
else: else:
@ -707,6 +734,7 @@ def view(request, view):
view_template = 'view_places.html' view_template = 'view_places.html'
total = Place.objects.all().count() total = Place.objects.all().count()
elif view == "repository": elif view == "repository":
context["tviews"] = _("Repositories")
if request.user.is_authenticated(): if request.user.is_authenticated():
private = Q() private = Q()
else: else:
@ -727,6 +755,7 @@ def view(request, view):
view_template = 'view_repositories.html' view_template = 'view_repositories.html'
total = Repository.objects.all().count() total = Repository.objects.all().count()
elif view == "citation": elif view == "citation":
context["tviews"] = _("Citations")
if request.user.is_authenticated(): if request.user.is_authenticated():
private = Q() private = Q()
else: else:
@ -744,6 +773,7 @@ def view(request, view):
view_template = 'view_citations.html' view_template = 'view_citations.html'
total = Citation.objects.all().count() total = Citation.objects.all().count()
elif view == "source": elif view == "source":
context["tviews"] = _("Sources")
if request.user.is_authenticated(): if request.user.is_authenticated():
private = Q() private = Q()
else: else:
@ -761,6 +791,7 @@ def view(request, view):
view_template = 'view_sources.html' view_template = 'view_sources.html'
total = Source.objects.all().count() total = Source.objects.all().count()
elif view == "tag": elif view == "tag":
context["tviews"] = _("Tags")
if request.GET.has_key("search"): if request.GET.has_key("search"):
search = request.GET.get("search") search = request.GET.get("search")
object_list = Tag.objects \ object_list = Tag.objects \
@ -771,6 +802,7 @@ def view(request, view):
view_template = 'view_tags.html' view_template = 'view_tags.html'
total = Tag.objects.all().count() total = Tag.objects.all().count()
elif view == "report": elif view == "report":
context["tviews"] = _("Reports")
if request.GET.has_key("search"): if request.GET.has_key("search"):
search = request.GET.get("search") search = request.GET.get("search")
object_list = Report.objects \ object_list = Report.objects \
@ -798,7 +830,6 @@ def view(request, view):
except (EmptyPage, InvalidPage): except (EmptyPage, InvalidPage):
page = paginator.page(paginator.num_pages) page = paginator.page(paginator.num_pages)
context = RequestContext(request)
context["page"] = page context["page"] = page
context["view"] = view context["view"] = view
context["tview"] = _(view.title()) context["tview"] = _(view.title())

View File

@ -232,7 +232,7 @@ def event_table(obj, user, action, url=None, *args):
event_list = [(obj.ref_object, obj) for obj in event_ref_list] event_list = [(obj.ref_object, obj) for obj in event_ref_list]
for (djevent, event_ref) in event_list: for (djevent, event_ref) in event_list:
table.row( table.row(
djevent.description, djevent.description or str(djevent),
table.db.get_event_from_handle(djevent.handle), table.db.get_event_from_handle(djevent.handle),
djevent.gramps_id, djevent.gramps_id,
display_date(djevent), display_date(djevent),
@ -322,7 +322,8 @@ def citation_table(obj, user, action, url=None, *args):
object_id=obj.id) object_id=obj.id)
for citation_ref in citation_refs: for citation_ref in citation_refs:
if citation_ref.citation: if citation_ref.citation:
citation = citation_ref.citation citation = table.db.get_citation_from_handle(
citation_ref.citation.handle)
table.row(citation, table.row(citation,
str(citation.confidence), str(citation.confidence),
str(citation.page), str(citation.page),