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

Tabs to switch between term pages for legislatures/houses in a single country #13598

Closed
wants to merge 3 commits into from

Conversation

zarino
Copy link
Member

@zarino zarino commented Jul 25, 2016

Adds tabs to the top of the term_table pages, serving the dual purpose of making it clear which legislature/house is currently selected, and also making it easier to switch between legislatures/houses without having to go back "up" to the country-level page.

Country with more than one legislature:

screen shot 2016-07-25 at 14 15 11

screen shot 2016-07-25 at 15 09 39

Country with only one legislature:

screen shot 2016-07-25 at 15 08 09

screen shot 2016-07-25 at 15 09 14

Part of #13297, but actually quite beneficial to deploy on its own, since it improves the current experience.

@tmtmtmtm tmtmtmtm temporarily deployed to everypolitician-viewe-pr-13598 July 25, 2016 13:15 Inactive
@@ -70,8 +70,5 @@ DEPENDENCIES
sinatra!
yajl-ruby

RUBY VERSION
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 think this change was added because I ran bundle install before starting work. Not sure whether it's needed or not? @tmtmtmtm @chrismytton

zarino added 2 commits July 25, 2016 14:23
Makes it easier to move from, for example, a country’s lower to
upper chamber. Will also help people navigate once executive
branch is included (#13297).
Also includes some fixes for various term_table page elements
that were causing horizontal scrolling on narrow screens.
@zarino zarino force-pushed the 13297-house-navigation branch from b102f6d to dc9ece3 Compare July 25, 2016 13:23
@tmtmtmtm tmtmtmtm temporarily deployed to everypolitician-viewe-pr-13598 July 25, 2016 13:23 Inactive
@tmtmtmtm
Copy link
Contributor

Thanks @zarino. I'm having difficulties getting this running at the minute, as nokogiri is complaining about libxml2 stuff, so whilst I'm wrestling with that, it would be helpful if you could also add a screenshot for a country where we only have a single legislature, and, as you've added some changes for narrow screens, a couple of parallel screenshots for those.

<ul class="house-tabs">
<% @country[:legislatures].each do |house| %>
<li>
<% latest_term = house[:legislative_periods].sort_by{ |term| term[:start_date] }.last %>
Copy link
Contributor

Choose a reason for hiding this comment

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

These are already pre-sorted (though in most-recent-first order), so you just need a house[:legislative_periods].first there (which also means you can probably inline it rather than setting up a latest_term).

@tmtmtmtm
Copy link
Contributor

@zarino The behaviour of always jumping to the most recent term for a country surprised me a little here — e.g. when I was on /australia/representatives/term-table/41.html and didn't go to the same term in the Senate.

Was it an explicit decision that that's what the behaviour should be?

@zarino
Copy link
Member Author

zarino commented Jul 25, 2016

@zarino The behaviour of always jumping to the most recent term for a country surprised me a little here

@tmtmtmtm: Yeah, it's not really what I wanted it to do. In an ideal world it would switch to the term, I guess, with the most overlap with the current term you're viewing. (I'm assuming terms don't necessarily increment at the same times, or have synchronised IDs between legislatures?)

@tmtmtmtm
Copy link
Contributor

Yeah — in some countries they'll pretty much always be in sync, but in others they'll be quite significantly different. Plus of course, they're not always two current houses of the same legislature.

Most overlap seems like an interesting way to go about it…

@zarino
Copy link
Member Author

zarino commented Jul 25, 2016

Most overlap seems like an interesting way to go about it…

Yeah, at least then you end up staying at roughly the same period in time. A simpler alternative might be to switch to the term with a start date closest to the start date of the term you're looking at.

@tmtmtmtm
Copy link
Contributor

A simpler alternative might be to switch to the term with a start date closest to the start date of the term you're looking at

I think I'd be more inclined to make that a check on the end date rather than the start date, unless there's a case I'm overlooking? (I'm imagining a scenario where the Upper house has 6 year terms, and the lower house 3 year terms, where if I'm looking at the current term in the Senate, and then switch to the lower house, I'd end up on the previous term, rather than the current one…)

@tmtmtmtm
Copy link
Contributor

I'm also not sure whether we should just go live with what we currently have, and potentially surprise some users in the meantime whilst we fix this up, or whether this is worth spending a bit of extra time doing the right thing now…

@zarino
Copy link
Member Author

zarino commented Jul 28, 2016

I'm also not sure whether we should just go live with what we currently have […]

It's hard to tell when we don't have any analytics data yet on how people navigate these pages.

I'm typically in favour of small incremental changes. But I'm a bit worried this is a sufficiently annoying thing that, if it happens, you'll just think the site is broken. Or, more perniciously, you might get switched to the wrong term without noticing.

Whatever we pick, there's always going to be a chance of people landing on the wrong term. Your suggestion of going by the end date is interesting, and certainly makes sense when you're switching from the most recent term. I just wonder whether it also makes sense when you're looking at historical terms?

@tmtmtmtm
Copy link
Contributor

I'm typically in favour of small incremental changes. But I'm a bit worried this is a sufficiently annoying thing that, if it happens, you'll just think the site is broken. Or, more perniciously, you might get switched to the wrong term without noticing.

Yep — that's my fear too. If a change clearly adds value with no negatives, I'm all for pushing it through, even if that value is miniscule. But here I'm worried that it adds possible negative value as well as the positive, so I'm more cautious.

Your suggestion of going by the end date is interesting, and certainly makes sense when you're switching from the most recent term. I just wonder whether it also makes sense when you're looking at historical terms?

I think it does. The one case where it might be odd is if you're looking at the first term in a country and then switch house, and end up on the second term of the other house. But that one doesn't worry as much as the opposite.

What this might all be telling us, of course, is that these tabs shouldn't be taking us to term pages at all, but just to the front page for that legislature. And the problem is that there's currently no such thing…

@zarino
Copy link
Member Author

zarino commented Jul 28, 2016

What this might all be telling us, of course, is that these tabs shouldn't be taking us to term pages at all, but just to the front page for that legislature.

Two worries about this:

  1. The UI convention of tabs is that they switch the content below the tabs. Even though, technically, the tabs in this PR are navigating you to a new page, visually, the top half of the new page looks just like the top half of the old page, so the effect marries up with how you'd expect tabs to work. If the tabs lead you to a completely different looking page, the illusion will be broken. So they probably shouldn't be styled like tabs.
  2. If the tabs take you to a "choose a term" page, then we're forcing everyone to make two clicks to get to the term they want (first click on the tab, then click on the term you want). Whereas, if clicking the tab at least attempts to send you to the term you're most likely to want, we could hope that at least some people would get to their desired destination in one click, and at worst, the remainder would get there in two clicks.

@tmtmtmtm
Copy link
Contributor

tmtmtmtm commented Jul 28, 2016

I think we're uncovering something quite interesting here, as now I'm unsure whether these should be tabs or not.

To me the primary thing we're dealign with here is the ability to switch to another sub-entity of the current country, and only secondarily to switch to an equivalent page — i.e. I currently see this as being something that's much more connected to what's above it, than to what's below it.

I suspect part of the difficulty in reasoning about this is because we mostly only really have one type of page per legislature, and currently only one type of 'entity' we're dealing with.

And whilst I definitely think we should work with what we currently have, rather than what we're hoping to have in the future, I'm a little way of introducing patterns that will completely break in other contexts if we can spot up-front something that would more naturally work both now and in the future.

To spell this all out a little more (as much for my own sake, as anything else), the only "Organization" (for lack of more precise terminology) we're dealing with here is a Legislature at the minute. In countries where we currently have more than one entity, those are of two types:

  1. bicameral legislatures (e.g. Australia, where the two are essentially sibling houses, which may or may not have their terms in sync (e.g. Australia where we do, or Namibia where we don't). [Note also that we may have much more historic data for one house than the other, such as with Cameroon]
  2. historic legislatures (e.g British Virgin Islands)

Soon we will have a third, connected but more distinct, version with executive level ones, e.g. the UK Cabinet.

At a future data we may also have sub-national legislatures etc too (e.g. the legislatures of each of the US States). [NB: I don't think we need to pay a lot of attention to this yet, as that's probably quite a way off, and we'll likely have to rethink a lot of other core stuff when we get to that stage. Listing here purely for completeness]

Within each of those we currently only really have the Term-table pages. Reasonably soon it's highly likely that we'll have other types of things too. In practice we do currently have other pages too, except we're careful not expose those on the static site. Interestingly the main one of those is now broken: https://everypolitician-viewe-pr-13598.herokuapp.com/australia/senate/wikidata

The breakage seems to be from an earlier change, which we'll need to track down, but the interesting question is whether that page should also have a way to get to the other house. My initial impression is that it should, but I guess I do expect that that would take me to the equivalent Wikidata page for the House of Representatives, rather than a 'front page' for it, which somewhat contradicts where I started this comment from, so I think I need to go away think about this a lot more!

@tmtmtmtm
Copy link
Contributor

I've fixed the broken Wikidata page in #13743; might be worth rebasing this over that so we can reason better about what that page should do under this PR…

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.

2 participants