sethelp db help entry creation fix, @laxy_property removed
evennia.web.website.tests all pass evennia.commands.default.tests.TestHelp all pass (sethelp command test is in that unit test)
This commit is contained in:
parent
a661e4801b
commit
8eb7ffa70b
3 changed files with 17 additions and 16 deletions
|
|
@ -17,8 +17,8 @@
|
|||
<hr />
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{% url 'help' %}">Help Index</a></li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'help' %}#{{ object.help_category }}">{{ object.help_category|title }}</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ object.key|title }}</li>
|
||||
<li class="breadcrumb-item"><a href="{% url 'help' %}#{{ object.web_help_category }}">{{ object.help_category|title }}</a></li>
|
||||
<li class="breadcrumb-item active" aria-current="page">{{ object.web_help_key|title }}</li>
|
||||
</ol>
|
||||
<hr />
|
||||
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
{% endif %}
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">{{ object.help_category|title }}</div>
|
||||
<div class="card-header">{{ object.web_help_category|title }}</div>
|
||||
|
||||
<ul class="list-group list-group-flush">
|
||||
{% for topic in topic_list %}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,10 @@ def get_help_category(help_entry, slugify_cat=True):
|
|||
Returns:
|
||||
help_category (str): The category for the help entry.
|
||||
"""
|
||||
help_category = getattr(help_entry, 'help_category', DEFAULT_HELP_CATEGORY)
|
||||
help_category = getattr(help_entry, 'help_category', None)
|
||||
if not help_category:
|
||||
help_category = getattr(help_entry, 'db_help_category', DEFAULT_HELP_CATEGORY)
|
||||
# if one does not exist, create a category for ease of use with web views html templates
|
||||
if not hasattr(help_entry, 'web_help_category'):
|
||||
setattr(help_entry, 'web_help_category', slugify(help_category))
|
||||
return slugify(help_category) if slugify_cat else help_category
|
||||
|
|
@ -46,9 +49,16 @@ def get_help_topic(help_entry):
|
|||
help_entry (HelpEntry, FileHelpEntry or Command): Help entry instance.
|
||||
|
||||
Returns:
|
||||
topic (str): The topic of the help entry. Default is 'unknown_topic'.
|
||||
help_topic (str): The topic of the help entry. Default is 'unknown_topic'.
|
||||
"""
|
||||
return getattr(help_entry, 'key', 'unknown_topic')
|
||||
help_topic = getattr(help_entry, 'key', None)
|
||||
# if object has no key, assume it is a db help entry.
|
||||
if not help_topic:
|
||||
help_topic = getattr(help_entry, 'db_key', 'unknown_topic')
|
||||
# if one does not exist, create a key for ease of use with web views html templates
|
||||
if not hasattr(help_entry, 'web_help_key'):
|
||||
setattr(help_entry, 'web_help_key', slugify(help_topic))
|
||||
return help_topic
|
||||
|
||||
|
||||
def can_read_topic(cmd_or_topic, account):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue