Skip to content

Commit 7c5937c

Browse files
committed
Added masonry javascript to profile page to layout tiles.
1 parent 3fa8e41 commit 7c5937c

File tree

4 files changed

+59
-50
lines changed

4 files changed

+59
-50
lines changed

app/views/home.scala.html

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -466,57 +466,9 @@ <h4><a href="@routes.Collections.collection(collectionInfo._1)">@collectionInfo.
466466
</div>
467467
</div>
468468

469-
<script src="@routes.Assets.at("javascripts/lib/masonry.pkgd.min.js")" type="text/javascript"></script>
470-
<script src="@routes.Assets.at("javascripts/lib/imagesloaded.pkgd.min.js")" type="text/javascript"></script>
469+
@* Use masonry javascript library to layout the tiles within each tab *@
470+
@util.masonryTabbed()
471471

472-
<script>
473-
var removeIndicator=true;
474-
function activateOne(id) {
475-
// initialize Masonry
476-
var $container = $('#'+id).masonry();
477-
// layout Masonry again after all images have loaded
478-
imagesLoaded( '#masonry', function() {
479-
$container.masonry({
480-
itemSelector: '.post-box',
481-
columnWidth: '.post-box',
482-
transitionDuration: 4
483-
});
484-
});
485-
}
486-
487-
function activate(){
488-
activateOne("masonry-datasets");
489-
activateOne("masonry-collections");
490-
activateOne("masonry-spaces");
491-
}
492-
493-
$(document).ready(function() {
494-
activate();
495-
$('.nav-tabs').stickyTabs();
496-
});
497-
498-
// fire when showing from tab
499-
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
500-
activate();
501-
})
502-
503-
var eventCount = 3;
504-
function moreEvents(){
505-
var request = jsRoutes.controllers.Events.getEvents(eventCount).ajax({
506-
type: 'GET'
507-
});
508-
509-
request.done(function (response, textStatus, jqXHR) {
510-
eventCount = eventCount + 1;
511-
$("#moreevent").append(response);
512-
});
513-
514-
request.fail(function (jqXHR, textStatus, errorThrown){
515-
console.error("The following error occured: " + textStatus, errorThrown);
516-
notify("Could not get moe events: " + errorThrown, "error");
517-
});
518-
}
519-
</script>
520472
<script src="@routes.Assets.at("javascripts/follow-button.js")" type="text/javascript"></script>
521473
<script src="@routes.Assets.at("javascripts/select.js")" type="text/javascript"></script>
522474

app/views/profile.scala.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,11 @@ <h4 id="userkeys">User API Keys</h4>
211211
</div>
212212
</div>
213213

214+
@* Required by next script *@
215+
<script src="@routes.Assets.at("javascripts/stickytabs/jquery.stickytabs.js")" type="text/javascript"></script>
216+
@* Use masonry javascript library to layout the tiles within each tab *@
217+
@util.masonryTabbed()
218+
214219
<script language="javascript">
215220
var profileMail = "@profile.email.getOrElse("")";
216221
var firstName = $('#first-name-title').text();
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<script src="@routes.Assets.at("javascripts/lib/masonry.pkgd.min.js")" type="text/javascript"></script>
2+
<script src="@routes.Assets.at("javascripts/lib/imagesloaded.pkgd.min.js")" type="text/javascript"></script>
3+
4+
<script>
5+
var removeIndicator=true;
6+
function activateOne(id) {
7+
// initialize Masonry
8+
var $container = $('#'+id).masonry();
9+
// layout Masonry again after all images have loaded
10+
imagesLoaded( '#masonry', function() {
11+
$container.masonry({
12+
itemSelector: '.post-box',
13+
columnWidth: '.post-box',
14+
transitionDuration: 4
15+
});
16+
});
17+
}
18+
19+
function activate(){
20+
activateOne("masonry-datasets");
21+
activateOne("masonry-collections");
22+
activateOne("masonry-spaces");
23+
}
24+
25+
$(document).ready(function() {
26+
activate();
27+
$('.nav-tabs').stickyTabs();
28+
});
29+
30+
// fire when showing from tab
31+
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
32+
activate();
33+
})
34+
35+
var eventCount = 3;
36+
function moreEvents(){
37+
var request = jsRoutes.controllers.Events.getEvents(eventCount).ajax({
38+
type: 'GET'
39+
});
40+
41+
request.done(function (response, textStatus, jqXHR) {
42+
eventCount = eventCount + 1;
43+
$("#moreevent").append(response);
44+
});
45+
46+
request.fail(function (jqXHR, textStatus, errorThrown){
47+
console.error("The following error occured: " + textStatus, errorThrown);
48+
notify("Could not get moe events: " + errorThrown, "error");
49+
});
50+
}
51+
</script>

app/views/util/multimasonry.scala.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@* TODO: Delete? I don't think this is being used anywhere in the code right now *@
12
<script src="@routes.Assets.at("javascripts/lib/masonry.pkgd.min.js")" type="text/javascript"></script>
23
<script src="@routes.Assets.at("javascripts/lib/imagesloaded.pkgd.min.js")" type="text/javascript"></script>
34

0 commit comments

Comments
 (0)