Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added autoform type parameter #84

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.build*
.idea
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ inputColClass='col-sm-9'
* ```formId``` defines id of the `quickForm` template. Useful when you want to set your custom autoform hooks.
* ```backdrop``` disables or enables modal-backdrop. Defaults to true (modal can be dismissed by mouse click). To disable use 'static' value. (See more [here](http://getbootstrap.com/javascript/#modals-options))
* ```meteormethod``` if specified meteor method will be called on submit. This has the same effect as passing `type="method"` and `meteormethod` to autoform template. See autoform docs for more details.
* ```type``` if specified the autoform type will be set accordingly. This overwrites anything set by ```meteormethod```. Useful for updating with a method.
* ```onSuccess``` function to be called when operation succeeds. Currently it's supported for `operation="remove"` only.
* ```dialogClass``` can be used to add additional class for `.modal-dialog` (e.g. `modal-sm`)

Expand Down
8 changes: 6 additions & 2 deletions lib/client/modals.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Template.autoformModals.rendered = ->
'cmFormId',
'cmAutoformType',
'cmMeteorMethod',
'cmType',
'cmCloseButtonContent',
'cmCloseButtonClasses'
]
Expand Down Expand Up @@ -100,9 +101,11 @@ helpers =
cmPlaceholder: () ->
Session.get 'cmPlaceholder'
cmFormId: () ->
Session.get('cmFormId') or defaultFormId
Session.get 'cmFormId' or defaultFormId
cmAutoformType: () ->
if Session.get 'cmMeteorMethod'
if Session.get 'cmType'
Session.get 'cmType'
else if Session.get 'cmMeteorMethod'
'method'
else
Session.get 'cmOperation'
Expand Down Expand Up @@ -141,6 +144,7 @@ Template.afModal.events
Session.set 'cmPlaceholder', if t.data.placeholder is true then 'schemaLabel' else ''
Session.set 'cmFormId', t.data.formId
Session.set 'cmMeteorMethod', t.data.meteormethod
Session.set 'cmType', t.data.type
Session.set 'cmModalDialogClass', t.data.dialogClass
Session.set 'cmModalContentClass', t.data.contentClass

Expand Down