Changes between Version 60 and Version 61 of RESTController


Ignore:
Timestamp:
08/27/10 22:55:52 (15 years ago)
Author:
Dominic König
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TabularUnified RESTController

    v60 v61  
    140140}}}
    141141
    142 The optional '''rheader''' argument helps you to display some information about the primary resource record in the view while operating on a component (e.g. the person's name and ID, when displaying a list of available images for this person). You may pass static content, or a function or lambda to produce content, which will be forwarded as ''rheader'' variable to the view. If rheader is a function or lambda, then it will be called with the current S3Request ("r") as the only argument.
    143 
    144 The tabs functionality is to be implemented by the respective rheader function, it is not generated by the REST controller.
     142The optional '''rheader''' argument helps you to display some information about the primary resource record in the view while operating on a component (e.g. the person's name and ID, when displaying a list of available images for this person). You may pass static content, or a function or lambda to produce content, which will be forwarded as ''rheader'' variable to the view.
     143
     144If for rheader a function or lambda is specified, then it will be called with the current S3Request ("r") as the only argument. Otherwise, rheader is passed to the view as-is.
     145
     146The tabs functionality as in the example is to be implemented by the respective rheader function. This can make use of the helper function shn_rheader_tabs(), which renders tabs into the rheader to enable easy navigation through the resource and its components.
    145147
    146148The "sticky" tag is to specify whether a create/update form of a primary record (=not a component) automatically returns to the list view or not:
    147149  - If rheader is specified, it is assumed True, i.e. the create/update form of the primary record will not return to the list view unless the user clicks on the "List All" button or selects that from the menu. You can override this behavior by setting sticky=False, in which case no rheader (and no tabs) will be rendered in the views of the primary record
    148150  - If no rheader is specified, sticky will be assumed False unless you specify otherwise, hence the create/update forms will return to the list view. An rheader will not be rendered anyway (since not specified).
    149 
    150 If you pass a function or lambda as rheader, then it has to take 5 arguments:
    151   - '''resource''' = name of the primary resource
    152   - '''record_id''' = id of the primary resource record
    153   - '''representation''' = data format of the request
    154   - '''next=None''' = backlink URL to reproduce the request (with empty method)
    155   - '''same=None''' = backlink URL to reproduce the request (with empty method and containing the string '[id]' instead of the primary resource record id)
    156 
    157 The backlinks can be used to reproduce the original request after doing something on the primary resource (e.g., edit or change the selected record).
    158151=== Options ===
    159152There are some options which can be set before invoking the REST controller: