Consistent buttons (all buttons are actions, links are navigation) and capitalization (all caps); added highlight to HTML parser

svn: r19715
This commit is contained in:
Doug Blank 2012-05-30 19:40:32 +00:00
parent f14b94dd14
commit 83b12cd6b6
13 changed files with 49 additions and 59 deletions

View File

@ -136,7 +136,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Citation" "/citation/%s" citation.handle %}
{% make_button "Cancel" "/citation/%s" citation.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -145,7 +145,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Citations" "/citation" %}
{% make_button "Add Citation" "/citation/add" %}
{% make_button "Edit Citation" "/citation/%s/edit" citation.handle %}
{% make_button "Delete Citation" "/citation/%s/delete" citation.handle %}

View File

@ -70,7 +70,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Event" "/event/%s" event.handle %}
{% make_button "Cancel" "/event/%s" event.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -79,7 +79,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Events" "/event" %}
{% make_button "Add Event" "/event/add" %}
{% make_button "Edit Event" "/event/%s/edit" event.handle %}
{% make_button "Delete Event" "/event/%s/delete" event.handle %}

View File

@ -119,7 +119,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Family" "/family/%s" family.handle %}
{% make_button "Cancel" "/family/%s" family.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -128,7 +128,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Families" "/family" %}
{% make_button "Add Family" "/family/add" %}
{% make_button "Edit Family" "/family/%s/edit" family.handle %}
{% make_button "Delete Family" "/family/%s/delete" family.handle %}

View File

@ -76,7 +76,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Media" "/media/%s" media.handle %}
{% make_button "Cancel" "/media/%s" media.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -85,7 +85,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Media" "/media" %}
{% make_button "Add Media" "/media/add" %}
{% make_button "Edit Media" "/media/%s/edit" media.handle %}
{% make_button "Delete Media" "/media/%s/delete" media.handle %}

View File

@ -95,7 +95,7 @@
&nbsp;
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-surnames">
{% surname_table person user action "/person/%s/name/%s/surname" person.handle nameform.model.order %}
{% surname_table person user action "/person/%s/name/%s/surname/add" person.handle nameform.model.order %}
</div>
<div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide" id="tab-names">
{% name_table person user action "/person/%s/name" person.handle %}
@ -109,24 +109,27 @@
</div>
</div>
<input type="button"
value="Back to Person"
onclick="document.location.href='/person/{{person.handle}}#tab-names'"/>
{% if user.is_authenticated %}
{% ifequal action "add" %}
<input type="button"
value="Cancel"
onclick="document.location.href='/person/{{person.handle}}#tab-names'"/>
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% ifequal action "edit" %}
<input type="button"
value="Cancel"
onclick="document.location.href='/person/'"/>
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
<input type="button"
value="Edit Name"
onclick="document.location.href='/person/{{person.handle}}/name/{{order}}/edit'"/>
<input type="button"
value="Add Name"
onclick="document.location.href='/person/{{person.handle}}/name/add'"/>
<input type="button"
value="Edit Name"
onclick="document.location.href='/person/{{person.handle}}/name/{{order}}/edit'"/>
<input type="button"
value="Delete Name"
onclick="document.location.href='/person/{{person.handle}}/name/{{order}}/delete'"/>

View File

@ -81,7 +81,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Note" "/note/%s" note.handle %}
{% make_button "Cancel" "/note/%s" note.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -90,7 +90,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Notes" "/note" %}
{% make_button "Add Note" "/note/add" %}
{% make_button "Edit Note" "/note/%s/edit" note.handle %}
{% make_button "Delete Note" "/note/%s/delete" note.handle %}

View File

@ -130,7 +130,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Person" "/person/%s" person.handle %}
{% make_button "Cancel" "/person/%s" person.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -139,7 +139,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to People" "/person" %}
{% make_button "Add Person" "/person/add" %}
{% make_button "Edit Person" "/person/%s/edit" person.handle %}
{% make_button "Delete Person" "/person/%s/delete" person.handle %}

View File

@ -75,7 +75,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Place" "/place/%s" place.handle %}
{% make_button "Cancel" "/place/%s" place.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -84,7 +84,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Places" "/place" %}
{% make_button "Add Place" "/place/add" %}
{% make_button "Edit Place" "/place/%s/edit" place.handle %}
{% make_button "Delete Place" "/place/%s/delete" place.handle %}

View File

@ -63,7 +63,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Repository" "/repository/%s" repository.handle %}
{% make_button "Cancel" "/repository/%s" repository.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -72,7 +72,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Repositories" "/repository" %}
{% make_button "Add Repository" "/repository/add" %}
{% make_button "Edit Repository" "/repository/%s/edit" repository.handle %}
{% make_button "Delete Repository" "/repository/%s/delete" repository.handle %}

View File

@ -71,7 +71,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Source" "/source/%s" source.handle %}
{% make_button "Cancel" "/source/%s" source.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -80,7 +80,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Sources" "/source" %}
{% make_button "Add Source" "/source/add" %}
{% make_button "Edit Source" "/source/%s/edit" source.handle %}
{% make_button "Delete Source" "/source/%s/delete" source.handle %}

View File

@ -77,11 +77,8 @@
<input type="submit" value="Save">
{% else %}
<input type="button"
value="Back to Person"
onclick="document.location.href='/person/{{person.handle}}#tab-names'"/>
<input type="button"
value="Back to Name"
onclick="document.location.href='/person/{{person.handle}}/name/{{order}}#tab-surnames'"/>
value="Add Surname"
onclick="document.location.href='/person/{{person.handle}}/name/{{order}}/surname/add'"/>
<input type="button"
value="Edit Surname"
onclick="document.location.href='/person/{{person.handle}}/name/{{order}}/surname/{{sorder}}/edit'"/>
@ -90,13 +87,6 @@
onclick="document.location.href='/person/{{person.handle}}/name/{{order}}/surname/{{sorder}}/delete'"/>
{% endif %}
{% endif %}
{% else %}
<input type="button"
value="Back to Person"
onclick="document.location.href='/person/{{person.handle}}#tab-names'"/>
<input type="button"
value="Back to Name"
onclick="document.location.href='/person/{{person.handle}}/name/order#tab-surnames'"/>
{% endif %}
</form>
{% endblock %}

View File

@ -50,7 +50,7 @@
{% if user.is_superuser %}
{% if action == "edit" %}
{% make_button "Back to Tag" "/tag/%s" tag.handle %}
{% make_button "Cancel" "/tag/%s" tag.handle %}
<input type="hidden" name="action" value="save"/>
<input type="submit" value="Save"/>
{% else %}
@ -59,7 +59,6 @@
<input type="hidden" name="action" value="create"/>
<input type="submit" value="Create"/>
{% else %}
{% make_button "Back to Tags" "/tag" %}
{% make_button "Add Tag" "/tag/add" %}
{% make_button "Edit Tag" "/tag/%s/edit" tag.handle %}
{% make_button "Delete Tag" "/tag/%s/delete" tag.handle %}

View File

@ -198,7 +198,6 @@ class Table(object):
# None is paperstyle, which is ignored:
self.doc = Doc(HtmlDoc.HtmlDoc(make_basic_stylesheet(Table={"set_width":95}), None))
self.doc.doc._backend = HtmlBackend()
self.doc.doc._backend.ADDITIONAL_LINK_TAGS = "class='browsecell'"
# You can set elements id, class, etc:
self.doc.doc.htmllist += [Html('div', class_="content", id="Gallery", style="overflow: auto; height:150px; background-color: #261803;")]
@ -254,8 +253,8 @@ def event_table(obj, user, action, url, args):
str(event_ref.role_type))
retval += table.get_html()
if user.is_superuser and action == "view":
retval += make_button(_("Add event"), (url % args).replace("$act", "add"))
retval += make_button(_("Share event"), (url % args).replace("$act", "share"))
retval += make_button(_("Add Event"), (url % args).replace("$act", "add"))
retval += make_button(_("Share Event"), (url % args).replace("$act", "share"))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -293,7 +292,7 @@ def name_table(obj, user, action, url=None, *args):
table.links(links)
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add name"), (url % args))
retval += make_button(_("Add Name"), (url % args))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -321,7 +320,7 @@ def surname_table(obj, user, action, url=None, *args):
else:
retval += "<p id='error'>No such name order = %s</p>" % order
if user.is_superuser and url and action == "view":
retval += make_button(_("Add surname"), (url % args))
retval += make_button(_("Add Surname"), (url % args))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -348,8 +347,8 @@ def source_table(obj, user, action, url=None, *args):
)
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add source"), (url % args).replace("$act", "add"))
retval += make_button(_("Share source"), (url % args).replace("$act", "share"))
retval += make_button(_("Add Source"), (url % args).replace("$act", "add"))
retval += make_button(_("Share Source"), (url % args).replace("$act", "share"))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -374,8 +373,8 @@ def citation_table(obj, user, action, url=None, *args):
)
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add citation"), (url % args).replace("$act", "add"))
retval += make_button(_("Share citation"), (url % args).replace("$act", "share"))
retval += make_button(_("Add Citation"), (url % args).replace("$act", "add"))
retval += make_button(_("Share Citation"), (url % args).replace("$act", "share"))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -399,8 +398,8 @@ def note_table(obj, user, action, url=None, *args):
note_ref.ref_object.text[:50])
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add note"), (url % args).replace("$act", "add"))
retval += make_button(_("Share note"), (url % args).replace("$act", "share"))
retval += make_button(_("Add Note"), (url % args).replace("$act", "add"))
retval += make_button(_("Share Note"), (url % args).replace("$act", "share"))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -420,7 +419,7 @@ def attribute_table(obj, user, action, url=None, *args):
attribute.value)
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add attribute"), (url % args))
retval += make_button(_("Add Attribute"), (url % args))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -444,7 +443,7 @@ def address_table(obj, user, action, url=None, *args):
location.country)
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add address"), (url % args))
retval += make_button(_("Add Address"), (url % args))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -467,8 +466,8 @@ def gallery_table(obj, user, action, url=None, *args):
media_ref.ref_object.path)
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add media"), (url % args).replace("$act", "add"))
retval += make_button(_("Share media"), (url % args).replace("$act", "share"))
retval += make_button(_("Add Media"), (url % args).replace("$act", "add"))
retval += make_button(_("Share Media"), (url % args).replace("$act", "share"))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -487,7 +486,7 @@ def internet_table(obj, user, action, url=None, *args):
url_obj.desc)
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add internet"), (str(url) % args))
retval += make_button(_("Add Internet"), (str(url) % args))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -506,7 +505,7 @@ def association_table(obj, user, action, url=None, *args):
table.row()
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add association"), (url % args))
retval += make_button(_("Add Association"), (url % args))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -729,7 +728,7 @@ def children_table(obj, user, action, url=None, *args):
table.links(links)
retval += table.get_html()
if user.is_superuser and url and action == "view":
retval += make_button(_("Add child"), (url % args))
retval += make_button(_("Add Child"), (url % args))
else:
retval += nbsp("") # to keep tabs same height
return retval
@ -907,6 +906,7 @@ class WebAppBackend(HtmlBackend):
DocBackend.FONTFACE,
DocBackend.FONTSIZE,
DocBackend.FONTCOLOR,
DocBackend.HIGHLIGHT,
DocBackend.SUPERSCRIPT,
DocBackend.LINK,
]
@ -961,7 +961,7 @@ class WebAppParser(HTMLParser):
FONTFACE = 3
FONTSIZE = 4
FONTCOLOR = 5
HIGHLIGHT = 6
HIGHLIGHT = 6 # background color
SUPERSCRIPT = 7
LINK = 8
@ -1015,6 +1015,13 @@ class WebAppParser(HTMLParser):
arg = match.groups()[0]
else:
print "Unhandled color tag: '%s'" % style
elif 'background-color' in style:
tagtype = self.HIGHLIGHT
match = re.match("background-color:([^;]*);", style)
if match:
arg = match.groups()[0]
else:
print "Unhandled background-color tag: '%s'" % style
elif "font-family" in style:
tagtype = self.FONTFACE
match = re.match("font-family:'([^;]*)';", style)