Innocenty Enikeew 10 жил өмнө
parent
commit
077971101f
3 өөрчлөгдсөн 15 нэмэгдсэн , 4 устгасан
  1. 6 3
      assets/site.css
  2. 8 0
      assets/site.js
  3. 1 1
      photo-store.lisp

+ 6 - 3
assets/site.css

@@ -162,7 +162,6 @@ p, ul.text-list {
 
 .section {
   width: 100%;
-  margin-top: 176px;
 }
 .docs {
   margin-top: 60px;
@@ -176,7 +175,7 @@ p, ul.text-list {
 
 
 .row {
-  max-width: 800px;
+  max-width: 1108px;
   margin: 24px auto;
   padding: 0 30px;
   position: relative;
@@ -372,7 +371,7 @@ img.img--with_border {
   display: block;
   float: left;
   margin: 0 12px 12px 0;
-  width: 171px;
+  width: 250px;
 /*  line-height: 0; */
 }
 .demo-gallery figure {
@@ -547,4 +546,8 @@ div.incoming-album label {
 
 div.incoming-album input[type='text'] {
     width: 400px;
+}
+
+h3.albums-year {
+    clear: both;
 }

+ 8 - 0
assets/site.js

@@ -1,7 +1,15 @@
 function setAlbums(albums) {
     var dAlbums = document.getElementById('albums');
+    var lastYear = null;
     dAlbums.innerHTML = '';
     Array.prototype.forEach.call(albums, function(alb, i){
+        var date = new Date(alb.date*1000),
+            yyyy = date.getFullYear();
+        if (yyyy != lastYear) {
+            appendElement(dAlbums, 'h3', null, 'albums-year', yyyy);
+            lastYear = yyyy;
+        };
+
         var a = addAlbumDom(dAlbums, alb, true);
         a.setAttribute('data-id', alb.id);
         a.setAttribute('title', alb.cover.src);

+ 1 - 1
photo-store.lisp

@@ -69,7 +69,7 @@
 (defun db-load-albums (&optional parent-id)
   (with-db (db)
     (iter (for (id title cover-path cover-w cover-h cover-taken count)
-               in-sqlite-query "select a.id, a.name, c.path, c.width, c.height, c.taken, (select count(photo_id) from album_photos where album_id=a.id) cnt from albums a left join photos c on a.cover_id=c.id where cnt > 0 and ((? is null and parent_id is null) or (parent_id=?)) order by c.taken" on-database db with-parameters (parent-id parent-id))
+               in-sqlite-query "select a.id, a.name, c.path, c.width, c.height, c.taken, (select count(photo_id) from album_photos where album_id=a.id) cnt from albums a left join photos c on a.cover_id=c.id where cnt > 0 and ((? is null and parent_id is null) or (parent_id=?)) order by c.taken desc" on-database db with-parameters (parent-id parent-id))
           (collect (list (cons :id id)
                          (cons :title title)
                          (cons :count count)