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={}, 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.
- name¶
str, required
Unique name for the message box
- title¶
str, required
Title that appears at the top of the message box
- message¶
str
Message that will appear in the main body of the message box
str
Title for the dismiss button (a.k.a.: the “Cancel” button)
str
Title for the affirmative action button (a.k.a.: the “OK” button)
- affirmative_attributes¶
str
Use this to place any html attributes on the affirmative button. (e.g.: ‘href=”/action” onclick=”doSomething();”’)
- width¶
int
The width of the message box in pixels
- attributes¶
dict
A dictionary representing additional HTML attributes to add to the primary element (e.g. {“onclick”: “run_me();”}).
- classes¶
str
Additional classes to add to the primary HTML element (e.g. “example-class another-class”).
Example
# CONTROLLER from 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);') # TEMPLATE <a href="#sampleModal" role="button" class="btn btn-success" data-toggle="modal">Show Message Box</a> {% gizmo message_box message_box %}