Commit c5ab5e8c authored by proberge's avatar proberge Committed by Commit Bot

Chrome Cleanup WebUI: small re-layout of the card for polish.

Moves the details text in with the title and the remove button.
Files to remove list now is a toggle instead of a expand-once section.

Bug: 690020
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I0301598d48ce2734f9bda0b7a96993cdc2040978
Reviewed-on: https://chromium-review.googlesource.com/576382
Commit-Queue: proberge <proberge@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#488142}
parent 2f243a62
<link rel="import" href="chrome://resources/html/polymer.html"> <link rel="import" href="chrome://resources/html/polymer.html">
<link rel="import" href="chrome://resources/cr_elements/cr_expand_button/cr_expand_button.html">
<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
<link rel="import" href="chrome://resources/html/util.html"> <link rel="import" href="chrome://resources/html/util.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-spinner/paper-spinner.html">
...@@ -17,6 +19,7 @@ ...@@ -17,6 +19,7 @@
<template> <template>
<style include="settings-shared"> <style include="settings-shared">
#files-to-remove-container { #files-to-remove-container {
padding: 0 var(--settings-box-row-padding);
/* Use the full available width for file paths to avoid inconsistent /* Use the full available width for file paths to avoid inconsistent
* line breaks when zooming in or out */ * line breaks when zooming in or out */
width: calc(var(--settings-card-max-width) - width: calc(var(--settings-card-max-width) -
...@@ -24,12 +27,18 @@ ...@@ -24,12 +27,18 @@
} }
#files-to-remove-list { #files-to-remove-list {
margin: 0;
word-break: break-all; word-break: break-all;
} }
#powered-by-settings-box {
min-height: 1em;
}
#powered-by-container { #powered-by-container {
align-items: center; align-items: center;
display: flex; display: flex;
min-height: var(--settings-row-min-height);
width: 100%; width: 100%;
} }
...@@ -41,14 +50,6 @@ ...@@ -41,14 +50,6 @@
height: 13px; height: 13px;
} }
#show-files-button {
--paper-button-ink-color: white;
/* Left-align the text of the button with the rest of the card's text */
-webkit-margin-start: calc(var(--cr-button-edge-spacing) * -1);
color: var(--google-blue-700);
text-transform: inherit;
}
#status-icon { #status-icon {
height: 24px; height: 24px;
width: 24px; width: 24px;
...@@ -70,8 +71,15 @@ ...@@ -70,8 +71,15 @@
.status-icon-warning { .status-icon-warning {
--iron-icon-fill-color: var(--paper-red-700); --iron-icon-fill-color: var(--paper-red-700);
} }
.top-aligned-settings-box {
align-items: start;
/* override settings-box min-height since we use vertical padding */
min-height: 0;
padding: 15px var(--settings-box-row-padding);
}
</style> </style>
<div class="settings-box first two-line"> <div class$="settings-box first [[getTopSettingsBoxClass_(showDetails_)]]">
<div class="status-icon-container"> <div class="status-icon-container">
<paper-spinner id="cleaning-spinner" active="[[isRemoving_]]" <paper-spinner id="cleaning-spinner" active="[[isRemoving_]]"
hidden="[[!isRemoving_]]"> hidden="[[!isRemoving_]]">
...@@ -81,7 +89,15 @@ ...@@ -81,7 +89,15 @@
id="status-icon"> id="status-icon">
</iron-icon> </iron-icon>
</div> </div>
<div class="start">[[title_]]</div> <div class="start">
<div>[[title_]]</div>
<div class="secondary" hidden="[[!showDetails_]]">
$i18n{chromeCleanupExplanation}
<a href="$i18n{chromeCleanupLearnMoreUrl}" target="_blank">
$i18n{learnMore}
</a>
</div>
</div>
<template is="dom-if" if="[[showActionButton_]]"> <template is="dom-if" if="[[showActionButton_]]">
<div class="separator"></div> <div class="separator"></div>
<paper-button id="action-button" class="primary-button" <paper-button id="action-button" class="primary-button"
...@@ -90,16 +106,7 @@ ...@@ -90,16 +106,7 @@
</paper-button> </paper-button>
</template> </template>
</div> </div>
<div id="details-container" <div class="settings-box" hidden="[[!showLogsPermission_]]">
class="settings-box two-line" hidden="[[!showDetails_]]">
<div>
$i18n{chromeCleanupExplanation}
<a href="$i18n{chromeCleanupLearnMoreUrl}" target="_blank">
$i18n{learnMore}
</a>
</div>
</div>
<div class="settings-box continuation" hidden="[[!showLogsPermission_]]">
<settings-toggle-button class="start" <settings-toggle-button class="start"
id="chromeCleanupLogsUploadControl" id="chromeCleanupLogsUploadControl"
label="$i18n{chromeCleanupLogsUploadPermission}" label="$i18n{chromeCleanupLogsUploadPermission}"
...@@ -107,26 +114,30 @@ ...@@ -107,26 +114,30 @@
on-settings-boolean-control-change="changeLogsPermission_"> on-settings-boolean-control-change="changeLogsPermission_">
</settings-toggle-button> </settings-toggle-button>
</div> </div>
<div class="settings-box" hidden="[[!showDetails_]]"> <div id="show-files-button" class="settings-box" actionable on-tap="
<div class="start" hidden="[[showFilesToRemove_]]"> toggleExpandButton_" hidden="[[!showDetails_]]">
<paper-button id="show-files-button" on-tap="showFiles_"> <div class="start">
$i18n{chromeCleanupLinkShowFiles} $i18n{chromeCleanupLinkShowFiles}
</paper-button>
</div> </div>
<div id="files-to-remove-container" hidden="[[!showFilesToRemove_]]"> <cr-expand-button expanded="{{showFilesToRemove_}}"
alt="$i18n{chromeCleanupLinkShowFiles}">
</cr-expand-button>
</div>
<iron-collapse opened="[[showFilesToRemove_]]">
<div id="files-to-remove-container">
<ul id="files-to-remove-list" class="secondary"> <ul id="files-to-remove-list" class="secondary">
<template is="dom-repeat" items="[[filesToRemove_]]" as="fileName"> <template is="dom-repeat" items="[[filesToRemove_]]" as="fileName">
<li>[[fileName]]</li> <li>[[fileName]]</li>
</template> </template>
</ul> </ul>
</div> </div>
</div> <div id="powered-by-settings-box" class="settings-box continuation">
<div class="settings-box" <div id="powered-by-container" class="secondary"
hidden="[[!showPoweredBy_(showFilesToRemove_, isPartnerPowered_)]]"> hidden="[[!isPartnerPowered_]]">
<div id="powered-by-container" class="secondary"> $i18nRaw{chromeCleanupPoweredByHtml}
$i18nRaw{chromeCleanupPoweredByHtml} </div>
</div> </div>
</div> </iron-collapse>
</template> </template>
<script src="chrome_cleanup_page.js"></script> <script src="chrome_cleanup_page.js"></script>
</dom-module> </dom-module>
...@@ -156,12 +156,25 @@ Polymer({ ...@@ -156,12 +156,25 @@ Polymer({
listenOnce(this, 'transitionend', this.doAction_.bind(this)); listenOnce(this, 'transitionend', this.doAction_.bind(this));
}, },
getTopSettingsBoxClass_: function(showDetails) {
return showDetails ? 'top-aligned-settings-box' : 'two-line';
},
/** /**
* Enables presenting the list of files to be removed by Chrome Cleanup. * Toggles the expand button within the element being listened to.
* @param {!Event} e
* @private * @private
*/ */
showFiles_: function() { toggleExpandButton_: function(e) {
this.showFilesToRemove_ = true; // The expand button handles toggling itself.
var expandButtonTag = 'CR-EXPAND-BUTTON';
if (e.target.tagName == expandButtonTag)
return;
/** @type {!CrExpandButtonElement} */
var expandButton = e.currentTarget.querySelector(expandButtonTag);
assert(expandButton);
expandButton.expanded = !expandButton.expanded;
}, },
/** /**
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
{ {
'target_name': 'chrome_cleanup_page', 'target_name': 'chrome_cleanup_page',
'dependencies': [ 'dependencies': [
'<(DEPTH)/ui/webui/resources/cr_elements/cr_expand_button/compiled_resources2.gyp:cr_expand_button',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:util', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:util',
'<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:i18n_behavior', '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:i18n_behavior',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment