Просмотр исходного кода

Layout templates in rows of four

James Allen 12 лет назад
Родитель
Сommit
c4b91de8e8

+ 13 - 2
services/web/app/views/templates/tag.jade

@@ -1,5 +1,12 @@
 extends ../layout
 
+mixin template(template)
+	.template-thumbnail
+		a(href=template.templatePagePath ? template.templatePagePath : template.canonicalUrl).thumbnail
+			img(src=template.thumbnailUrl)
+			div.caption
+				h3 #{template.name}
+					
 block content
 	.content.content-alt
 		.container
@@ -9,8 +16,12 @@ block content
 						a(href="/templates") #{translate("templates")}
 						|  ›
 						a(href=tag.tagPagePath)  #{tag.name}
-				.row
-					- _.groupBy(templates, function(e, i) { return Math.floor(index/4) });
+				- for (var row = 0; row <= Math.floor(templates.length / 4); row++)
+					.row
+						- for (var column = 0; column < 4; column++)
+							- if (templates[row*4 + column])
+								.col-md-3
+									+template(templates[row*4 + column])
 					//- -each template in templates
 					//- 	a(href=template.templatePagePath || template.canonicalUrl) 
 					//- 		.col-md-3.template-thumbnail

+ 3 - 0
services/web/public/stylesheets/app/templates.less

@@ -12,6 +12,9 @@
 	.thumbnail {
 		box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);	
 	    -webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.1);
+		img {
+			width: 100%;
+		}
 	}
 
 	a {