newui: permanode: rm type drop down, added cammount tip

Change-Id: Iec6f4fb7c3e7ad1ed92ee409822f15a5e2d41e11
This commit is contained in:
mpl 2013-06-10 00:41:05 +02:00
parent 2de24d22b5
commit 4ea052fca0
2 changed files with 25 additions and 31 deletions

View File

@ -63,21 +63,7 @@
<div id="existingPaths"></div>
<form id="formType">
<p>
Type:
<select id='type' disabled>
<option value=''>(None / auto)</option>
<option value='_other'>(Other)</option>
<option value="root">Root (of a hierarchy)</option>
<option value="collection">Collection (e.g. directory, gallery)</option>
<option value="file">File</option>
<option value="collection">File Collection / Gallery</option>
<option value="microblog">Microblog Post</option>
<option value="blog">Blog Post</option>
</select>
</p>
</form>
<div id="cammountTip"></div>
<div id="members"></div>
<p><button id="btnGallery" value="list">Thumbnails</button></p>

View File

@ -236,8 +236,10 @@ function(permanode, describeResult) {
// handle type detection
handleType(permObj);
// TODO(mpl): link to filetree browser when type is dir
// TODO(mpl): display command to cammount the dir
// TODO(mpl): add a line showing something like
// "Content: file (blobref)" or
// "Content: directory (blobref)" or
// "Content: None (has members)".
// members
this.reloadMembers_();
@ -251,6 +253,19 @@ function(permanode, describeResult) {
var useFileBlobrefAsLink = "true";
var blobItem = new camlistore.BlobItem(permanode, meta, useFileBlobrefAsLink);
blobItem.decorate(content);
// TODO(mpl): ideally this should be done by handleType, but it's easier
// to do it now that we have a blobItem object to work with.
var isdir = blobItem.getDirBlobref_()
var mountTip = goog.dom.getElement("cammountTip");
goog.dom.removeChildren(mountTip);
if (isdir != "") {
var tip = "Mount with:";
goog.dom.setTextContent(mountTip, tip);
goog.dom.appendChild(mountTip, goog.dom.createDom("br"));
var codeTip = goog.dom.createDom("code");
goog.dom.setTextContent(codeTip, "$ cammount /some/mountpoint " + isdir);
goog.dom.appendChild(mountTip, codeTip);
}
}
// debug attrs
@ -899,27 +914,20 @@ function permAttr(permanodeObject, name) {
function handleType(permObj) {
var disablePublish = false;
var selType = goog.dom.getElement("type");
if (permAttr(permObj, "camliRoot")) {
selType.value = "root";
disablePublish = true; // can't give a URL to a root with a claim
} else if (permAttr(permObj, "camliContent")) {
selType.value = "file";
} else if (permAttr(permObj, "camliMember")) {
selType.value = "collection";
}
var dnd = goog.dom.getElement("dnd");
var btnGallery = goog.dom.getElement("btnGallery");
var membersDiv = goog.dom.getElement("members");
if (selType.value == "collection" || selType.value == "") {
dnd.style.display = "none";
btnGallery.style.visibility = 'hidden';
goog.dom.setTextContent(membersDiv, "");
if (permAttr(permObj, "camliRoot")) {
disablePublish = true; // can't give a URL to a root with a claim
} else if (permAttr(permObj, "camliMember")) {
dnd.style.display = "block";
btnGallery.style.visibility = 'visible';
goog.dom.setTextContent(membersDiv, "Members:");
} else {
dnd.style.display = "none";
btnGallery.style.visibility = 'hidden';
goog.dom.setTextContent(membersDiv, "");
}
goog.dom.getElement("selectPublishRoot").disabled = disablePublish;
goog.dom.getElement("publishSuffix").disabled = disablePublish;
goog.dom.getElement("btnSavePublish").disabled = disablePublish;