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

Add fullscreen option to map #1655

Closed

Conversation

pezholio
Copy link
Contributor

@pezholio pezholio commented Mar 1, 2017

For mysociety/fixmystreetforcouncils#156

This adds a 'Show Fullscreen' option to the map on a /report page to make the map easier to use when on mobile:

@pezholio pezholio requested a review from davea March 1, 2017 13:17
@pezholio pezholio force-pushed the issues/forcouncils/156-add-fullscreen-option-to-map branch from 66dbd19 to 1896c34 Compare March 1, 2017 13:21
Copy link
Member

@dracos dracos left a comment

Choose a reason for hiding this comment

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

This is lovely 🍇 On the other hand, I've potentially asked you to change a lot of it ;)

@@ -869,6 +869,10 @@ $.extend(fixmystreet.set_up, {
}
$('#key-tools li:empty').remove();
$('#report-updates-data').insertAfter($('#map_box'));
if (fixmystreet.page === 'report') {
$('#sub_map_links').append('<a href="#" id="show-fullscreen" class="expand">Expand map</span>');
Copy link
Member

Choose a reason for hiding this comment

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

These need internationalizing, see how other strings do it elsewhere :)

@@ -1496,6 +1497,48 @@ html.js #map .noscript {
background-image:url($image-sprite);
background-position: flip(right, -341px) -3936px;
}
&.expand {
padding: 0.6em 1em 0.5em 1em;
&:after {
Copy link
Member

Choose a reason for hiding this comment

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

Not saying this is wrong, but why is this done differently to the other sub map link icons, with an :after, and not just an immediate background-image?
Also, note how the other icons do their positioning - you need to account for the LTR/RTL possibility (where you'd want the icon on the right in RTL).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was wrestling with this for a while this morning (my CSS-fu is weak), and @zarino suggested doing it this way, as positioning relative to the right hand side is tricky to do with background-position. I think it's easier with the others as they use a sprite, but I decided to use an SVG as we seem to be moving in that direction for other stuff.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough! Hmm, not sure the LTR/RTL code has had to deal with an after/before swap before, I'll leave that with you to try and sort ;) There are many uses of the left/right and flip() mixins that hopefully make sense. .expand and .close can share most of their CSS too.

Copy link
Member

Choose a reason for hiding this comment

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

Yup, my fault! Maybe we’d use the sprite more, if we had some convenience functions to automatically compile them and surface coordinates for positioning in the sass.

Re: RTL, my understanding is that the :after pseudo element will respect RTL ordering, if it’s display: inline or display: inline-block – ie: in English, the pseudo-element will sit to the right of the button, in Arabic it'd sit to the left. I think.

You’d just need to make sure you use our RTL sass mixins like flip() for any margins/padding you added.

@@ -869,6 +869,10 @@ $.extend(fixmystreet.set_up, {
}
$('#key-tools li:empty').remove();
$('#report-updates-data').insertAfter($('#map_box'));
if (fixmystreet.page === 'report') {
$('#sub_map_links').append('<a href="#" id="show-fullscreen" class="expand">Expand map</span>');
$('#sub_map_links').append('<a href="#" id="hide-fullscreen" class="compress hidden">Collapse map</span>');
Copy link
Member

Choose a reason for hiding this comment

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

Would this be nicer as one link that changes class/text when clicked, rather than two? Guess it doesn't make much difference, but I think other similar uses in the code currently toggle the one link.

@@ -1559,7 +1602,7 @@ html.js #map .noscript {
text-transform: uppercase;
text-align: center;
font-size: 0.875em;
.mobile-reporting-map & {
.mobile-reporting-map &, .report-fullscreen & {
Copy link
Member

Choose a reason for hiding this comment

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

This class never appears on a report page.

@@ -1656,7 +1699,7 @@ a:hover.rap-notes-trigger {
// and make the map full screen to reduce distractions. JavaScript also
// tweaks the text content of some of the map-related elements, to make
// it more "app-like".
.mobile-reporting-map {
.mobile-reporting-map, .report-fullscreen {
Copy link
Member

Choose a reason for hiding this comment

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

I like how these share a lot, I wonder if we can clear it up a bit to split it out a bit more. So we'd have:

  • one class that shows the map full screen, map-fullscreen perhaps;
  • one class that 'locks' it, that's only-map;
  • one class that does page-specific thing, so mobile-reporting-map (perhaps renamed something like map-reporting?) and its pan zoom top.

Then the report page would have map-fullscreen only-map, and the around page would have map-fullscreen only-map map-reporting (where it currently has mobile-reporting-map only-map). Does that make sense, or not worth it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I like this, then if we want to use map-fullscreen anywhere else, it makes sense, without having to add another class

Copy link
Member

@dracos dracos left a comment

Choose a reason for hiding this comment

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

Looking good, a couple of small things.

}
background-size: 16px 16px;
vertical-align: middle;
margin: flip(0 0 0 8px, 0 8px 0 0);
Copy link
Member

Choose a reason for hiding this comment

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

This is fine, just to note that if you did only want to do the one margin as originally, you could write it as:
margin-#{$left}: 8px;.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Aaaah, shiny!

@@ -869,7 +869,7 @@ $.extend(fixmystreet.set_up, {
}
$('#key-tools li:empty').remove();
$('#report-updates-data').insertAfter($('#map_box'));
if (fixmystreet.page === 'report') {
if (['reports','report'].includes(fixmystreet.page)) {
Copy link
Member

Choose a reason for hiding this comment

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

includes is much too modern, I'm afraid.

margin: flip(0 0 0 8px, 0 8px 0 0);
}
}
&.compress {
Copy link
Member

Choose a reason for hiding this comment

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

.expand and .compress still share most of their style, all of it apart from the image URLs could be on #toggle-fullscreen for example.

@pezholio pezholio requested a review from dracos March 2, 2017 15:47
@pezholio pezholio force-pushed the issues/forcouncils/156-add-fullscreen-option-to-map branch from f6df291 to 664850e Compare March 2, 2017 16:17
@pezholio pezholio closed this Mar 2, 2017
@pezholio pezholio force-pushed the issues/forcouncils/156-add-fullscreen-option-to-map branch from 664850e to a38b5d7 Compare March 2, 2017 16:25
@dracos dracos removed the Reviewed label Mar 2, 2017
@dracos dracos deleted the issues/forcouncils/156-add-fullscreen-option-to-map branch April 13, 2017 09:17
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

3 participants