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

Date range selector for stats #4302

Merged
merged 3 commits into from Dec 27, 2018

Conversation

cesswairimu
Copy link
Collaborator

@cesswairimu cesswairimu commented Dec 14, 2018

Fixes #4297

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • ask @publiclab/reviewers for help, in a comment below

@ghost ghost assigned cesswairimu Dec 14, 2018
@ghost ghost added the in progress label Dec 14, 2018
@plotsbot
Copy link
Collaborator

plotsbot commented Dec 14, 2018

2 Messages
📖 @cesswairimu Thank you for your pull request! I’m here to help with some tips and recommendations. Please take a look at the list provided and help us review and accept your contribution! And don’t be discouraged if you see errors – we’re here to help.
📖 It looks like you haven’t marked all the checkboxes. Help us review and accept your suggested changes by going through the steps one by one. If it is still a ‘Work in progresss’, please include ‘[WIP]’ in the title.

Generated by 🚫 Danger

@jywarren
Copy link
Member

Ooh! Very cool! Screenshots? Thanks, Cess!

@cesswairimu
Copy link
Collaborator Author

cesswairimu commented Dec 14, 2018

range2
Here it is @jywarren.
Also I realized the footer in this page looks weird. https://publiclab.org/stats/range/ not same as https://publiclab.org/stats. Should it be like this or should I try and fix it? Thanks

@cesswairimu cesswairimu changed the title Date range selector for stats (WIP)Date range selector for stats Dec 14, 2018
@jywarren
Copy link
Member

jywarren commented Dec 14, 2018 via email

@cesswairimu
Copy link
Collaborator Author

cesswairimu commented Dec 14, 2018

Actually, found the bug on the footer, it was a missing '/' in a closing table tag 😄 It's fixed

@cesswairimu cesswairimu changed the title (WIP)Date range selector for stats Date range selector for stats Dec 14, 2018
@jywarren
Copy link
Member

This is great. I'm thinking also we might have a way to auto-select some useful date ranges, like "Past 7 days" or "Past month" and such. See how in this date chooser, those are offered at the top? We could start with just a few as buttons:

image

But that can be in follow-up to this PR. Is this ready to merge? So great!!!!! 👍

@cesswairimu
Copy link
Collaborator Author

I have it default selected start for DateTime.now-1.weeks and end DateTime.now. Yeah the selector looks awesome. I will have implement that on this PR. Thanks

@cesswairimu
Copy link
Collaborator Author

screen1
screen2

@jywarren
Copy link
Member

Hi, @cesswairimu ! CodeClimate is warning us about something here; would you mind clicking the icon above the notice to learn about what it's objecting to? It may be a security issue, but let's just be sure:

https://codeclimate.com/github/publiclab/plots2/pull/4302 -- if it doesn't seem critical, we could in theory ignore it.

Thanks! Otherwise this looks lovely. Maybe we could get the "Today" to align a bit better in the blue button, and add a 2-3px padding inside that button? Let me take a look at the code driving it.

Once we resolve this CodeClimate issue we should be good to go.

<p>
<button data-placement="bottom" data-toggle="popover" data-container="body" data-placement="bottom" type="button" data-html="true" class="btn btn-primary">
<span><i class="fa fa-calendar fa-2x"> </i> Today </span> </button>
</button> Compared to <%= Date.today.to_formatted_s(:long) %>
Copy link
Member

Choose a reason for hiding this comment

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

Ah, here maybe there is a 2nd redundant button element causing trouble? Also, is the span totally necessary? It might be causing some layout issues too... just not totally sure it's required. Thanks!

<h4><b> Select a range below to view stats within the range </b></h4>
<%= form_tag request.url, method: 'get' do %>
<div class="row">
<div class="col-md-8" style="background:#F5F6F8;">
Copy link
Member

Choose a reason for hiding this comment

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

Here you could use the well css class from Bootstrap instead of a background css style. Take a look!

https://getbootstrap.com/docs/3.3/

<h5> Date Range </h5>
<%= select_tag :options, options_for_select(["Week", "Month","Year"]), prompt: "View stats in the past", class: " form-control input-lg", onchange: "this.form.submit();" %>
</div>
</div>
Copy link
Member

Choose a reason for hiding this comment

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

I know it's a bit overly detailed to ask, but if you could keep all the indentations really consistent it does pay off in the long run across our whole project. Thanks, @cesswairimu !!!

@cesswairimu cesswairimu force-pushed the date-range-selector-for-stats branch 4 times, most recently from 5fbc450 to a96fe2b Compare December 26, 2018 14:41
@cesswairimu
Copy link
Collaborator Author

refac
removed the today from the calendar icon and moved the range details to the calendar icon. Made more sense to me this way because the range changes and would not be compared with today. How does this look?

@jywarren
Copy link
Member

jywarren commented Dec 26, 2018 via email

@cesswairimu
Copy link
Collaborator Author

cesswairimu commented Dec 26, 2018

Cool on it. Thanks

@cesswairimu
Copy link
Collaborator Author

style

@jywarren
Copy link
Member

Looks fantastic. Merging this now!!!

@jywarren jywarren merged commit 14cc431 into publiclab:master Dec 27, 2018
@ghost ghost removed the in progress label Dec 27, 2018
SrinandanPai pushed a commit to SrinandanPai/plots2 that referenced this pull request May 5, 2019
* date-range selector for range

* fix a missing '/' in table

* style calendar selector
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