Skip to content
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 coffeescript bindings #5

Merged
merged 2 commits into from
Apr 11, 2015
Merged
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.1
* Duplicate snippets for CoffeeScript files

## 1.0.0
* Add `Ember.computed.alias` snippet
* Split snippets into different files
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Then reload your Atom.

Example output for `controller`

Javascript:
```js
import Ember from 'ember';

Expand All @@ -44,6 +45,14 @@ export default Ember.ObjectController.extend({
});
```

CoffeeScript:
```coffee
NameController = Ember.Controller.extend
# body

`export default NameController`
```

#### Properties

Used inside Ember objects
Expand All @@ -55,12 +64,20 @@ Used inside Ember objects

Example output for `observes`

JavaScript:
```js
fooChanged: function() {
// body
}.observes('foo'),
```

CoffeeScript:
```coffee
fooChanged: Ember.observer 'foo', ->
# body
```


#### Functions

- `find`
Expand All @@ -73,6 +90,12 @@ fooChanged: function() {

Example output for `find`

JavaScript:
```js
this.store.find('post');
```

CoffeeScript:
```coffee
this.store.find 'post'
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ember-snippets",
"version": "1.0.0",
"version": "1.0.1",
"description": "Ember.js ES6 Snippets for Atom",
"repository": "https://github.com/seifsallam/atom-ember-snippets",
"license": "MIT",
Expand Down
30 changes: 30 additions & 0 deletions snippets/functions.cson
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,33 @@
'Ember Logger Error':
'prefix': 'logger-error'
'body': "Ember.Logger.error('${1:message}');"

'.source.coffee':

'Ember Find':
'prefix': 'find'
'body': "this.store.find${1:(}'${2:model}'${1:)}"

'Ember Find by id':
'prefix': 'find-id'
'body': "this.store.find${1:(}'${2:model}', params.${2:model}_id${1:)}"

'Ember Logger Debug':
'prefix': 'logger-debug'
'body': "Ember.Logger.debug${1:(}\"${1:message}\"${1:)}"

'Ember Logger Log':
'prefix': 'logger-log'
'body': "Ember.Logger.log${1:(}\"${2:message}\"${1:)}"

'Ember Logger Info':
'prefix': 'logger-info'
'body': "Ember.Logger.info${1:(}\"${2:message}\"${1:)}"

'Ember Logger Warn':
'prefix': 'logger-warn'
'body': "Ember.Logger.warn${1:(}\"${2:message}\"${1:)}"

'Ember Logger Error':
'prefix': 'logger-error'
'body': "Ember.Logger.error${1:(}\"${2:message}\"${1:)}"
150 changes: 150 additions & 0 deletions snippets/modules.cson
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,153 @@
${2:// body}
};
"""

'.source.coffee':

'Ember Route':
'prefix': 'route'
'body': """
${1:name}Route = Ember.Route.extend
model: ->
${2:# body}
`export default ${1}Route`
"""

'Ember Controller':
'prefix': 'controller'
'body': """
${1:name}Controller = Ember.Controller.extend
${2:# body}
`export default ${1}Controller`
"""

'Ember Array Controller':
'prefix': 'arr-controller'
'body': """
${1:name}Controller = Ember.ArrayController.extend
${2:# body}
`export default ${1}Controller`
"""

'Ember View':
'prefix': 'view'
'body': """
${1:name}View = Ember.View.extend
${2:# body}
`export default ${1}View`
"""

'Ember Component':
'prefix': 'component'
'body': """
${1:name}Component = Ember.Component.extend
${2:# body}
`export default ${1}Component`
"""

'Ember Mixin':
'prefix': 'mixin'
'body': """
${1:name}Mixin = Ember.Mixin.create
${2:# body}
`export default ${1}Mixin`
"""

'Ember Object':
'prefix': 'object'
'body': """
${1:name} = Ember.Object.extend
${2:# body}
`export default ${1}`
"""

'Ember Helper':
'prefix': 'helper'
'body': """
${1}Helper = Ember.Handlebars.makeBoundHelper ->
${2:# body}
`export default ${1}Helper`
"""

'Ember Model':
'prefix': 'model'
'body': """
${1:name} = DS.Model.extend
${2:# body}
`export default ${1}`
"""

'Ember REST Adapter':
'prefix': 'adapter'
'body': """
${1}Adapter = DS.RESTAdapter.extend
${2:# body}
`export default ${1}Adapter`
"""

'Ember Active Model Adapter':
'prefix': 'active-adapter'
'body': """
${1}Adapter = DS.ActiveModelAdapter.extend
${2:# body}
`export default ${1}Adapter`
"""

'Ember REST Serializer':
'prefix': 'serializer'
'body': """
${1:name}Serializer = DS.RESTSerializer.extend
${2:# body}
`export default ${1}Serializer`
"""

'Ember Active Model Serializer':
'prefix': 'active-serializer'
'body': """
${1:name}Serializer = DS.ActiveModelSerializer.extend
${2:# body}
`export default ${1}Serializer`
"""

'Ember Transform Serializer':
'prefix': 'transform'
'body': """
${1:name}Transformer = DS.Transforms.extend
${2:# body}
`export default ${1}Transformer`
"""

'Ember Initializer':
'prefix': 'initializer'
'body': """
${1:name}Initializer =
name: '${1:name}'
initialize: ->
${2:# body}
`export default ${1}Initializer`
"""

'Ember Utility':
'prefix': 'utility'
'body': """
${1:myUtility} = ->
${2:# body}
`export default ${1:myUtility}`
"""
30 changes: 30 additions & 0 deletions snippets/properties.cson
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,33 @@
'body': """
${1:foo}: Ember.computed.alias('${2:property}'),
"""

'.source.coffee':

'Ember Computed Property':
'prefix': 'property'
'body': """
${1:fooCount}: Ember.computed ${2:'}${3:property}${2:'} ->
${4:# body}
"""

'Ember Observer':
'prefix': 'observes'
'body': """
${1:fooChanged}: Ember.observer${2:(}'${3:property}', ->
${4:# body}
${2:)}
"""

'Ember Actions':
'prefix': 'actions'
'body': """
actions:
${1:# body}
"""

'Ember Computed Alias':
'prefix': 'alias'
'body': """
${1:foo}: Ember.computed.alias${2:(}'${3:property}'${2:)}
"""