Added help message in history panel.

Better resizing for left panel's tabs.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@488 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-04-16 23:38:49 +00:00
parent f1e05194e4
commit b7c3f99e3c
4 changed files with 54 additions and 21 deletions

View File

@ -45,11 +45,14 @@ function resize() {
} }
function resizeTabs() { function resizeTabs() {
var totalHeight = ui.leftPanelTabs.height(); var totalHeight = ui.leftPanel.height();
var headerHeight = ui.leftPanelTabs.find(".ui-tabs-nav").innerHeight(); var headerHeight = ui.leftPanelTabs.find(".ui-tabs-nav").outerHeight(true);
var tabPanels = ui.leftPanelTabs.find(".ui-tabs-panel")
var paddings = tabPanels.innerHeight(true) - tabPanels.height(); var visibleTabPanels = ui.leftPanelTabs.find(".ui-tabs-panel:not(.ui-tabs-hide)");
tabPanels.height(totalHeight - headerHeight - paddings); var paddings = visibleTabPanels.innerHeight(true) - visibleTabPanels.height();
var allTabPanels = ui.leftPanelTabs.find(".ui-tabs-panel");
allTabPanels.height(totalHeight - headerHeight - paddings - 1);
} }
function resizeAll() { function resizeAll() {

View File

@ -7,8 +7,9 @@ function HistoryWidget(div, tabHeader) {
HistoryWidget.prototype.resize = function() { HistoryWidget.prototype.resize = function() {
var body = this._div.find(".history-panel-body"); var body = this._div.find(".history-panel-body");
var footer = this._div.find(".history-panel-footer"); var footer = this._div.find(".history-panel-footer");
var bodyPaddings = body.outerHeight(true) - body.height();
body.css("height", (this._div.height() - footer.innerHeight(true)) + "px"); body.css("height", (this._div.height() - footer.outerHeight(true) - bodyPaddings) + "px");
}; };
HistoryWidget.prototype.update = function(onDone) { HistoryWidget.prototype.update = function(onDone) {
@ -35,6 +36,11 @@ HistoryWidget.prototype._render = function() {
.empty() .empty()
.unbind() .unbind()
.html( .html(
'<div class="history-panel-help" bind="helpDiv">' +
'<h1>Don\'t worry ...</h1>' +
'<p>about making mistakes. Every change you make will be shown here, and you can undo changes at any point.</p>' +
'<p><a href="">Learn more &raquo;</a></p>' +
'</div>' +
'<div class="history-panel-body" bind="bodyDiv">' + '<div class="history-panel-body" bind="bodyDiv">' +
'<div class="history-past" bind="pastDiv"></div>' + '<div class="history-past" bind="pastDiv"></div>' +
'<div class="history-now" bind="nowDiv">done upto here</div>' + '<div class="history-now" bind="nowDiv">done upto here</div>' +
@ -56,22 +62,28 @@ HistoryWidget.prototype._render = function() {
return a; return a;
}; };
if (!this._data.past.length) { if (this._data.past.length > 0 || this._data.future.length > 0) {
elmts.pastDiv.html('<div class="history-panel-message">No change to undo</div>'); if (!this._data.past.length) {
} else { elmts.pastDiv.html('<div class="history-panel-message">No change to undo</div>');
for (var i = 0; i < this._data.past.length; i++) { } else {
var entry = this._data.past[i]; for (var i = 0; i < this._data.past.length; i++) {
renderEntry(elmts.pastDiv, entry, i === 0 ? 0 : this._data.past[i - 1].id, "Undo to here"); var entry = this._data.past[i];
renderEntry(elmts.pastDiv, entry, i === 0 ? 0 : this._data.past[i - 1].id, "Undo to here");
}
} }
}
if (!this._data.future.length) { if (!this._data.future.length) {
elmts.futureDiv.html('<div class="history-panel-message">No change to redo</div>'); elmts.futureDiv.html('<div class="history-panel-message">No change to redo</div>');
} else { } else {
for (var i = 0; i < this._data.future.length; i++) { for (var i = 0; i < this._data.future.length; i++) {
var entry = this._data.future[i]; var entry = this._data.future[i];
renderEntry(elmts.futureDiv, entry, entry.id, "Redo to here"); renderEntry(elmts.futureDiv, entry, entry.id, "Redo to here");
}
} }
elmts.helpDiv.hide();
} else {
elmts.bodyDiv.hide();
} }
elmts.extractLink.click(function() { self._extractOperations(); }); elmts.extractLink.click(function() { self._extractOperations(); });
@ -79,7 +91,10 @@ HistoryWidget.prototype._render = function() {
this.resize(); this.resize();
elmts.bodyDiv[0].scrollTop = elmts.nowDiv[0].offsetTop + elmts.nowDiv[0].offsetHeight - elmts.bodyDiv[0].offsetHeight; elmts.bodyDiv[0].scrollTop =
elmts.nowDiv[0].offsetTop +
elmts.nowDiv[0].offsetHeight -
elmts.bodyDiv[0].offsetHeight;
}; };
HistoryWidget.prototype._onClickHistoryEntry = function(evt, entry, lastDoneID) { HistoryWidget.prototype._onClickHistoryEntry = function(evt, entry, lastDoneID) {

View File

@ -48,7 +48,7 @@ body {
.left-panel { .left-panel {
position: fixed; position: fixed;
background: white; background: white;
overflow: visible; overflow: hidden;
padding: 0px; padding: 0px;
font-size: 12px; font-size: 12px;
} }
@ -111,6 +111,7 @@ body {
background: #DBE8EB; background: #DBE8EB;
-moz-border-radius-bottomleft: 7px; -moz-border-radius-bottomleft: 7px;
-webkit-border-bottom-left-radius: 7px; -webkit-border-bottom-left-radius: 7px;
overflow: hidden;
} }
.facet-panel { .facet-panel {

View File

@ -1,3 +1,17 @@
.history-panel-help {
padding: 10px;
background: white;
border: 1px solid #ccc;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
}
.history-panel-help h1 {
margin-top: 0px;
font-size: 150%;
font-weight: bold;
color: #888;
}
.history-panel-body { .history-panel-body {
background: #fff; background: #fff;
overflow: auto; overflow: auto;