Skip to content

Commit

Permalink
Merge pull request #45 from omarduarte/moment-feature
Browse files Browse the repository at this point in the history
Moment Creation Feature
  • Loading branch information
kranrao committed Feb 21, 2015
2 parents 062a065 + ed6d8bd commit 7838cb9
Show file tree
Hide file tree
Showing 24 changed files with 525 additions and 322 deletions.
12 changes: 5 additions & 7 deletions client/www/app/app.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@
.config(function($stateProvider, $urlRouterProvider) {

$stateProvider
.state('moment', {
url: '/moment',
templateUrl: 'app/moment/moment.html',
controller: 'Moment',
controllerAs: 'vm'
});
.state('moment', {
url: '/moment',
templateUrl: 'app/moment/moment.create.html',
controller: 'MomentCreate as vm'
});

// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/moment');

});

})();
Expand Down
7 changes: 4 additions & 3 deletions client/www/app/core/CurrentMoment.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
(function() {

angular.module('app.core')
.factory('CurrentMoment', CurrentMoment);
angular
.module('app.core')
.factory('CurrentMoment', CurrentMoment);

function CurrentMoment() {
var moment = {}
Expand All @@ -10,7 +11,7 @@
set: function(obj) {
moment = angular.copy(obj);
},
get: function(obj) {
get: function() {
return angular.copy(moment);
}
};
Expand Down
283 changes: 18 additions & 265 deletions client/www/app/core/dataservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,276 +5,25 @@
.module('app.core')
.factory('dataservice', dataservice);

/* @ngInject */ /*FIXME: makesure ngInject is working during minification*/
/*TODO: $http, $q and other dependencies will be needed when connecting to server*/
function dataservice() {
/*FIXME: makesure ngInject is working during minification*/

/* @ngInject */
function dataservice($q) {

// mementos table - NOTE: assumes that the user is 'Wes'
var mementos = {
'received': [{
'ID': 3,
'title': 'For wes',
'authors' : ['Mom'],
'recipients' : ['Wes']
}],
'created': [{
'ID': 1,
'title' : 'For mom',
'authors' : ['Wes'],
'recipients' : ['Mom']
}, {
'ID': 2,
'title' : 'For my girlfriend',
'authors' : ['Wes'],
'recipients' : ['Girlfriend']
}]
};

// MOCKED DATA
// NOTE: These were uglified to provide better visibility to the funcitons below.
// If you need to insert, retrieve something from them, copy and pasta them into: http://jsbeautifier.org/
//
// mementos table - NOTE: assumes that the user is 'Wes'
var mementos={received:[{ID:3,title:"For wes",authors:["Mom"],recipients:["Wes"]}],created:[{ID:1,title:"For mom",authors:["Wes"],recipients:["Mom"]},{ID:2,title:"For my girlfriend",authors:["Wes"],recipients:["Girlfriend"]}]};
// detailed mementos table - NOTE: assumes that the user is 'Wes'
var mementosDetail = [{
'ID' : 1,
'title' : 'For mom',
'owner' : 'Wes',
'authors' : ['Wes'],
'recipients' : ['Mom'],
'options' : {
'public' : false,
'releaseType' : 'default',
},
'latestReleasedIndex' : 1, // associated with moments array. latest moment released
'moments' : [{
'ID' : 1,
'title' : 'Hi mom!',
'author' : ['Wes'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my awesome note to my mom who is awesome. Awesome bro!!' // using media instead of url pointing to it for time being
}]
}, {
'ID' : 2,
'title' : 'love youuuuuu mom!',
'author' : ['Wes'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my looooooooooove noooote tooo mmyyy mom!!' // using media instead of url pointing to it for time being
}]
}]
}, {
'ID' : 2,
'title' : 'For my girlfriend',
'owner' : 'Wes',
'authors' : ['Wes'],
'recipients' : ['Girlfriend'],
'options' : {
'public' : false,
'releaseType' : 'default',
},
'latestReleasedIndex' : 1, // associated with moments array. latest moment released
'moments' : [{
'ID' : 3,
'title' : 'Hey girl!',
'author' : ['Wes'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my awesome note to my girlfriend who is awesome. Awesome bro!!' // using media instead of url pointing to it for time being
}]
}, {
'ID' : 4,
'title' : 'love youuuuuu girl!',
'author' : ['Wes'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my looooooooooove noooote tooo mmyyy girl!!' // using media instead of url pointing to it for time being
}]
}]
}, {
'ID' : 3,
'title' : 'For Wes',
'owner' : 'Mom',
'authors' : ['Mom'],
'recipients' : ['Wes'],
'options' : {
'public' : false,
'releaseType' : 'default',
},
'latestReleasedIndex' : 1, // associated with moments array. latest moment released
'moments' : [{
'ID' : 5,
'title' : 'Hey son!',
'author' : ['Mom'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my awesome note to my Wes who is awesome. Awesome!!' // using media instead of url pointing to it for time being
}]
}, {
'ID' : 6,
'title' : 'love youuuuuu son!',
'author' : ['Mom'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my looooooooooove noooote tooo mmyyy son!!' // using media instead of url pointing to it for time being
}]
}]
}];

var mementosDetail=[{ID:1,title:"For mom",owner:"Wes",authors:["Wes"],recipients:["Mom"],options:{"public":!1,releaseType:"default"},latestReleasedIndex:1,moments:[{ID:1,title:"Hi mom!",author:["Wes"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my awesome note to my mom who is awesome. Awesome bro!!"}]},{ID:2,title:"love youuuuuu mom!",author:["Wes"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my looooooooooove noooote tooo mmyyy mom!!"}]}]},{ID:2,title:"For my girlfriend",owner:"Wes",authors:["Wes"],recipients:["Girlfriend"],options:{"public":!1,releaseType:"default"},latestReleasedIndex:1,moments:[{ID:3,title:"Hey girl!",author:["Wes"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my awesome note to my girlfriend who is awesome. Awesome bro!!"}]},{ID:4,title:"love youuuuuu girl!",author:["Wes"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my looooooooooove noooote tooo mmyyy girl!!"}]}]},{ID:3,title:"For Wes",owner:"Mom",authors:["Mom"],recipients:["Wes"],options:{"public":!1,releaseType:"default"},latestReleasedIndex:1,moments:[{ID:5,title:"Hey son!",author:["Mom"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my awesome note to my Wes who is awesome. Awesome!!"}]},{ID:6,title:"love youuuuuu son!",author:["Mom"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my looooooooooove noooote tooo mmyyy son!!"}]}]}];
// moment table
var moments = [{
'ID' : 1,
'title' : 'Hi mom!',
'author' : ['Wes'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my awesome note to my mom who is awesome. Awesome bro!!' // using media instead of url pointing to it for time being
}]
}, {
'ID' : 2,
'title' : 'love youuuuuu mom!',
'author' : ['Wes'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my looooooooooove noooote tooo mmyyy mom!!' // using media instead of url pointing to it for time being
}]
}, {
'ID' : 3,
'title' : 'Hey girl!',
'author' : ['Wes'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my awesome note to my girlfriend who is awesome. Awesome bro!!' // using media instead of url pointing to it for time being
}]
}, {
'ID' : 4,
'title' : 'love youuuuuu girl!',
'author' : ['Wes'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my looooooooooove noooote tooo mmyyy girl!!' // using media instead of url pointing to it for time being
}]
}, {
'ID' : 5,
'title' : 'Hey son!',
'author' : ['Mom'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my awesome note to my Wes who is awesome. Awesome!!' // using media instead of url pointing to it for time being
}]
}, {
'ID' : 6,
'title' : 'love youuuuuu son!',
'author' : ['Mom'],
'releaseDate' : '01/01/2016',
'meta' : {
'creationDate' : '01/01/2015',
'location' : {
'latitude' : 0,
'longitude' : 0,
'place' : 'Someplace awesome'
}
},
content : [{
'type' : 'text',
'url' : 'This is my looooooooooove noooote tooo mmyyy son!!' // using media instead of url pointing to it for time being
}]
}];
var moments=[{ID:1,title:"Hi mom!",author:["Wes"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my awesome note to my mom who is awesome. Awesome bro!!"}]},{ID:2,title:"love youuuuuu mom!",author:["Wes"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my looooooooooove noooote tooo mmyyy mom!!"}]},{ID:3,title:"Hey girl!",author:["Wes"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my awesome note to my girlfriend who is awesome. Awesome bro!!"}]},{ID:4,title:"love youuuuuu girl!",author:["Wes"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my looooooooooove noooote tooo mmyyy girl!!"}]},{ID:5,title:"Hey son!",author:["Mom"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my awesome note to my Wes who is awesome. Awesome!!"}]},{ID:6,title:"love youuuuuu son!",author:["Mom"],releaseDate:"01/01/2016",meta:{creationDate:"01/01/2015",location:{latitude:0,longitude:0,place:"Someplace awesome"}},content:[{type:"text",url:"This is my looooooooooove noooote tooo mmyyy son!!"}]}];
//
// MOCKED DATA - END

var service = {
getMementos: getMementos,
Expand Down Expand Up @@ -331,6 +80,10 @@
obj.ID = momentsSize() + 1;

moments.push(obj);

return $q(function(resolve, reject) {
resolve(obj.ID);
});
}

// NOTE: addMoment happens concurrently with memento creation
Expand Down
5 changes: 5 additions & 0 deletions client/www/app/moment/items/moment.items.module.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(function() {
'use strict';

angular.module('app.moment.items', []);
})();
13 changes: 13 additions & 0 deletions client/www/app/moment/items/newItem.directive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<div>
<div class="new-item-placeholder">
<new-text ng-if="typeSelected === 'text'"></new-text>
<div>

<button on-tap="selectType('text')" ng-if="newItemButtonWasTapped" class="new-text-button">Add Text</button>
<button ng-if="newItemButtonWasTapped" class="new-image-button">Add Image</button>

<button ng-disabled="newItemButtonWasTapped" class="new-item-button">+</button>

<button ng-if="newItemButtonWasTapped" class="new-video">Add Video</button>
<button ng-if="newItemButtonWasTapped" class="new-audio">Add Audio</button>
</div>
Loading

0 comments on commit 7838cb9

Please sign in to comment.