MeteorStuff / meteor-materialize-modal

A modal object with materialize styling
http://materializemodal.meteor.com
9 stars 5 forks source link

Meteor-Materialize-Modal

A pattern to display application modal dialogs via Materialize, written in coffeescript.

Demo Site

Warning: Only tested on Meteor 1.2+

Note

Before submitting an issue please make sure that the issue is not a problem in [materializecss](http://materializecss.com). All the CSS except for the full screen modal is pulled from the [materializecss](http://materializecss.com) framework and we try not to fix issues with that framework in this package.

Version 1.0 Changes

Install

meteor add meteorstuff:materialize-modal

or for the old callback version

meteor add meteorstuff:materialize-modal@=0.4.0

You are required to get Materialize on your own, either from a package or inserting it manually into your meteor app. This allows you to either use a CSS or SASS version for more customization.

Usage

    MaterializeModal.[message|alert|error|confirm|prompt|form|loading|progress](options={})

Options

UI

You can change the UI by overwriting the CSS.

.materialize-modal {
  // See source for all the css vars
}

Examples

To display a modal


MaterializeModal.message
    title: 'Title'
    message: 'some message'

MaterializeModal.alert
    message: 'some message'

MaterializeModal.error
    message: 'some message'

MaterializeModal.confirm
    title: 'title'
    message: 'You feeling groovy?'
    callback: (error, rtn) ->
        if rtn?.submit
            Materialize.toast("Glad to here it!", 3000, 'green')
        else
            Materialize.toast("Too bad")

MaterializeModal.prompt
    message: 'Enter something'
    callback: (error, rtn) ->
        if rtn?.submit
            Materialize.toast("You entered #{rtn.value}", 3000, 'green')

MaterializeModal.form
    bodyTemplate: 'testForm'
    callback: (error, rtn ->
        if rtn.submit
            console.log("Form data", rtn.value)         

Notes

There might be are more undocumented options that need to be documented. See code.

License

MIT