Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WW-4634 Centre alignment doesn't seem to work in Velocity tags #95

Merged
merged 19 commits into from
Jun 12, 2016
Merged

WW-4634 Centre alignment doesn't seem to work in Velocity tags #95

merged 19 commits into from
Jun 12, 2016

Conversation

victorsosa
Copy link
Contributor

Fix for WW-4634

Centre alignment doesn't seem to work in Velocity tags

<td
<td
<#if parameters.align??>
class="tdAlign${parameters.align?html}"
Copy link
Member

Choose a reason for hiding this comment

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

Can you use - to separate prefix and suffix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean like this class="tdAlign-${parameters.align?html}" ?

Copy link
Member

Choose a reason for hiding this comment

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

yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@lukaszlenart
Copy link
Member

This doesn't fix the main issue, right?

@victorsosa
Copy link
Contributor Author

victorsosa commented May 17, 2016

Yes, it does fix the main issue and keep the back compatibility.

@victorsosa
Copy link
Contributor Author

Another thing I will change the name to just

align-center

because this css class can be used in other places that are using the align attribute; which is s Not supported in HTML5.

@aleksandr-m
Copy link
Contributor

Why not just add some CSS class to this table cell? Then end-users can style it as they want and align parameter will not be needed.

@victorsosa
Copy link
Contributor Author

CSS class to this table cell is what we have now and to have back compatibility as @lukaszlenart said.

@lukaszlenart
Copy link
Member

I'm just wondering what was the main reason, I have prepared a unit test and it didn't pass when using 2.3.29-SNAPSHOT which means 2.3.28.1 is broken the same way.

@victorsosa
Copy link
Contributor Author

@lukaszlenart the parameter align was remove on this commit
victorsosa@a0b3480

@aleksandr-m
Copy link
Contributor

Issue is about Velocity tags, not FreeMarker. Are we still supporting Velocity tags?

@lukaszlenart
Copy link
Member

So it's not a regression bug ;-) Yes, we do support Velocity.

@aleksandr-m
Copy link
Contributor

How the Velocity templating is working? The only Velocity templates I see are in the archive.

@aleksandr-m
Copy link
Contributor

Yep, the aforementioned commit misses css class for that cell in the controlheader.ftl. It should be the same way as for the buttons. :)

@victorsosa
Copy link
Contributor Author

victorsosa commented May 17, 2016

@victorsosa
Copy link
Contributor Author

the css class for that cell is in the controlheader.ftl already.

@lukaszlenart
Copy link
Member

All the tags are implemented in FreeMarker, those archive templates are deprecated and should be thrown away.

@aleksandr-m
Copy link
Contributor

@lukaszlenart Ahh ok. Thanks for clarifying that.

@aleksandr-m
Copy link
Contributor

@victorsosa I mean something like <td class="tdInput"> in controlheader.ftl and .tdInput {text-align:left;} in styles.css. <-- This is for 2.5.

And if alignment doesn't work in 2.3 and your solution fixes it, then this PR should target support-2-3 branch.

@victorsosa
Copy link
Contributor Author

It will break back compatibility as @lukaszlenart said.

@aleksandr-m
Copy link
Contributor

@victorsosa You see, this commit already broke backward compatibility, but it was incomplete in the way it didn't introduce css class for the input cell.
It is 2.5 so some breaking changes are expected.

@lukaszlenart
Copy link
Member

@victorsosa this commit a0b3480 dropped align attribute for buttons, it shouldn't affect textfield tag. Anyway, I think we should merge this PR and if needed prepare another one to target 2.3

@victorsosa
Copy link
Contributor Author

@lukaszlenart ok

@aleksandr-m
Copy link
Contributor

I would prefer to follow html5 and drop align attribute completely from S2 tags, BUT @victorsosa can you at least add some css class to input cell along with your solution.
Something like:

if align then class="tdInput align-${parameters.align?html}" else class="tdInput"

@victorsosa
Copy link
Contributor Author

victorsosa commented May 24, 2016

@aleksandr-m You mean something like <td class="tdInput"> in controlheader.ftl and .tdInput {text-align:left;} in styles.css. <-- This is for 2.5.

THat means drop align attribute completely from S2 tags; So from now on the only way to set the align to center for example is to overwrite the css class tdInput in 2.5, right?

I will change that code.

@aleksandr-m
Copy link
Contributor

@victorsosa IMO it would be great. BUT if we really really want it to be backward compatible then we can do both. Add a class for future and use align attribute with class="align-${parameters.align?html}" like you propose in this PR.

@cnenning
Copy link
Member

👍

@lukaszlenart
Copy link
Member

Tests are failing :(

Error Message

expected:<...bel:</label></td><td[]><labelid="myname"ti...> but was:<...bel:</label></td><td[class="tdInput"]><labelid="myname"ti...>
Stacktrace

junit.framework.ComparisonFailure: expected:<...bel:</label></td><td[]><labelid="myname"ti...> but was:<...bel:</label></td><td[class="tdInput"]><labelid="myname"ti...>
    at junit.framework.Assert.assertEquals(Assert.java:100)
    at junit.framework.Assert.assertEquals(Assert.java:107)
    at junit.framework.TestCase.assertEquals(TestCase.java:269)
    at org.apache.struts2.views.jsp.AbstractUITagTest.verify(AbstractUITagTest.java:246)
    at org.apache.struts2.views.jsp.ui.LabelTest.testSimple(LabelTest.java:49)

@lukaszlenart
Copy link
Member

103 tests need to be updated, I think it isn't worth

@victorsosa
Copy link
Contributor Author

I will fix the 103 test cases, give me some time

@lukaszlenart
Copy link
Member

@victorsosa osm!

@lukaszlenart
Copy link
Member

I assume we're ok with this and this PR can be merged?

@victorsosa
Copy link
Contributor Author

Yes, I am ok

@aleksandr-m
Copy link
Contributor

Looks fine. Good job.

@asfgit asfgit merged commit e0b13a5 into apache:master Jun 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants