https://github.com/choptastic/coldstrap
Bootstrap for Nitrogen Web Framework
https://github.com/choptastic/coldstrap
bootstrap nitrogen
Last synced: about 2 months ago
JSON representation
Bootstrap for Nitrogen Web Framework
- Host: GitHub
- URL: https://github.com/choptastic/coldstrap
- Owner: choptastic
- License: mit
- Created: 2016-01-29T21:35:39.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-31T06:45:55.000Z (over 2 years ago)
- Last Synced: 2025-03-28T12:45:35.750Z (about 1 year ago)
- Topics: bootstrap, nitrogen
- Language: Erlang
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Coldstrap
[Bootstrap](http://getbootstrap.com) elements for the [Nitrogen Web Framework](http://nitrogenproject.com)
### 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](https://github.com/nitrogen/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](http://github.com/richcarl/merl) to your rebar dependencies.
## Elements
To see the elements, check out
[include/records.hrl](https://github.com/choptastic/coldstrap/blob/master/include/records.hrl)
to see which elements are added, and are extended versions of Nitrogen analogs.
## Functions
### modal
Opens a bootstrap [modal](http://getbootstrap.com/javascript/#modals) 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](http://getbootstrap.com/javascript/#modals-options)
### 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:
1. `{ButtonText, Postback}`
2. `{ButtonText, PostbackDelegate, Postback}`
3. 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:
```erlang
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