-
Notifications
You must be signed in to change notification settings - Fork 44
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-on works for Ember Engines #55
Open
kkgomez2
wants to merge
6
commits into
twokul:master
Choose a base branch
from
kkgomez2:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f0fa46f
Working state whoa!
kkgomez2 76b1162
Brand spankin new!!!!!
kkgomez2 8a0fdab
rename to ember
kkgomez2 32cd925
Changed min-height to width for Firefox
kkgomez2 1da1914
Oh wait I need this
kkgomez2 ea84747
Merge pull request #1 from kkgomez2/topic/make-it-work
kkgomez2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
root: true, | ||
parserOptions: { | ||
ecmaVersion: 6, | ||
sourceType: 'module' | ||
}, | ||
extends: 'eslint:recommended', | ||
env: { | ||
browser: true | ||
}, | ||
rules: { | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
bower_components/ | ||
tests/ | ||
tmp/ | ||
dist/ | ||
|
||
/bower_components | ||
/config/ember-try.js | ||
/dist | ||
/tests | ||
/tmp | ||
**/.gitkeep | ||
.bowerrc | ||
.editorconfig | ||
.ember-cli | ||
.gitignore | ||
.eslintrc.js | ||
.watchmanconfig | ||
.travis.yml | ||
.npmignore | ||
**/.gitkeep | ||
bower.json | ||
ember-cli-build.js | ||
Brocfile.js | ||
testem.json | ||
testem.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,40 @@ | ||
--- | ||
language: node_js | ||
node_js: | ||
- "0.12" | ||
- "6" | ||
|
||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- node_modules | ||
- $HOME/.npm | ||
- $HOME/.cache # includes bowers cache | ||
|
||
env: | ||
matrix: | ||
- EMBER_TRY_SCENARIO=ember-release | ||
- EMBER_TRY_SCENARIO=ember-beta | ||
- EMBER_TRY_SCENARIO=ember-canary | ||
# we recommend testing LTS's and latest stable release (bonus points to beta/canary) | ||
- EMBER_TRY_SCENARIO=ember-lts-2.4 | ||
- EMBER_TRY_SCENARIO=ember-lts-2.8 | ||
- EMBER_TRY_SCENARIO=ember-release | ||
- EMBER_TRY_SCENARIO=ember-beta | ||
- EMBER_TRY_SCENARIO=ember-canary | ||
- EMBER_TRY_SCENARIO=ember-default | ||
|
||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- env: EMBER_TRY_SCENARIO=ember-beta | ||
- env: EMBER_TRY_SCENARIO=ember-canary | ||
|
||
before_install: | ||
- "npm config set spin false" | ||
- "npm install -g npm@^2" | ||
- npm config set spin false | ||
- npm install -g bower phantomjs-prebuilt | ||
- bower --version | ||
- phantomjs --version | ||
|
||
install: | ||
- npm install -g bower | ||
- npm install | ||
- bower install | ||
|
||
script: | ||
- ember try $EMBER_TRY_SCENARIO test | ||
# Usually, it's ok to finish the test scenario without reverting | ||
# to the addon's original dependency state, skipping "cleanup". | ||
- node_modules/.bin/ember try:one $EMBER_TRY_SCENARIO test --skip-cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"ignore_dirs": ["tmp"] | ||
"ignore_dirs": ["tmp", "dist"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,139 +1,27 @@ | ||
# ember-lazy-image | ||
|
||
[![Build Status](https://travis-ci.org/twokul/ember-lazy-image.svg)](https://travis-ci.org/twokul/ember-lazy-image) | ||
|
||
`ember-lazy-image` is a component that allows you to gracefully handle image loading. | ||
|
||
Component will load images lazily, only if they appeared in the view port. | ||
This optimization brings page load time down. | ||
|
||
Default loading placeholder is stolen from [aurer](https://github.com/aurer) and his awesome [codepen](http://codepen.io/aurer/pen/jEGbA). | ||
|
||
### Installation | ||
|
||
From inside your ember-cli project, run the following: | ||
|
||
```bash | ||
ember install ember-lazy-image | ||
``` | ||
|
||
#### Installation for ember-cli 0.1.5 - 0.2.2 | ||
|
||
```bash | ||
ember install:addon ember-lazy-image | ||
``` | ||
|
||
#### Installation without ember-cli | ||
|
||
```bash | ||
npm install ember-lazy-image --save | ||
``` | ||
|
||
### lazy-image | ||
|
||
```hbs | ||
{{lazy-image url='http://my-valid-url.com/foo.jpg'}} | ||
``` | ||
|
||
Component will wait until the image is loaded and while waiting it will show default | ||
loading placeholder (see above). | ||
|
||
You can customize `loading` placeholder by passing it as an parameter: | ||
|
||
```hbs | ||
{{#lazy-image url='http://my-valid-url.com/foo.jpg'}} | ||
<!-- custom template goes here, spinner, svg, etc. --> | ||
{{/lazy-image}} | ||
``` | ||
|
||
You can also define the fallback if the image failed to load. By default, component will render | ||
`Image failed to load` text. | ||
|
||
You can customize `error` text by passing it as an parameter: | ||
|
||
```hbs | ||
{{lazy-image url='http://my-not-valid-url.com/foo.jpg' errorText='Something went wrong.'}} | ||
``` | ||
|
||
### `width`, `height` and `data-*` attributes | ||
|
||
Lazy Image supports `width`, `height` and `data-*` attribute bindings. | ||
|
||
```hbs | ||
{{lazy-image url='http://my-valid-url.com/foo.jpg' width=400 height=400 data-foo-bar="my-foo-bar"}} | ||
{{lazy-image url='http://my-valid-url.com/foo.jpg' width=400 height=400 data-foo-bar=foo.bar.path}} | ||
``` | ||
|
||
### `class` attribute | ||
|
||
You can also pass class names for the image element. | ||
|
||
```hbs | ||
{{lazy-image url='http://my-valid-url.com/foo.jpg' class='foo-bar baz-bar'}} | ||
``` | ||
|
||
### `alt` attribute | ||
|
||
You can pass the alt attribute to the component and it will be rendered on the image element | ||
|
||
```hbs | ||
{{lazy-image url='http://my-valid-url.com/foo.jpg' alt='foo description'}} | ||
``` | ||
|
||
### ember-in-viewport options | ||
|
||
Lazy Image uses [ember-in-viewport](https://github.com/dockyard/ember-in-viewport/) for viewport detection. Due to the way listeners and `requestAnimationFrame` is setup, you'll have to override the `ember-in-viewport` options by creating `app/components/lazy-image.js`: | ||
|
||
```js | ||
// app/components/lazy-image.js | ||
|
||
import Ember from 'ember'; | ||
import LazyImage from 'ember-lazy-image/components/lazy-image'; | ||
|
||
export default LazyImage.extend({ | ||
viewportOptionsOverride: Ember.on('didInsertElement', function() { | ||
Ember.setProperties(this, { | ||
viewportUseRAF : true, | ||
viewportSpy : false, | ||
viewportRefreshRate : 150, | ||
viewportTolerance: { | ||
top : 50, | ||
bottom : 50, | ||
left : 20, | ||
right : 20 | ||
} | ||
}); | ||
}) | ||
}); | ||
``` | ||
|
||
See [Advanced usage (options)](https://github.com/dockyard/ember-in-viewport/tree/1.0.0#advanced-usage-options) for more in detail `ember-in-viewport` options. | ||
|
||
The use of `threshold` is deprecated in favor of `viewportTolerance`. | ||
|
||
### Experimental `lazy-background-image` | ||
|
||
This is an experimental component that will add `background-image` style attribute to a component's `div`. It also | ||
sets `min-height` attribute to `270px` so the image is visible. You should be able to overwrite it by using `lazy-background-image` class. | ||
This README outlines the details of collaborating on this Ember addon. | ||
|
||
## Installation | ||
|
||
* `git clone` this repository | ||
* `git clone <repository-url>` this repository | ||
* `cd ember-lazy-image` | ||
* `npm install` | ||
* `bower install` | ||
|
||
## Running | ||
|
||
* `ember server` | ||
* Visit your app at http://localhost:4200. | ||
* `ember serve` | ||
* Visit your app at [http://localhost:4200](http://localhost:4200). | ||
|
||
## Running Tests | ||
|
||
* `npm test` (Runs `ember try:each` to test your addon against multiple Ember versions) | ||
* `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/). | ||
For more information on using ember-cli, visit [https://ember-cli.com/](https://ember-cli.com/). |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The readme should probably stay the same?