Coldstrap
Bootstrap elements for the Nitrogen Web Framework
Note about elements
The vast majority of the Coldstrap elements are copies of their respective Nitrogen analogs with a few additional attributes. I will show which are which.
Note about compatibility
Coldstrap depends on the rekt parse
transform and uses the typespecs, which only works with the merl library
(which was added to OTP in Erlang 18). If you're trying to use Coldstrap with
a version of Erlang older than Erlang 18.0, you'll want to add
merl to your rebar dependencies.
Elements
To see the elements, check out include/records.hrl to see which elements are added, and are extended versions of Nitrogen analogs.
Functions
modal
Opens a bootstrap modal window.
coldstrap:modal(Body)coldstrap:modal(Title, Body)coldstrap:modal(Title, Body, Footer)coldstrap:modal(Title, Body, Footer, Options)
Note:Options is a proplist analog to the options presented in the
Bootstrap Modal Docs
confirm
A special modal window specifically for submitting things and providing buttons
Note: Below, the Buttons argument is expected to be a list of tuples, any
of the following are acceptable:
{ButtonText, Postback}{ButtonText, PostbackDelegate, Postback}-
Any valid Nitrogen element (e.g.
#btn{})
The confirm functions
coldstrap:confirm(Body)coldstrap:confirm(Body, CloseText)coldstrap:confirm(Body, Buttons, CloseText)coldstrap:confirm(Title, Body, Buttons, CloseText)
Example:
User = "Chops",
Title = "Delete User",
Body = ["Really delete the user named ",#em{text=User},"?"],
Buttons = [
{"Yes, Delete", {delete, User}},
{"No, Don't Delete, but Disable Account", {disable, User}}
],
CloseText = "No, Do not Delete",
coldstrap:confirm(Title, Body, Buttons, CloseText).close_modal
coldstrap:close_modal()
Licence
Copyright 2016-2017 Jesse Gumm
MIT License