mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1468992 - Remove the Library infopane More/Less toggle. r=mak
MozReview-Commit-ID: LRNXWTHaGYS --HG-- extra : rebase_source : c71bf348490ea8f3791202e65f42280bf81ed803
This commit is contained in:
parent
f794a876e1
commit
bf70cd59cf
@ -114,7 +114,6 @@
|
||||
|
||||
<vbox id="editBMPanel_keywordRow"
|
||||
collapsed="true">
|
||||
<observes element="additionalInfoBroadcaster" attribute="hidden"/>
|
||||
<label value="&editBookmarkOverlay.keyword.label;"
|
||||
accesskey="&editBookmarkOverlay.keyword.accesskey;"
|
||||
control="editBMPanel_keywordField"/>
|
||||
@ -122,8 +121,4 @@
|
||||
onchange="gEditItemOverlay.onKeywordFieldChange();"/>
|
||||
</vbox>
|
||||
</vbox>
|
||||
|
||||
<!-- If the ids are changing or additional fields are being added, be sure
|
||||
to sync the values in places.js -->
|
||||
<broadcaster id="additionalInfoBroadcaster"/>
|
||||
</vbox>
|
||||
|
@ -28,13 +28,6 @@ const HISTORY_LIBRARY_SEARCH_TELEMETRY = "PLACES_HISTORY_LIBRARY_SEARCH_TIME_MS"
|
||||
var PlacesOrganizer = {
|
||||
_places: null,
|
||||
|
||||
// IDs of fields from editBookmark that should be hidden when infoBox
|
||||
// is minimal. IDs should be kept in sync with the IDs of the elements
|
||||
// observing additionalInfoBroadcaster.
|
||||
_additionalInfoFields: [
|
||||
"editBMPanel_keywordRow",
|
||||
],
|
||||
|
||||
_initFolderTree() {
|
||||
this._places.place = `place:type=${Ci.nsINavHistoryQueryOptions.RESULTS_AS_LEFT_PANE_QUERY}&excludeItems=1&expandQueries=0`;
|
||||
},
|
||||
@ -584,41 +577,6 @@ var PlacesOrganizer = {
|
||||
fp.open(fpCallback);
|
||||
},
|
||||
|
||||
_detectAndSetDetailsPaneMinimalState:
|
||||
function PO__detectAndSetDetailsPaneMinimalState(aNode) {
|
||||
/**
|
||||
* The details of simple folder-items (as opposed to livemarks) or the
|
||||
* of livemark-children are not likely to fill the infoBox anyway,
|
||||
* thus we remove the "More/Less" button and show all details.
|
||||
*
|
||||
* the wasminimal attribute here is used to persist the "more/less"
|
||||
* state in a bookmark->folder->bookmark scenario.
|
||||
*/
|
||||
var infoBox = document.getElementById("infoBox");
|
||||
var infoBoxExpanderWrapper = document.getElementById("infoBoxExpanderWrapper");
|
||||
var additionalInfoBroadcaster = document.getElementById("additionalInfoBroadcaster");
|
||||
|
||||
if (!aNode) {
|
||||
infoBoxExpanderWrapper.hidden = true;
|
||||
return;
|
||||
}
|
||||
if (aNode.itemId != -1 &&
|
||||
PlacesUtils.nodeIsFolder(aNode) && !aNode._feedURI) {
|
||||
if (infoBox.getAttribute("minimal") == "true")
|
||||
infoBox.setAttribute("wasminimal", "true");
|
||||
infoBox.removeAttribute("minimal");
|
||||
infoBoxExpanderWrapper.hidden = true;
|
||||
} else {
|
||||
if (infoBox.getAttribute("wasminimal") == "true")
|
||||
infoBox.setAttribute("minimal", "true");
|
||||
infoBox.removeAttribute("wasminimal");
|
||||
infoBoxExpanderWrapper.hidden =
|
||||
this._additionalInfoFields.every(id =>
|
||||
document.getElementById(id).collapsed);
|
||||
}
|
||||
additionalInfoBroadcaster.hidden = infoBox.getAttribute("minimal") == "true";
|
||||
},
|
||||
|
||||
_fillDetailsPane: function PO__fillDetailsPane(aNodeList) {
|
||||
var infoBox = document.getElementById("infoBox");
|
||||
var detailsDeck = document.getElementById("detailsDeck");
|
||||
@ -659,8 +617,6 @@ var PlacesOrganizer = {
|
||||
|
||||
gEditItemOverlay.initPanel({ node: selectedNode,
|
||||
hiddenRows: ["folderPicker"] });
|
||||
|
||||
this._detectAndSetDetailsPaneMinimalState(selectedNode);
|
||||
} else if (!selectedNode && aNodeList[0]) {
|
||||
if (aNodeList.every(PlacesUtils.nodeIsURI)) {
|
||||
let uris = aNodeList.map(node => Services.io.newURI(node.uri));
|
||||
@ -670,7 +626,6 @@ var PlacesOrganizer = {
|
||||
"location",
|
||||
"keyword",
|
||||
"name"]});
|
||||
this._detectAndSetDetailsPaneMinimalState(selectedNode);
|
||||
} else {
|
||||
detailsDeck.selectedIndex = 0;
|
||||
let selectItemDesc = document.getElementById("selectItemDescription");
|
||||
@ -703,27 +658,6 @@ var PlacesOrganizer = {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
toggleAdditionalInfoFields: function PO_toggleAdditionalInfoFields() {
|
||||
var infoBox = document.getElementById("infoBox");
|
||||
var infoBoxExpander = document.getElementById("infoBoxExpander");
|
||||
var infoBoxExpanderLabel = document.getElementById("infoBoxExpanderLabel");
|
||||
var additionalInfoBroadcaster = document.getElementById("additionalInfoBroadcaster");
|
||||
|
||||
if (infoBox.getAttribute("minimal") == "true") {
|
||||
infoBox.removeAttribute("minimal");
|
||||
infoBoxExpanderLabel.value = infoBoxExpanderLabel.getAttribute("lesslabel");
|
||||
infoBoxExpanderLabel.accessKey = infoBoxExpanderLabel.getAttribute("lessaccesskey");
|
||||
infoBoxExpander.className = "expander-up";
|
||||
additionalInfoBroadcaster.removeAttribute("hidden");
|
||||
} else {
|
||||
infoBox.setAttribute("minimal", "true");
|
||||
infoBoxExpanderLabel.value = infoBoxExpanderLabel.getAttribute("morelabel");
|
||||
infoBoxExpanderLabel.accessKey = infoBoxExpanderLabel.getAttribute("moreaccesskey");
|
||||
infoBoxExpander.className = "expander-down";
|
||||
additionalInfoBroadcaster.setAttribute("hidden", "true");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -441,25 +441,8 @@
|
||||
</description>
|
||||
<spacer flex="3"/>
|
||||
</vbox>
|
||||
<vbox id="infoBox" minimal="true">
|
||||
<vbox id="infoBox">
|
||||
#include editBookmarkPanel.inc.xul
|
||||
<hbox id="infoBoxExpanderWrapper" align="center">
|
||||
|
||||
<button type="image" id="infoBoxExpander"
|
||||
class="expander-down"
|
||||
oncommand="PlacesOrganizer.toggleAdditionalInfoFields();"
|
||||
observes="paneElementsBroadcaster"/>
|
||||
|
||||
<label id="infoBoxExpanderLabel"
|
||||
lesslabel="&detailsPane.less.label;"
|
||||
lessaccesskey="&detailsPane.less.accesskey;"
|
||||
morelabel="&detailsPane.more.label;"
|
||||
moreaccesskey="&detailsPane.more.accesskey;"
|
||||
value="&detailsPane.more.label;"
|
||||
accesskey="&detailsPane.more.accesskey;"
|
||||
control="infoBoxExpander"/>
|
||||
|
||||
</hbox>
|
||||
</vbox>
|
||||
</deck>
|
||||
</vbox>
|
||||
|
@ -62,7 +62,6 @@ skip-if = (verify && debug && (os == 'mac' || os == 'linux'))
|
||||
[browser_library_delete_tags.js]
|
||||
[browser_library_delete.js]
|
||||
[browser_library_downloads.js]
|
||||
[browser_library_infoBox.js]
|
||||
[browser_library_left_pane_middleclick.js]
|
||||
[browser_library_left_pane_select_hierarchy.js]
|
||||
[browser_library_middleclick.js]
|
||||
|
@ -48,11 +48,6 @@ add_task(async function() {
|
||||
library.ContentTree.view.selectNode(node);
|
||||
synthesizeClickOnSelectedTreeCell(library.ContentTree.view);
|
||||
|
||||
// Expand the additional info for the first bookmark.
|
||||
if (i === 0) {
|
||||
library.document.getElementById("infoBoxExpander").click();
|
||||
}
|
||||
|
||||
is(library.document.getElementById("editBMPanel_keywordField").value, "",
|
||||
"The keyword field should be empty");
|
||||
info("Add a keyword to the bookmark");
|
||||
|
@ -1,160 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* Test appropriate visibility of infoBoxExpanderWrapper and
|
||||
* additionalInfoFields in infoBox section of library
|
||||
*/
|
||||
|
||||
let gLibrary;
|
||||
add_task(async function() {
|
||||
// Open Library.
|
||||
gLibrary = await promiseLibrary();
|
||||
registerCleanupFunction(async () => {
|
||||
gLibrary.close();
|
||||
await PlacesUtils.history.clear();
|
||||
});
|
||||
gLibrary.PlacesOrganizer._places.focus();
|
||||
|
||||
info("Bug 430148 - Remove or hide the more/less button in details pane...");
|
||||
let PO = gLibrary.PlacesOrganizer;
|
||||
let ContentTree = gLibrary.ContentTree;
|
||||
let infoBoxExpanderWrapper = getAndCheckElmtById("infoBoxExpanderWrapper");
|
||||
|
||||
await PlacesTestUtils.addVisits("http://www.mozilla.org/");
|
||||
|
||||
// open all bookmarks node
|
||||
PO.selectLeftPaneBuiltIn("AllBookmarks");
|
||||
isnot(PO._places.selectedNode, null,
|
||||
"Correctly selected all bookmarks node.");
|
||||
checkInfoBoxSelected();
|
||||
ok(infoBoxExpanderWrapper.hidden,
|
||||
"Expander button is hidden for all bookmarks node.");
|
||||
checkAddInfoFieldsCollapsed(PO);
|
||||
|
||||
// open history node
|
||||
PO.selectLeftPaneBuiltIn("History");
|
||||
isnot(PO._places.selectedNode, null, "Correctly selected history node.");
|
||||
checkInfoBoxSelected();
|
||||
ok(infoBoxExpanderWrapper.hidden,
|
||||
"Expander button is hidden for history node.");
|
||||
checkAddInfoFieldsCollapsed(PO);
|
||||
|
||||
// open history child node
|
||||
var historyNode = PO._places.selectedNode.
|
||||
QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
historyNode.containerOpen = true;
|
||||
var childNode = historyNode.getChild(0);
|
||||
isnot(childNode, null, "History node first child is not null.");
|
||||
PO._places.selectNode(childNode);
|
||||
checkInfoBoxSelected();
|
||||
ok(infoBoxExpanderWrapper.hidden,
|
||||
"Expander button is hidden for history child node.");
|
||||
checkAddInfoFieldsCollapsed(PO);
|
||||
|
||||
// open history item
|
||||
var view = ContentTree.view.view;
|
||||
ok(view.rowCount > 0, "History item exists.");
|
||||
view.selection.select(0);
|
||||
ok(infoBoxExpanderWrapper.hidden,
|
||||
"Expander button is hidden for history item.");
|
||||
checkAddInfoFieldsCollapsed(PO);
|
||||
|
||||
historyNode.containerOpen = false;
|
||||
|
||||
// open bookmarks menu node
|
||||
PO.selectLeftPaneBuiltIn("BookmarksMenu");
|
||||
isnot(PO._places.selectedNode, null,
|
||||
"Correctly selected bookmarks menu node.");
|
||||
checkInfoBoxSelected();
|
||||
ok(infoBoxExpanderWrapper.hidden,
|
||||
"Expander button is hidden for bookmarks menu node.");
|
||||
checkAddInfoFieldsCollapsed(PO);
|
||||
|
||||
// open recently bookmarked node
|
||||
await PlacesUtils.bookmarks.insert({
|
||||
parentGuid: PlacesUtils.bookmarks.menuGuid,
|
||||
url: "place:" + PlacesUtils.bookmarks.userContentRoots.map(guid => `parent=${guid}`).join("&") +
|
||||
"&queryType=" + Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS +
|
||||
"&sort=" + Ci.nsINavHistoryQueryOptions.SORT_BY_DATEADDED_DESCENDING +
|
||||
"&maxResults=10" +
|
||||
"&excludeQueries=1",
|
||||
title: "Recent Bookmarks",
|
||||
index: 0
|
||||
});
|
||||
await PlacesUtils.bookmarks.insert({
|
||||
parentGuid: PlacesUtils.bookmarks.menuGuid,
|
||||
url: "http://mozilla.org/",
|
||||
title: "Mozilla",
|
||||
index: 1
|
||||
});
|
||||
var menuNode = PO._places.selectedNode.
|
||||
QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
menuNode.containerOpen = true;
|
||||
childNode = menuNode.getChild(0);
|
||||
isnot(childNode, null, "Bookmarks menu child node exists.");
|
||||
is(childNode.title, "Recent Bookmarks",
|
||||
"Correctly selected recently bookmarked node.");
|
||||
PO._places.selectNode(childNode);
|
||||
checkInfoBoxSelected();
|
||||
ok(infoBoxExpanderWrapper.hidden,
|
||||
"Expander button is hidden for recently bookmarked node.");
|
||||
checkAddInfoFieldsCollapsed(PO);
|
||||
|
||||
// open first bookmark
|
||||
view = ContentTree.view.view;
|
||||
ContentTree.view.focus();
|
||||
ok(view.rowCount > 0, "Bookmark item exists.");
|
||||
view.selection.select(0);
|
||||
checkInfoBoxSelected();
|
||||
ok(!infoBoxExpanderWrapper.hidden,
|
||||
"Expander button is not hidden for bookmark item.");
|
||||
checkAddInfoFieldsNotCollapsed(PO);
|
||||
|
||||
ok(true, "Checking additional info fields visibiity for bookmark item");
|
||||
var expanderButton = getAndCheckElmtById("infoBoxExpander");
|
||||
|
||||
// make sure additional fields are hidden by default
|
||||
PO._additionalInfoFields.forEach(function(id) {
|
||||
ok(getAndCheckElmtById(id).hidden,
|
||||
"Additional info field correctly hidden by default: #" + id);
|
||||
});
|
||||
|
||||
// toggle fields and make sure they are hidden/unhidden as expected
|
||||
expanderButton.click();
|
||||
PO._additionalInfoFields.forEach(function(id) {
|
||||
ok(!getAndCheckElmtById(id).hidden,
|
||||
"Additional info field correctly unhidden after toggle: #" + id);
|
||||
});
|
||||
expanderButton.click();
|
||||
PO._additionalInfoFields.forEach(function(id) {
|
||||
ok(getAndCheckElmtById(id).hidden,
|
||||
"Additional info field correctly hidden after toggle: #" + id);
|
||||
});
|
||||
|
||||
menuNode.containerOpen = false;
|
||||
});
|
||||
|
||||
function checkInfoBoxSelected() {
|
||||
is(getAndCheckElmtById("detailsDeck").selectedIndex, 1,
|
||||
"Selected element in detailsDeck is infoBox.");
|
||||
}
|
||||
|
||||
function checkAddInfoFieldsCollapsed(PO) {
|
||||
PO._additionalInfoFields.forEach(id => {
|
||||
ok(getAndCheckElmtById(id).collapsed,
|
||||
`Additional info field should be collapsed: #${id}`);
|
||||
});
|
||||
}
|
||||
|
||||
function checkAddInfoFieldsNotCollapsed(PO) {
|
||||
ok(PO._additionalInfoFields.some(id => !getAndCheckElmtById(id).collapsed),
|
||||
`Some additional info field should not be collapsed.`);
|
||||
}
|
||||
|
||||
function getAndCheckElmtById(id) {
|
||||
var elmt = gLibrary.document.getElementById(id);
|
||||
isnot(elmt, null, "Correctly got element: #" + id);
|
||||
return elmt;
|
||||
}
|
@ -94,10 +94,6 @@
|
||||
|
||||
<!ENTITY forwardButton.tooltip "Go forward">
|
||||
|
||||
<!ENTITY detailsPane.more.label "More">
|
||||
<!ENTITY detailsPane.more.accesskey "e">
|
||||
<!ENTITY detailsPane.less.label "Less">
|
||||
<!ENTITY detailsPane.less.accesskey "e">
|
||||
<!ENTITY detailsPane.selectAnItemText.description "Select an item to view and edit its properties">
|
||||
|
||||
<!ENTITY view.label "View">
|
||||
|
@ -248,22 +248,6 @@
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
/**** expanders ****/
|
||||
|
||||
.expander-up,
|
||||
.expander-down {
|
||||
margin: 0 4px 1px 8px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.expander-up {
|
||||
-moz-appearance: -moz-mac-disclosure-button-open;
|
||||
}
|
||||
|
||||
.expander-down {
|
||||
-moz-appearance: -moz-mac-disclosure-button-closed;
|
||||
}
|
||||
|
||||
/**
|
||||
* info pane
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user