Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkriss committed Dec 11, 2014
0 parents commit b7c797b
Show file tree
Hide file tree
Showing 43 changed files with 574 additions and 0 deletions.
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
}
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp

# dependencies
/node_modules
/bower_components

# 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
21 changes: 21 additions & 0 deletions Brocfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* jshint node: true */
/* global require, module */

var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

var app = new EmberAddon();

// 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.

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

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.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# ember-button-select

A button select component for your ember app.

## Installation

* `npm install --save ember-button-select`

## Usage

In your template:

```hbs
{{#button-select selected=period}}
{{#button-option value='week'}}Week{{/button-option}}
{{#button-option value='month'}}Month{{/button-option}}
{{#button-option value='year'}}Year{{/button-option}}
{{/button-select}}
```

When one of the button options is selected, it will have the 'selected' class set on it. In addition, the `selected` binding that gets passed into the `button-select` component will be updated to the selected buttons `value`.

Styling is left completely to you.
Empty file added addon/.gitkeep
Empty file.
19 changes: 19 additions & 0 deletions addon/components/button-option.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import Em from 'ember';

export default Em.Component.extend({
tagName: 'button',
type: 'button',
classNames: ['button-option'],
classNameBindings: ['isSelected:selected'],
attributeBindings: ['type'],
value: null,
isSelected: false,

register: function() {
this.get('parentView').send('register', this);
}.on('didInsertElement'),

select: function() {
this.get('parentView').send('select', this);
}.on('click')
});
24 changes: 24 additions & 0 deletions addon/components/button-select.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import Em from 'ember';

export default Em.Component.extend({
classNames: ['button-select'],
buttons: null,
selected: null,

setup: function() {
this.buttons = [];
}.on('init'),

actions: {
select: function(button) {
this.set('selected', button.get('value'));
this.buttons.setEach('isSelected', false);
button.set('isSelected', true);
},

register: function(button) {
button.set('isSelected', button.get('value') === this.get('selected'));
this.buttons.addObject(button);
}
}
});
Empty file added app/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions app/components/button-option.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ButtonOption from 'ember-button-select/components/button-option';

export default ButtonOption;
3 changes: 3 additions & 0 deletions app/components/button-select.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import ButtonSelect from 'ember-button-select/components/button-select';

export default ButtonSelect;
17 changes: 17 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "ember-button-select",
"dependencies": {
"handlebars": "~1.3.0",
"jquery": "^1.11.1",
"ember": "1.8.1",
"ember-data": "1.0.0-beta.11",
"ember-resolver": "~0.1.10",
"loader.js": "stefanpenner/loader.js#1.0.1",
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
"ember-qunit": "0.1.8",
"ember-qunit-notifications": "0.0.4",
"qunit": "~1.15.0"
}
}
5 changes: 5 additions & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
'use strict';

module.exports = function(/* environment, appConfig */) {
return { };
};
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* jshint node: true */
'use strict';

module.exports = {
name: 'ember-button-select'
};
41 changes: 41 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "ember-button-select",
"version": "0.1.0",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"start": "ember server",
"build": "ember build",
"test": "ember test"
},
"repository": "https://github.com/jasonkriss/ember-button-select",
"engines": {
"node": ">= 0.10.0"
},
"author": "Jason Kriss",
"license": "MIT",
"devDependencies": {
"broccoli-asset-rev": "^1.0.0",
"broccoli-ember-hbs-template-compiler": "^1.6.1",
"ember-cli": "0.1.3",
"ember-cli-content-security-policy": "0.3.0",
"ember-cli-dependency-checker": "0.0.6",
"ember-cli-esnext": "0.1.1",
"ember-cli-ic-ajax": "0.1.1",
"ember-cli-inject-live-reload": "^1.3.0",
"ember-cli-qunit": "0.1.2",
"ember-data": "1.0.0-beta.11",
"ember-export-application-global": "^1.0.0",
"express": "^4.8.5",
"glob": "^4.0.5"
},
"description": "The default blueprint for ember-cli addons.",
"keywords": [
"ember-addon"
],
"ember-addon": {
"configPath": "tests/dummy/config"
}
}
11 changes: 11 additions & 0 deletions testem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"framework": "qunit",
"test_page": "tests/index.html",
"launch_in_ci": [
"PhantomJS"
],
"launch_in_dev": [
"PhantomJS",
"Chrome"
]
}
74 changes: 74 additions & 0 deletions tests/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"predef": [
"document",
"window",
"location",
"setTimeout",
"$",
"-Promise",
"QUnit",
"define",
"console",
"equal",
"notEqual",
"notStrictEqual",
"test",
"asyncTest",
"testBoth",
"testWithDefault",
"raises",
"throws",
"deepEqual",
"start",
"stop",
"ok",
"strictEqual",
"module",
"moduleFor",
"moduleForComponent",
"moduleForModel",
"process",
"expect",
"visit",
"exists",
"fillIn",
"click",
"keyEvent",
"triggerEvent",
"find",
"findWithAssert",
"wait",
"DS",
"isolatedContainer",
"startApp",
"andThen",
"currentURL",
"currentPath",
"currentRouteName"
],
"node": false,
"browser": false,
"boss": true,
"curly": false,
"debug": false,
"devel": false,
"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
}
Loading

0 comments on commit b7c797b

Please sign in to comment.