Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Do not return icon when not specified, and use this info to know if I…

… must display or not the icon image. This close #3
  • Loading branch information...
commit 4b9cb635bf5a67cc065153a1f200dd9deb4bbabe 1 parent f90cfae
Luca Fabbri keul authored
5 collective/navigationtoggle/browser/collective.navigationtoggle.js
@@ -76,7 +76,7 @@ jQuery.collective_navigationtoggle = {
76 76 */
77 77 var makeSubelement = function (data, wrapper, withImage, wrapDiv, reviewStateClass, contentTypeClass) {
78 78 var newE = $('<a href="' + data.url + '" title="' + data.description + '">' +
79   - (withImage ? '<img alt="' + data.type + '" width="16" height="16" src="' + data.icon + '"/>' : '') +
  79 + (withImage ? '<img alt="' + data.type + '" width="16" height="16" src="' + data.icon + '"/>&nbsp;' : '') +
80 80 '<span>' + data.title + '</span></a>');
81 81 if (reviewStateClass) {
82 82 newE.addClass("state-" + data.review_state_normalized);
@@ -136,7 +136,6 @@ jQuery.collective_navigationtoggle = {
136 136 } else {
137 137 elements = $("a[href$='" + escape(value) + "']");
138 138 }
139   - console.log(escape(value));console.log(elements);
140 139 }
141 140
142 141 elements.each(function () {
@@ -239,7 +238,7 @@ jQuery.collective_navigationtoggle = {
239 238 'foo': loading_time}, // for cache prevention management
240 239 function (data) {
241 240 $.each(data, function (index, value) {
242   - new_ul.append(makeSubelement(value, li_model.clone(), $('img', control).length > 0,
  241 + new_ul.append(makeSubelement(value, li_model.clone(), value.icon,
243 242 wrapDiv, reviewStateClass, contentTypeClass));
244 243 });
245 244 // If no element returned from the subtree, perform normal browser action
3  collective/navigationtoggle/browser/query_subelements.py
@@ -56,8 +56,7 @@ def __call__(self, *args, **kwargs):
56 56 'type': x.portal_type,
57 57 'type_normalized': ptool.normalizeString(x.portal_type),
58 58 'review_state_normalized': ptool.normalizeString(x.review_state),
59   - 'icon': "%s/%s" % (portal_url(), x.getIcon),
  59 + 'icon': x.getIcon and "%s/%s" % (portal_url(), x.getIcon) or None,
60 60 'description': x.Description,
61 61 })
62   -
63 62 return json.dumps(navElems)
3  docs/HISTORY.txt
@@ -6,8 +6,11 @@ Changelog
6 6
7 7 - fixed a bug when used with containers with spaces inside the id
8 8 (close `#2`__) [keul]
  9 +- file icon of generated elements where not handled in the right way
  10 + (close `#3`__) [keul]
9 11
10 12 __ https://github.com/RedTurtle/collective.navigationtoggle/issues/2
  13 + __ https://github.com/RedTurtle/collective.navigationtoggle/issues/3
11 14
12 15 0.4.0 (2012-11-15)
13 16 ------------------

0 comments on commit 4b9cb63

Please sign in to comment.
Something went wrong with that request. Please try again.