djangofloor.signals.html

Python shortcuts for JS signals

This module only defines shortcuts to existing JS signals. These signals are intended to be called on the JS side from the Python side and allow you to easily modify the client webpage.

djangofloor.signals.html.add(window_info, selector, html_content, to=WINDOW)[source]

Create a new JS object (with jQuery) with elements added to the set of matched elements.

djangofloor.signals.html.add_attribute(window_info, selector, attr_name, attr_value, to=WINDOW)[source]

Adds the specified attribute(s) to each of the set of matched elements.

djangofloor.signals.html.add_class(window_info, selector, class_name, to=WINDOW)[source]

Adds the specified class(es) to each of the set of matched elements.

djangofloor.signals.html.after(window_info, selector, html_content, to=WINDOW)[source]

Insert content, specified by the parameter, before after element in the set of matched elements.

djangofloor.signals.html.append(window_info, selector, html_content, to=WINDOW)[source]

Insert content, specified by the parameter, to the end of each element in the set of matched elements.

djangofloor.signals.html.before(window_info, selector, html_content, to=WINDOW)[source]

Insert content, specified by the parameter, before each element in the set of matched elements.

djangofloor.signals.html.content(window_info, selector, html_content, to=WINDOW)[source]

set the HTML contents of every matched element.

Parameters:
  • window_info – a djangofloor.wsgi.window_info.WindowInfo object
  • html_content – HTML content sent to the client
  • selector – jQuery selector (like “#my_div”)
  • to – list of signal clients
djangofloor.signals.html.download_file(window_info, url, filename=None, to=WINDOW)[source]

Force the client to download the given file.

djangofloor.signals.html.empty(window_info, selector, to=WINDOW)[source]

Remove all child nodes of the set of matched elements from the DOM.

djangofloor.signals.html.fade_in(window_info, selector, duration=400, to=WINDOW)[source]

Display the matched elements by fading them to opaque.

djangofloor.signals.html.fade_out(window_info, selector, duration=400, to=WINDOW)[source]

Hide the matched elements by fading them to transparent.

djangofloor.signals.html.fade_to(window_info, selector, opacity, duration=400, to=WINDOW)[source]

Adjust the opacity of the matched elements.

Parameters:
  • window_infodjangofloor.wsgi.window_info.WindowInfo
  • selector – jQuery selector
  • duration – determining how long the animation will run (ms).
  • opacity – A number between 0 and 1 denoting the target opacity.
  • to – target of the signal
djangofloor.signals.html.fade_toggle(window_info, selector, duration=400, easing='swing', to=WINDOW)[source]

Display or hide the matched elements by animating their opacity.

Parameters:
  • window_infodjangofloor.wsgi.window_info.WindowInfo
  • selector – jQuery selector
  • duration – determining how long the animation will run (ms).
  • easing – A string indicating which easing function to use for the transition.
  • to – target of the signal
djangofloor.signals.html.focus(window_info, selector, to=WINDOW)[source]

Set the focus to the matched element.

djangofloor.signals.html.hide(window_info, selector, duration=400, easing='swing', to=WINDOW)[source]

Hide the matched elements.

djangofloor.signals.html.prepend(window_info, selector, html_content, to=WINDOW)[source]

Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.

djangofloor.signals.html.remove(window_info, selector, to=WINDOW)[source]

Remove the set of matched elements from the DOM.

djangofloor.signals.html.remove_attr(window_info, selector, attr_name, to=WINDOW)[source]

Remove an attribute from each element in the set of matched elements.

djangofloor.signals.html.remove_class(window_info, selector, class_name, to=WINDOW)[source]

Remove a single class, multiple classes, or all classes from each element in the set of matched elements.

djangofloor.signals.html.render_to_client(window_info, template_name, context, selector, to=WINDOW, using=None)[source]

render a template and send the result inside a HTML selector on every selected clients

Parameters:
  • window_info – a djangofloor.wsgi.window_info.WindowInfo object
  • template_name – name of the Django template
  • context – template context (a dict)
  • selector – jQuery selector (like “#my_div”)
  • to – list of signal clients
  • using – the using parameter of Django templates
djangofloor.signals.html.replace_with(window_info, selector, html_content, to=WINDOW)[source]

Replace each element in the set of matched elements with the provided new content.

djangofloor.signals.html.show(window_info, selector, duration=400, easing='swing', to=WINDOW)[source]

Display the matched elements.

djangofloor.signals.html.text(window_info, selector, text_content, to=WINDOW)[source]

Set the text contents of the matched elements.

djangofloor.signals.html.toggle(window_info, selector, duration=400, easing='swing', to=WINDOW)[source]

Display or hide the matched elements.

djangofloor.signals.html.trigger(window_info, selector, event, to=WINDOW)[source]

Execute all handlers and behaviors attached to the matched elements for the given event type.

djangofloor.signals.html.val(window_info, selector, value, to=WINDOW)[source]

Set the value of every matched element.