def message_or_dialog(request, message): view = request.view if view.force_redirect or not request.is_xhr: if is_failure(message): messages.error(request, str(message)) else: messages.info(request, message) raise HttpRedirect(request.url) title = 'Failure' if is_failure(message) else 'success' return ajax.dialog(request.environ, hd=title, bd=str(message), modal=True)
def ajax_get_response(self, request): '''Default AJAX GET response. It renders and return a ajax dialog.''' text = request.render(block=True) content_type = request.REQUEST.get('content_type', 'json') media = request.media if content_type == 'json': js = ajax.dialog(request.environ, hd=request.title, bd=text, width=self.dialog_width, height=self.dialog_height, modal=True) else: js = ajax.Text(request.environ, text) js.javascript(media.all_js) return js
def ajax_get_response(self, request): """Default AJAX GET response. It renders and return a ajax dialog.""" text = request.render(block=True) content_type = request.REQUEST.get("content_type", "json") media = request.media if content_type == "json": js = ajax.dialog( request.environ, hd=request.title, bd=text, width=self.dialog_width, height=self.dialog_height, modal=True, ) else: js = ajax.Text(request.environ, text) js.javascript(media.all_js) return js