Message Box
Last Updated: August 10, 2015
- class tethys_sdk.gizmos.MessageBox(name, title, message='', dismiss_button='Cancel', affirmative_button='Ok', affirmative_attributes='', width=560, attributes=None, classes='')
Message box gizmos can be used to display messages to users. These are especially useful for alerts and warning messages. The message box gizmo is implemented using Twitter Bootstrap's modal.
- affirmative_attributes
Use this to place any html attributes on the affirmative button. (e.g.: 'href="/action" onclick="doSomething();"')
- Type:
str
- attributes
A dictionary representing additional HTML attributes to add to the primary element (e.g. {"onclick": "run_me();"}).
- Type:
dict
- classes
Additional classes to add to the primary HTML element (e.g. "example-class another-class").
- Type:
str
Controller Example
pythonfrom tethys_sdk.gizmos import MessageBox message_box = MessageBox(name='sampleModal', title='Message Box Title', message='Congratulations! This is a message box.', dismiss_button='Nevermind', affirmative_button='Proceed', width=400, affirmative_attributes='href=javascript:void(0);') context = { 'message_box': message_box, }
Template Example
python{% load tethys_gizmos %} <a href="#sampleModal" role="button" class="btn btn-success" data-toggle="modal">Show Message Box</a> {% block after_app_content %} {% gizmo message_box %} {% endblock %}