Permalink
Browse files

Merge "app/publisher: variable width images in UI"

  • Loading branch information...
mpl authored and Gerrit Code Review committed Apr 29, 2017
2 parents 8fa2ec5 + c5b4448 commit 8f1a7df176de21d0d052c04db45b373c5c282fb1
Showing with 8 additions and 7 deletions.
  1. +2 −2 app/publisher/js/file.go
  2. +5 −4 app/publisher/js/members.go
  3. +1 −1 app/publisher/pics.css
@@ -539,10 +539,10 @@ func (fit *fileItem) setThumb(fic *fileItemContainer) {
return
}
if fic.isTopNode {
fit.thumb = fmt.Sprintf("%s/h%s/=i/%s/?mw=%d&mh=%d", fic.basePath, fit.contentRef.DigestPrefix(10), url.QueryEscape(fit.fileName), fic.thumbHeight, fic.thumbHeight)
fit.thumb = fmt.Sprintf("%s/h%s/=i/%s/?mw=%d&mh=%d", fic.basePath, fit.contentRef.DigestPrefix(10), url.QueryEscape(fit.fileName), maxThumbWidthRatio*fic.thumbHeight, fic.thumbHeight)
return
}
fit.thumb = fmt.Sprintf("%s/h%s/h%s/=i/%s/?mw=%d&mh=%d", fic.basePath, fit.pn.DigestPrefix(10), fit.contentRef.DigestPrefix(10), url.QueryEscape(fit.fileName), fic.thumbHeight, fic.thumbHeight)
fit.thumb = fmt.Sprintf("%s/h%s/h%s/=i/%s/?mw=%d&mh=%d", fic.basePath, fit.pn.DigestPrefix(10), fit.contentRef.DigestPrefix(10), url.QueryEscape(fit.fileName), maxThumbWidthRatio*fic.thumbHeight, fic.thumbHeight)
}

func (fit *fileItem) setDownload(fic *fileItemContainer) {
@@ -35,9 +35,10 @@ import (
const (
bicMembersList = "ul#members" // jquery matching convenience
// TODO(mpl): derive precisely how much blobItemHeight should be from thumbHeight + various margins in css
thumbnailHeight = 200
blobItemHeight = 250 // thumbHeight + some slack
getMembersLimit = 50 // how many more items to fetch in search queries
thumbnailHeight = 200
maxThumbWidthRatio = 3 // maximum thumb width is height*maxThumbWidthRatio
blobItemHeight = 250 // thumbHeight + some slack
getMembersLimit = 50 // how many more items to fetch in search queries
)

var theBic *blobItemContainer
@@ -391,7 +392,7 @@ func (bi *blobItem) thumbnail(pathPrefix, basePath string, thumbHeight int) stri
switch {
case bi.isImage:
// TODO(mpl): should we/can we prefetch the image?
bi.thumb = fmt.Sprintf("%s/h%s/h%s/=i/%s/?mw=%d&mh=%d", basePath, bi.pn.DigestPrefix(10), bi.contentRef.DigestPrefix(10), url.QueryEscape(bi.fileName), thumbHeight, thumbHeight)
bi.thumb = fmt.Sprintf("%s/h%s/h%s/=i/%s/?mw=%d&mh=%d", basePath, bi.pn.DigestPrefix(10), bi.contentRef.DigestPrefix(10), url.QueryEscape(bi.fileName), maxThumbWidthRatio*thumbHeight, thumbHeight)
case bi.isDir:
bi.thumb = fmt.Sprintf("%s=s/folder.png", pathPrefix)
case bi.fileName != "": // isFile, but not image
@@ -65,7 +65,7 @@ li img {
border-radius: 6px;
display: block;
max-height: 200px;
max-width: 200px;
max-width: 600px;
margin-bottom: 1em;
}
li .camlifile {

0 comments on commit 8f1a7df

Please sign in to comment.