-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
…opover plone/Products.CMFPlone#1074 fixes to related items
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,27 +99,28 @@ define([ | |
homeText: _t('home'), | ||
folderTypes: ['Folder'], | ||
selectableTypes: null, // null means everything is selectable, otherwise a list of strings to match types that are selectable | ||
attributes: ['UID', 'Title', 'portal_type', 'path', 'getIcon'], | ||
attributes: ['UID', 'Title', 'portal_type', 'path','getURL', 'getIcon','contenttype_class','is_folderish','review_state'], | ||
This comment has been minimized.
Sorry, something went wrong. |
||
dropdownCssClass: 'pattern-relateditems-dropdown', | ||
maximumSelectionSize: -1, | ||
resultTemplate: '' + | ||
'<div class="pattern-relateditems-result pattern-relateditems-type-<%= portal_type %> <% if (selected) { %>pattern-relateditems-active<% } %>">' + | ||
' <a href="#" class="pattern-relateditems-result-select <% if (selectable) { %>selectable<% } %> contenttype-<%= portal_type.toLowerCase() %>">' + | ||
' <% if (typeof getIcon !== "undefined" && getIcon) { %><span class="pattern-relateditems-result-icon"><img src="<%= getIcon %>" /></span><% } %>' + | ||
' <span class="pattern-relateditems-result-title"><%= Title %></span>' + | ||
'<div class="pattern-relateditems-result <% if (selected) { %>pattern-relateditems-active<% } %>">' + | ||
' <a href="#" class="pattern-relateditems-result-select <% if (selectable) { %>selectable<% } %>">' + | ||
' <% if (typeof getIcon !== "undefined" && getIcon) { %><img src="<%= getURL %>/@@images/image/icon "> <% } %>' + | ||
' <span class="pattern-relateditems-result-title <%= contenttype_class %> <% if (typeof review_state !== "undefined") { %> state-<%= review_state %> <% } %>" /span>' + | ||
' <span class="pattern-relateditems"><%= Title %></span>' + | ||
' <span class="pattern-relateditems-result-path"><%= path %></span>' + | ||
' </a>' + | ||
' <span class="pattern-relateditems-buttons">' + | ||
' <% if (folderish) { %>' + | ||
' <% if (is_folderish) { %>' + | ||
This comment has been minimized.
Sorry, something went wrong.
fgrcon
Author
Member
|
||
' <a class="pattern-relateditems-result-browse" href="#" data-path="<%= path %>"></a>' + | ||
' <% } %>' + | ||
' </span>' + | ||
'</div>', | ||
resultTemplateSelector: null, | ||
selectionTemplate: '' + | ||
'<span class="pattern-relateditems-item pattern-relateditems-type-<%= portal_type %>">' + | ||
' <% if (typeof getIcon !== "undefined" && getIcon) { %><span class="pattern-relateditems-result-icon"><img src="<%= getIcon %>" /></span><% } %>' + | ||
' <span class="pattern-relateditems-item-title"><%= Title %></span>' + | ||
'<span class="pattern-relateditems-item">' + | ||
' <% if (typeof getIcon !== "undefined" && getIcon) { %> <img src="<%= getURL %>/@@images/image/icon"> <% } %>' + | ||
' <span class="pattern-relateditems-item-title <%= contenttype_class %> <% if (typeof review_state !== "undefined") { %> state-<%= review_state %> <% } %>" ><%= Title %></span>' + | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
petschki
Member
|
||
' <span class="pattern-relateditems-item-path"><%= path %></span>' + | ||
'</span>', | ||
selectionTemplateSelector: null, | ||
|
@@ -374,7 +375,7 @@ define([ | |
Select2.prototype.initializeOrdering.call(self); | ||
|
||
self.options.formatResult = function(item) { | ||
if (!item.portal_type || _.indexOf(self.options.folderTypes, item.portal_type) === -1) { | ||
if (item.is_folderish) { | ||
This comment has been minimized.
Sorry, something went wrong.
fgrcon
Author
Member
|
||
item.folderish = false; | ||
} else { | ||
item.folderish = true; | ||
|
3 comments
on commit d0463c8
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.
the changes in relateditems results to:
please review / see inline commets above
the contenttype icons are not rendered in the dropdown though i think the tags are correctly rendered ??? :
<a href="#" class="pattern-relateditems-result-select selectable">
<span class="pattern-relateditems-result-title state-published " span="">
<span class="pattern-relateditems contenttype-news-item">newsitem 3</span>
<span class="pattern-relateditems-result-path">/news/newsitem-3</span> </span>
</a>
The search result looks funny to me (most probably a different issue):
No searchstring given: I would expect something like
folder 1 >
folder 2 >
folder 3 >
page
...
when expandig folder 1:
folder 11 >
image 1
...
etc.
what I get is something like
image 1
folder1\folder11 >
folder 1 >
folder3/folder33/images/image.jpg
folder 2 >
....
etc. (this is rather unsorted, and does not stop reloading if you have many items,....)
the search should be restrictréd to the first level.
when you enter a searchstring it should search only the title but it seems also to search pathnames
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 searches SearchableText index which includes text, tags, etc.
I see we have the double icon issue going on again too. If the result has a "thumb", it shouldn't render the markup to provide the contenttype icon.
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.
well searching paths is a little bit confusing for me (tags ar ok) but thats a minor thing for now.
No I dont have the double icon issue anymore. You might need the changes in p.a.contenttypes (indexer) and p.a.content as well. Reindexing will be necessary (Upgradestep ???).
If item has an image/leadimage the icon sized thumb is also shown (i think this a very usefull feature ...).
The old contenttype icons are not shown anymore - see screenshot above.
Next thing (i am just learning the whole js/pattern stuff): in related items (add rel items) wee need to respect all folderish types even custom types, but I have yet a problem with the relateditems used for tinymce for selecting links and images - i dont get the new attributes contenttype_class and is_folderish
there (... CMFPlone/patterns/init.py ???), then folders selected should be filtered against object contains settings in tinymce-control-panel but only when selecting images and not links.
contenttype_class needs to be supplied from p.a.contenttypes vocublary to support e.g.: news-item, my-custom-dex-type etc. requires plone/plone.app.content#57