Created
September 6, 2012 14:32
-
-
Save george/3656888 to your computer and use it in GitHub Desktop.
Trying to grok Em.Select
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
SocialRoi.Router = Ember.Router.extend | |
enableLogging: true | |
location: 'hash' | |
root: Ember.Route.extend | |
# removed a bunch of unrelated routing code | |
reports: Ember.Route.extend | |
# SETUP | |
route: '/reports' | |
# EVENTS | |
createReport: Ember.Route.transitionTo 'create' | |
cancel: (router, event) -> | |
router.get('applicationController.transaction').rollback() | |
router.transitionTo('index') | |
save: (router, event) -> | |
router.get('applicationController.transaction').commit() | |
router.transitionTo('index') | |
# STATES | |
index: Ember.Route.extend | |
# SETUP | |
route: '/' | |
connectOutlets: (router) -> | |
router.get('applicationController').connectOutlet 'reports', SocialRoi.Report.find() | |
create: Ember.Route.extend | |
# SETUP | |
route: '/new' | |
connectOutlets: (router) -> | |
transaction = router.get('store').transaction() | |
report = transaction.createRecord(SocialRoi.Report) | |
router.get('applicationController').set('transaction', transaction) | |
router.get('applicationController').connectOutlet | |
viewClass: SocialRoi.NewReportView | |
controller: router.get('reportController') | |
context: report | |
# EVENTS | |
unroutePath: (router, path) -> | |
router.get('applicatinoController.transaction').rollback() | |
@_super(router, path) |
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
SocialRoi.Enterprise = DS.Model.extend | |
name: DS.attr('string') | |
eto_guid: DS.attr('string') |
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
SocialRoi.NewReportView = Ember.View.extend | |
templateName: 'reports/new' |
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
SocialRoi.Report = DS.Model.extend | |
name: DS.attr('string') | |
configuration_state: DS.attr('string') | |
enterprise_guid: DS.attr('string') | |
enterprise_name: DS.attr('string') | |
enterprise_guid: DS.attr('string') | |
site_name: DS.attr('string') | |
site_id: DS.attr('number') | |
program_name: DS.attr('string') | |
program_id: DS.attr('number') | |
enterprises: (-> | |
SocialRoi.Enterprise.find() | |
).property() |
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
SocialRoi.ReportController = Em.ObjectController.extend() |
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
SocialRoi.ReportFormView = Em.View.extend | |
templateName: 'reports/form' | |
didInsertElement: -> | |
@$(':text:visible:enabled:first').focus() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment