Make our administration templates/scripts work on default Django setups.

Review Request #8790 — Created March 1, 2017 and submitted — Latest diff uploaded

Information

Djblets
release-0.10.x
186e18f...

Reviewers

Much of Djblets's administration widgets and template code was based on
code we had in Review Board. For many many years, Review Board had a
heavily customized administration interface, and we've been testing
against this. Unfortunately, the code we had in Djblets didn't quite
work right in a default Django install. There were style problems,
script problems, and blocks that had to be specially defined in a base
template in order for pages to work.

This change is the first step to addressing that and making our code
work in both Review Board and standard Django setups.

A new base template, djblets_forms/admin/base_site.html, has been added.
This is now used in our templates instead of admin/base_site.html, and
is built to give us a few new blocks to work with: admin_css,
admin_scripts, and admin_scripts_post. These replace the old css,
scripts, and scripts-post blocks that were defined in Review Board.
These new blocks are guaranteed to be available to any child templates
on a standard Django install. Applications like Review Board will get
them for free as long as they don't override the parent blocks or if
they specially declare the new blocks themselves in a base template.

The template for custom change forms now has support for a top-level
"media" variable, like the standard template. It doesn't require a
version on the form anymore. Some other changes are coming soon to this
template.

The scripts we inject into the page that for integration operations and
the conditions field are now compatible with the version of jQuery that
Django supplies in the administration page. If a custom version of
jQuery is injected into the page, that will take precedence.

The djblets-forms JavaScript package no longer requires other Djblets
JavaScript packages to be loaded. It was previously depending on a
pre-existing window.Djblets variable, but it now defines this if not
found, like other packages do.

With these changes, most of our code working with the administration UI
is now compatible out of the box on any new Django project. Some work is
still required to fix up assumptions and bad styling in the extension
and integration pages, which will be coming in an upcoming change.

Tested that the settings forms, integration list, integration
configuration, extension list, extension configuration, and log
viewer pages loaded and worked on Review Board, and mostly worked on
a plain Django admin UI (some work is needed here, which will be done
separately).

    Loading...