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 sorting to organisation summary table #242

Merged
merged 4 commits into from May 26, 2015
Merged

Add sorting to organisation summary table #242

merged 4 commits into from May 26, 2015

Conversation

@fofr
Copy link
Contributor

@fofr fofr commented May 26, 2015

  • Make table header cells clickable and use them to sort the table by those columns
  • Default to last 7 days sorting
  • Add spec for browsing by organisation

support-table-sorting

Part of https://tree.taiga.io/project/core-improvement-theme/us/12?kanban-status=211675

cc @boffbowsh @benilovj

fofr added 2 commits May 23, 2015
The support-api now handles all sorting, instead we only need to render
what is returned.
def fetch_organisation_summary_from_support_api
support_api.organisation_summary(params[:slug])
def fetch_organisation_summary_from_support_api(ordering)
support_api.organisation_summary(params[:slug], {ordering: ordering})

This comment has been minimized.

@boffbowsh

boffbowsh May 26, 2015
Contributor

Doesn't need the {} on the last Hash argument

expect(page).to have_selector('th.sorted-column', text: "7 days")
end

scenario "organisation feedback table can be sorted by path, 7, 30 and 90 days" do

This comment has been minimized.

@boffbowsh

boffbowsh May 26, 2015
Contributor

You can move the loop to outside the scenario, and have multiple scenarios auto-generated:

{
  path: 'Page',
  last_7_days: '7 days',
  last_30_days: '30 days',
  last_90_days: '90 days'
}.each do |param, name|
  scenario "organisation feedback table can be sorted by #{name}" do
    stub_summary_sorted_by(param.to_s)
    within '.table-sortable thead' do
      click_on name
    end
    expect(organisation_summary_results).to eq(organisation_summary)
    expect(page).to have_selector('th.sorted-column', text: name)
    expect(page).to have_no_selector('th a', text: name)
  end
end
@boffbowsh
Copy link
Contributor

@boffbowsh boffbowsh commented May 26, 2015

Couple of tiny points, otherwise 👍 from me

fofr added 2 commits May 23, 2015
* Make table header cells clickable and use them to sort the table by
those columns
* Default to last_7_days sorting
The Department of Fair Dos was refactored out in a commit on master and
replaced with `stub_anonymous_feedback_organisations_list` – this uses
Cabinet Office as the default org.
@fofr fofr force-pushed the sorting-feedback branch from 4cc9e85 to 6bd7a87 May 26, 2015
@fofr
Copy link
Contributor Author

@fofr fofr commented May 26, 2015

@boffbowsh Rebased and addressed first comment. Second one (test refactor) caused tests to fail so I have held off on that one.

@boffbowsh
Copy link
Contributor

@boffbowsh boffbowsh commented May 26, 2015

Bon. Merge at will 🚀

fofr added a commit that referenced this pull request May 26, 2015
Add sorting to organisation summary table
@fofr fofr merged commit 99bb86f into master May 26, 2015
1 check passed
1 check passed
default "Build #231 succeeded on Jenkins"
Details
@fofr fofr deleted the sorting-feedback branch May 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.