forked from brownbaglunch/BrownBagLunch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
baggers-test.html
315 lines (287 loc) · 14.7 KB
/
baggers-test.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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Brown Bag Lunch France</title>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.7.0/mustache.min.js"></script>
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/foundation/3.2.2/stylesheets/foundation.min.css" media="screen">
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="js/bootstrap-dropdown.js"></script>
<script src="js/bootstrap-button.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.0.1/lodash.min.js "></script>
</head>
<body>
<script type="text/javascript" src="js/baggers.js"></script>
<!-- Header -->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="#" style="padding-top: 0; padding-bottom: 0;"><img class="logo" src="images/BBL/BBL_light.png" width="100px" style="padding-left: 20px;"></a>
<ul class="nav pull-right">
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">Baggers <b class="caret"></b></a>
<ul class="dropdown-menu" id="baggersNavigationBar">
{{#villes}}
<li class="dropdown-submenu">
<a tabindex="-1" href="#">{{name}}</a>
<ul class="dropdown-menu">
{{#baggers}}
<li><a tabindex="-1" href="#{{{baggerId}}}">{{name}}</a></li>
{{/baggers}}
</ul>
</li>
{{/villes}}
</ul>
</li>
</ul>
</div>
</div>
</div>
<div id="filter-box" class="panel radius" style="margin: 50px 10px 10px 10px; padding: 5px 10px;">
<p class="lead" style="margin: 0 0 0 10px;"> <i class="icon-caret-down show-filter" style="cursor: pointer;"></i> Filtres - <span id="available-baggers" class="label"></span></p>
<div class="container row" style="width: 100%;" id="filter-subbox">
<div class="span3">
<h4><i class="icon-globe"></i> Villes
<button type="button" class="btn btn-inverse btn-small all-tag-filter">Toutes</button>
<button type="button" class="btn btn-inverse btn-small none-tag-filter">Aucune</button>
</h4>
<div id="cities-filter" class="filters">
{{#villes}}
<button type="button" class="btn btn-success btn-city-filter active btn-small" style="margin-bottom: 10px;" data-toggle="button" data-label="ville-{{name}}">{{name}}</button>
{{/villes}}
</div>
</div>
<div class="span10">
<h4><i class="icon-heart"></i> Intérêts
<button type="button" class="btn btn-inverse btn-small all-tag-filter">Tous</button>
<button type="button" class="btn btn-inverse btn-small none-tag-filter">Aucun</button>
</h4>
<div id="tags-filter" class="filters">
</div>
</div>
</div>
</div>
<!-- BAGGERS! -->
<div id="baggersDetails" class="container">
{{#villes}}
<div class="ville-{{name}}">
<div class="row">
<div class="span12">
<img width="910" height="364" src="{{ville_img}}">
<hr>
{{message}}
</div>
</div>
{{#baggers}}
<div id="{{baggerId}}" class="bagger">
<div class="row panel radius container {{#paire}}callout{{/paire}}">
<div class="span3" style="text-align: center; margin: 0 20px 0 0;">
<h3 style="{{#paire}}color: white;{{/paire}}">{{name}}</h3>
<img src="{{picture}}" alt="{{name}}" style="height: 256px;">
<br/><br/>
{{#tags}}
<span class="label label-success {{^paire}}label-info{{/paire}} ">{{.}}</span>
{{/tags}}
</div>
<div class="span8" style="margin: 0;">
<div style="margin-top: 10px;">
<p>{{{bio}}}</p>
<ul class="icons" style="margin-left: 30px;">
{{#websites}}
<li><i class="icon-book"></i> <a href="{{href}}">{{title}}</a></li>
{{/websites}}
<li><i class="icon-twitter"></i> <a href="https://twitter.com/{{twitter}}">@{{twitter}}</a></li>
<li><i class="icon-envelope-alt"></i> Infos et contact : {{{contact}}}</li>
</ul>
</div>
<hr/>
<span class="label round {{#paire}}secondary{{/paire}}">Lieu: </span>
<p><i class="icon-globe"></i> {{location}}</p>
<span class="label round {{#paire}}secondary{{/paire}}">Propose :</span>
<ul class="icons">
{{#sessions}}
<li>
<span class="show-details" style="font-weight: bold; cursor: pointer;"><i class="icon-caret-right"></i> {{title}}</span>
<!--<i class="icon-plus-sign-alt show-details" style="margin-left: 20px; font-weight: normal; color: green; cursor: pointer;"></i>-->
<blockquote style="display: none; {{#paire}}color: white;{{/paire}}">
{{{summary}}}
</blockquote>
</li>
{{/sessions}}
</ul>
</div>
</div>
</div>
{{/baggers}}
<hr>
</div>
{{/villes}}
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.card').click(function(e) {
if ($(e.target).is('span.show-details')) {
e.preventDefault();
} else if (e.target.tagName != 'A') {
var $card = $(this);
console.log('Click to flip');
if ($card.hasClass('flip')) {
$card.removeClass('flip');
} else {
$card.addClass('flip');
}
}
});
});
</script>
<footer style="width:100%;background:#3f3f3f; color:white; padding: 15px 0">
<div class="row">
<strong>
Vous voulez proposer vous aussi des sujets ? Rejoignez la communauté des baggers :
<a style="color: yellow;" href="https://github.com/nrichand/BrownBagLunch/"><i class="icon-github-alt"></i> page github</a>
| <a style="color: yellow;" href="https://twitter.com/bbl_fr"><i class="icon-twitter"></i> @bbl_fr</a>
</strong>
</div>
</footer>
<script type="text/javascript">
// Code taken from js/baggersUtils.js to avoid calling baggersUtils.js because it also include the GoogleMaps JS code, not present in that page...
for (var villeIndex = 0; villeIndex < data['villes'].length; villeIndex++) {
var baggers = data['villes'][villeIndex]['baggers'];
if (baggers !== undefined) {
for (var baggerIndex = 0; baggerIndex < baggers.length; baggerIndex++) {
var bagger = baggers[baggerIndex];
bagger['paire'] = (baggerIndex % 2 == 1);
// On n'utilise plus encodeURIComponent, car cela pose un souci avec le dropdown + Mustache (les liens ne marchent plus)
bagger['baggerId'] = bagger.name.replace(/ /g, '_');
}
}
}
// addPaireImpaire();
// Use Mustache to fill templates
var template = $('#baggersNavigationBar');
template.html(Mustache.render(template.html(), data));
template = $('#baggersDetails');
template.html(Mustache.render(template.html(), data));
template = $('#filter-box');
template.html(Mustache.render(template.html(), data));
// Manage (un)folding for presentation details
$('span.show-details').click(function() {
var $icon = $(this).find('i');
var $blockquote = $(this).next('blockquote');
if ($blockquote.is(':visible')) {
$icon.removeClass('icon-caret-down').addClass('icon-caret-right');
$blockquote.fadeOut();
} else {
$icon.removeClass('icon-caret-right').addClass('icon-caret-down');
$blockquote.fadeIn();
}
});
$('i.show-filter').click(function() {
var $div = $('div#filter-subbox');
if ($div.is(':visible')) {
$(this).removeClass('icon-caret-down').addClass('icon-caret-right');
$div.fadeOut();
} else {
$(this).removeClass('icon-caret-right').addClass('icon-caret-down');
$div.fadeIn();
}
});
$(document).ready(function() {
// Get list of tags from users
var tags = new Array();
for (var i = 0; i < data.villes.length; i++) {
var ville = data.villes[i];
for (var j = 0; j < ville.baggers.length; j++) {
var bagger = ville.baggers[j];
if (bagger.tags !== undefined) {
for (var k = 0; k < bagger.tags.length; k++) {
var tag = bagger.tags[k];
if (tags.indexOf(tag) == -1) {
tags.push(tag);
}
$("div#" + bagger.baggerId).addClass("tag-" + tag.replace(/ /g, '_'));
}
}
}
}
var $div = $('#tags-filter');
tags.sort();
// Create one button per tag in the filter part
for (var i = 0; i < tags.length; i++) {
$div.append('<button type="button" class="btn btn-success btn-tag-filter active btn-small" style="margin-bottom: 10px;" data-toggle="button" data-label="tag-' +
tags[i].replace(/ /g, '_') + '">' + tags[i] + '</button> ');
}
// Manage click on a CITY filter
$('.btn-city-filter').click(function() {
var $btn = $(this);
if ($btn.hasClass('active')) {
$btn.removeClass('btn-success').addClass('btn-default');
} else {
$btn.removeClass('btn-default').addClass('btn-success');
}
$('div.' + $btn.attr('data-label')).fadeToggle('slow', function() { updateBaggers(); });
});
// Manage click on a TAG filter
$('#tags-filter .btn-tag-filter').click(function() {
var $btn = $(this);
console.log('Click on tag ' + $btn.attr('data-label'));
if ($btn.hasClass('active')) {
$btn.removeClass('btn-success').addClass('btn-default');
} else {
$btn.removeClass('btn-default').addClass('btn-success');
}
updateBaggers();
});
// Add / Clear all TAG filters
$('.all-tag-filter').click(function() {
$(this).closest('div').find('button').addClass('active btn-success').removeClass('btn-default');
updateBaggers();
});
$('.none-tag-filter').click(function() {
$(this).closest('div').find('button').removeClass('active btn-success').addClass('btn-default');
updateBaggers();
});
updateBaggers();
});
// Count the number of visible baggers, i.e. the number of baggers that fit the filter criteria.
function updateBaggers() {
// Hide all baggers and cities (it's simpler)
$("div.bagger:visible").hide();
$("div[class^=ville]:visible").hide();
$("#cities-filter button.btn-success").each(function(ic, city) {
$("#tags-filter button.btn-success").each(function(it, tag) {
// For each tag activated, we redisplay the bagger with at least this tag
var baggers = $("div.bagger." + $(tag).attr("data-label") + ":hidden");
if (baggers.length > 0) {
$("." + $(city).attr("data-label")).show();
baggers.show();
};
});
});
var nb = $('div.bagger:visible').length;
var suffix = (nb > 1) ? 's' : '';
$('#available-baggers').html(nb + ' bagger' + suffix + ' disponible' + suffix);
if (nb > 0) {
$('#available-baggers').removeClass('label-important').addClass('label-info');
} else {
$('#available-baggers').removeClass('label-info').addClass('label-important');
}
return nb;
}
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-38399904-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>