Code Monkey home page Code Monkey logo

meteor-autoform-modals's Introduction

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. Add a button to trigger the modal

alt tag

##Example Button Markup##

Insert Example

<a href="#afModal" data-toggle="modal" class="btn btn-primary" collection="Posts" operation="insert" doc="mpb8f7m6x929DwTau">Add a new post</a>

Update Example

<a href="#afModal" data-toggle="modal" class="btn btn-primary" collection="Posts" operation="update" doc="{{_id}}">Update post</a>

Remove Example

<a href="#afModal" data-toggle="modal" class="btn btn-danger" collection="Posts" operation="remove" doc="mpb8f7m6x929DwTau">Delete post</a>

Example with customisation

<a href="#afModal" data-toggle="modal" 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</a>

##Usage## Elements with href="#afModal" and data-toggle="modal" will trigger the modal. The required attributes on this element 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 href="#afModal" element that triggers the modal.

  • title will be the title of the modal (default to html of the button clicked)
  • buttonContent is the html content of the modals' button (default to html of the button clicked)
  • fields is a comma separated list of the only fields that should be in the form. See the autoform docs.
  • omitFields is a comma separated list of fields to omit. See the autoform docs.
  • buttonClasses allows you to add different classes to the submit button. See the autoform docs.
  • prompt a paragraph appears above the form / delete button. Defaults to 'Are you sure?' on delete.

meteor-autoform-modals's People

Contributors

yogiben avatar djhi avatar pbrekelmans avatar gwendall avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.