UI Standards ************ .. highlight:: python - Click here for :doc:`dev-standards` - Click here for :doc:`dev-standards-code` - Click here for :doc:`dev-standards-doc` - Click here for :doc:`dev-standards-html` - Click here for :doc:`dev-standards-js` - Click here for :doc:`dev-standards-security` - Click here for :doc:`dev-standards-sys` - Click here for :doc:`dev-standards-tech` Accessibility ============= We really want to make our sites accessible. For a good introduction, see the `How I do an accessibility audit`_ YouTube video. Adam Wathan (Tailwind UI) referred to http://html5doctor.com/ ... The `GOV.UK, Testing for accessibility`_ web pages are probably worth reading. Dashboard ========= .. note:: Public pages will normally be in the ``web`` app. The ``dash`` app is generally for pages where the user has to be logged in. The ``settings`` app is generally for pages where a member of staff can configure settings, add records to look-up tables etc. These are not a hard and fast rules. We will often want other apps where the user needs to be logged in. Projects will normally have a dashboard and a settings page. The URL for the dashboard must be named ``project.dash`` and the URL for the settings page must be named ``project.settings`` e.g:: # from 'dash/urls.py' url(regex=r'^$', view=DashView.as_view(), name='project.dash' ), url(regex=r'^settings/$', view=SettingsView.as_view(), name='project.settings' ), An app can make it easy for a developer to add items to the dashboard or settings template by making an ``/_dash.html`` or ``/_settings.html`` template e.g: .. code-block:: html {% include 'cms/_dash.html' %} {% include 'cms/_settings.html' %} For example code, see: - https://github.com/pkimber/cms/blob/master/cms/templates/cms/_dash.html - https://github.com/pkimber/cms/blob/master/cms/templates/cms/_settings.html Forms ===== To make forms look good on desktop *and* mobile, see :ref:`app_base_forms`. Icons ===== Align ----- To vertically align icons (from `Fixed Width Icons`_), use the ``fa-fw`` class e.g:: Apps ---- :doc:`app-invoice` Usage ----- Audit / superuser:: # http://fontawesome.io/icon/cogs/ Calendar / booking:: # http://fontawesome.io/icon/calendar/ Tick / check:: # http://fontawesome.io/icon/check/ Waiting / spinner / time:: # 'KbSpinner' uses ''' internally # http://fontawesome.io/icon/clock-o # https://fontawesome.com/v4/icon/spinner Download:: # http://fontawesome.io/icon/cloud-download/ Report:: Download CSV (prefer ``fa-cloud-download`` for a download:: # caption - Download CSV Mail / email:: # http://fontawesome.io/icon/envelope-o/ Warning:: # http://fontawesome.io/icon/exclamation-triangle/ Link (internal):: # https://fontawesome.com/icons/link Link (external):: # http://fontawesome.io/icon/external-link/ Template - HTML:: # http://fontawesome.io/icon/file-code-o/ Header / footer:: # http://fontawesome.io/icon/header/ Home:: # http://fontawesome.io/icon/home/ Money / payment:: # http://fontawesome.io/icon/gbp/ Audit / history / log / logging:: # https://fontawesome.com/v4.7.0/icon/history Workflow:: # http://fontawesome.io/icon/magic/ Docs / notes:: # https://fontawesome.com/v4/icon/sticky-note-o Upload (attach / upload):: # http://fontawesome.io/icon/paperclip/ Edit:: # http://fontawesome.io/icon/pencil-square-o/ Help, information, info:: # http://fontawesome.io/icon/info/ Next / previous:: # https://fontawesome.com/v4.7.0/icon/arrow-circle-right:: Phone:: # http://fontawesome.io/icon/phone/ Add / create:: # http://fontawesome.io/icon/plus/ Previous / next:: # https://fontawesome.com/v4.7.0/icon/arrow-circle-left Retry / sync:: # http://fontawesome.io/icon/refresh/ Dash (back):: # http://fontawesome.io/icon/reply/ Star / highlight:: # https://fontawesome.com/v4.7.0/icon/star:: Settings:: # https://fontawesome.com/v4.7.0/icon/cog Login / Sign in:: # https://fontawesome.com/v4.7.0/icon/sign-in GDPR:: # https://fontawesome.com/icons/shield-check Money / payments:: # http://fontawesome.io/icon/shopping-cart/ Sort (up / down):: # https://fontawesome.com/icons/sort/ Page:: # http://fontawesome.io/icon/file-text-o/ Project:: # https://fontawesome.com/v4/icon/bullseye Search:: # http://fontawesome.io/icon/search/ Dashboard:: # http://fontawesome.io/icon/tachometer/ Delete (or cross - opposite to a tick):: # http://fontawesome.io/icon/trash-o/ # or Undo / undelete:: # https://fontawesome.com/v4.7.0/icon/undo User:: # http://fontawesome.io/icon/user/ Pure ==== Grid ---- Two columns .. code-block:: html
Menu ---- .. code-block:: html Table ----- .. code-block:: html
Template ======== Date ---- Short date e.g. ``05/09/2015 13:30``: .. code-block:: html {{ item.checkout_date|date:'d/m/Y H:i' }} In python:: >>> x.strftime('%d/%m/%Y %H:%M') '20/05/2011 10:55' Tags ---- From `Two Scoops of Django`_, *the convention we follow is* ``_tags.py`` e.g. ``cms_tags.py``. .. _`booking_form.html`: https://gitlab.com/kb/booking/blob/1242-community-centre/booking/templates/booking/booking_form.html#L21 .. _`Fixed Width Icons`: https://fontawesome.com/how-to-use/on-the-web/styling/fixed-width-icons .. _`GOV.UK, Testing for accessibility`: https://www.gov.uk/service-manual/technology/testing-for-accessibility .. _`How I do an accessibility audit`: https://www.youtube.com/watch?v=cOmehxAU_4s .. _`Two Scoops of Django`: http://twoscoopspress.org/products/two-scoops-of-django-1-6