Skip to content
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
4 changes: 4 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"directory": "bower_components",
"analytics": false
}
33 changes: 33 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true


[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.hbs]
indent_style = space
indent_size = 2

[*.css]
indent_style = space
indent_size = 2

[*.html]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions .ember-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
}
38 changes: 14 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
# bower
bower_components
# See http://help.github.com/ignore-files/ for more about ignoring files.

# node
node_modules
# compiled output
/dist
/tmp

# temporary/dev files and directories
tmp
# dependencies
/node_modules
/bower_components

# sublime text
*.sublime-workspace
*.sublime-project

# windows
Thumbs.db
ehthumbs.db
Desktop.ini

# osx
.DS_Store
.DS_Store?
.AppleDouble
.LSOverride
.Spotlight-V100
.Trashes
._*
Icon
# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
testem.log
32 changes: 32 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"predef": [
"document",
"window",
"-Promise"
],
"browser": true,
"boss": true,
"curly": true,
"debug": false,
"devel": true,
"eqeqeq": true,
"evil": true,
"forin": false,
"immed": false,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": false,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": false,
"eqnull": true,
"esnext": true,
"unused": true
}
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
language: node_js

sudo: false

cache:
directories:
- node_modules

before_install:
- "npm config set spin false"
- "npm install -g npm@^2"

install:
- npm install -g bower
- npm install
- bower install

script:
- npm test
78 changes: 17 additions & 61 deletions Brocfile.js
Original file line number Diff line number Diff line change
@@ -1,65 +1,21 @@
var env = require('broccoli-env').getEnv(),
mergeTrees = require('broccoli-merge-trees'),
pickFiles = require('broccoli-static-compiler'),
concat = require('broccoli-concat'),
uglifyJs = require('broccoli-uglify-js'),
compileLess = require('broccoli-less-single'),
buildTemplates = require('broccoli-template-builder'),
compileTemplates = require('ember-template-compiler'),
sourceTree = 'lib',
templatesTree = 'lib/templates',
stylesTree = 'lib/styles',
templates,
js,
css,
prodJs,
prodCss;
/* jshint node: true */
/* global require, module */

templates = buildTemplates(templatesTree, {
extensions: ['hbs'],
outputFile: 'templates.js',
namespace: 'Ember.TEMPLATES',
compile: function(string) {
return 'Ember.Handlebars.template(' + compileTemplates.precompile(string) + ')';
}
});
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

js = concat(mergeTrees([templates, sourceTree]), {
inputFiles: [
'components/**/*.js',
'templates-top.js',
'templates.js',
'templates-bottom.js',
'main.js'
],
outputFile: '/ember-date-picker.js'
});
var app = new EmberAddon();

css = compileLess(
[stylesTree],
'ember-date-picker.less',
'ember-date-picker.css'
);
// Use `app.import` to add additional libraries to the generated
// output files.
//
// If you need to use different assets in different
// environments, specify an object as the first parameter. That
// object's keys should be the environment name and the values
// should be the asset to use in that environment.
//
// If the library that you are including contains AMD or ES6
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.

//create minified versions for production
if(env === 'production') {
prodJs = uglifyJs(concat(mergeTrees([templates, sourceTree]), {
inputFiles: [
'components/**/*.js',
'templates-top.js',
'templates.js',
'templates-bottom.js',
'main.js'
],
outputFile: '/ember-date-picker.min.js'
}));

prodCss = compileLess(
[stylesTree],
'ember-date-picker.less',
'ember-date-picker.min.css',
{cleancss: true}
);
}

module.exports = mergeTrees(env === 'production' ? [prodJs, prodCss, js, css] : [js, css]);
module.exports = app.toTree();
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2014 William Dami

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 changes: 0 additions & 21 deletions LICENSE.txt

This file was deleted.

59 changes: 41 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ember-date-picker
=================

A lightweight, mobile-optimized, date picker component for ember.js applications.
A lightweight, mobile-optimized, date picker component for ember-cli applications.

**DISCLAIMER:** This is beta software and has yet to be battle tested in a wide range of environments. As such, it should be used with caution in production apps. If you encounter any bugs or browser-specific anomalies, please submit an issue or a pull request. Thanks!

Expand All @@ -13,7 +13,6 @@ http://billdami.com/ember-date-picker/
Features
--------

* Lightweight (~4k javascript / ~1k css, minified and gzipped, including dependencies)
* Spin box style UI for fast date selection (built using [ember-spin-box](https://github.com/billdami/ember-spin-box)</a>)
* Supports mousewheel, keyboard, and touch-based control
* Mobile-optimized slide-up panel UI on small screens (480px width and below)
Expand All @@ -24,10 +23,9 @@ Features
Installation
------------

1. `bower install ember-date-picker` or grab the files in `dist/`.
2. Install [ember-spin-box](https://github.com/billdami/ember-spin-box) dependency (will already be downloaded if you used bower on step 1)
2. Add `dist/ember-date-picker.min.js` to your application's javascript assets.
3. Add `dist/ember-date-picker.min.css` to your application's css assets. Or if you use LESS, and intend to customize the component's styles, you can import `lib/styles/ember-date-picker.less`.
1. Add the following to your ember-cli-project in package.json `"ember-date-picker": "billdami/ember-date-picker"`.
2. Run `npm install`.
3. Run `ember g date-picker` to install the [ember-spin-box](https://github.com/billdami/ember-spin-box) dependency.
4. **Optional:** Install [moment.js](http://momentjs.com/) to enable custom date format parsing/output.

Usage
Expand All @@ -45,26 +43,26 @@ The `controls` parameter of the `{{date-picker-input}}` must reference the `id`
`{{date-picker-input}}` Parameters
-------

* **Any valid HTML text input element attribute**
* **Any valid HTML text input element attribute**
Since `{{date-picker-input}}` renders a regular text input element, any valid HTML attribute (e.g. `value`, `class`, `placeholder`, ect) may be provided.
* **controls** (`string`, required)
* **controls** (`string`, required)
The `id` of the `{{date-picker-controls}}` component that the input is associated with.
* **dateFormat** (`string`)
* **dateFormat** (`string`)
The format for parsed and displayed dates (i.e. the input's value). This parameter **will only be used if moment.js is installed**, otherwise the native [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse) and [Date.toLocaleDateString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString) functions will be used to parse and format dates, respectively. See the [moment.js docs](http://momentjs.com/docs/#/parsing/string-format/) for all available formatting tokens.
* **minYear** (`int|string|bool`, default: `false`)
* **minYear** (`int|string|bool`, default: `false`)
The minimum selectable year. When set to `false`, there is no minimum year. A string value may be provided to specify a year relative to the current date (e.g. `"-10"`, or `"+25"`).
* **maxYear** (`int|string|bool`, default: `false`)
* **maxYear** (`int|string|bool`, default: `false`)
The maximum selectable year. When set to `false`, there is no maximum year. A string value may be provided to specify a year relative to the current date (e.g. `"-10"`, or `"+25"`).
* **onUpdate** (`string`)
* **onUpdate** (`string`)
The name of an action to send when the input's value has been updated. The new value is sent as the action's only parameter.

`{{date-picker-controls}}` Parameters
-------

* **id** (`string`, required)
* **id** (`string`, required)
A unique identifier that `{{date-picker-input}}` uses to associate with the component via its `controls` parameter.
* **i18n** (`object`)
Localized text strings for the controls UI. If provided, this parameter must match exactly the structure of the default i18n object below:
* **i18n** (`object`)
Localized text strings for the controls UI. If provided, this parameter must match exactly the structure of the default i18n object below:

```
{
Expand All @@ -77,9 +75,34 @@ The `controls` parameter of the `{{date-picker-input}}` must reference the `id`
]
}
```
* **dateFormat** (`string`)
* **dateFormat** (`string`)
The default date format for the `{{date-picker-controls}}` component. If an associated `{{date-picker-input}}` specifies its own `dateFormat`, it will override this setting while that input is active.
* **minYear** (`int|string|bool`, default: `false`)
* **minYear** (`int|string|bool`, default: `false`)
The default minimum year for the `{{date-picker-controls}}` component. If an associated `{{date-picker-input}}` specifies its own `minYear`, it will override this setting while that input is active.
* **maxYear** (`int|string|bool`, default: `false`)
* **maxYear** (`int|string|bool`, default: `false`)
The default maximum year for the `{{date-picker-controls}}` component. If an associated `{{date-picker-input}}` specifies its own `maxYear`, it will override this setting while that input is active.


This README outlines the details of collaborating on this Ember addon.

## Installation

* `git clone` this repository
* `npm install`
* `bower install`

## Running

* `ember server`
* Visit your app at http://localhost:4200.

## Running Tests

* `ember test`
* `ember test --server`

## Building

* `ember build`

For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/).
Empty file added addon/.gitkeep
Empty file.
Empty file added app/.gitkeep
Empty file.
Empty file added app/components/.gitkeep
Empty file.
Loading