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