-
Notifications
You must be signed in to change notification settings - Fork 58
/
app.js
176 lines (149 loc) · 5.6 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
var app = angular.module('wineApp', []);
////////////
// ROUTES //
////////////
app.config(function($routeProvider, $locationProvider){
$routeProvider
.when('/', {
template: 'Home!'
})
// $locationProvider.html5Mode({
// enabled: true,
// requireBase: false
// });
})
/////////////////
// CONTROLLERS //
/////////////////
app.controller('WinesIndexCtrl',function($scope){
console.log("Wine Index")
})
app.controller('WinesShowCtrl',function($scope){
console.log("Wine Show")
})
////////////
// MODELS //
////////////
app.factory('WineService', function(){
var WineService = {};
WineService.query = function(){
return ALL_WINES;
}
WineService.get = function(id){
var id = parseInt(id);
return ALL_WINES.find(function(wine){
return wine.id == id;
});
}
return WineService;
})
/*
* Temporary Mock JSON
* Eventually we will retrieve this data using AJAX
*/
ALL_WINES = [
{
"id": 1423,
"created_at": "2015-10-13T01:30:28.255Z",
"updated_at": "2015-10-13T01:30:28.255Z",
"name": "CHATEAU DE SAINT COSME",
"year": "2009",
"grapes": "Grenache / Syrah",
"country": "France",
"region": "Southern Rhone",
"price": 13,
"description": "The aromas of fruit and spice give one a hint of the light drinkability of this lovely wine, which makes an excellent complement to fish dishes.",
"picture": "http://s3-us-west-2.amazonaws.com/sandboxapi/saint_cosme.jpg"
},
{
"id": 1424,
"created_at": "2015-10-13T01:30:28.608Z",
"updated_at": "2015-10-13T01:30:28.608Z",
"name": "LAN RIOJA CRIANZA",
"year": "2006",
"grapes": "Tempranillo",
"country": "Spain",
"region": "Rioja",
"price": 21,
"description": "A resurgence of interest in boutique vineyards has opened the door for this excellent foray into the dessert wine market. Light and bouncy, with a hint of black truffle, this wine will not fail to tickle the taste buds.",
"picture": "http://s3-us-west-2.amazonaws.com/sandboxapi/lan_rioja.jpg"
},
{
"id": 1425,
"created_at": "2015-10-13T01:30:28.613Z",
"updated_at": "2015-10-13T01:30:28.613Z",
"name": "MARGERUM SYBARITE",
"year": "2010",
"grapes": "Sauvignon Blanc",
"country": "USA",
"region": "California",
"price": 25,
"description": "The cache of a fine Cabernet in ones wine cellar can now be replaced with a childishly playful wine bubbling over with tempting tastes of black cherry and licorice. This is a taste sure to transport you back in time.",
"picture": "http://s3-us-west-2.amazonaws.com/sandboxapi/margerum.jpg"
},
{
"id": 1426,
"created_at": "2015-10-13T01:30:28.618Z",
"updated_at": "2015-10-13T01:30:28.618Z",
"name": "OWEN ROE \"EX UMBRIS\"",
"year": "2009",
"grapes": "Syrah",
"country": "USA",
"region": "Washington",
"price": 15,
"description": "A one-two punch of black pepper and jalapeno will send your senses reeling, as the orange essence snaps you back to reality. Dont miss this award-winning taste sensation.",
"picture": "http://s3-us-west-2.amazonaws.com/sandboxapi/ex_umbris.jpg"
},
{
"id": 1427,
"created_at": "2015-10-13T01:30:28.623Z",
"updated_at": "2015-10-13T01:30:28.623Z",
"name": "REX HILL",
"year": "2009",
"grapes": "Pinot Noir",
"country": "USA",
"region": "Oregon",
"price": 32,
"description": "One cannot doubt that this will be the wine served at the Hollywood award shows, because it has undeniable star power. Be the first to catch the debut that everyone will be talking about tomorrow.",
"picture": "http://s3-us-west-2.amazonaws.com/sandboxapi/rex_hill.jpg"
},
{
"id": 1428,
"created_at": "2015-10-13T01:30:28.627Z",
"updated_at": "2015-10-13T01:30:28.627Z",
"name": "VITICCIO CLASSICO RISERVA",
"year": "2007",
"grapes": "Sangiovese Merlot",
"country": "Italy",
"region": "Tuscany",
"price": 45,
"description": "Though soft and rounded in texture, the body of this wine is full and rich and oh-so-appealing. This delivery is even more impressive when one takes note of the tender tannins that leave the taste buds wholly satisfied.",
"picture": "http://s3-us-west-2.amazonaws.com/sandboxapi/viticcio.jpg"
},
{
"id": 1429,
"created_at": "2015-10-13T01:30:28.631Z",
"updated_at": "2015-10-13T01:30:28.631Z",
"name": "CHATEAU LE DOYENNE",
"year": "2005",
"grapes": "Merlot",
"country": "France",
"region": "Bordeaux",
"price": 12,
"description": "Though dense and chewy, this wine does not overpower with its finely balanced depth and structure. It is a truly luxurious experience for the senses.",
"picture": "http://s3-us-west-2.amazonaws.com/sandboxapi/le_doyenne.jpg"
},
{
"id": 1430,
"created_at": "2015-10-13T01:30:28.646Z",
"updated_at": "2015-10-13T01:30:28.646Z",
"name": "DOMAINE DU BOUSCAT",
"year": "2009",
"grapes": "Merlot",
"country": "France",
"region": "Bordeaux",
"price": 34,
"description": "The light golden color of this wine belies the bright flavor it holds. A true summer wine, it begs for a picnic lunch in a sun-soaked vineyard.",
"picture": "http://s3-us-west-2.amazonaws.com/sandboxapi/bouscat.jpg"
}
];