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

EZP-25552: Explorer view #742

Conversation

StephaneDiot
Copy link
Contributor

@StephaneDiot StephaneDiot commented Nov 29, 2016

jira : https://jira.ez.no/browse/EZP-25552

Description

This is the first version of the content repository finder explorer. This should allow to browse content with an explorer.

Screencast

https://youtu.be/vMsBmqIgLeU

TODO

  • feature
  • unit tests
  • CSS

@StephaneDiot StephaneDiot force-pushed the EZP-25552_Explorer_View branch 2 times, most recently from 111b9fa to 17c1d22 Compare January 5, 2017 10:25
@StephaneDiot StephaneDiot changed the base branch from feature/EZP-25552_UDW_Finder_Content_Explorer to master January 5, 2017 10:27
@StephaneDiot StephaneDiot changed the title WIP [Paused] EZP-25552: Explorer view EZP-25552: Explorer view Jan 5, 2017
@StephaneDiot StephaneDiot force-pushed the EZP-25552_Explorer_View branch from 17c1d22 to e458fac Compare January 5, 2017 10:36
@StephaneDiot StephaneDiot changed the base branch from master to feature/EZP-25552_UDW_Finder_Content_Explorer January 5, 2017 13:26
@StephaneDiot StephaneDiot force-pushed the EZP-25552_Explorer_View branch 2 times, most recently from c7a2331 to bf2970d Compare January 5, 2017 14:08
@StephaneDiot
Copy link
Contributor Author

StephaneDiot commented Jan 5, 2017

@dpobel @yannickroger ready for review (CSS missing)

@@ -22,6 +26,7 @@ YUI.add('ez-universaldiscoverybrowseview', function (Y) {
*/
Y.eZ.UniversalDiscoveryBrowseView = Y.Base.create('universalDiscoveryBrowseView', Y.eZ.UniversalDiscoveryMethodBaseView, [], {
initializer: function () {
console.warn('UniversalDiscoveryBrowseView is deprecated');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the whole module is deprecated, you don't need to add this console.log call

* @extends eZ.TemplateBasedView
*/
Y.eZ.UniversalDiscoveryFinderExplorerLevelView = Y.Base.create(
'universalDiscoveryFinderExplorerLevelView',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cs (if the line is too long, just put the name in a variable with a shortname)

location: item.location.toJSON(),
contentInfo: item.location.get('contentInfo').toJSON(),
contentType: item.contentType.toJSON(),
content: item.content.toJSON(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not seem to be used in the corresponding template. In addition, you already pass the content info so the Content is not needed.

itemsJSONified.push({
location: item.location.toJSON(),
contentInfo: item.location.get('contentInfo').toJSON(),
contentType: item.contentType.toJSON(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used any where as well

@@ -0,0 +1,24 @@
<div class="ez-ud-finder-explorerlevel-content ez-asynchronousview">
{{#if loading}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of passing loading and adding a markup when the view is in loading module, I would make sure the view add/remove a class on its container depending on its loading state.

this.fire('explorerNavigate', {
data: item,
location: item.location,
depth: this.get('depth')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no depth attribute

initializer: function () {
this.after('activeChange', function () {
if (this.get('active')) {
Y.Array.each(this.get('levelViews'), function (levelView) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is exactly the wakeUp method

}, this);
}
});
this.on('*:explorerNavigate', function(e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this event handler deserves its own method with a good name

this._addLevel(e.location);
}
Y.Array.each(this.get('levelViews'), function (levelView) {
this._renderLevelView(levelView);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed only for the newly added levels not for all of them

var LevelView = this.get('levelViewConstructor'),
levelView = new LevelView({
parentLocation: location,
depth: this.get('levelViews').length + 1});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cs

@StephaneDiot StephaneDiot force-pushed the EZP-25552_Explorer_View branch 3 times, most recently from 418f0e6 to 3bbb411 Compare January 13, 2017 14:17
@StephaneDiot
Copy link
Contributor Author

@dpobel rdy for review

this._removeLevels(count);
}
if (this.get('levelViews').length > 1) {
this.get('levelViews')[this.get('levelViews').length - 2].removeHighlighting();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not super fan of this removeHighlighthing method. Since behind the scene it actually set an attribute, why not directly update the attribute here ?

<li class="ez-explorer-level-list-item ez-font-icon
{{#if location.childCount}} is-parent-location{{/if}}
{{#if selectedLocationId}} is-selected{{/if}}
{{#if ../ownSelectedItem}} has-selected-item{{/if}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related to my previous remark on removeHightlighting method. Given it's an attribute of the view, this should probably mean that a class is added or removed on the container when the attribute is updated

@@ -3,6 +3,10 @@
* For full copyright and license information view LICENSE file distributed with this source code.
*/

.ez-view-universaldiscoveryselectedview {
margin-left: 1em;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in theory, you are just reusing the selected view in the Finder so no CSS change should be needed for the component. This also means there's a regression risk in others method using the Selected view.
(also setting a margin should not be a theme CSS)

@@ -0,0 +1,16 @@
.ez-view-universaldiscoveryfinderexplorerview .ez-ud-finder-explorerlevel {
height: 100%;
display: -webkit-box;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need the prefixes on flexbox anymore so you can stick with the standard properties:

display: flex;
flex-direction: row;

* @protected
* @return {Object} Returns an item containing a location.
*/
_findLocationInItems: function (locationId) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it returns an item, it can not be named _findLocation.
_findItemByLocationId maybe ?

{{#if selectedLocationId}} is-selected{{/if}}
{{#if ../ownSelectedItem}} has-selected-item{{/if}}"
>
<a class="ez-explorer-level-item ez-font-icon{{#if selectedLocationId}} is-selected{{/if}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

given you set add an ellipsis when that's too long, you should add a title attribute with the full name

*/
_handleLevelViews: function (depth, location) {
if (depth < this.get('levelViews').length) {
var count = this.get('levelViews').length - depth;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS: var at the beginning of the method

*/
reset: function (name) {
if (name == 'levelViews') {
var count = this.get('levelViews').length - 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS: var at the beginning of the method

* @constructor
* @extends eZ.TemplateBasedView
*/
Y.eZ.UniversalDiscoveryFinderExplorerLevelView = Y.Base.create( viewName, Y.eZ.TemplateBasedView, [Y.eZ.AsynchronousView], {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CS: no space before viewName

}, this);
container.setHTML(this.template({
items: itemsJSONified,
loading: this.get('loading'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed anymore, no ?

@StephaneDiot StephaneDiot force-pushed the EZP-25552_Explorer_View branch from fa50a0d to 3e3f651 Compare January 19, 2017 14:46
@StephaneDiot StephaneDiot changed the base branch from feature/EZP-25552_UDW_Finder_Content_Explorer to master January 19, 2017 14:49
@StephaneDiot StephaneDiot changed the base branch from master to feature/EZP-25552_UDW_Finder_Content_Explorer January 19, 2017 14:52
@StephaneDiot
Copy link
Contributor Author

StephaneDiot commented Jan 19, 2017

Ready for review @dpobel @yannickroger

@StephaneDiot StephaneDiot force-pushed the EZP-25552_Explorer_View branch from 3e3f651 to 3bd5ea4 Compare January 19, 2017 15:27
Copy link
Contributor

@dpobel dpobel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you fix the finder inconsistent reset when switching to another method after using it and getting back to the finder ?

@@ -127,6 +130,9 @@ system:
- 'bundles/ezplatformui/css/theme/views/universaldiscovery/browse.css'
- 'bundles/ezplatformui/css/theme/views/universaldiscovery/search.css'
- 'bundles/ezplatformui/css/theme/views/universaldiscovery/selected.css'
- 'bundles/ezplatformui/css/theme/views/universaldiscovery/finder.css'
- 'bundles/ezplatformui/css/theme/views/universaldiscovery/explorer.css'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems to be empty so it can be remove from here and from the filesystem

@@ -0,0 +1,32 @@
.ez-view-universaldiscoveryfinderview {
/*margin: 0 -1em -1em -1em;*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be removed

@StephaneDiot
Copy link
Contributor Author

I did, it now keep the state of the explorer when switching method and coming back to the explorer ( as shown in the screencast )

Copy link
Contributor

@dpobel dpobel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah I did not notice the screencast :) so besides the last minor comments, +1
good job :)

@StephaneDiot StephaneDiot force-pushed the EZP-25552_Explorer_View branch from 3bd5ea4 to 64210b5 Compare January 20, 2017 10:17
@@ -16,8 +16,9 @@
min-height: 0;
}

.ez-view-universaldiscoverybrowseview .ez-ud-pane-selected {
width: 25%;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: empty line, there's also another one bellow.

{{ contentInfo.name }}
</a>
</li>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick again

@yannickroger
Copy link
Contributor

Don't forget to squash the commits :)

@StephaneDiot StephaneDiot force-pushed the EZP-25552_Explorer_View branch from 64210b5 to 1af55aa Compare January 26, 2017 12:47
@StephaneDiot StephaneDiot merged commit 0525fe7 into feature/EZP-25552_UDW_Finder_Content_Explorer Jan 26, 2017
@yannickroger yannickroger deleted the EZP-25552_Explorer_View branch February 6, 2017 09:57
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants