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

Add template, label & input classes, and placeholder options #31

Merged
merged 1 commit into from
Feb 27, 2015
Merged
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
18 changes: 17 additions & 1 deletion lib/client/modals.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ Template.autoformModals.rendered = ->
'cmButtonContent',
'cmTitle',
'cmButtonClasses',
'cmPrompt'
'cmPrompt',
'cmTemplate',
'cmLabelClass',
'cmInputColClass',
'cmPlaceholder'
]
delete Session.keys[key] for key in sessionKeys

Expand Down Expand Up @@ -71,6 +75,14 @@ helpers =
Session.get 'cmButtonClasses'
cmPrompt: () ->
Session.get 'cmPrompt'
cmTemplate: () ->
Session.get 'cmTemplate'
cmLabelClass: () ->
Session.get 'cmLabelClass'
cmInputColClass: () ->
Session.get 'cmInputColClass'
cmPlaceholder: () ->
Session.get 'cmPlaceholder'
title: () ->
StringTemplate.compile '{{{cmTitle}}}', helpers
prompt: () ->
Expand All @@ -94,6 +106,10 @@ Template.afModal.events
Session.set 'cmOmitFields', t.data.omitFields
Session.set 'cmButtonHtml', html
Session.set 'cmTitle', t.data.title or html
Session.set 'cmTemplate', t.data.template
Session.set 'cmLabelClass', t.data.labelClass
Session.set 'cmInputColClass', t.data.inputColClass
Session.set 'cmPlaceholder', if t.data.placeholder is true then 'schemaLabel' else ''

if t.data.doc
Session.set 'cmDoc', collectionObj(t.data.collection).findOne _id: t.data.doc
Expand Down
2 changes: 1 addition & 1 deletion lib/client/modals.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h4 class="modal-title">{{{title}}}</h4>
{{#if $and cmCollection cmOperation}}
<p>{{{prompt}}}</p>
{{#if $neq cmOperation 'remove'}}
{{> quickForm title=cmTitle id="cmForm" collection=cmCollection doc=cmDoc type=cmOperation buttonContent=cmButtonContent fields=cmFields omitFields=cmOmitFields buttonClasses=cmButtonClasses}}
{{> quickForm title=cmTitle id="cmForm" collection=cmCollection doc=cmDoc type=cmOperation buttonContent=cmButtonContent fields=cmFields omitFields=cmOmitFields template=cmTemplate label-class=cmLabelClass input-col-class=cmInputColClass buttonClasses=cmButtonClasses afFieldInput-placeholder=cmPlaceholder}}
{{/if}}
{{/if}}
</div>
Expand Down