Changeset 6011


Ignore:
Timestamp:
2 May 2011, 11:44:49 (14 years ago)
Author:
uli
Message:

Register the new styles and scripts as resources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/resources.py

    r5958 r6011  
    131131#:
    132132tabs = ResourceInclusion(waeup_sirp, 'tabs.js',
    133                          depends=[base, jquery, jqueryui])
     133                         depends=[jquery, jqueryui])
     134
     135#: Resource that makes datatables for jQuery UI available.
     136#:
     137#: We register a normal version and a minified version. To make real
     138#: use of datatables you might want to add some specialized CSS like
     139#: `datatable_css` below.
     140datatables = ResourceInclusion(waeup_sirp, 'jquery.dataTables.js',
     141                               minified='jquery.dataTables.min.js',
     142                               depends=[jquery])
     143
     144#: A stylesheet for datatables
     145datatables_css = ResourceInclusion(waeup_sirp, 'datatables.css')
     146                                 
     147#: A resource that turns HTML tables into sortable, searchable and :
     148#: multi-page widgets using jQuery and the dataTables plugin available
     149#: from http://www.datatables.net.
     150#:
     151#: If you want jQuery datatables for some <table> in your page then you
     152#: have to perform two steps:
     153#:
     154#: * In the `update()` method of the responsible view/page/form
     155#:   require the JavaScript code to be rendered into the page:
     156#:
     157#:     from waeup.sirp.browser.resources import datatable
     158#:     ...
     159#:     class MyPage(...):
     160#:       ...
     161#:       def update(self):
     162#:         datatable.need()
     163#:
     164#:   This way all required JavaScripts will be rendered correctly
     165#:   into the HTML page generated.
     166#:
     167#: * Assign a ``datatable`` id to the HTML table you want to tune:
     168#:   
     169#:      <table id="datatable">
     170#:        <thead>
     171#:          <tr>
     172#:            <th>Name</th><th>Title</th>
     173#:          </tr>
     174#:        </thead>
     175#:        <tbody>
     176#:          <tr class="gradeA">
     177#:            <td>Manfred</td><td>Mammoth of the year</td>
     178#:          </tr>
     179#:          <tr class="gradeA">
     180#:            <td>Wolfgang</td><td>Junior</td>
     181#:          </tr>
     182#:        </tbody>
     183#:      </table>
     184#:
     185#: When the HTML is rendered, clicking into one of the tabs will make
     186#: other <div>s disappear. See
     187#:
     188#:   http://jqueryui.com/demos/tabs/
     189#:
     190#: for details.
     191#:
     192datatable = ResourceInclusion(waeup_sirp, 'datatable.js',
     193                              depends=[datatables, datatables_css])
    134194
    135195#: Register basic YUI based CSS as a resource.
     
    153213    waeup_sirp, 'waeuptheme-gray1.css',
    154214    depends=[waeup_base_css])
     215
     216#: A basic theme based on jQuery only (crappy yet).
     217waeuptheme_base = ResourceInclusion(
     218    waeup_sirp, 'empty.css',
     219    depends=[humanity])
Note: See TracChangeset for help on using the changeset viewer.