1 |
|
Configuration
|
2 |
|
=============
|
|
1 |
=====
|
|
2 |
Gadjo
|
|
3 |
=====
|
|
4 |
|
|
5 |
Gadjo is a base template for Django applications, tailored for
|
|
6 |
management interfaces, built to provide a nice and modern look, while
|
|
7 |
using progressive enhancement and responsive designs to adapt to
|
|
8 |
different environments.
|
|
9 |
|
|
10 |
|
|
11 |
Usage
|
|
12 |
=====
|
|
13 |
|
|
14 |
Make your application base template {% extends "gadjo/base.html" %}.
|
|
15 |
|
3 |
16 |
|
4 |
17 |
You should add gadjo.finders.XStaticFinder to STATICFILES_FINDERS,
|
5 |
18 |
|
... | ... | |
14 |
27 |
CDNS = [('google', 'https')]
|
15 |
28 |
|
16 |
29 |
|
17 |
|
Usage
|
18 |
|
=====
|
19 |
|
|
20 |
|
Make your application base template {% extends "gadjo/base.html" %}.
|
|
30 |
Additional static files
|
|
31 |
------------------------
|
21 |
32 |
|
22 |
33 |
Additional static files libraries can be added via INSTALLED_APPS,
|
23 |
34 |
for example 'xstatic.pkg.jquery_tablesorter'; its static files can
|
24 |
35 |
then be referred in a template using the xstatic template tag:
|
25 |
36 |
|
26 |
37 |
{% xstatic 'jquery_tablesorter' 'jquery.tablesorter.js' %}
|
|
38 |
|
|
39 |
|
|
40 |
Progressive enhancement -- Dialogs
|
|
41 |
----------------------------------
|
|
42 |
|
|
43 |
Links marked with rel="popup" will be opened into dialog boxes.
|
|
44 |
|
|
45 |
The dialog title is extracted from "#appbar h2" (this selector can be
|
|
46 |
changed with a @data-title-selector attribute on the anchor tag).
|
|
47 |
|
|
48 |
The dialog content is extracted from "form" (this selector can be
|
|
49 |
changed with a @data-selector attribute).
|
|
50 |
|
|
51 |
Buttons (both <button> and <a>) are extracted from the content and
|
|
52 |
converted into proper dialog buttons. A button with "cancel" as its
|
|
53 |
class will have its action changed to simply close the dialog, without
|
|
54 |
server processing.
|
|
55 |
|
|
56 |
After loading the dialog content, a gadjo:dialog-loaded event is
|
|
57 |
triggered on the anchor with the dialog content as argument.
|
|
58 |
|
|
59 |
Alternatively the server may notice the ajax request and answer with
|
|
60 |
an appropriate JSON response. In that case it should have a 'content'
|
|
61 |
attribute with the HTML content, or a 'location' attribute in case of
|
|
62 |
a redirect.
|
|
63 |
|
|
64 |
In case of such a redirect, a gadjo:dialog-done event is triggered on
|
|
65 |
the anchor and can be cancelled to prevent the default redirect
|
|
66 |
behaviour.
|