-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds memento-list, memento, and mementoCreate functionality and initi…
…al unit and integration tests Adds basic mementos module, controller, and html to application Adds spec for app.mementos and adds initial unit test for controller creation Adds mock memento data for getMementos testing Adds unit tests working with mock mementos data in dataservice spec Adds app.mementos to module Created and received mementos are now displayed on mementos view Adds mementos controller unit tests with mock data Begins links mementos view to created and existing memento views Adds a mock data for mementoDetail Memento unit tests added Refactors code to be more readable Adds memento.module to app Adds memento.module Adds memento javascript tags to index.html Sets up nested state for memento All tests passed for core functionality Mementos to memento displaying moments is now functional Adds additional unit test for getMemento method Adds functionality to hide/show received mementos depending on if user is creating memento or not Adds memento create view, controller, and module into application Adds and solves unit tests for memento-create Adds memento creation functionality Passes failing tests Title and recipients inputs for memento create now work. Button disabled if these fields are not set Save memento disabled until user input. On save, send user to memento view for created memento Removes tests from bottom of file Refactors to meet style guide expectations Fixes bugs from CurrentMoment commit Removes momentID property from mementos controller mementoCreate now adds latest moment to memento Moments are now added in memento-create Can now add moments to mementos in memento-list Updates dataservice to get and add moments correctly memento-create refactored to mimic moment.create style Fixes saveMoment on moment.create.html. Removes fake moment from dataservice memento-list and dataservice refactored memento and dataservice refactored promisifies elements of memento-create and mementos-list Adjusts addMoment method in dataservice Tests failing. Need to rewrite Refactors memento-create code for style purposes Memento test now working Fixes mementos tests Renames memento-create to memento.create Change memento-create to memento.create
- Loading branch information
Showing
20 changed files
with
623 additions
and
253 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<ion-view view-title="{{vm.title}}"> | ||
<ion-content> | ||
|
||
<div class="list list-inset"> | ||
<label class="item item-input"> | ||
<input type="text" placeholder="Memento Title" ng-model="vm.currentMemento.title"> | ||
</label> | ||
</div> | ||
|
||
<div class="list list-inset"> | ||
<label class="item item-input"> | ||
<input type="text" placeholder="Recipients" ng-model="vm.currentMemento.recipients[0]"> | ||
</label> | ||
</div> | ||
|
||
<!-- FIXME: both link and button need to be disabled until user has inputed validated info --> | ||
<button ng-disabled="!vm.currentMemento.title || !vm.currentMemento.recipients[0]" on-tap="vm.saveMemento(vm.currentMemento)" class="button button-block button-positive"> | ||
Save | ||
</button> | ||
|
||
</ion-content> | ||
</ion-view> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular | ||
.module('app.memento.create') | ||
.controller('MementoCreate', MementoCreate); | ||
|
||
/* @ngInject */ | ||
function MementoCreate($state, dataservice, CurrentMoment , $stateParams) { | ||
/*jshint validthis: true */ | ||
var vm = this; | ||
vm.title = 'Create Memento'; | ||
vm.currentMemento = new EmptyMemento(); | ||
vm.saveMemento = saveMemento; | ||
|
||
activate(); | ||
|
||
//////////////////////////////////////////////////////////// | ||
|
||
function activate() { | ||
return addMoment(); | ||
} | ||
|
||
function saveMemento(currentMemento) { | ||
return dataservice.saveMemento(currentMemento) | ||
.then(function(mementoID) { | ||
|
||
console.log('Memento ' + mementoID + ' has been saved.'); | ||
$state.go('memento', {ID: mementoID}); | ||
|
||
}) | ||
.catch(function(err) { | ||
// TODO: Connection errors, DB errors. | ||
// savingError(err); | ||
console.error('There was an error saving memento:', err); | ||
}); | ||
} | ||
|
||
function addMoment() { | ||
var momentID = CurrentMoment.get(); | ||
|
||
// NOTE: adds entire moment to fit dummy data. Will only add momentID when connected with server | ||
return dataservice.getMoment(momentID.momentID) | ||
.then(function(data) { | ||
console.log('Successfull getting moment'); | ||
|
||
vm.currentMemento.moments.push(data); | ||
|
||
// NOTE: sets moment back to an empty object | ||
CurrentMoment.set({}); | ||
}) | ||
.catch(function(err) { | ||
console.error('There was an error getting moment:', err); | ||
}); | ||
} | ||
|
||
function EmptyMemento() { | ||
this.title = ''; | ||
this.owner = 'User1'; | ||
this.authors = [this.owner]; | ||
this.recipients = ''; | ||
this.options = { | ||
'public' : false, | ||
'releaseType' : 'default', | ||
}; | ||
this.latestReleasedIndex = 1; | ||
this.moments = []; | ||
} | ||
} | ||
})(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('app.memento.create', []); | ||
})(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
memento.html | ||
<ion-view view-title="{{vm.memento.title}}"> | ||
<ion-content> | ||
|
||
<div ng-repeat="moment in vm.memento.moments"> | ||
|
||
<div ng-repeat="item in moment.content"> | ||
{{item.url}} | ||
</div> | ||
|
||
</div> | ||
|
||
</ion-content> | ||
</ion-view> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular | ||
.module('app.memento') | ||
.controller('Memento', Memento); | ||
|
||
/* @ngInject */ | ||
function Memento(dataservice, $stateParams) { | ||
/*jshint validthis: true */ | ||
var vm = this; | ||
vm.memento = {}; | ||
vm.mementoID = Number($stateParams.ID); | ||
vm.getMemento = getMemento; | ||
|
||
activate(); | ||
|
||
//////////////////////////////////////////////////////////// | ||
|
||
function activate() { | ||
return getMemento(vm.mementoID).then(function() { | ||
console.log('Activated memento view'); | ||
}); | ||
} | ||
|
||
function getMemento(ID) { | ||
return dataservice.getMemento(ID) | ||
.then(function(data) { | ||
console.log('Successfull getting memento'); | ||
|
||
vm.memento = data; | ||
}) | ||
.catch(function(err) { | ||
console.error('There was an error getting memento:', err); | ||
}); | ||
} | ||
|
||
} | ||
})(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
(function() { | ||
'use strict'; | ||
|
||
angular.module('app.memento', []); | ||
})(); |
Oops, something went wrong.