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 Topic Column to Learning Hour Table #5247

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/views/learning_hours/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<tr>
<th>Title</th>
<th>Learning Type</th>
<% if current_user.casa_org.learning_topic_active %>
<th>Learning Topic</th>
<% end %>
<th>Date</th>
<th>Time Spent</th>
</tr>
Expand All @@ -26,6 +29,9 @@
<%= link_to learning_hour.name, volunteer_learning_hour_path(id: learning_hour.id) %>
</td>
<td> <%= learning_hour.learning_hour_type.name %> </td>
<% if current_user.casa_org.learning_topic_active %>
<td> <%= learning_hour.learning_hour_topic&.name %> </td>
<% end %>
<td> <%= learning_hour.occurred_at.strftime("%B %d, %Y") %> </td>
<td>
<% if (learning_hour.duration_hours > 0) %>
Expand Down
12 changes: 12 additions & 0 deletions spec/requests/learning_hours_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
get volunteer_learning_hours_path(volunteer_id: volunteer.id)
expect(response).to have_http_status(:success)
end

it "displays the Learning Topic column if learning_topic_active is true" do
volunteer.casa_org.update(learning_topic_active: true)
get volunteer_learning_hours_path(volunteer_id: volunteer.id)
expect(response.body).to include("Learning Topic")
end

it "does not display the Learning Topic column if learning_topic_active is false" do
volunteer.casa_org.update(learning_topic_active: false)
get volunteer_learning_hours_path(volunteer_id: volunteer.id)
expect(response.body).not_to include("Learning Topic")
end
end
end
end