Skip to content

Commit

Permalink
adjust and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
aldeed committed Dec 29, 2014
1 parent 3582ae2 commit 8c43050
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .versions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
aldeed:autoform@4.0.0
aldeed:autoform-bs-datepicker@1.0.5
aldeed:autoform-bs-datepicker@1.1.0
aldeed:simple-schema@1.1.0
base64@1.0.2
blaze@2.0.4
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Or on the `afFieldInput` component or any component that passes along attributes
{{> afFieldInput name="typeTest" type="bootstrap-datepicker"}}
```

## Automatic Type Conversions

This input type is intended to be used with `type: Date` schema keys, but it also works with other schema types. Here's a list:

* `Date`: Value is stored as a `Date` object representing midnight in the UTC timezone on the morning of the selected date.
Expand All @@ -59,6 +61,31 @@ This input type is intended to be used with `type: Date` schema keys, but it als

To provide bootstrap-datepicker options, set a `datePickerOptions` attribute equal to a helper that returns the options object. Most of the `data-date` attributes that the plugin recognizes should also work.

## Customizing Appearance

To easily add an input group add-on after the field, just provide the classes for the span in a `buttonClasses` attribute:

```js
{{> afFieldInput name="typeTest" type="bootstrap-datepicker" buttonClasses="glyphicon glyphicon-calendar"}}
```

If you want to customize the appearance of the input more, for example to use input group add-ons both before and after the field, use the [aldeed:template-extension](https://atmospherejs.com/aldeed/template-extension) package to replace the "afBootstrapDatepicker" template, like this:

```html
<template name="dpReplacement">
<div class='input-group date'>
<input type="text" value="" {{atts}}/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</template>
```

```js
Template.dpReplacement.replaces("afBootstrapDatepicker");
```

## Demo

[Live](http://autoform.meteor.com/types)
Expand Down
5 changes: 2 additions & 3 deletions autoform-bs-datepicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
<div class="input-group date">
<input type="text" value="" {{atts}}/><span class="input-group-addon"><i class="{{atts.buttonClasses}}"></i></span>
</div>
{{/if}}
{{#unless atts.buttonClasses}}
{{else}}
<input type="text" value="" {{atts}}/>
{{/unless}}
{{/if}}
</template>
2 changes: 1 addition & 1 deletion autoform-bs-datepicker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global AutoForm */
/* global AutoForm, $ */

AutoForm.addInputType("bootstrap-datepicker", {
template: "afBootstrapDatepicker",
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package.describe({
name: 'aldeed:autoform-bs-datepicker',
summary: 'Custom bootstrap-datepicker input type for AutoForm',
version: '1.0.5',
version: '1.1.0',
git: 'https://github.com/aldeed/meteor-autoform-bs-datepicker.git'
});

Expand Down

0 comments on commit 8c43050

Please sign in to comment.