"""
Various constants are used throughout the UI to maintain consistency and reduce the possibility of errors. In some
cases, changing the behavior of the UI requires the use of a value represented by a constant. When this is required, you
are strongly encouraged to use the appropriate constant rather than a "raw" variable.
Filtering
---------
List filters may make use of constants to manage the orientation and style of filters presented to the user.
Lists
-----
List constants refer to the "mode" of output and also pagination style.
Locations
---------
Location constants refer to an area of the rendered page where something should be displayed. While built-in templates
seek to honor a specified location, the output will in some cases still depend upon the theme's handling of layout.
Menus
-----
Standardize menu locations.
Orientations
------------
Horizontal or vertical orientation of output elements.
Pagination
----------
Various controls over paged results.
Size
----
Various indicators for the relative size of an element rendered on a page.
User
----
``USER`` helps identify the type or user.
- ``ALL``: All (or any) user.
- ``CUSTOMER``: A paying customer.
- ``NORMAL``: A normal user.
- ``ROOT`` is an administrator or superuser.
- ``STAFF`` a staff user.
Verbs
-----
Standard verbs/actions.
"""
__author__ = "Shawn Davis <shawn@superdjango.com>"
__maintainer__ = "Shawn Davis <shawn@superdjango.com>"
__version__ = "0.5.0-d"
# Imports
from django.utils.translation import gettext_lazy as _
# Exports
__all__ = (
"FILTER",
"LIST",
"LOCATION",
"MENU",
"ORIENTATION",
"PAGINATION",
"SIZE",
"USER",
"VERB",
)
# Constants
[docs]class FILTER:
"""Control over the style of list filters."""
CHECKBOXES = "checkboxes"
LISTGROUP = "listgroup"
SELECT = "select"
[docs]class LIST:
"""List types (object templates)."""
CALENDAR = "calendar"
CARDS = "cards"
GANTT = "gantt"
GROUP = "group"
KANBAN = "kanban"
MAP = "map"
MOSAIC = "mosaic"
SLIDESHOW = "slideshow"
TABLE = "table"
[docs]class LOCATION:
"""Location of elements in UI output."""
BOTTOM = "bottom"
CENTER = "center"
DEFAULT = "default"
LEFT = "left"
RIGHT = "right"
TOP = "top"
[docs]class ORIENTATION:
"""Orientation of elements such as filters, detail data, etc. in UI output."""
HORIZONTAL = "horizontal"
VERTICAL = "vertical"
[docs]class SIZE:
"""Relative size descriptions for UI elements."""
TINY = "tiny"
SMALL = "small"
MEDIUM = "medium"
LARGE = "large"
HUGE = "huge"
P10 = "10%"
P25 = "25%"
P50 = "50%"
P75 = "75%"
P90 = "90%"
P95 = "95%"
P100 = "100%"
[docs]class USER:
"""Identifies a type of user."""
ALL = "all"
CUSTOMER = "customer"
NORMAL = "user"
ROOT = "root"
STAFF = "staff"
[docs]class VERB:
"""A verb is any action within the UI, typically associated with a model. Verb constants are therefore tied to the
"base" name of a view; that is, the name of the view before an app label and model name have been applied.
"""
AJAX_AUTO_COMPLETE = "ajax_auto_complete"
AJAX_CHAINED_REFERENCE = "ajax_chained_reference"
AJAX_CHOOSER = "ajax_chooser"
AJAX_CREATE = "ajax_create"
AJAX_DELETE = "ajax_delete"
AJAX_DETAIL = "ajax_detail"
AJAX_DRAG_AND_DROP = "ajax_drag_and_drop"
AJAX_MARK_COMPLETE = "ajax_mark_complete"
AJAX_REORDER = "ajax_reorder"
AJAX_SEARCH = "ajax_search"
AJAX_UPDATE = "ajax_update"
BATCH_CHANGE = "batch_change"
BULK_COMPARE = "bulk_compare"
BULK_DELETE = "bulk_delete"
BULK_EDIT = "bulk_edit"
BULK_TRASH = "bulk_trash"
CHOOSER = "chooser"
CREATE = "create"
DASHBOARD = "dashboard"
DELETE = "delete"
DETAIL = "detail"
DUPLICATE = "duplicate"
INTERMEDIATE = "intermediate"
LIST = "list"
MARK_ARCHIVED = "mark_archived"
MARK_COMPLETE = "mark_complete"
MARK_PUBLISHED = "mark_published"
MARK_REVIEWED = "mark_reviewed"
MARK_RESOLVED = "mark_resolved"
SAVE_AS = "save_as"
SEARCH = "search"
TRASH = "trash"
UPDATE = "update"
WIZARD = "wizard"
DJANGO_CREATE = "add"
DJANGO_DELETE = "delete"
DJANGO_DETAIL = "view"
DJANGO_UPDATE = "change"
ALIASES = {
AJAX_AUTO_COMPLETE: ("ajax_auto_complete", "ajax-auto-complete", "auto_complete", "auto-complete"),
AJAX_CHAINED_REFERENCE: ("ajax_chained_reference", "ajax-chained-reference"),
AJAX_CHOOSER: ("ajax_chooser", "ajax-chooser"),
AJAX_DRAG_AND_DROP: ("ajax_drag_and_drop", "ajax-drag-and-drop"),
AJAX_REORDER: ("ajax_reorder", "ajax-reorder"),
AJAX_SEARCH: ("ajax_search", "ajax-search"),
BATCH_CHANGE: ("batch_change", "batch-change"),
BULK_COMPARE: ("bulk_compare", "bulk-compare", "compare", "comparison"),
BULK_DELETE: ("bulk_delete", "bulk-delete", "bulk_remove", "bulk-remove"),
BULK_EDIT: ("bulk_edit", "bulk-edit", "bulk_update", "bulk-update"),
BULK_TRASH: ("bulk_discard", "bulk-discard", "bulk_trash", "bulk-trash"),
CREATE: ("add", "create", "new"),
DASHBOARD: ("dash", "dashboard"),
DELETE: ("delete", "remove"),
DETAIL: ("detail", "inspect", "view"),
DUPLICATE: ("copy", "duplicate", "save-as"),
LIST: ("index", "list", "listing"),
MARK_REVIEWED: ("mark_reviewed", "mark-reviewed"),
SEARCH: ("find", "search"),
TRASH: ("discard", "trash"),
UPDATE: ("change", "edit", "update"),
WIZARD: ("form_wizard", "form-wizard", "wizard"),
}
LABELS = {
BATCH_CHANGE: _("Batch Change"),
BULK_COMPARE: _("Compare"),
BULK_DELETE: _("Delete"),
BULK_EDIT: _("Edit"),
BULK_TRASH: _("Trash"),
CREATE: _("New"),
DASHBOARD: _("Dashboard"),
DELETE: _("Delete"),
DETAIL: _("Detail"),
DUPLICATE: _("Duplicate"),
LIST: _("List"),
SAVE_AS: _("Save As"),
SEARCH: _("Search"),
TRASH: _("Trash"),
UPDATE: _("Update"),
}