diff --git a/README.md b/README.md index 2347442..b290354 100644 --- a/README.md +++ b/README.md @@ -43,13 +43,6 @@ Make use of the many generators for code, try `ember help generate` for more det * `ember build` (development) * `ember build --environment production` (production) -### Deploying - -You'll need to set up `deploy.json` and put in your app's main directory. - -* `ember deploy --environment production` -* `ember deploy:activate --revision frolfr-client:REVISION_SHA --environment production` - ## Further Reading / Useful Links * [ember.js](http://emberjs.com/) diff --git a/app/components/scorecards-table-cell.js b/app/components/scorecards-table-cell.js index 8b0af76..4642b92 100644 --- a/app/components/scorecards-table-cell.js +++ b/app/components/scorecards-table-cell.js @@ -15,7 +15,7 @@ var ScorecardsTableCell = Ember.Component.extend({ return this.get('scorecard').get('turns').find(function(turn) { return turn.get('holeNumber') === holeNumber; }); - }.property('scorecard.turns.@each', 'holeNumber') + }.property('scorecard.turns.[]', 'holeNumber') }); export default ScorecardsTableCell; diff --git a/app/controllers/course-rounds.js b/app/controllers/course-rounds.js index 70ce5e0..2a431b7 100644 --- a/app/controllers/course-rounds.js +++ b/app/controllers/course-rounds.js @@ -1,5 +1,6 @@ import Ember from 'ember'; +// TODO: Change to just Controller var CourseRoundsController = Ember.ArrayController.extend({ // Pagination page: 1, @@ -16,7 +17,7 @@ var CourseRoundsController = Ember.ArrayController.extend({ var end = this.get('page') * this.get('perPage'); return this.get('filteredContent').slice(start, end); - }.property('filteredContent.@each', 'page', 'perPage'), + }.property('filteredContent.[]', 'page', 'perPage'), isPaginated: function() { return this.get('filteredContent').length > this.get('perPage'); @@ -47,7 +48,7 @@ var CourseRoundsController = Ember.ArrayController.extend({ } else { return this.get('completedScorecards'); } - }.property('arrangedContent.@each', 'includeIncompleteScorecards', 'completedScorecards.@each'), + }.property('arrangedContent.[]', 'includeIncompleteScorecards', 'completedScorecards.[]'), completedScorecards: function() { return this.get('arrangedContent').filter(function(scorecard) { diff --git a/app/controllers/courses/index.js b/app/controllers/courses/index.js index 4a9124d..47a1dfa 100644 --- a/app/controllers/courses/index.js +++ b/app/controllers/courses/index.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -var CoursesIndexController = Ember.ArrayController.extend({ +var CoursesIndexController = Ember.Controller.extend({ queryParams: ["page"], pageBinding: "content.page", 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/friendable-users.js b/app/controllers/friendable-users.js index 28a7e43..bee17ee 100644 --- a/app/controllers/friendable-users.js +++ b/app/controllers/friendable-users.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -var FriendableUsersController = Ember.ArrayController.extend({ +var FriendableUsersController = Ember.Controller.extend({ selection: null, query: null, diff --git a/app/controllers/friends.js b/app/controllers/friends.js index 7149e1c..cfe3438 100644 --- a/app/controllers/friends.js +++ b/app/controllers/friends.js @@ -1,7 +1,7 @@ import Ember from 'ember'; import pagedArray from 'ember-cli-pagination/computed/paged-array'; -var FriendsController = Ember.ArrayController.extend({ +var FriendsController = Ember.Controller.extend({ pagedContent: pagedArray("content", {infinite: true}), hasNextPage: function() { 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/public-round.js b/app/controllers/public-round.js deleted file mode 100644 index 428d8b6..0000000 --- a/app/controllers/public-round.js +++ /dev/null @@ -1,22 +0,0 @@ -import Ember from 'ember'; - -var PublicRoundController = Ember.ObjectController.extend({ - columnWidth: function() { - var scorecardColumns = this.get('scorecards.length'); - var scorecardColumnPercentage = 100 / scorecardColumns; - - return 'width: ' + scorecardColumnPercentage + '%;'; - }.property('scorecards.length'), - - holeNumbers: function() { - var turnsCount = this.get('scorecards.firstObject.turns.length'); - var holeNumbers = new Array(turnsCount) - .join().split(',') - .map(function(item, index){ return ++index; }); - - return holeNumbers; - }.property('scorecards.firstObject.turns.length') - -}); - -export default PublicRoundController; diff --git a/app/controllers/review/edit.js b/app/controllers/review/edit.js deleted file mode 100644 index 87954b4..0000000 --- a/app/controllers/review/edit.js +++ /dev/null @@ -1,22 +0,0 @@ -import Ember from 'ember'; - -var ReviewEditController = Ember.ObjectController.extend({ - ratingChoices: [1,2,3,4,5,6,7,8,9,10], - - actions: { - saveChanges: function () { - var _this = this; - var review = this.get('model'); - review.save().then(function () { - _this.transitionToRoute('reviews.index'); - }); - }, - - cancel: function() { - this.get('model').rollback(); - } - } - -}); - -export default ReviewEditController; diff --git a/app/controllers/reviews/index.js b/app/controllers/reviews/index.js deleted file mode 100644 index 41cb6e3..0000000 --- a/app/controllers/reviews/index.js +++ /dev/null @@ -1,37 +0,0 @@ -import Ember from 'ember'; - -var ReviewsIndexController = Ember.ArrayController.extend({ - needs: ['currentUser'], - currentUser: Ember.computed.alias('controllers.currentUser'), - - sortProperties: ['createdAt'], - sortAscending: false, - - filteredReviews: function() { - return this.get('arrangedContent').filter(function(review) { - return !review.get('isDirty'); - }); - }.property('arrangedContent.@each.isDirty'), - - isAlreadyReviewed: function () { - var currentUserId = this.get('currentUser.id'), - currentUserReview = this.get('content').findBy('user.id', currentUserId); - - return !!currentUserReview; - }.property('content'), - - averageRating: function() { - var sumOfRatings = this.get('filteredReviews').reduce(function (total, review) { - return total + review.get('rating'); - }, 0), - reviewsCount = this.get('filteredReviews').length; - - return sumOfRatings / reviewsCount; - }.property('filteredReviews.@each.rating'), - - averageRatingRoundedToNearestHalf: function() { - return (Math.round(this.get('averageRating') * 2) / 2).toFixed(1); - }.property('averageRating') -}); - -export default ReviewsIndexController; diff --git a/app/controllers/reviews/new.js b/app/controllers/reviews/new.js deleted file mode 100644 index 27e2537..0000000 --- a/app/controllers/reviews/new.js +++ /dev/null @@ -1,19 +0,0 @@ -import Ember from 'ember'; - -var ReviewsNewController = Ember.ObjectController.extend({ - - ratingChoices: [1,2,3,4,5,6,7,8,9,10], - - actions: { - submitReview: function () { - var _this = this; - var review = this.get('content'); - review.save().then(function () { - _this.transitionToRoute('reviews.index'); - }); - } - } - -}); - -export default ReviewsNewController; diff --git a/app/controllers/round.js b/app/controllers/round.js index 1940dd6..6719d26 100644 --- a/app/controllers/round.js +++ b/app/controllers/round.js @@ -1,21 +1,5 @@ import Ember from 'ember'; -var RoundController = Ember.ObjectController.extend({ - publicRoundUrl: function () { - return 'http://frolfr.com/public/rounds/' + this.get('model.id'); - }.property(), - - actions: { - makePrivate: function() { - this.get('model').set('publicRecap', false); - this.get('model').save(); - }, - - publish: function() { - this.get('model').set('publicRecap', true); - this.get('model').save(); - } - } -}); +var RoundController = Ember.Controller.extend({}); export default RoundController; 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/round/settings.js b/app/controllers/round/settings.js index db5eee5..220b268 100644 --- a/app/controllers/round/settings.js +++ b/app/controllers/round/settings.js @@ -22,7 +22,7 @@ export default Ember.Controller.extend({ return friends.filter(function(friend) { return !player_ids.contains(friend.get("id")); }); - }.property('roundPlayers.@each', 'friends.@each'), + }.property('roundPlayers.[]', 'friends.[]'), actions: { addPlayer: function() { diff --git a/app/controllers/rounds/new.js b/app/controllers/rounds/new.js index 832d25a..6595a3d 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.[]', 'model.players.[]'), 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) { @@ -38,7 +38,7 @@ var RoundsNewController = Ember.ObjectController.extend({ createRound: function() { var _this = this; - this.set('model.course', this.get('model.course.content')); + this.get('model').save().then(function(round) { _this.controllerFor('application').set('currentRound', round); _this.controllerFor('application').set('currentHole', '1'); diff --git a/app/controllers/turns.js b/app/controllers/turns.js index 56c7cb5..985461b 100644 --- a/app/controllers/turns.js +++ b/app/controllers/turns.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -var TurnsController = Ember.ArrayController.extend({ +var TurnsController = Ember.Controller.extend({ holeNumber: Ember.computed.alias('model.firstObject.holeNumber'), holePar: Ember.computed.alias('model.firstObject.par'), 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/helpers/display-date.js b/app/helpers/display-date.js index 342ee14..6034219 100644 --- a/app/helpers/display-date.js +++ b/app/helpers/display-date.js @@ -1,6 +1,6 @@ import Ember from 'ember'; /* global moment */ -export default Ember.Handlebars.makeBoundHelper(function(value) { +export default Ember.Helper.helper(function([value]) { return moment(value).format('dddd, MMM Do YYYY'); }); diff --git a/app/helpers/display-score.js b/app/helpers/display-score.js index c93857c..8d092e0 100644 --- a/app/helpers/display-score.js +++ b/app/helpers/display-score.js @@ -1,6 +1,6 @@ import Ember from 'ember'; -export default Ember.Handlebars.makeBoundHelper(function(score) { +export default Ember.Helper.helper(function([score]) { if (score > 0) { return "+" + score; } else if (Math.abs(score) === 0) { diff --git a/app/helpers/formatted-address.js b/app/helpers/formatted-address.js deleted file mode 100644 index c09296b..0000000 --- a/app/helpers/formatted-address.js +++ /dev/null @@ -1,7 +0,0 @@ -import Ember from 'ember'; - -export function formattedAddress(input) { - return input; -} - -export default Ember.Handlebars.makeBoundHelper(formattedAddress); diff --git a/app/helpers/ranking-from-index.js b/app/helpers/ranking-from-index.js index 481a0e2..87c190c 100644 --- a/app/helpers/ranking-from-index.js +++ b/app/helpers/ranking-from-index.js @@ -1,5 +1,5 @@ import Ember from 'ember'; -export default Ember.Handlebars.makeBoundHelper(function(index) { +export default Ember.Helper.helper(function([index]) { return index + 1 + "."; }); diff --git a/app/models/course.js b/app/models/course.js index a1949d7..71fdc64 100644 --- a/app/models/course.js +++ b/app/models/course.js @@ -12,7 +12,6 @@ var Course = DS.Model.extend({ scorecards: DS.hasMany('scorecard', { async: true }), holes: DS.hasMany('hole', { async: true }), holeCount: DS.attr('number'), - reviews: DS.hasMany('review', { async: true }), photos: DS.hasMany('photo', {async: true}), isApproved: function() { diff --git a/app/models/public-round.js b/app/models/public-round.js deleted file mode 100644 index f3cf41e..0000000 --- a/app/models/public-round.js +++ /dev/null @@ -1,5 +0,0 @@ -import Round from './round'; - -var PublicRound = Round.extend(); - -export default PublicRound; diff --git a/app/models/review.js b/app/models/review.js deleted file mode 100644 index ce5cc4f..0000000 --- a/app/models/review.js +++ /dev/null @@ -1,15 +0,0 @@ -import DS from 'ember-data'; -import Ember from 'ember'; - -var Review = DS.Model.extend({ - rating: DS.attr('number'), - canUpdate: DS.attr('boolean'), - post: DS.attr('string'), - course: DS.belongsTo('course', { async: true }), - user: DS.belongsTo('user', { async: true }), - createdAt: DS.attr('date'), - - userFullName: Ember.computed.alias('user.fullName') -}); - -export default Review; diff --git a/app/models/round.js b/app/models/round.js index e295e5a..fbc0edb 100644 --- a/app/models/round.js +++ b/app/models/round.js @@ -6,7 +6,6 @@ var Round = DS.Model.extend({ scorecards: DS.hasMany('scorecard', {async: true}), course: DS.belongsTo('course', {async: true}), holeCount: DS.attr('string'), - publicRecap: DS.attr('boolean'), isStarted: function() { return this.get('scorecards').any(function (scorecard) { diff --git a/app/router.js b/app/router.js index d34c49d..1a43908 100644 --- a/app/router.js +++ b/app/router.js @@ -7,7 +7,6 @@ const Router = Ember.Router.extend({ Router.map(function() { this.route('welcome'); - this.resource('publicRound', { path: '/public/rounds/:id' }); this.resource('sessions', function() { this.route('login'); }); @@ -19,12 +18,6 @@ Router.map(function() { this.resource('courseRounds', { path: '/rounds' }); this.resource('courseStatLog', { path: '/stats' }); this.resource('holeStatLogs', { path: '/holes' }); - this.resource('reviews', function() { - this.route('new'); - }); - this.resource('review', { path: '/reviews/:review_id' }, function() { - this.route('edit'); - }); }); this.resource('friends'); this.resource('profile', function() { diff --git a/app/routes/course-rounds.js b/app/routes/course-rounds.js index afd6120..a6f6de2 100644 --- a/app/routes/course-rounds.js +++ b/app/routes/course-rounds.js @@ -2,7 +2,7 @@ import AuthenticatedRoute from './authenticated'; var CourseRoundsRoute = AuthenticatedRoute.extend({ model: function() { - return this.store.find('courseScorecard', { course_id: this.modelFor('course').id }); + return this.store.query('courseScorecard', { course_id: this.modelFor('course').id }); } }); diff --git a/app/routes/hole-stat-logs.js b/app/routes/hole-stat-logs.js index d306586..b80935f 100644 --- a/app/routes/hole-stat-logs.js +++ b/app/routes/hole-stat-logs.js @@ -2,7 +2,7 @@ import AuthenticatedRoute from './authenticated'; var HoleStatLogsRoute = AuthenticatedRoute.extend({ model: function() { - return this.store.find('holeStatLog', { course_id: this.modelFor('course').id }); + return this.store.query('holeStatLog', { course_id: this.modelFor('course').id }); } }); diff --git a/app/routes/joint-rounds.js b/app/routes/joint-rounds.js index 25c3e26..34b9a9e 100644 --- a/app/routes/joint-rounds.js +++ b/app/routes/joint-rounds.js @@ -2,7 +2,7 @@ import AuthenticatedRoute from './authenticated'; var JointRoundsRoute = AuthenticatedRoute.extend({ model: function() { - return this.store.find('jointRound', { user_id: this.modelFor('user').id }); + return this.store.query('jointRound', { user_id: this.modelFor('user').id }); } }); diff --git a/app/routes/leaderboard.js b/app/routes/leaderboard.js index 9dedc08..c94d756 100644 --- a/app/routes/leaderboard.js +++ b/app/routes/leaderboard.js @@ -2,7 +2,7 @@ import AuthenticatedRoute from './authenticated'; var LeaderboardRoute = AuthenticatedRoute.extend({ model: function() { - return this.store.find('leaderboardScorecard', { course_id: this.modelFor('course').id }); + return this.store.query('leaderboardScorecard', { course_id: this.modelFor('course').id }); } }); diff --git a/app/routes/public-round.js b/app/routes/public-round.js deleted file mode 100644 index e1999d2..0000000 --- a/app/routes/public-round.js +++ /dev/null @@ -1,9 +0,0 @@ -import Ember from 'ember'; - -var PublicRoundRoute = Ember.Route.extend({ - model: function(params) { - return this.store.find('publicRound', params.id); - } -}); - -export default PublicRoundRoute; diff --git a/app/routes/review.js b/app/routes/review.js deleted file mode 100644 index 645f2a7..0000000 --- a/app/routes/review.js +++ /dev/null @@ -1,9 +0,0 @@ -import AuthenticatedRoute from './authenticated'; - -var ReviewRoute = AuthenticatedRoute.extend({ - model: function(params) { - return this.store.find('review', params.review_id); - } -}); - -export default ReviewRoute; diff --git a/app/routes/reviews/index.js b/app/routes/reviews/index.js deleted file mode 100644 index 0cc9c5e..0000000 --- a/app/routes/reviews/index.js +++ /dev/null @@ -1,9 +0,0 @@ -import AuthenticatedRoute from '../authenticated'; - -var ReviewsIndexRoute = AuthenticatedRoute.extend({ - model: function() { - return this.modelFor('course').get('reviews'); - } -}); - -export default ReviewsIndexRoute; diff --git a/app/routes/reviews/new.js b/app/routes/reviews/new.js deleted file mode 100644 index 76b34fb..0000000 --- a/app/routes/reviews/new.js +++ /dev/null @@ -1,13 +0,0 @@ -import AuthenticatedRoute from '../authenticated'; - -var ReviewsNewRoute = AuthenticatedRoute.extend({ - - model: function() { - return this.store.createRecord('review', { - course: this.modelFor('course') - }); - } - -}); - -export default ReviewsNewRoute; diff --git a/app/styles/app.scss b/app/styles/app.scss index 68dcddd..888db89 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -12,7 +12,6 @@ @import "flatboot"; @import "variables_and_overrides"; @import "round-show-table"; -@import "reviews"; @import "twitter-typeahead"; @import "block-grids"; @import "turns"; diff --git a/app/styles/reviews.scss b/app/styles/reviews.scss deleted file mode 100644 index a267f91..0000000 --- a/app/styles/reviews.scss +++ /dev/null @@ -1,12 +0,0 @@ -.review-header { - background-color: #fafafa; - padding: 5px; -} - -.review-body { - padding: 5px; -} - -.review { - margin-bottom: 10px; -} diff --git a/app/templates/course.hbs b/app/templates/course.hbs index 37c1323..af403ff 100644 --- a/app/templates/course.hbs +++ b/app/templates/course.hbs @@ -37,15 +37,6 @@ {{/link-to}} - {{#link-to "reviews" tagName="li" classNames="u-pointer"}} - - - - - - {{/link-to}} {{#link-to "leaderboard" tagName="li" classNames="u-pointer"}}