-
Notifications
You must be signed in to change notification settings - Fork 16
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
Allow select winner legislation proposals #1640
Conversation
5bf1b4d
to
375761f
Compare
Add admin interface for mark any proposal as selected Add filter to public interface for selected proposals
The `update` action is usually expected to behave the same way it does everywhere else, which is updating a record using the `params` hash. The name `toggle_select` comes from the name we use in a similar situation for budget investments.
2ece1e9
to
538545b
Compare
Now the interface is more similar to the one in budget investments.
Just as we do with confidence score, and as admins expect when they order by received supports: the ones with more supports appear first.
By default records are already ordered by ID, so we weren't checking the ordering by ID functionality was working properly. Making the records be ordered by title first makes the test a bit more reliable.
942bd9d
to
dc6aff3
Compare
dc6aff3
to
224e9ce
Compare
scenario 'Selected filter works correctly' do | ||
legislation_process = create(:legislation_process) | ||
proposal1 = create(:legislation_proposal, legislation_process_id: legislation_process.id) | ||
proposal2 = create(:legislation_proposal, legislation_process_id: legislation_process.id, selected: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [109/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
end | ||
end | ||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingBlankLines: Final newline missing. (https://github.com/bbatsov/ruby-style-guide#newline-eof)
legislation_process = create(:legislation_process) | ||
proposal1 = create(:legislation_proposal, title: 'bbbb', cached_votes_up: 10, legislation_process_id: legislation_process.id) | ||
proposal2 = create(:legislation_proposal, title: 'aaaa', cached_votes_up: 20, legislation_process_id: legislation_process.id) | ||
proposal3 = create(:legislation_proposal, title: 'cccc', cached_votes_up: 30, legislation_process_id: legislation_process.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [131/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
scenario 'Sorting legislation proposals by Id', js: true do | ||
legislation_process = create(:legislation_process) | ||
proposal1 = create(:legislation_proposal, title: 'bbbb', cached_votes_up: 10, legislation_process_id: legislation_process.id) | ||
proposal2 = create(:legislation_proposal, title: 'aaaa', cached_votes_up: 20, legislation_process_id: legislation_process.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [131/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
|
||
scenario 'Sorting legislation proposals by Id', js: true do | ||
legislation_process = create(:legislation_process) | ||
proposal1 = create(:legislation_proposal, title: 'bbbb', cached_votes_up: 10, legislation_process_id: legislation_process.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [131/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
scenario 'Sorting legislation proposals by title', js: true do | ||
legislation_process = create(:legislation_process) | ||
create(:legislation_proposal, title: 'bbbb', cached_votes_up: 10, legislation_process_id: legislation_process.id) | ||
create(:legislation_proposal, title: 'aaaa', cached_votes_up: 20, legislation_process_id: legislation_process.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [119/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
|
||
scenario 'Sorting legislation proposals by title', js: true do | ||
legislation_process = create(:legislation_process) | ||
create(:legislation_proposal, title: 'bbbb', cached_votes_up: 10, legislation_process_id: legislation_process.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [119/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
@@ -1,5 +1,7 @@ | |||
class Legislation::ProcessesController < Legislation::BaseController | |||
has_filters %w{open next past}, only: :index | |||
has_filters %w{all selected}, only: :proposals |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/PercentLiteralDelimiters: %w-literals should be delimited by [ and ]. (https://github.com/bbatsov/ruby-style-guide#percent-literal-braces)
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Layout/TrailingBlankLines: Final newline missing. (https://github.com/bbatsov/ruby-style-guide#newline-eof)
@@ -1,7 +1,16 @@ | |||
class Admin::Legislation::ProposalsController < Admin::Legislation::BaseController | |||
|
|||
has_orders %w{id title supports}, only: :index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/PercentLiteralDelimiters: %w-literals should be delimited by [ and ]. (https://github.com/bbatsov/ruby-style-guide#percent-literal-braces)
1259d15
to
9a7a377
Compare
We kill two birds with one stone and also make each line less than 100 characters long.
As agreed when discussing our rubocop rules.
406d306
to
f664946
Compare
As done in the rest of the application: we show the filters even if there isn't any data to display.
The same way we order budget results.
That way users might be less surprised when they see proposals are different each time they access the page.
b28d273
to
15f4fbd
Compare
Using xpath is usually harder to read and more fragile.
6ca53c2
to
60af247
Compare
Note: continuing #1608 since Raúl isn't available anymore. Everything here is copied from there and was written by @raul-fuentes.
References
consuldemocracy#2739
Objectives
with the proposals list and a select button for each proposal
if any shown proposal is selected now appears filters for only show the selected proposals (or all)
Visual Changes
admin interface changes
![peek 09-08-2018 14-41](https://user-images.githubusercontent.com/33748390/43899500-6d87bfec-9be2-11e8-8e29-584fa663a47a.gif)
public interface changes
![peek 09-08-2018 14-40](https://user-images.githubusercontent.com/33748390/43899482-5f2ade70-9be2-11e8-9206-c7079f4a2c63.gif)
Notes
None