diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c91ded..652601d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index f78fa2b..b920d88 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Then reload your Atom. Example output for `controller` ⇥ +Javascript: ```js import Ember from 'ember'; @@ -44,6 +45,14 @@ export default Ember.ObjectController.extend({ }); ``` +CoffeeScript: +```coffee +NameController = Ember.Controller.extend + # body + +`export default NameController` +``` + #### Properties Used inside Ember objects @@ -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` ⇥ @@ -73,6 +90,12 @@ fooChanged: function() { Example output for `find` ⇥ +JavaScript: ```js this.store.find('post'); ``` + +CoffeeScript: +```coffee +this.store.find 'post' +``` diff --git a/package.json b/package.json index 5dfe515..f50ef89 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/snippets/functions.cson b/snippets/functions.cson index 653385c..d9bb516 100644 --- a/snippets/functions.cson +++ b/snippets/functions.cson @@ -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:)}" diff --git a/snippets/modules.cson b/snippets/modules.cson index 42fd242..9f6c14d 100644 --- a/snippets/modules.cson +++ b/snippets/modules.cson @@ -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}` + """ diff --git a/snippets/properties.cson b/snippets/properties.cson index f52709d..0f3cf5e 100644 --- a/snippets/properties.cson +++ b/snippets/properties.cson @@ -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:)} + """