Skip to content

Commit

Permalink
Merge pull request #604 from maebeale/inexhaustible-edit
Browse files Browse the repository at this point in the history
Inexhaustible edit
  • Loading branch information
maebeale authored Jul 30, 2020
2 parents 7f8d213 + 4c51d24 commit ee9291e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
## [Unreleased]
### Enhancements
* Display inexhaustible icon on Contributions, Matches, Respond #601
* Update Listings index layout to include buttons to get to Listing edit #604

### Bugfixes
* Fix bug where inexhaustible wasn't updating when edited on Triage page #604

## [0.2.6] - 2020-07-25
### Enhancements
Expand Down
14 changes: 8 additions & 6 deletions app/controllers/contributions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ def triage_update
contribution_params = params[@contribution.type.downcase.to_sym]
title = contribution_params[:title]
description = contribution_params[:description]
if @contribution.update(title: title, description: description)
CommunicationLog.create!(person: @contribution.person,
sent_at: Time.current,
subject: "triaged by #{current_user.name}",
delivery_status: "connected",
delivery_method: @contribution.person.preferred_contact_method)
inexhaustible = contribution_params[:inexhaustible]

if @contribution.update(title: title, description: description, inexhaustible: inexhaustible)
# CommunicationLog.create!(person: @contribution.person,
# sent_at: Time.current,
# subject: "triaged by #{current_user.name}",
# delivery_status: "connected",
# delivery_method: @contribution.person.preferred_contact_method)
redirect_to respond_contribution_path(@contribution), notice: 'Contribution was successfully updated.'
else
render triage_contribution_path(@contribution)
Expand Down
1 change: 1 addition & 0 deletions app/views/admin/landing_page.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
["donations"],
["feedbacks", "Feedback"],
["asks"],
["listings"],
["offers"],
["matches"],
["people"],
Expand Down
17 changes: 8 additions & 9 deletions app/views/listings/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<th>Urgency</th>
<th>Match</th>
<th>Action</th>
<th>Triage</th>
<!-- <th>Find Match</th>-->
</tr>
</thead>
Expand All @@ -42,20 +43,18 @@
<span class="tag <%= 'is-warning fa fa-exclamation' %>"></span>
<% else %>
<% if listing.matches.count > 1 %>
<%= link_to "Matches #{" (#{listing.matches.count})"}", matches_path(match_ids: listing.matches.map(&:id)), class: "button is-primary is-outlined" %>
<%= link_to "View Matches #{" (#{listing.matches.count})"}", matches_path(match_ids: listing.matches.map(&:id)), class: "button is-primary is-outlined" %>
<% else %>
<%= link_to "Match", edit_match_path(listing.matches.last), class: "button is-primary is-outlined" %>
<%= link_to "View Match", edit_match_path(listing.matches.last), class: "button is-primary is-outlined" %>
<% end %>
<% end %>
</td>
<td>
<% if unmatched %>
<%= link_to("<span class='fa fa-reply'></span> <span> &nbsp Respond</span>".html_safe, respond_contribution_path(listing, contribution_type: listing.type),
class: "button #{unmatched ? "is-primary" : "is-primary is-outlined"}") %>
<% else %>
<% button_css_class = "#{unmatched ? "is-primary is-outlined" : "is-primary"}" %>
<%= triage_button(listing, button_css_class) %>
<% end %>
<%= link_to("<span class='fa fa-reply'></span> <span> &nbsp Respond</span>".html_safe, respond_contribution_path(listing, contribution_type: listing.type),
class: "button #{unmatched ? "is-primary" : "is-primary is-outlined"}") %>
</td>
<td>
<%= triage_button(listing, 'is-primary is-outlined') %>
</td>
<!-- # TODO - add find match functionality <td><%##= link_to("Find Match [TBD]", match_listing_path(listing), class: "button") %></td>-->
</tr>
Expand Down

0 comments on commit ee9291e

Please sign in to comment.