Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
114 additions
and
15 deletions.
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
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,26 @@ | ||
import Ember from 'ember'; | ||
import getOwner from 'ember-getowner-polyfill'; | ||
|
||
const { | ||
Helper, | ||
assert, | ||
computed, | ||
get | ||
} = Ember; | ||
|
||
export default Helper.extend({ | ||
router: computed(function() { | ||
return getOwner(this).lookup('router:main'); | ||
}).readOnly(), | ||
|
||
compute([actionName, ...params]) { | ||
let router = get(this, 'router'); | ||
assert('[ember-route-action-helper] Unable to lookup router', router); | ||
|
||
return function(...invocationArgs) { | ||
let args = params.concat(invocationArgs); | ||
|
||
router.send(actionName, ...args); | ||
}; | ||
} | ||
}); |
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 @@ | ||
export { default } from 'ember-route-action-helper/helpers/route-action'; |
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
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,12 @@ | ||
import { test } from 'qunit'; | ||
import moduleForAcceptance from '../../tests/helpers/module-for-acceptance'; | ||
|
||
moduleForAcceptance('Acceptance | main'); | ||
|
||
test('it sends a route action', function(assert) { | ||
visit('/thing'); | ||
|
||
andThen(() => assert.equal(currentURL(), '/thing')); | ||
andThen(() => click('#foo-button')); | ||
andThen(() => assert.equal(findWithAssert('#foo-value').text().trim(), 'Hello world Bob!')); | ||
}); |
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ const Router = Ember.Router.extend({ | |
}); | ||
|
||
Router.map(function() { | ||
this.route('thing'); | ||
}); | ||
|
||
export default Router; |
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,11 @@ | ||
import Ember from 'ember'; | ||
|
||
const { Route, set } = Ember; | ||
|
||
export default Route.extend({ | ||
actions: { | ||
updateFoo(...args) { | ||
return set(this, 'controller.foo', args.join(' ')); | ||
} | ||
} | ||
}); |
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 @@ | ||
<h2 id="title">Welcome to Ember</h2> | ||
<h2 id="foo-value">{{foo}}</h2> | ||
|
||
{{outlet}} |
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 @@ | ||
<button id="foo-button" {{action this.attrs.clicked "Bob!"}}>Click Me!</button> |
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,3 @@ | ||
<div class="thing-route"> | ||
{{foo-bar clicked=(route-action "updateFoo" "Hello" "world")}} | ||
</div> |
Empty file.