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

Show or hide budget investment winners on budget results #3185

Open
decabeza opened this issue Jan 15, 2019 · 4 comments
Open

Show or hide budget investment winners on budget results #3185

decabeza opened this issue Jan 15, 2019 · 4 comments

Comments

@decabeza
Copy link
Collaborator

Background

When a budget finished in the results page budgets/N/results the table only show "sucess" budget investments and hide the discarded ones.

What we need

Add a checkbox on Admin in /admin/budgets/N/budget_investments?filter=winners:

Show only winner budget investments
If enabled hide discarded budget investments. Also shows a button to "Show All" budget investment on table results.

  • If the checkbox is enabled show all budget investments (hide button "Show all / Hide discarded" and "success / X" icons on table rows).

  • If the checkbox is disabled show as now (button to "Show all / Hide discarded" and "success / X" icons on table rows).

Why

This allows the order by "votes" to be used as the criteria for a winning budget investment regardless of the amount of money.

Screenshots

Admin checkbox
admin

Checkbox disabled
disabled

Checkbox enabled
enabled

Notes & help

The conditions and CSS classes are in app/views/budgets/results/_results_table.html.erb lines 31 to 47:

<tr id="<%= dom_id(investment) %>"
              class="budget-investments <%= investment.winner? ? 'success' : 'js-discarded' %>"
              style="<%= investment.winner? ? '' : 'display: none' %>">
            <td>
              <% if investment.winner? %>
                <span class="icon-check">
                  <span class="show-for-sr">
                    <%= t("budgets.results.accepted") %>
                  </span>
                </span>
              <% else %>
                <span class="icon-x delete">
                  <span class="show-for-sr">
                    <%= t("budgets.results.discarded") %>
                  </span>
                </span>
              <% end %>
              <%= link_to investment.title, budget_investment_path(@budget, investment) %>

And button to show/hide budget investment on results views in views/budgets/results/show.html.erb lines 60 to 63:

<%= link_to t("budgets.results.show_all_link"), "#",
                class: "js-toggle-link button hollow margin-bottom float-right-medium",
                data: {'toggle-selector' => '.js-discarded',
                       'toggle-text' => t("budgets.results.hide_discarded_link")} %>
@alceumedeiros
Copy link

Hi, I'd just like to point that I'm currently working on a solution for this one 😃

@decabeza
Copy link
Collaborator Author

Perfect @alceumedeiros! 🎉

@microweb10 microweb10 assigned microweb10 and unassigned microweb10 Feb 25, 2019
@microweb10 microweb10 added this to Doing in Roadmap Feb 25, 2019
@alceumedeiros
Copy link

Hi @decabeza
I've been away for a while but heading back to the project now and I see somethings have changed. So I was wondering, is this still applicable? If so how exactly do I get there? I'm not sure how to do it given the current dev seed. Thanks!

@decabeza
Copy link
Collaborator Author

Hi @alceumedeiros!

Yes, this changes are still applicable. 😌

Nothing had change of this part on admin section or front views. 🤔

The affected files are:

  • Admin: views/admin/budget_investments/_investments.html.erb
  • Front: views/budgets/results/_results_table.html.erb

I don't understand what do you mean with the current dev seed. 😅

@javierm javierm removed this from Doing in Roadmap Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants