yogiben / meteor-autoform-modals

Adds modals to insert/update/delete Meteor collections
63 stars 41 forks source link

Meteor Autoform Modals

Adds bootstrap modals to insert/update/remove docs from Meteor collections.

Setup

  1. meteor add yogiben:autoform-modals
  2. Include the template in the layouts that will use the modals {{> autoformModals}}
  3. Use afModal template to create a button that will trigger the modal

alt tag

Maintained by Meteor Factory. Professional Meteor development.

Meteor autoform modals

Example Button Markup

Insert Example

{{#afModal class="btn btn-primary" collection="Posts" operation="insert"}}
  Add a new post
{{/afModal}}

Update Example

{{#afModal class="btn btn-primary" collection="Posts" operation="update" doc=_id}}
  Update post
{{/afModal}}

Remove Example

{{#afModal class="btn btn-danger" collection="Posts" operation="remove" doc=_id}}
  Delete post
{{/afModal}}

Example with customisation

{{#afModal class="btn btn-primary" collection="Posts" omitFields="createdAt,owner,upvotes" operation="update" buttonContent="Update Challenger" prompt="Use this form to update your doc" title="Update your great content" buttonClasses="btn-success"}}
  Update your post
{{/afModal}}

Usage

Use afModal template to create a link that will trigger the modal. The required attributes of this template are collection & operation.

Collection should be the name of the global collection object e.g. Posts.

Operation can be insert,update or remove.

If operation="update or operation="remove" you also need to set the doc property to the _id of the document.

Customisation

It is possible to customise the modals by adding additional attributes to the afModal template.

Callbacks/Hooks

It's possible to add your own autoform callbacks/hooks by setting the formId.