? Success

User tests: Successful: Unsuccessful:

avatar b2z
b2z
13 Jul 2014

Summary

When "Show Print Icon" and "Show Email Icon" both are set to "Hide" in the parameters and you do not have an "edit" rights, still an empty div class="icons" is displayed in some article views. This patch will fix it.

How to reproduce the problem and test the patch:

  1. Login to BE and proceed to "Content" -> "Article manager".
  2. Click on "Options" and on the first tab "Article" set "Show Print Icon" and "Show Email Icon" both to "Hide". Be sure that the same is set up in the "Menu" parameters and that you do not have an "edit" rights.
  3. Proceed to Single Article, Article Category Blog, Featured Articles views and notice that an empty div class="icons" is displayed.
  4. Apply the patch. Notice that the div class="icons" is not displayed.
  5. Set "Show Print Icon" and/or "Show Email Icon" to "Show". Be sure that the same is set up in the "Menu" parameters. Notice that the icons are displayed as expected.
  6. Set "Show Print Icon" and "Show Email Icon" both to "Hide" and give yourself an "edit" rights. Notice that the icon is displayed as expected.

#33945

Thanks @proweb for reporting the bug.

avatar b2z b2z - open - 13 Jul 2014
avatar Bakual
Bakual - comment - 13 Jul 2014

I think in the layout files we prefer or and and over || and &&.
And wouldn't it make more sense to do that in the JLayout file? Then it would be fixed in all instances where that is used.

avatar proweb
proweb - comment - 13 Jul 2014

Well, Bakual is right. May be this more correct - http://pastebin.com/bjJrJ9KS in /layouts/joomla/content/icons.php

avatar b2z
b2z - comment - 13 Jul 2014

Thomas, I think you are right. I will move the logic to the layout file, that makes sense.

Best regards,
Dmitry

----- Reply message -----
From: "Thomas Hunziker" notifications@github.com
To: "joomla/joomla-cms" joomla-cms@noreply.github.com
Subject: [joomla-cms] [#33945] Fix an empty icons div in single article view (#3897)
Date: Sun, Jul 13, 2014 22:10
I think in the layout files we prefer or and and over || and &&.

And wouldn't it make more sense to do that in the JLayout file? Then it would be fixed in all instances where that is used.


Reply to this email directly or view it on GitHub.

avatar brianteeman
brianteeman - comment - 13 Jul 2014

Shouldnt the layout have less logic not more

avatar Bakual
Bakual - comment - 13 Jul 2014

It already uses that conditional already anyway. We probably can just move it a bit :)

avatar b2z
b2z - comment - 14 Jul 2014

Having a good sleep today after the great football match I starting to think that moving this logic to the layout is not such a great idea as it sounds. When we have this logic in the main layout we control the call of JLayout and inclusion of layout file. This allow us not always to include this layout.

I think in the layout files we prefer or and and over || and &&.

May be, but currently default.php contains only || and &&, so I am using them for consistency.

avatar brianteeman
brianteeman - comment - 14 Jul 2014

Thanks. That's exactly my point. Wherever possible you shouldn't be overriding the logic just the format

avatar Bakual
Bakual - comment - 14 Jul 2014

I'm fine either way. It was just a thought :smile:
@brianteeman The logic is already there anyway if you look at https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/content/icons.php#L19.

avatar Kubik-Rubik
Kubik-Rubik - comment - 14 Jul 2014

I think @Bakual is right. We should adjust it in the source, not in the template files. If we decide to use this solution instead, every template file should be adjusted (e.g. featured articles), not only the article view.

As @Bakual already said, the logic is already there, we just have to move the div container a little bit!

avatar b2z
b2z - comment - 14 Jul 2014

Yes the logic is there, but it does not control the inclusion of the layout file. Currently we always include it, but do we need to?

avatar Kubik-Rubik
Kubik-Rubik - comment - 14 Jul 2014

@b2z No, so your suggestion is also okay. But the PR can only be accepted if you edit every view of the component.

avatar b2z
b2z - comment - 14 Jul 2014

But the PR can only be accepted if you edit every view of the component.

Yeah but before I will do it I need to know - should I ? :) Everyone is ok with it?

avatar Bakual
Bakual - comment - 14 Jul 2014

I'm fine either way. Feel free to adjust the other views as well.

avatar b2z
b2z - comment - 14 Jul 2014

Fixed also "Article Category Blog" and "Featured Articles".

avatar Kubik-Rubik
Kubik-Rubik - comment - 14 Jul 2014

@b2z Thanks, looks good now!

avatar b2z
b2z - comment - 15 Jul 2014

Waiting for testers now. Thanks.

avatar n9iels
n9iels - comment - 15 Jul 2014

@test: works fine for me and resolves the bug

avatar Kubik-Rubik
Kubik-Rubik - comment - 15 Jul 2014

@test: tested successfully - can be merged @Bakual

@b2z Thank you for your contribution!

avatar proweb
proweb - comment - 15 Jul 2014

Hooray!

avatar Bakual Bakual - change - 15 Jul 2014
Status New Closed
Closed_Date 0000-00-00 00:00:00 2014-07-15 17:26:26
avatar Bakual Bakual - close - 15 Jul 2014
avatar Bakual Bakual - close - 15 Jul 2014
avatar b2z b2z - head_ref_deleted - 15 Jul 2014
avatar beat
beat - comment - 16 Jul 2014

I think in the layout files we prefer or and and over || and &&.

Just for information as it bites hardly: "and" and "or" don't have the same precedence/priority as "&&" and "||" over other operators. So the last 2 should be much preferred everywhere.

avatar Bakual
Bakual - comment - 16 Jul 2014

The difference plays mainly a role when you mix them or use it in an assignment, which would be not the case here. (See http://php.net/manual/en/language.operators.precedence.php)
I looked over the coding standard to see if I can find it but had no luck. So either it's not a valid rule anymore or it never was and I mistakenly believed it to be or I just am blind :smiley:

Anyway, doesn't matter much.

avatar beat
beat - comment - 16 Jul 2014

My remark was "just for information", not a bug report :)

This different precedence depending on the operator form used a quite wierd behavior of PHP.

Thanks for the link. It shows that wierd different priority (and i got bitten by that some years ago).

Add a Comment

Login with GitHub to post a comment