From b2885cedfa92cd2ed9bada5b29516f63e527bf4c Mon Sep 17 00:00:00 2001 From: Brett Slatkin Date: Sun, 23 Dec 2012 16:32:30 -0800 Subject: [PATCH 1/2] newui: Cleaning up styling of create item Change-Id: Ie35684c4efba4ce4cec777537b8a0783b51b311f --- server/camlistored/newui/blob_item.css | 4 ++-- server/camlistored/newui/blob_item.js | 2 +- server/camlistored/newui/blob_item_container.js | 3 ++- server/camlistored/newui/create_item.js | 4 +--- server/camlistored/newui/server_connection.js | 1 + 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/camlistored/newui/blob_item.css b/server/camlistored/newui/blob_item.css index 388964014..118773e82 100644 --- a/server/camlistored/newui/blob_item.css +++ b/server/camlistored/newui/blob_item.css @@ -3,16 +3,16 @@ margin: 0.25em; border: 1px solid gray; padding: 8px; - max-width: 250px; display: inline-block; overflow: hidden; text-align: center; vertical-align: top; } -.cam-blobitem-150 { +.cam-blobitemcontainer-150 .cam-blobitem { width: 150px; height: 150px; + max-width: 250px; } .cam-blobitem:hover { diff --git a/server/camlistored/newui/blob_item.js b/server/camlistored/newui/blob_item.js index b386c4cd8..f80cdd83a 100644 --- a/server/camlistored/newui/blob_item.js +++ b/server/camlistored/newui/blob_item.js @@ -140,7 +140,7 @@ camlistore.BlobItem.prototype.decorateInternal = function(element) { camlistore.BlobItem.superClass_.decorateInternal.call(this, element); var el = this.getElement(); - goog.dom.classes.add(el, 'cam-blobitem', 'cam-blobitem-150'); + goog.dom.classes.add(el, 'cam-blobitem'); var linkEl = this.dom_.createDom('a'); diff --git a/server/camlistored/newui/blob_item_container.js b/server/camlistored/newui/blob_item_container.js index 51af19efd..43e9f5e65 100644 --- a/server/camlistored/newui/blob_item_container.js +++ b/server/camlistored/newui/blob_item_container.js @@ -72,7 +72,8 @@ camlistore.BlobItemContainer.prototype.decorateInternal = function(element) { camlistore.BlobItemContainer.superClass_.decorateInternal.call(this, element); var el = this.getElement(); - goog.dom.classes.add(el, 'cam-blobitemcontainer'); + goog.dom.classes.add( + el, 'cam-blobitemcontainer', 'cam-blobitemcontainer-150'); }; diff --git a/server/camlistored/newui/create_item.js b/server/camlistored/newui/create_item.js index 19d1dad88..ed247bee4 100644 --- a/server/camlistored/newui/create_item.js +++ b/server/camlistored/newui/create_item.js @@ -48,9 +48,7 @@ camlistore.CreateItem.prototype.decorateInternal = function(element) { camlistore.CreateItem.superClass_.decorateInternal.call(this, element); var el = this.getElement(); - // TODO(bslatkin): Put cam-blobitem-150 on the parent container. - goog.dom.classes.add(el, 'cam-blobitem', 'cam-blobitem-150', - 'cam-createitem'); + goog.dom.classes.add(el, 'cam-blobitem', 'cam-createitem'); var plusEl = this.dom_.createDom('a', 'cam-createitem-link'); plusEl.href = '#'; diff --git a/server/camlistored/newui/server_connection.js b/server/camlistored/newui/server_connection.js index df8d6fad4..38a9fa2bc 100644 --- a/server/camlistored/newui/server_connection.js +++ b/server/camlistored/newui/server_connection.js @@ -72,5 +72,6 @@ camlistore.ServerConnection.prototype.getRecentlyUpdatedPermanodesDone_ = return; } + // TODO(bslatkin): Rewrite thumbnail URLs to be absolute. success(result); }; From 511eb7c6d44edefd6498b721d4edd627fe79c921 Mon Sep 17 00:00:00 2001 From: Brett Slatkin Date: Sun, 23 Dec 2012 16:47:03 -0800 Subject: [PATCH 2/2] newui: Links to permanodes working Change-Id: Iaaf9ca22dbd401d5c0b2e75d0349358f8282ca68 --- server/camlistored/newui/blob_item.css | 2 ++ server/camlistored/newui/blob_item.js | 20 +++++++++++++++---- server/camlistored/newui/create_item.css | 3 ++- server/camlistored/newui/create_item.js | 2 +- server/camlistored/newui/server_connection.js | 2 -- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/server/camlistored/newui/blob_item.css b/server/camlistored/newui/blob_item.css index 118773e82..ae59b6096 100644 --- a/server/camlistored/newui/blob_item.css +++ b/server/camlistored/newui/blob_item.css @@ -7,6 +7,8 @@ overflow: hidden; text-align: center; vertical-align: top; + outline: 0; + cursor: default; } .cam-blobitemcontainer-150 .cam-blobitem { diff --git a/server/camlistored/newui/blob_item.js b/server/camlistored/newui/blob_item.js index f80cdd83a..4a2bd4bd3 100644 --- a/server/camlistored/newui/blob_item.js +++ b/server/camlistored/newui/blob_item.js @@ -90,8 +90,8 @@ camlistore.BlobItem.resolve = function(blobRef, metaBag) { * @return {string} */ camlistore.BlobItem.prototype.getThumbSrc_ = function() { - // TODO(bslatkin): Make this prefix configured by globals, discovered by - // the page at initialization. + // TODO(bslatkin): Remove the '../' once we move the new UI to the right + // handler, or change the server side to return an absolute URL. return '../' + this.metaData_.thumbnailSrc; }; @@ -112,6 +112,16 @@ camlistore.BlobItem.prototype.getThumbWidth_ = function() { }; +/** + * @return {string} + */ +camlistore.BlobItem.prototype.getLink_ = function() { + // TODO(bslatkin): Remove the '../' once we move the new UI to the right + // handler, or change the server side to return an absolute URL. + return '../?p=' + this.blobRef_; +}; + + /** * @return {string} */ @@ -143,13 +153,15 @@ camlistore.BlobItem.prototype.decorateInternal = function(element) { goog.dom.classes.add(el, 'cam-blobitem'); var linkEl = this.dom_.createDom('a'); - + linkEl.href = this.getLink_(); var thumbEl = this.dom_.createDom('img', 'cam-blobitem-thumb'); thumbEl.src = this.getThumbSrc_(); thumbEl.height = this.getThumbHeight_(); thumbEl.width = this.getThumbWidth_(); - this.dom_.appendChild(el, thumbEl); + + this.dom_.appendChild(linkEl, thumbEl); + this.dom_.appendChild(el, linkEl); var titleEl = this.dom_.createDom('p', 'cam-blobitem-thumbtitle'); this.dom_.setTextContent(titleEl, this.getTitle_()); diff --git a/server/camlistored/newui/create_item.css b/server/camlistored/newui/create_item.css index d0f356e7d..954bf6649 100644 --- a/server/camlistored/newui/create_item.css +++ b/server/camlistored/newui/create_item.css @@ -2,6 +2,7 @@ font-size: 40pt; text-decoration: none; } + .cam-createitem { - cursor: pointer;; + cursor: pointer !important; } diff --git a/server/camlistored/newui/create_item.js b/server/camlistored/newui/create_item.js index ed247bee4..a19d2a89e 100644 --- a/server/camlistored/newui/create_item.js +++ b/server/camlistored/newui/create_item.js @@ -51,7 +51,7 @@ camlistore.CreateItem.prototype.decorateInternal = function(element) { goog.dom.classes.add(el, 'cam-blobitem', 'cam-createitem'); var plusEl = this.dom_.createDom('a', 'cam-createitem-link'); - plusEl.href = '#'; + plusEl.href = 'javascript:void(0)'; this.dom_.setTextContent(plusEl, "+") this.dom_.appendChild(el, plusEl); diff --git a/server/camlistored/newui/server_connection.js b/server/camlistored/newui/server_connection.js index 38a9fa2bc..29a50d49a 100644 --- a/server/camlistored/newui/server_connection.js +++ b/server/camlistored/newui/server_connection.js @@ -71,7 +71,5 @@ camlistore.ServerConnection.prototype.getRecentlyUpdatedPermanodesDone_ = } return; } - - // TODO(bslatkin): Rewrite thumbnail URLs to be absolute. success(result); };