Skip to content

Commit

Permalink
Convert to ember-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Radchenko committed Dec 11, 2014
1 parent eb4e6ec commit 2165012
Show file tree
Hide file tree
Showing 54 changed files with 619 additions and 627 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
}
27 changes: 14 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
# See http://help.github.com/ignore-files/ for more about ignoring files.

pids
logs
results
# compiled output
/dist
/tmp

# dependencies
/node_modules
/bower_components

# misc
/.sass-cache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log
node_modules
/.idea
testem.log
40 changes: 25 additions & 15 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
{
"node" : true,
"browser" : true,

"predef": [
"document",
"window",
"-Promise"
],
"browser": true,
"boss": true,
"curly": true,
"latedef": "nofunc",
"debug": false,
"devel": true,
"eqeqeq": true,
"immed": 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,
"undef": "nofunc",
"strict": true,
"white": true,
"indent": 2,
"trailing": true,
"quotmark": "single",
"multistr": true,
"predef": [
"Ember"
]
"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
23 changes: 23 additions & 0 deletions Brocfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* 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.
app.import('bower_components/bootstrap/dist/css/bootstrap.css');
app.import('bower_components/bootstrap/dist/js/bootstrap.js');

module.exports = app.toTree();
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

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.
90 changes: 15 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,25 @@
pagination-pager
================
# Pagination-pager

Ember Component for Bootstrap 3 Pagination & Pager components
This README outlines the details of collaborating on this Ember addon.

```hbs
{{pagination-pager current=2 count=10}}
```
## Installation

Here's a [demo][1] jsbin, and these are the original Bootstrap Components: [Pagination][2] and [Pager][3].
* `git clone` this repository
* `npm install`
* `bower install`

## Getting Started
## Running

Install via Bower, `bower install pagination-pager --save`, then include in your app.
* `ember server`
* Visit your app at http://localhost:4200.

### Available Options
- `pager` -- Switches to the pager component, defaults to `false`
- `hide` -- Hide the component if `count` equals `1`, defaults to `false`
## Running Tests

#### Required
- `count` -- The number of pages in total, required
- `current` -- The current page number, required
* `ember test`
* `ember test --server`

#### Pagination Only
- `paginationNext` -- The text to display for pagination next button
- `paginationPrevious` -- The text to display for pagination previous button
- `paginationSize` -- The size of the element, default is '', available options include `lg` and `sm`.
- `countOut` -- The number of page links in the begin and end of whole range
- `countIn` -- The number of page links on each side of current page
## Building

#### Pager Only
- `pagerNext` -- The text to display for the pager next button
- `pagerPrevious` -- The text to display for the pager previous button
- `pagerSpread` -- Pager buttons spaced out, defaults to false
* `ember build`

By default the first page is `1`, and the last is the value of `count`, you can change these by setting `firstPage` and `lastPage`.

## Testing

```bash
# install & start server
npm install
npm start

# start watch (in new terminal)
gulp dev
```

## Example Usage


```html
<!doctype html>

<html lang="en">
<head>
<meta charset="utf-8">
<title>pagination-pager</title>

<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
</head>

<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-v1.3.0.js"></script>
<script src="http://builds.emberjs.com/tags/v1.4.0/ember.js"></script>
<script src="https://rawgithub.com/knownasilya/pagination-pager/master/dist/pagination-pager.template.js"></script>
<script src="https://rawgithub.com/knownasilya/pagination-pager/master/dist/pagination-pager.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

<!-- application.hbs template -->
<script type="text/x-handlebars">
{{pagination-pager count=5 current=2}}
</script>

<script>
var App = Ember.Application.create();
</script>
</body>
</html>
```

[1]: http://emberjs.jsbin.com/nuroraxe/2/
[2]: http://getbootstrap.com/components/#pagination
[3]: http://getbootstrap.com/components/#pagination-pager
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.
26 changes: 26 additions & 0 deletions addon/components/page-item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import Ember from 'ember';

var computed = Ember.computed;

export default Ember.Component.extend({
tagName: 'li',
classNameBindings: ['isActive:active'],
seperator: '…',

isActive: computed('page', 'selected', function () {
return this.get('page') === this.get('selected');
}),

isDots: computed('page', function () {
var seperator = this.get('seperator');
var page = this.get('page');

return page === seperator;
}),

actions: {
setCurrent: function () {
this.set('selected', this.get('page'));
}
}
});
Loading

0 comments on commit 2165012

Please sign in to comment.