Skip to content

Commit

Permalink
Gallery interface and styling per #64
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgarner committed Nov 26, 2014
1 parent df5c57f commit cccfc7d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
3 changes: 1 addition & 2 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
<title>{{ site.name }} | {{ page.title }}</title>
<meta name="description" content="">

<meta name="viewport" content="width=1024,
user-scalable=yes, target-densitydpi=device-dpi">
<meta name="viewport" content="width=1024, user-scalable=yes">

<link rel="stylesheet" href="/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/spectrum.css">
Expand Down
15 changes: 9 additions & 6 deletions css/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,15 @@ div#displayEditor {
box-shadow: 4px 4px 1px rgba(0,0,0,.25);
}

#loadMore {
background: $light-color;
}

#loadMore:hover {
background: $mid-color;
text-decoration: none;
}

#galleryFilter {
background: $secondary-color;
height: 32px;
Expand Down Expand Up @@ -675,12 +684,6 @@ div#displayEditor {
border-bottom: 2px solid white;
}

#galleryControls {
width: 100%;
text-align: center;
padding-bottom: 12px;
}

/* Hints Preview */

.hintPreview {
Expand Down
12 changes: 6 additions & 6 deletions gallery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<script id="template" type="text/html">
{% raw %}
<div class="galleryImage">
<div class="galleryImage" data-index="0">
<a href="{{link}}"><img src="{{image}}" width="250" height="200"/></a>
</div>
{% endraw %}
Expand Down Expand Up @@ -34,12 +34,12 @@
</a>
</div>

<div id="galleryView"></div>
<div id="galleryView">

<button id="loadMore" class="galleryImage btn btn-link" data-loading-text="Loading..." data-index="1">
<span class="glyphicon glyphicon-plus"></span> Load More
</button>

<div id="galleryControls">
<button id="loadMore" class="btn btn-default btn-sm" data-loading-text="Loading...">
<span class="glyphicon glyphicon-plus"></span> Load More
</button>
</div>

</div>
Expand Down
37 changes: 18 additions & 19 deletions js/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var helloGallery = {

helloGallery.pageNumber = 0;
$('#galleryView').isotope('destroy');
$('#galleryView').html("");
$('.galleryImage').not("#loadMore").remove();
$("#loadMore").show();

helloGallery.loadInitial();
Expand All @@ -50,30 +50,29 @@ var helloGallery = {

loadInitial: function() {

helloGallery.loadElements( function(elements){

var container = $('#galleryView');
container.append( elements );
$('#galleryView').isotope({
itemSelector: '.galleryImage',
sortBy : 'index',
getSortData: {
index: '[data-index]'
},
masonry: {
gutter: 12,
isFitWidth: true
}
});

container.isotope({
itemSelector: '.galleryImage',
masonry: {
gutter: 12,
isFitWidth: true
}
});
});
helloGallery.loadMore();
},

loadMore: function() {

helloGallery.loadElements(function(elements){

for (var element in elements) {
var item = $(elements[element]);

$('#galleryView').append(item);
$('#galleryView').isotope('appended', item);
//$('#galleryView').append(item);
$('#galleryView').isotope('insert', item);
}
});

Expand All @@ -90,17 +89,17 @@ var helloGallery = {

switch (helloGallery.sortMode) {
case 0:
console.log("Featured");
//console.log("Featured");
query.descending("featureScore");
query.addDescending("createdAt");
break;
case 1:
console.log("Popular");
//console.log("Popular");
query.descending("viewCount");
query.addDescending("createdAt");
break;
case 2:
console.log("Recent");
//console.log("Recent");
query.descending("createdAt");
break;
}
Expand Down

0 comments on commit cccfc7d

Please sign in to comment.