Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
EZP-25248: Be able to empty the Trash
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickroger committed Feb 8, 2016
1 parent a3be8d5 commit a8cec96
Show file tree
Hide file tree
Showing 21 changed files with 768 additions and 51 deletions.
7 changes: 7 additions & 0 deletions Resources/config/yui.yml
Expand Up @@ -425,6 +425,11 @@ system:
- 'ez-movecontentactionview'
- 'ez-translateactionview'
path: %ez_platformui.public_dir%/js/views/ez-actionbarview.js
ez-trashbarview:
requires:
- 'ez-barview'
- 'ez-buttonactionview'
path: %ez_platformui.public_dir%/js/views/ez-trashbarview.js
ez-rawcontentview:
requires:
- 'ez-templatebasedview'
Expand Down Expand Up @@ -475,6 +480,8 @@ system:
requires:
- 'ez-templatebasedview'
- 'trashview-ez-template'
- 'ez-trashbarview'
- 'node-style'
- 'array-extras'
path: %ez_platformui.public_dir%/js/views/ez-trashview.js
trashview-ez-template:
Expand Down
11 changes: 10 additions & 1 deletion Resources/public/css/theme/views/actions/button.css
Expand Up @@ -35,6 +35,8 @@

.is-discoverybar-minimized .ez-view-discoverybarview .active-actions .ez-view-buttonactionview .action-label,
.is-discoverybar-minimized .ez-view-discoverybarview .active-actions .ez-view-buttonactionview .action-hint,
.is-trashbar-minimized .active-actions .ez-view-buttonactionview .action-label,
.is-trashbar-minimized .active-actions .ez-view-buttonactionview .action-hint,
.is-actionbar-minimized .active-actions .ez-view-buttonactionview .action-label,
.is-actionbar-minimized .active-actions .ez-view-buttonactionview .action-hint {
display: block;
Expand Down Expand Up @@ -77,15 +79,22 @@
}

.ez-view-buttonactionview .ez-action[data-action="sendToTrash"] .action-icon:before,
.ez-view-buttonactionview .ez-action[data-action="sendToTrash"] .action-label{
.ez-view-buttonactionview .ez-action[data-action="sendToTrash"] .action-label,
.ez-view-buttonactionview .ez-action[data-action="emptyTrash"] .action-icon:before,
.ez-view-buttonactionview .ez-action[data-action="emptyTrash"] .action-label{
color: #E46474;
}

.ez-view-buttonactionview .ez-action[data-action="minimizeActionBar"] .action-icon:before,
.ez-view-buttonactionview .ez-action[data-action="minimizeTrashBar"] .action-icon:before,
.ez-view-buttonactionview .ez-action[data-action="minimizeDiscoveryBar"] .action-icon:before {
content: "\E60c";
}

.ez-view-buttonactionview .ez-action[data-action="emptyTrash"] .action-icon:before {
content: "\E900";
}

.ez-view-buttonactionview .ez-action[data-action="publish"] .action-icon:before {
content: "\E60d";
}
Expand Down
10 changes: 10 additions & 0 deletions Resources/public/css/theme/views/trash.css
Expand Up @@ -8,6 +8,12 @@
padding-bottom: 1em;
}

.ez-view-trashview .ez-trashbar-container {
background: #333;
margin-top: -1px; /* to align the trash bar with bottom border of navigation hub */
transition: all 0.30s ease-in-out;
}

.ez-view-trashview header {
background: #f5f4f2;
border-bottom: 1px solid #ccc;
Expand All @@ -34,6 +40,10 @@
text-decoration: underline;
}

.ez-view-trashview .ez-trashview-no-content {
font-style: italic;
}

.ez-view-trashview .ez-trashview-info-message {
font-style: italic;
}
2 changes: 2 additions & 0 deletions Resources/public/css/views/actions/button.css
Expand Up @@ -24,6 +24,8 @@

.is-discoverybar-minimized .ez-view-discoverybarview .ez-view-buttonactionview .active-actions .action-label,
.is-discoverybar-minimized .ez-view-discoverybarview .ez-view-buttonactionview .active-actions .action-hint,
.is-trashbar-minimized .ez-view-buttonactionview .active-actions .action-label,
.is-trashbar-minimized .ez-view-buttonactionview .active-actions .action-hint,
.is-actionbar-minimized .ez-view-buttonactionview .active-actions .action-label,
.is-actionbar-minimized .ez-view-buttonactionview .active-actions .action-hint {
display: none;
Expand Down
3 changes: 3 additions & 0 deletions Resources/public/css/views/bar.css
Expand Up @@ -36,14 +36,17 @@
cursor: default;
}

.is-trashbar-minimized .ez-view-barview .view-more-actions.is-hidden,
.is-actionbar-minimized .ez-view-barview .view-more-actions.is-hidden {
right: 4em;
}

.is-trashbar-minimized .ez-view-barview .view-more-button,
.is-actionbar-minimized .ez-view-barview .view-more-button {
padding: 0.5em 0;
}

.is-trashbar-minimized .ez-view-barview .view-more-actions,
.is-actionbar-minimized .ez-view-barview .view-more-actions {
right: 4em;
}
Expand Down
20 changes: 20 additions & 0 deletions Resources/public/css/views/trash.css
Expand Up @@ -2,6 +2,26 @@
* Copyright (C) eZ Systems AS. All rights reserved.
* For full copyright and license information view LICENSE file distributed with this source code.
*/

.ez-view-trashview > .pure-g {
padding-right: 230px;
transition: all 0.30s ease-in-out;
}

.ez-view-trashview.is-trashbar-minimized > .pure-g {
padding-right: 4em;
}

.ez-view-trashview .ez-trashbar-container {
width: 230px;
margin-right: -230px;
}

.ez-view-trashview.is-trashbar-minimized .ez-trashbar-container {
width: 4em;
margin-right: -4em;
}

.ez-view-trashview .ez-trashview-content {
width: 100%;
}
Expand Down
Binary file modified Resources/public/fonts/icomoon.eot
Binary file not shown.
1 change: 1 addition & 0 deletions Resources/public/fonts/icomoon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Resources/public/fonts/icomoon.ttf
Binary file not shown.
Binary file modified Resources/public/fonts/icomoon.woff
Binary file not shown.
11 changes: 11 additions & 0 deletions Resources/public/js/apps/ez-platformuiapp.js
Expand Up @@ -126,6 +126,7 @@ YUI.add('ez-platformuiapp', function (Y) {
*/
initializer: function () {
this.on("logOut", this._destroySideViews);
this.on("*:refreshView", this._refreshView);
this._dispatchConfig();
/**
* Stores the initial title of the page so it can be used when
Expand Down Expand Up @@ -173,6 +174,16 @@ YUI.add('ez-platformuiapp', function (Y) {
});
},

/**
* Refreshes the current view
*
* @method _refreshView
* @protected
*/
_refreshView: function () {
this.navigate(window.location.href);
},

/**
* Dispatches the `config` attribute value so that the app is configured
* accordingly. The values consumed by the app are removed from the
Expand Down
52 changes: 52 additions & 0 deletions Resources/public/js/views/ez-trashbarview.js
@@ -0,0 +1,52 @@
/*
* Copyright (C) eZ Systems AS. All rights reserved.
* For full copyright and license information view LICENSE file distributed with this source code.
*/
YUI.add('ez-trashbarview', function (Y) {
"use strict";
/**
* Provides the Trash Bar class
*
* @module ez-trashbarview
*/
Y.namespace('eZ');

/**
* The trash bar
*
* @namespace eZ
* @class TrashBarView
* @constructor
* @extends eZ.BarView
*/
Y.eZ.TrashBarView = Y.Base.create('trashBarView', Y.eZ.BarView, [], {
}, {
ATTRS: {
/**
* An array of {{#crossLink
* "eZ.ButtonActionView"}}eZ.ButtonActionView{{/crossLink}}
*
* @attribute actionsList
* @type Array
*/
actionsList: {
valueFn: function () {
return [
new Y.eZ.ButtonActionView({
actionId: "minimizeTrashBar",
disabled: false,
label: "Minimize",
priority: 1000
}),
new Y.eZ.ButtonActionView({
actionId: "emptyTrash",
disabled: false,
label: "Empty the Trash",
priority: 10
}),
];
}
},
}
});
});
56 changes: 56 additions & 0 deletions Resources/public/js/views/ez-trashview.js
Expand Up @@ -11,6 +11,8 @@ YUI.add('ez-trashview', function (Y) {
*/
Y.namespace('eZ');

var MINIMIZE_TRASH_BAR_CLASS = 'is-trashbar-minimized';

/**
* The Trash view
*
Expand All @@ -20,6 +22,19 @@ YUI.add('ez-trashview', function (Y) {
* @extends eZ.TemplateBasedView
*/
Y.eZ.TrashView = Y.Base.create('trashView', Y.eZ.TemplateBasedView, [], {
initializer: function () {
this.on('*:minimizeTrashBarAction', this._handleMinimizeTrashBar);
},

/**
* Event handler for the minimizeTrashBarAction event
*
* @protected
* @method _handleMinimizeTrashBar
*/
_handleMinimizeTrashBar: function () {
this.get('container').toggleClass(MINIMIZE_TRASH_BAR_CLASS);
},

/**
* Renders the trash view
Expand All @@ -34,9 +49,28 @@ YUI.add('ez-trashview', function (Y) {
trashItems: this._convertTrashItemsToJSON(),
}));

container.one('.ez-trashbar-container').append(
this.get('trashBar').render().get('container')
);

this._uiSetMinHeight();
return this;
},

/**
* Sets the minimum height of the view
*
* @private
* @method _uiSetMinHeight
*/
_uiSetMinHeight: function () {
var container = this.get('container');

container.one('.ez-trashview-content').setStyle(
'minHeight', container.get('winHeight') + 'px'
);
},

/**
* Converts the content of the `trashItems` attribute into JSON
*
Expand All @@ -53,6 +87,13 @@ YUI.add('ez-trashview', function (Y) {
};
});
},

destructor: function () {
var bar = this.get('trashBar');

bar.removeTarget(this);
bar.destroy();
}
}, {
ATTRS: {

Expand All @@ -70,6 +111,21 @@ YUI.add('ez-trashview', function (Y) {
trashItems: {
value: [],
},

/**
* The trash bar instance, by default an instance {{#crossLink
* "eZ.TrashBarView"}}eZ.TrashBarView{{/crossLink}}
*
* @attribute trashBar
* @type eZ.BarView
*/
trashBar: {
valueFn: function () {
return new Y.eZ.TrashBarView({
bubbleTargets: this,
});
}
},
}
});
});

0 comments on commit a8cec96

Please sign in to comment.