Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: bluedynamics/cone.app
base: d0e2560e7e
...
head fork: bluedynamics/cone.app
compare: bcb682afa5
Checking mergeability… Don't worry, you can still create the pull request.
  • 5 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
6 README.rst
@@ -37,6 +37,12 @@ Changes
0.9.3dev
--------
+- Support bdajax overlay continuation as introduced in bdajax 1.4.
+ [rnix, 2012-05-04]
+
+- Move AJAX forms related markup and javascript to bdajax.
+ [rnix, 2012-05-04]
+
- Add property ``head_additional`` to table tile. Supposed to be used for
hooking additional markup to table header.
[rnix, 2012-05-03]
View
27 src/cone/app/browser/ajax.py
@@ -134,10 +134,18 @@ def __init__(self, payload, flavor, selector):
self.selector = selector
-# XXX
-#class AjaxOverlay(object):
-# """Ajax overlay configuration
-# """
+class AjaxOverlay(object):
+ """Ajax overlay configuration. Used to display or close overlays on client
+ side.
+ """
+
+ def __init__(self, selector='#ajax-overlay', action=None, target=None,
+ close=False, content_selector='.overlay_content'):
+ self.selector = selector
+ self.content_selector = content_selector
+ self.action = action
+ self.target = target
+ self.close = close
class AjaxContinue(object):
@@ -178,6 +186,15 @@ def definitions(self):
'flavor': definition.flavor,
'selector': definition.selector,
})
+ if isinstance(definition, AjaxOverlay):
+ continuation.append({
+ 'type': 'overlay',
+ 'selector': definition.selector,
+ 'content_selector': definition.content_selector,
+ 'action': definition.action,
+ 'target': definition.target,
+ 'close': definition.close,
+ })
return continuation
def dump(self):
@@ -234,7 +251,7 @@ def ajax_form_fiddle(request, selector, mode):
while(child != null && child.nodeType == 3) {
child = child.nextSibling;
}
- parent.cone.ajaxformrender(child, '%(selector)s', '%(mode)s');
+ parent.bdajax.render_ajax_form(child, '%(selector)s', '%(mode)s');
parent.bdajax.continuation(%(next)s);
</script>
"""
View
38 src/cone/app/browser/authoring.py
@@ -31,6 +31,7 @@
from cone.app.browser.ajax import (
AjaxAction,
AjaxEvent,
+ AjaxOverlay,
ajax_continue,
ajax_message,
ajax_form_fiddle,
@@ -257,6 +258,43 @@ def form_heading(self):
return heading
+@view_config('overlayform', permission='view')
+def overlayform(model, request):
+ """Overlay form.
+ """
+ return render_form(model, request, 'overlayform')
+
+
+@tile('overlayform', permission='view')
+class OverlayFormTile(ProtectedContentTile):
+ """The overlayform tile is responsible to render forms on given model.
+ """
+ form_tile_name = 'overlayeditform'
+
+ def render(self):
+ return render_tile(self.model, self.request, self.form_tile_name)
+
+
+class OverlayPart(Part):
+ """Form part rendering to overlay.
+ """
+ action_resource = extend('overlayform')
+ overlay_selector = extend('#ajax-form')
+ overlay_content_selector = extend('.overlay_content')
+
+ @plumb
+ def __call__(_next, self, model, request):
+ form = _next(self, model, request)
+ selector = '%s %s' % (self.overlay_selector,
+ self.overlay_content_selector)
+ ajax_form_fiddle(request, selector, 'inner')
+ return form
+
+ @default
+ def next(self, request):
+ return [AjaxOverlay(selector=self.overlay_selector, close=True)]
+
+
@tile('delete', permission="delete")
class DeleteAction(Tile):
View
23 src/cone/app/browser/static/cone.app.js
@@ -25,7 +25,6 @@ if (typeof(window['yafowil']) == "undefined") yafowil = {};
cone.dropdownmenubinder();
cone.transitionmenubinder();
cone.tabletoolbarbinder();
- cone.ajaxformbinder();
cone.sharingbinder();
cone.selectable.binder();
cone.copysupportbinder();
@@ -37,7 +36,6 @@ if (typeof(window['yafowil']) == "undefined") yafowil = {};
dropdownmenubinder: cone.dropdownmenubinder,
transitionmenubinder: cone.transitionmenubinder,
tabletoolbarbinder: cone.tabletoolbarbinder,
- ajaxformbinder: cone.ajaxformbinder,
sharingbinder: cone.sharingbinder,
selectablebinder: cone.selectable.binder,
copysupportbinder: cone.copysupportbinder,
@@ -256,27 +254,6 @@ if (typeof(window['yafowil']) == "undefined") yafowil = {};
params: target.params
});
});
- },
-
- // ajax form related. XXX: move to bdajax
-
- // bind ajax form handling to all forms providing ajax css class
- ajaxformbinder: function(context) {
- var ajaxform = $('form.ajax', context);
- ajaxform.append('<input type="hidden" name="ajax" value="1" />');
- ajaxform.attr('target', 'ajaxformresponse');
- ajaxform.unbind().bind('submit', function(event) {
- bdajax.spinner.show();
- });
- },
-
- // called by iframe response, renders form (i.e. if validation errors)
- ajaxformrender: function(payload, selector, mode) {
- if (!payload) {
- return;
- }
- bdajax.spinner.hide();
- bdajax.fiddle(payload, selector, mode);
}
}
View
6 src/cone/app/browser/templates/main.pt
@@ -15,12 +15,6 @@
</head>
<body>
<tal:bdajax replace="structure tile('bdajax')" />
-
- <iframe id="ajaxformresponse"
- name="ajaxformresponse"
- src="#"
- style="width:0px;height:0px;display:none">
- </iframe>
<div id="wrapper">

No commit comments for this range

Something went wrong with that request. Please try again.