-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
196 lines (171 loc) · 6.05 KB
/
index.html
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Photo App with Angular</title>
<script src="build/react.js"></script>
<script src="build/JSXTransformer.js"></script>
<script src="build/react-bootstrap.js"></script>
<!-- stylesheets -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<div class="jumbotron app-header">
<h1>My Super Awesome Photos</h1>
</div>
<div id="app-container">
</div> <!-- where we will mount the app -->
<div id="photo-container"></div>
<div id="rating-dropdown"></div>
<script type="text/jsx">
/** @jsx React.DOM */
var Table = ReactBootstrap.Table;
var Glyphicon = ReactBootstrap.Table;
var Button = ReactBootstrap.Button;
var ButtonToolbar = ReactBootstrap.ButtonToolbar;
var SplitButton = ReactBootstrap.SplitButton;
var MenuItem = ReactBootstrap.MenuItem;
var PhotoTitle = React.createClass({
render: function() {
var title = this.props.photo.title;
return (
<tr>
<td>{title}</td>
</tr>
);
}
});
// var AlbumInfo = React.createClass({
// render: function() {
// var rows = [];
// this.props.photos.forEach(function(photo) {
// rows.push(<PhotoTitle photo={photo} key={photo.title} />);
// });
// return (
// <div className="album-info">
// <Table responsive bordered hover>
// <thead>
// <tr><th>Photos in this Album</th></tr>
// </thead>
// <tbody><a onClick={alertClicked}>{rows}</a></tbody>
// </Table></div>
// );
// }
// });
var SelectedPhoto = React.createClass({
render: function() {
return (
<div className="selected-photo">
<img src={this.imageUrl} />
</div>
);
}
});
var RatingDropdown = React.createClass({
render: function() {
return (
<ButtonToolbar>
<SplitButton title="Rating" id="split-button-basic">
<MenuItem eventKey='1'>1</MenuItem>
<MenuItem eventKey='2'>2</MenuItem>
<MenuItem eventKey='3'>3</MenuItem>
<MenuItem eventKey='4'>4</MenuItem>
</SplitButton>
</ButtonToolbar>
);
}
});
var AppContainer = React.createClass({
url: '',
getInitialState: function() {
return {
title: '',
caption: '',
rating: 0,
orderCount: 0,
imageUrl: 'https://drscdn.500px.org/photo/81913125/m%3D2048/d6926aeb94599899fc9e76fce241ff94'
};
},
handleChange: function(event) {
this.setState({
rating: event.target.value
});
},
handleClick: function(i) {
this.setState({
title: this.props.photos[i].title,
imageUrl: this.props.photos[i].imageUrl,
orderCount: this.props.photos[i].orderCount,
caption: this.props.photos[i].caption
});
var url = this.props.photos[i].imageUrl;
console.log(url);
},
render: function() {
return (
<div className="album-info">
<Table responsive bordered hover>
<thead>
<tr><th>Photos in this Album</th></tr>
</thead>
<tbody>
{this.props.photos.map(function(photo, i) {
return (
<tr><td onClick={this.handleClick.bind(this, i)} key={i} ref="photoClicked">{photo.title}</td></tr>
);
}, this)}
</tbody>
</Table>
</div>
);
}
});
var PHOTOS = [
{
title: "Norway",
caption: "Low tide at Olstinden by Douglas Stratton",
rating: null,
orderCount: 3,
imageUrl: "https://drscdn.500px.org/photo/81913125/m%3D2048/d6926aeb94599899fc9e76fce241ff94"
},
{
title: "Maui",
caption: "Makena Cove, Maui. Let's go to the beach!",
rating: null,
orderCount: 2,
imageUrl: "http://assets.fodors.com/destinations/4636/beach-makena-cove-south-shore-maui-maui-hawaii-usa_main.jpg"
},
{
title: "Tufa",
caption: "Tufa at Night by Romain Guy",
rating: '',
orderCount: 3,
imageUrl: "https://lh3.googleusercontent.com/-YifreVFp77c/UMoTI_wpC6I/AAAAAAAAMRw/6VACc_ubeaU/w2048-h1312/Tufa%2Bat%2BNight.jpg"
},
{
title: "Lost Island",
caption: "Lost Island, San Gregorio, by Romain Guy",
rating: '',
orderCount: 1,
imageUrl: "https://lh3.googleusercontent.com/-7WqXcxOUVVA/VW1ct0NIx1I/AAAAAAAAQKE/GUcb_c0UAzc/w1719-h1149-no/Lost%2BIsland.jpg"
},
{
title: "Winter Scene",
caption: "Winter is coming, somewhere",
rating: '',
orderCount: 5,
imageUrl: "http://www.smashingmagazine.com/images/winter-wonderland/temple.jpg"
}
];
// React.render(<AlbumInfo photos={PHOTOS}/>, document.getElementById('app-container'));
// TODO: refactor below to include photo view and rating inside app container
React.render(<AppContainer photos={PHOTOS}/>, document.getElementById('app-container'));
React.render(<RatingDropdown/>, document.getElementById('rating-dropdown'));
React.render(<SelectedPhoto/>, document.getElementById('photo-container'));
</script>
</div> <!-- /container wrapper for bootstrap styling to work-->
</body>
</html>