diff --git a/app/controllers/courses/new.js b/app/controllers/courses/new.js index 96b491d..021a43b 100644 --- a/app/controllers/courses/new.js +++ b/app/controllers/courses/new.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -var CoursesNewController = Ember.ObjectController.extend({ +var CoursesNewController = Ember.Controller.extend({ stateAbbreviations: ["","AK","AL","AR","AZ","CA","CO", "CT","DC","DE","FL","GA","GU","HI","IA","ID","IL", "IN","KS","KY","LA","MA","MD","ME","MH","MI","MN", diff --git a/app/controllers/current-user.js b/app/controllers/current-user.js index 5934e3c..fb3c0a7 100644 --- a/app/controllers/current-user.js +++ b/app/controllers/current-user.js @@ -1,5 +1,6 @@ import Ember from 'ember'; +// TODO: Update to simply 'Controller' after getting rid of janky auth var CurrentUserController = Ember.ObjectController.extend({ isAuthenticated: function() { return this.get('model.isLoaded'); diff --git a/app/controllers/password/edit.js b/app/controllers/password/edit.js index 6bae07e..dc82b51 100644 --- a/app/controllers/password/edit.js +++ b/app/controllers/password/edit.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -var PasswordEditController = Ember.ObjectController.extend({ +var PasswordEditController = Ember.Controller.extend({ needs: "sessions", showPasswordError: false, @@ -8,12 +8,13 @@ var PasswordEditController = Ember.ObjectController.extend({ changePassword: function() { var _this = this, password = this.get('model'), - isValidPassword = this.get('password') === this.get('passwordConfirmation'); + isValidPassword = password.get('password') === password.get('passwordConfirmation'); if (isValidPassword) { password.save().then(function(user) { var email = user.get('email'), - password = _this.get('password'); + password = user.get('password'); + _this.get('controllers.sessions').send('loginWithCredentials', email, password); }); } else { diff --git a/app/controllers/profile/settings.js b/app/controllers/profile/settings.js index 1c6bee3..d4c1373 100644 --- a/app/controllers/profile/settings.js +++ b/app/controllers/profile/settings.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -var ProfileSettingsController = Ember.ObjectController.extend({ +var ProfileSettingsController = Ember.Controller.extend({ actions: { saveChanges: function() { this.get('model').save(); diff --git a/app/controllers/review/edit.js b/app/controllers/review/edit.js index 87954b4..8647a23 100644 --- a/app/controllers/review/edit.js +++ b/app/controllers/review/edit.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -var ReviewEditController = Ember.ObjectController.extend({ +var ReviewEditController = Ember.Controller.extend({ ratingChoices: [1,2,3,4,5,6,7,8,9,10], actions: { diff --git a/app/controllers/reviews/index.js b/app/controllers/reviews/index.js index 41cb6e3..29f1956 100644 --- a/app/controllers/reviews/index.js +++ b/app/controllers/reviews/index.js @@ -15,7 +15,7 @@ var ReviewsIndexController = Ember.ArrayController.extend({ isAlreadyReviewed: function () { var currentUserId = this.get('currentUser.id'), - currentUserReview = this.get('content').findBy('user.id', currentUserId); + currentUserReview = this.get('content').findBy('model.user.id', currentUserId); return !!currentUserReview; }.property('content'), diff --git a/app/controllers/reviews/new.js b/app/controllers/reviews/new.js index 27e2537..cc0776f 100644 --- a/app/controllers/reviews/new.js +++ b/app/controllers/reviews/new.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -var ReviewsNewController = Ember.ObjectController.extend({ +var ReviewsNewController = Ember.Controller.extend({ ratingChoices: [1,2,3,4,5,6,7,8,9,10], diff --git a/app/controllers/round/index.js b/app/controllers/round/index.js index bdd4614..f165934 100644 --- a/app/controllers/round/index.js +++ b/app/controllers/round/index.js @@ -1,21 +1,21 @@ import Ember from 'ember'; -var RoundIndexController = Ember.ObjectController.extend({ +var RoundIndexController = Ember.Controller.extend({ columnWidth: function() { - var scorecardColumns = this.get('scorecards.length'); + var scorecardColumns = this.get('model.scorecards.length'); var scorecardColumnPercentage = 100 / scorecardColumns; return 'width: ' + scorecardColumnPercentage + '%;'; - }.property('scorecards.length'), + }.property('model.scorecards.length'), holeNumbers: function() { - var turnsCount = this.get('scorecards.firstObject.turns.length'); + var turnsCount = this.get('model.scorecards.firstObject.turns.length'); var holeNumbers = new Array(turnsCount) .join().split(',') .map(function(item, index){ return ++index; }); return holeNumbers; - }.property('scorecards.firstObject.turns.length') + }.property('model.scorecards.firstObject.turns.length') }); diff --git a/app/controllers/rounds/new.js b/app/controllers/rounds/new.js index 832d25a..d955d76 100644 --- a/app/controllers/rounds/new.js +++ b/app/controllers/rounds/new.js @@ -1,17 +1,17 @@ import Ember from 'ember'; -var RoundsNewController = Ember.ObjectController.extend({ +var RoundsNewController = Ember.Controller.extend({ selectedPlayer: null, query: null, nearestCourses: false, potentialPlayers: function() { var friends = this.get('friends'); - var players = this.get('players'); + var players = this.get('model.players'); players.forEach(function(p) { friends.removeObject(p); }); return friends; - }.property('friends.@each', 'players.@each'), + }.property('friends.@each', 'model.players.@each'), noPlayerSelected: function() { @@ -20,13 +20,13 @@ var RoundsNewController = Ember.ObjectController.extend({ actions: { addPlayer: function() { - this.get('players').addObject(this.get('selectedPlayer')); + this.get('model.players').addObject(this.get('selectedPlayer')); this.set('selectedPlayer', null); this.set('query', null); }, removePlayer: function(player) { - this.get('players').removeObject(player); + this.get('model.players').removeObject(player); }, updateCourseInput: function(nearestCourse) { diff --git a/app/controllers/users/new.js b/app/controllers/users/new.js index 7d13ff1..18d2a6c 100644 --- a/app/controllers/users/new.js +++ b/app/controllers/users/new.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -var UsersNewController = Ember.ObjectController.extend({ +var UsersNewController = Ember.Controller.extend({ needs: "sessions", actions: { @@ -9,9 +9,9 @@ var UsersNewController = Ember.ObjectController.extend({ user = this.get('model'); if (user.get('hasValidPassword')) { - user.save().then(function() { - var email = self.get('email'), - password = self.get('password'); + user.save().then(function(user) { + var email = user.get('email'), + password = user.get('password'); self.get('controllers.sessions').send("loginWithCredentials", email, password); }); diff --git a/app/templates/courses/new.hbs b/app/templates/courses/new.hbs index 3966456..70f0664 100644 --- a/app/templates/courses/new.hbs +++ b/app/templates/courses/new.hbs @@ -7,25 +7,25 @@ - {{input value=name type="text" id="name" required=true classNames="form-control"}} + {{input value=model.name type="text" id="name" required=true classNames="form-control"}}
- {{input value=city type="text" id="city" required=true classNames="form-control"}} + {{input value=model.city type="text" id="city" required=true classNames="form-control"}}
- {{view "select" content=stateAbbreviations value=state required=true classNames="form-control"}} + {{view "select" content=stateAbbreviations value=model.state required=true classNames="form-control"}}
- {{input value=holeCount type="number" id="holeCount" required=true min=9 max=27 classNames="form-control"}} + {{input value=model.holeCount type="number" id="holeCount" required=true min=9 max=27 classNames="form-control"}}

For now, Frolfr only supports U.S. courses diff --git a/app/templates/password/edit.hbs b/app/templates/password/edit.hbs index ad734ec..8779c87 100644 --- a/app/templates/password/edit.hbs +++ b/app/templates/password/edit.hbs @@ -7,13 +7,13 @@ - {{input value=password type="password" id="password" required=true classNames="form-control"}} + {{input value=model.password type="password" id="password" required=true classNames="form-control"}}

- {{input value=passwordConfirmation type="password" id="passwordConfirmation" required=true classNames="form-control"}} + {{input value=model.passwordConfirmation type="password" id="passwordConfirmation" required=true classNames="form-control"}}
{{#if showPasswordError}}

@@ -24,4 +24,4 @@ - \ No newline at end of file + diff --git a/app/templates/profile/settings.hbs b/app/templates/profile/settings.hbs index 7ec0864..399c8db 100644 --- a/app/templates/profile/settings.hbs +++ b/app/templates/profile/settings.hbs @@ -9,28 +9,28 @@ - {{input value=firstName type="text" id="firstName" required=true classNames="form-control"}} + {{input value=model.firstName type="text" id="firstName" required=true classNames="form-control"}}

- {{input value=middleName type="text" id="middleName" classNames="form-control"}} + {{input value=model.middleName type="text" id="middleName" classNames="form-control"}}
- {{input value=lastName type="text" id="lastName" required=true classNames="form-control"}} + {{input value=model.lastName type="text" id="lastName" required=true classNames="form-control"}}
-
-
@@ -42,9 +42,9 @@

Avatar

-{{#if hasAvatar}} +{{#if model.hasAvatar}}
- +
{{else}}

diff --git a/app/templates/review/edit.hbs b/app/templates/review/edit.hbs index d2644cf..25a72d6 100644 --- a/app/templates/review/edit.hbs +++ b/app/templates/review/edit.hbs @@ -3,22 +3,22 @@

- {{view Ember.Select content=ratingChoices value=rating required=true prompt="Select Rating" classNames='form-control'}} + {{view Ember.Select content=ratingChoices value=model.rating required=true prompt="Select Rating" classNames='form-control'}}
- {{textarea value=post required=true classNames='form-control' rows=10}} + {{textarea value=model.post required=true classNames='form-control' rows=10}}
-
-
diff --git a/app/templates/reviews/new.hbs b/app/templates/reviews/new.hbs index b8d9cc4..f74e377 100644 --- a/app/templates/reviews/new.hbs +++ b/app/templates/reviews/new.hbs @@ -2,11 +2,11 @@
- {{view Ember.Select content=ratingChoices value=rating required=true prompt="Select Rating" classNames='form-control'}} + {{view Ember.Select content=ratingChoices value=model.rating required=true prompt="Select Rating" classNames='form-control'}}
- {{textarea value=post required=true classNames='form-control' rows=10}} + {{textarea value=model.post required=true classNames='form-control' rows=10}}
diff --git a/app/templates/round/index.hbs b/app/templates/round/index.hbs index 914c7bb..d2fc30c 100644 --- a/app/templates/round/index.hbs +++ b/app/templates/round/index.hbs @@ -1,8 +1,8 @@
-

{{courseName}}

-
{{display-date createdAt}}
+

{{model.courseName}}

+
{{display-date model.createdAt}}
-{{scorecards-table scorecards=scorecards holeNumbers=holeNumbers hasHoleLinks=true}} +{{scorecards-table scorecards=model.scorecards holeNumbers=holeNumbers hasHoleLinks=true}} diff --git a/app/templates/rounds/new.hbs b/app/templates/rounds/new.hbs index 9bf7f4a..18c54bb 100644 --- a/app/templates/rounds/new.hbs +++ b/app/templates/rounds/new.hbs @@ -18,7 +18,7 @@ - {{view "select" content=courses selection=course.content optionValuePath="content.id" optionLabelPath="content.name" prompt="Select Course" id="course" required=true classNames="form-control"}} + {{view "select" content=courses selection=model.course.content optionValuePath="content.id" optionLabelPath="content.name" prompt="Select Course" id="course" required=true classNames="form-control"}}

Can't see the course you're looking for? Why not @@ -50,7 +50,7 @@ {{currentUser.fullName}}

- {{#each players as |player|}} + {{#each model.players as |player|}}
{{#if player.hasAvatar}} diff --git a/app/templates/users/new.hbs b/app/templates/users/new.hbs index 9021bd5..a5843d5 100644 --- a/app/templates/users/new.hbs +++ b/app/templates/users/new.hbs @@ -7,25 +7,25 @@ - {{input value=firstName type="text" id="firstName" required=true classNames="form-control"}} + {{input value=model.firstName type="text" id="firstName" required=true classNames="form-control"}}
- {{input value=middleName type="text" id="middleName" classNames="form-control"}} + {{input value=model.middleName type="text" id="middleName" classNames="form-control"}}
- {{input value=lastName type="text" id="lastName" required=true classNames="form-control"}} + {{input value=model.lastName type="text" id="lastName" required=true classNames="form-control"}}
- {{input value=email type="text" id="email" required=true classNames="form-control"}} + {{input value=model.email type="text" id="email" required=true classNames="form-control"}} {{#each model.errors.email as |error|}}
{{error.message}} @@ -36,13 +36,13 @@ - {{input value=password type="password" id="password" required=true classNames="form-control"}} + {{input value=model.password type="password" id="password" required=true classNames="form-control"}}
- {{input value=passwordConfirmation type="password" id="passwordConfirmation" required=true classNames="form-control"}} + {{input value=model.passwordConfirmation type="password" id="passwordConfirmation" required=true classNames="form-control"}}
{{#if showPasswordError}}