-
Notifications
You must be signed in to change notification settings - Fork 47
EZP-25552: Explorer view #742
EZP-25552: Explorer view #742
Conversation
111b9fa
to
17c1d22
Compare
17c1d22
to
e458fac
Compare
c7a2331
to
bf2970d
Compare
@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'); |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
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}} |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cs
418f0e6
to
3bbb411
Compare
@dpobel rdy for review |
this._removeLevels(count); | ||
} | ||
if (this.get('levelViews').length > 1) { | ||
this.get('levelViews')[this.get('levelViews').length - 2].removeHighlighting(); |
There was a problem hiding this comment.
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}}" |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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}}" |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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], { |
There was a problem hiding this comment.
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'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed anymore, no ?
fa50a0d
to
3e3f651
Compare
Ready for review @dpobel @yannickroger |
3e3f651
to
3bd5ea4
Compare
There was a problem hiding this 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' |
There was a problem hiding this comment.
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;*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be removed
I did, it now keep the state of the explorer when switching method and coming back to the explorer ( as shown in the screencast ) |
There was a problem hiding this 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 :)
3bd5ea4
to
64210b5
Compare
@@ -16,8 +16,9 @@ | |||
min-height: 0; | |||
} | |||
|
|||
.ez-view-universaldiscoverybrowseview .ez-ud-pane-selected { | |||
width: 25%; | |||
|
There was a problem hiding this comment.
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> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick again
Don't forget to squash the commits :) |
64210b5
to
1af55aa
Compare
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