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

Clean up river gauge #2011

Merged
merged 4 commits into from Dec 16, 2017
Merged

Clean up river gauge #2011

merged 4 commits into from Dec 16, 2017

Conversation

haarg
Copy link
Member

@haarg haarg commented Dec 11, 2017

Layout and some other cleanups for river gauge. It also embeds the svg directly on pod and release pages. We could also embed it on other pages if that was desired, but the data wasn't immediately available so I didn't both at this point.

The html br tags in the SVG don't work in Firefox, but an encoded newline seems to, so I replaced them.

Search page

Chrome before:
search-chrome before
After:
search-chrome after
Firefox before:
search-firefox before
After:
search-firefox after

Pod breadcrumbs

Chrome before:
pod-chrome before
After:
pod-chrome after
Firefox before:
pod-firefox before
After:
pod-firefox after

Release list

Chrome before:
author-chrome before
After:
author-chrome after
Firefox before:
author-firefox before
After:
author-firefox after

@haarg haarg requested a review from tsibley December 11, 2017 19:18
@tsibley
Copy link
Contributor

tsibley commented Dec 12, 2017

The html br tags in the SVG don't work in Firefox, but an encoded newline seems to, so I replaced them.

Yeah, I realized the <br> didn't work in Firefox, but didn't think to encode them. Nice!

Copy link
Contributor

@tsibley tsibley left a comment

Choose a reason for hiding this comment

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

Can you look into why tests are failing?

@@ -2,9 +2,9 @@
Unlike an <img>, an <object> grafts the SVG document into the DOM, which
means browsers will display the <title> elements of the SVG. Yay!
-->
<object data="/river/gauge/<% distribution | uri | html %>"
<object data="/river/gauge/<% distribution | uri %>"
Copy link
Contributor

Choose a reason for hiding this comment

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

Relying on uri to do enough escaping for HTML too is bad practice. Why did you remove it here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was checking on how the default filtering is applied and it slipped into the commit.

@@ -48,8 +48,8 @@
IF have_released; %>
<a class="latest" href="<% IF module %>/pod/<% module.documentation %><% ELSE %>/release/<% release.distribution; END %>" title="<%- IF release.maturity == 'developer'; 'dev release, '; END %>go to latest"><span class="fa fa-step-forward"></span></a>
<%- END; END; %>
<div class="inline"><% INCLUDE inc/river-gauge.html, distribution = release.distribution %></div>
<div class="inline"><%- INCLUDE inc/favorite.html %></div>
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason for removing the inline class in an otherwise unrelated change isn't mentioned. From the face of it, it seems like it would break https://github.com/metacpan/metacpan-web/blob/d3f34a1/root/static/js/cpan.js#L301 (although the correctness and provenance of that line seems dubious at first glance).

Copy link
Member Author

Choose a reason for hiding this comment

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

The div serves no real purpose, and then uses a silly class like "inline" to fix it. I'll fix the javascript to handle this properly.

Copy link
Contributor

Choose a reason for hiding this comment

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

I totally agree it's a stupid bit of markup. :-)

@tsibley
Copy link
Contributor

tsibley commented Dec 12, 2017

@haarg Did you see #2011 (comment)? It looks like GitHub decided that was on an outdated commit for some reason and doesn't show it by default.

@haarg haarg force-pushed the haarg/river-cleanups branch 2 times, most recently from da74305 to 1dbc249 Compare December 14, 2017 22:45
@tsibley
Copy link
Contributor

tsibley commented Dec 15, 2017

Hrm. Switching to <svg:title> appears to have broken the tooltip when the SVG is embedded in the page (on both Chrome and Firefox). It still works on the SVGs which are included via an <object>.

@tsibley
Copy link
Contributor

tsibley commented Dec 15, 2017

It's a stupid state of affairs, but I guess we can vary the use of <title> and <svg:title> with the value of embed. Nope, nevermind, that's the wrong association.

@tsibley
Copy link
Contributor

tsibley commented Dec 15, 2017

(Otherwise, this looks great and I appreciate the cleanups.)

Various tweaks to the CSS and markup to make the river gauge layout more
consistent across browsers.

Also removes some needless extra divs in the breadcrumb that served no
purpose.  They were styled as inline, so they effectively functioned as
spans, which without any extra styles apply effectively means they were
no-ops.  There was a bit of javascript relying on the "inline" class
that was applied surrounding the favorite button, but it was just
reusing classes that happened to be there rather than anything
semantically tied to the button.
Using a newline entity in title seems to work properly in Firefox,
Chrome, and Safari.
@tsibley tsibley merged commit 5795229 into master Dec 16, 2017
@tsibley tsibley deleted the haarg/river-cleanups branch December 16, 2017 20:00
@tsibley
Copy link
Contributor

tsibley commented Dec 16, 2017

Merged! Thank you!

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.

None yet

2 participants