ผลต่างระหว่างรุ่นของ "CuneiModal"
บรรทัดที่ 2: | บรรทัดที่ 2: | ||
== Design & Pre-made Scripts == | == Design & Pre-made Scripts == | ||
The process of putting up a CuneiModal is designed to be as straigtforward as possible, at least for the most common use cases ''(see notes on [[#Modal Upper Macro & Modal Object|CuneiModal types]] below)''. All one has to do is to surround whatever that go in a modal with 2 extra lines of Jinja2 macros. | |||
<syntaxhighlight lang="css+jinja" line="1"> | |||
{{ CuneiModals.modal_upper_half("<ModalID>", ...) }} | |||
/* Modal content goes here. */ | |||
{{ CuneiModals.modal_lower_half("<ModalID>", ...) }} | |||
</syntaxhighlight> | |||
=== Modal Upper Macro & Modal Object === | === Modal Upper Macro & Modal Object === |
รุ่นแก้ไขเมื่อ 14:59, 20 มิถุนายน 2567
CuneiModals are basically pop-up windows with pre-defined scripts and event handlers to make them work fluently with CuneiForms and CuneiTables. They are purely client-side constructs, so there are no needs to define and initiate them on the server side. It is, however, necessary for the server-side developer to anticipate their existence and, in most cases, their IDs in the server-side code. (See attributes in_modal of CuneiForms and in_modal/bound_modal of CuneiTables.)
Design & Pre-made Scripts
The process of putting up a CuneiModal is designed to be as straigtforward as possible, at least for the most common use cases (see notes on CuneiModal types below). All one has to do is to surround whatever that go in a modal with 2 extra lines of Jinja2 macros.
{{ CuneiModals.modal_upper_half("<ModalID>", ...) }}
/* Modal content goes here. */
{{ CuneiModals.modal_lower_half("<ModalID>", ...) }}
Modal Upper Macro & Modal Object
modal_upper_half(modalid, type="table", title="Look up",
class="primary", head_bg=false, size=false,
first_focus=false)
Parameters | DO NOT rely on argument order farther than modalid and type, ALWAYS PROVIDE argument keywords.
|
Modal Lower Macro
modal_lower_half(modalid, class="success", head_bg=false, hidden=false,
ok_btn="OK", hide_ok=false, addi_btns=[],
close_btn="Close", hide_cancel=false)
Parameters | DO NOT rely on argument order farther than modalid and type, ALWAYS PROVIDE argument keywords.
|