Permalink
Browse files

Standard list method is now select_filter (shows filter form by defau…

…lt, if configured for the resource), datatable/datalist w/o filter form can be chosen explicitly via URL-method
  • Loading branch information...
1 parent 024cd04 commit e0187972fb8d4ecc211cb7a0178b08b127c01d93 @nursix nursix committed Mar 27, 2013
Showing with 32 additions and 26 deletions.
  1. +1 −1 VERSION
  2. +16 −16 modules/eden/org.py
  3. +13 −7 modules/s3/s3crud.py
  4. +2 −2 private/templates/DRMP/controllers.py
View
@@ -1 +1 @@
-vita-1.0.2-devel-359-gd8a502d (2013-03-27 21:03:34)
+vita-1.0.2-devel-360-g024cd04 (2013-03-27 22:03:36)
View
@@ -2317,22 +2317,22 @@ def model(self):
onaccept=self.org_office_onaccept,
deduplicate=self.org_office_duplicate,
search_method=office_search,
- # Experimental: filter form (used by S3CRUD.select_dl)
- filter_widgets=[
- S3TextFilter(["name", "email", "comments"],
- label=T("Search"),
- comment=T("Search for office by text.")),
- S3OptionsFilter("organisation_id",
- label=messages.ORGANISATION,
- comment=T("Search for office by organization."),
- represent="%(name)s",
- cols=3,
- widget="multiselect"),
- S3OptionsFilter("location_id$L1",
- location_level="L1",
- cols=3,
- widget="multiselect")
- ],
+ ## Experimental: filter form
+ #filter_widgets=[
+ #S3TextFilter(["name", "email", "comments"],
+ #label=T("Search"),
+ #comment=T("Search for office by text.")),
+ #S3OptionsFilter("organisation_id",
+ #label=messages.ORGANISATION,
+ #comment=T("Search for office by organization."),
+ #represent="%(name)s",
+ #cols=3,
+ #widget="multiselect"),
+ #S3OptionsFilter("location_id$L1",
+ #location_level="L1",
+ #cols=3,
+ #widget="multiselect")
+ #],
list_fields=["id",
"name",
"organisation_id", # Filtered in Component views
View
@@ -109,20 +109,25 @@ def apply_method(self, r, **attr):
output = self.read(r, **attr)
elif method == "update":
output = self.update(r, **attr)
+
+ # Standard list view: list-type and hide-filter set by controller
+ # (default: list_type="datatable", hide_filter=False)
elif method == "list":
- output = self.select(r, **attr)
- #output = self.select_filter(r, **attr)
+ #output = self.select(r, **attr)
+ output = self.select_filter(r, **attr)
- # Temporary code for testing
- elif method == "datatable":
+ # URL Methods to explicitly choose list-type and hide-filter in the URL
+ elif method in ("datatable", "datatable_f"):
_attr = Storage(attr)
_attr["list_type"] = "datatable"
+ _attr["hide_filter"] = method == "datatable"
output = self.select_filter(r, **_attr)
- elif method == "datalist":
+ elif method in ("datalist", "datalist_f"):
_attr = Storage(attr)
_attr["list_type"] = "datalist"
+ _attr["hide_filter"] = method == "datalist"
output = self.select_filter(r, **_attr)
-
+
elif method == "validate":
output = self.validate(r, **attr)
elif method == "review":
@@ -1175,8 +1180,9 @@ def select_filter(self, r, **attr):
output["title"] = title
# Filter-form
+ hide_filter = attr.get("hide_filter", False)
filter_widgets = get_config("filter_widgets", None)
- if filter_widgets:
+ if filter_widgets and not hide_filter:
# Where to retrieve filtered data from:
filter_submit_url = attr.get("filter_submit_url",
@@ -109,15 +109,15 @@ def homepage():
if "datalist_dl_post" in request.args:
# DataList pagination or Ajax-deletion request
- request.args = ["datalist"]
+ request.args = ["datalist_f"]
ajax = "list"
elif "datalist_dl_filter" in request.args:
# FilterForm options update request
request.args = ["filter"]
ajax = "filter"
else:
# Default
- request.args = ["datalist"]
+ request.args = ["datalist_f"]
ajax = None
def prep(r):

0 comments on commit e018797

Please sign in to comment.