-
Notifications
You must be signed in to change notification settings - Fork 22
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
ember-cli-coffee-snippets #2
Changes from all commits
584a961
fb0c079
b465a34
bc648e1
c5c2f21
0cc861a
3c97a41
f862107
80101be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'.source.coffee': | ||
|
||
'Ember fixtureAdapter': | ||
'prefix': 'ds.fixA' | ||
'body': | ||
""" | ||
export = DS.FixtureAdapter.extend() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add body here, like the rest of your methods |
||
""" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you remove extra spacing. Only 1 line between is enough. |
||
|
||
'Ember REST Adapter': | ||
'prefix': 'ds.resA' | ||
'body': | ||
""" | ||
_export = DS.RESTAdapter.extend( | ||
${1:#body} | ||
) | ||
""" | ||
|
||
|
||
'Ember Active Model Adapter': | ||
'prefix': 'ds.actA' | ||
'body': | ||
""" | ||
_export = DS.ActiveModelAdapter.extend( | ||
${1:#body} | ||
) | ||
""" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,243 @@ | ||
|
||
'.source.coffee': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move merge this file's content with existing snippets based on it's type (function, module, property) |
||
|
||
'Ember Route': | ||
'prefix': 'em.rou' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same rule for prefixes too. Please follow my prefixes naming |
||
'body': | ||
""" | ||
_export = Ember.Route.extend( | ||
model: -> | ||
${1:#@store.find("name_of_a_model")} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
) | ||
|
||
""" | ||
|
||
|
||
|
||
'Ember Object Controller': | ||
'prefix': 'em.obj' | ||
'body': | ||
""" | ||
_export = Ember.ObjectController.extend( | ||
${1:#body} | ||
) | ||
|
||
""" | ||
|
||
'Ember Array Controller': | ||
'prefix': 'em.arr' | ||
'body': | ||
""" | ||
_export = Ember.ArrayController.extend( | ||
${1:itemController: 'name_of_an_objectController'} | ||
${2:sortProperties: ['','']} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like this is too complex. Why sorting and why it requires two actions? |
||
${3:sortAscending: false} | ||
${4:actions: | ||
${5:name}: -> | ||
${6:#logic...} | ||
${7:name2}: -> | ||
${8:#logic2...} | ||
} | ||
) | ||
""" | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove extra lines. Only 1 line should do |
||
|
||
|
||
|
||
|
||
'Ember View': | ||
'prefix': 'em.vie' | ||
'body': | ||
""" | ||
_export = Ember.View.extend( | ||
tagName: ${1:"div"} | ||
${2:classNames: ['','']} | ||
${3:classNameBindings: ['','']} | ||
${4:eventManager: Ember.Object.create( | ||
mouseEnter: (event, view) -> | ||
#logic... | ||
return | ||
click: (event, view) -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why mouseEnter and click? |
||
#logic... | ||
return | ||
} | ||
) | ||
|
||
""" | ||
|
||
|
||
|
||
|
||
|
||
|
||
'Ember Component': | ||
'prefix': 'em.com' | ||
'body': | ||
""" | ||
_export = Ember.Component.extend( | ||
${1:#body} | ||
) | ||
|
||
""" | ||
|
||
|
||
|
||
|
||
|
||
|
||
'Ember Mixin': | ||
'prefix': 'em.mix' | ||
'body': | ||
""" | ||
_export = Ember.Mixin.create( | ||
${1:#body} | ||
) | ||
|
||
""" | ||
|
||
|
||
|
||
|
||
|
||
|
||
'Ember Object': | ||
'prefix': 'em.obj' | ||
'body': | ||
""" | ||
_export = Ember.Object.extend( | ||
${1:#body} | ||
) | ||
|
||
""" | ||
|
||
|
||
|
||
|
||
|
||
|
||
'Ember Helper': | ||
'prefix': 'em.hel' | ||
'body': | ||
""" | ||
_export = Ember.Handlebars.makeBoundHelper( -> | ||
${1:#body} | ||
) | ||
|
||
""" | ||
|
||
|
||
|
||
|
||
|
||
|
||
'Ember Model': | ||
'prefix': 'ds.mod' | ||
'body': | ||
""" | ||
_export = DS.Model.extend( | ||
${1:title}: DS.attr(${2:"string"}) | ||
${3:title: DS.attr("boolean")} | ||
${4:title: DS.attr("number")} | ||
${5:title: DS.belongsTo('someModel',async: true)} | ||
${6:title: DS.hasMany('someModel' ,async: true)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see need for adding all this as part of model. I believe it's better to have it's separate autocomplete. |
||
|
||
) | ||
""" | ||
|
||
|
||
|
||
|
||
'Ember REST Serializer': | ||
'prefix': 'ds.resS' | ||
'body': | ||
""" | ||
_export = DS.RESTSerializer.extend( | ||
${1:#body} | ||
) | ||
""" | ||
|
||
|
||
|
||
|
||
|
||
|
||
'Ember Active Model Serializer': | ||
'prefix': 'ds.actS' | ||
'body': | ||
""" | ||
_export = DS.ActiveModelSerializer.extend( | ||
${1:#body} | ||
) | ||
""" | ||
|
||
|
||
|
||
|
||
'Ember Transform Serializer': | ||
'prefix': 'ds.tra' | ||
'body': | ||
""" | ||
_export = DS.Transforms.extend( | ||
deserialize: (jsonFromServer) -> | ||
jsonToApp = ${1:#logic...} | ||
jsonToApp | ||
|
||
serialize: (jsonFromAppToServer) -> | ||
go2server = ${2:#logic...} | ||
go2server | ||
) | ||
""" | ||
|
||
|
||
|
||
'Ember Initializer': | ||
'prefix': 'em.ini' | ||
'body': | ||
""" | ||
_export = Ember.Application.initializer | ||
name: "put_name_of_this_initializer_here" | ||
${1:after : [ | ||
"name_of_other_initializers_to_run_first" | ||
"name_of_other_initializers_to_run_first" | ||
]} | ||
|
||
initialize: (container, application) -> | ||
${2:#logic...} | ||
return | ||
|
||
${3:before : [ | ||
"name_of_other_initializers_to_run_later" | ||
"name_of_other_initializers_to_run_later" | ||
]} | ||
|
||
""" | ||
|
||
|
||
|
||
'Ember Utility': | ||
'prefix': 'utility' | ||
'body': | ||
""" | ||
_export = ${1:myUtility} -> | ||
${2:#body} | ||
|
||
""" | ||
|
||
'Fixture Reopen': | ||
'prefix': 'reo.fix' | ||
'body': | ||
""" | ||
_export.reopenClass FIXTURES: [ | ||
{ | ||
id: 1 | ||
title: "learn ember" | ||
isCompleted: true | ||
author: [10,15,20] #hasMany | ||
author: 12 #bolongTo | ||
} | ||
{ | ||
|
||
} | ||
] | ||
""" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Ember Functions snippets | ||
# | ||
# Examples | ||
# | ||
# `ember<tab>` | ||
# | ||
|
||
'.source.coffee': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move merge this file's content with existing snippets file |
||
|
||
|
||
'Ember Find by id': | ||
'prefix': 'sto.fin' | ||
'body': "@store.find('${1:model}', params.${1:model}_id)" | ||
|
||
|
||
'Create Record in Store': | ||
'prefix': 'sto.cre' | ||
'body': | ||
""" | ||
${1:foo} = @store.createRecord('${2:modelType}', | ||
${3:property} : ${4:property} | ||
) | ||
${1:foo}.save() | ||
""" | ||
|
||
'delete Record in Store': | ||
'prefix': 'sto.del' | ||
'body': | ||
""" | ||
@store.deleteRecord('${1:modelInstance}') | ||
""" | ||
|
||
'fetch Record to Store': | ||
'prefix': 'sto.fet' | ||
'body': | ||
""" | ||
@store.fetch('modelType', params.post_id) | ||
""" | ||
|
||
'modelFor': | ||
'prefix': 'modFor' | ||
'body': | ||
""" | ||
@.modelFor('${1:theNameOfParentRoute}').filterBy(${2:properyName}) | ||
""" | ||
|
||
|
||
|
||
'Ember Logger Debug': | ||
'prefix': 'log.deb' | ||
'body': "Ember.Logger.debug('${1:message}')" | ||
|
||
'Ember Logger Log': | ||
'prefix': 'log.log' | ||
'body': "Ember.Logger.log('${1:message}')" | ||
|
||
'Ember Logger Info': | ||
'prefix': 'log.inf' | ||
'body': "Ember.Logger.info('${1:message}')" | ||
|
||
'Ember Logger Warn': | ||
'prefix': 'log.war' | ||
'body': "Ember.Logger.warn('${1:message}')" | ||
|
||
'Ember Logger Error': | ||
'prefix': 'log.err' | ||
'body': "Ember.Logger.error('${1:message}')" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'.source.coffee': | ||
|
||
'ES6 import Ember': | ||
'prefix': 'im.emb' | ||
'body': | ||
""" | ||
${1:`import Ember from "ember";`} | ||
""" | ||
|
||
'ES6 import DS': | ||
'prefix': 'im.ds' | ||
'body': | ||
""" | ||
${1:`import DS from 'ember-data';`} | ||
""" | ||
|
||
|
||
'ES6 export syntax': | ||
'prefix': 'ex.def' | ||
'body': | ||
""" | ||
`export default ${1:_export};` | ||
""" |
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.
Can you use more clear prefix like
fixture-adapter
, so it's similar to the rest of the rest of the project. Also please apply this concept to the rest of the prefixes. (rest-adapter
,active-adapter
)Can you also move adapters to
modules.cson