Skip to content

Commit

Permalink
Merge pull request #4 from rubyforgood/master
Browse files Browse the repository at this point in the history
Merge latest commits into my branch
  • Loading branch information
internetroger committed Sep 5, 2020
2 parents add13cd + 8a0c9bf commit 1689a22
Show file tree
Hide file tree
Showing 29 changed files with 463 additions and 307 deletions.
1 change: 1 addition & 0 deletions .better-html.yml
@@ -0,0 +1 @@
# defaults
4 changes: 4 additions & 0 deletions .erb-lint.yml
@@ -1,2 +1,6 @@
---
EnableDefaultLinters: true
linters:
ErbSafety:
enabled: true
better_html_config: .better-html.yml
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -115,7 +115,7 @@ Test coverage is run by simplecov on all builds and aggregated by CodeClimate
**Cleaning up before you commit**

1. `bundle exec standardrb --fix` auto-fix Ruby linting issues [more linter info](https://github.com/testdouble/standard)
1. `bundle exec erblint --lint-all --autocorrect` [ERB linter](https://github.com/Shopify/erb-lint)
1. `bundle exec erblint --lint-all --enable-all-linters --autocorrect` [ERB linter](https://github.com/Shopify/erb-lint)
1. `yarn lint:fix` to run the [JS linter](https://standardjs.com/index.html) and fix isses

If you have any troubles running tests, check out `.travis.yml` which is what makes the CI build run.
Expand Down
14 changes: 14 additions & 0 deletions app/helpers/case_contacts_helper.rb
Expand Up @@ -59,6 +59,12 @@ def set_contact_made_true(case_contact)
end
end

def render_back_link(casa_case)
return send_home if !current_user || current_user&.volunteer?

send_to_case(casa_case)
end

private

def build_minute_options
Expand All @@ -84,4 +90,12 @@ def build_hour_options

durations
end

def send_home
root_path
end

def send_to_case(casa_case)
casa_case_path(casa_case)
end
end
5 changes: 5 additions & 0 deletions app/helpers/ui_helper.rb
@@ -0,0 +1,5 @@
module UiHelper
def return_to_dashboard_button
link_to 'Return to Dashboard', root_path, { class: "btn btn-info pull-right" }
end
end
3 changes: 2 additions & 1 deletion app/models/case_contact_report.rb
Expand Up @@ -35,7 +35,8 @@ def full_data(case_contact)
casa_case_number: case_contact&.casa_case&.case_number,
creator_email: case_contact&.creator&.email,
creator_name: case_contact&.creator&.display_name,
supervisor_name: case_contact&.creator&.supervisor&.display_name
supervisor_name: case_contact&.creator&.supervisor&.display_name,
case_contact_notes: case_contact&.notes
}
end
end
3 changes: 2 additions & 1 deletion app/views/casa_cases/new.html.erb
Expand Up @@ -23,9 +23,10 @@

<div class="actions">
<%= form.submit "Create CASA Case", class: "btn btn-primary" %>
<%= return_to_dashboard_button %>
</div>
<% end %>
</div>
</div>
<br>
<%= link_to 'Back', :back %>

4 changes: 2 additions & 2 deletions app/views/casa_cases/show.html.erb
Expand Up @@ -4,8 +4,8 @@
<div class="col-sm-12 form-header">
<h1><%= @casa_case.decorate.transition_aged_youth_only_icon %> CASA Case Details</h1>
<%- if policy(:case_contact).new? %>
<%= link_to "New Case Contact",
new_case_contact_path(case_contact: { casa_case_id: @casa_case.id }),
<%= link_to "New Case Contact",
new_case_contact_path(case_contact: { casa_case_id: @casa_case.id }),
class: "btn btn-primary" %>
<%- end %>
<%= link_to 'Edit Case Details', edit_casa_case_path(@casa_case), class: "btn btn-primary" %>
Expand Down
6 changes: 3 additions & 3 deletions app/views/case_assignments/index.html.erb
Expand Up @@ -18,9 +18,9 @@
<tr>
<td><%= assignment.casa_case.case_number %></td>
<td><%= assignment.casa_case.decorate.transition_aged_youth_icon %></td>
<td><%= button_to 'Unassign Case',
volunteer_case_assignment_path(@volunteer, assignment),
method: :delete,
<td><%= button_to 'Unassign Case',
volunteer_case_assignment_path(@volunteer, assignment),
method: :delete,
class: "btn btn-danger" %>
</td>
</tr>
Expand Down
1 change: 1 addition & 0 deletions app/views/case_contacts/_form.html.erb
Expand Up @@ -123,5 +123,6 @@

<div class="actions">
<%= form.submit "Submit", class: "btn btn-primary", id: "case-contact-submit" %>
<%= return_to_dashboard_button %>
</div>
<% end %>
3 changes: 1 addition & 2 deletions app/views/case_contacts/edit.html.erb
Expand Up @@ -10,5 +10,4 @@

<br>

<%= link_to 'Show', @case_contact %> |
<%= link_to 'Back', :back %>
<%= link_to 'Back', render_back_link(@case_contact.casa_case) %>
8 changes: 1 addition & 7 deletions app/views/case_contacts/new.html.erb
@@ -1,14 +1,8 @@
<h1 class="text-center">New Case Contact</h1>

<br>

<div class="row">

<div class="col-sm-12">
<%= render 'form', case_contact: @case_contact, casa_cases: @casa_cases %>
</div>
</div>

<br>

<%= link_to 'Back', :back %>
</div>
76 changes: 38 additions & 38 deletions app/views/imports/index.html.erb
Expand Up @@ -20,84 +20,84 @@
<div class="row">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<%= content_tag :a,
role: "tab",
href: "#volunteer",
id: "volunteer-tab",
<%= content_tag :a,
role: "tab",
href: "#volunteer",
id: "volunteer-tab",
class: [
"nav-link",
("active" if @import_type == "volunteer")
].compact,
data: { toggle: "tab" },
].compact,
data: { toggle: "tab" },
aria: { controls: "volunteer", selected: (@import_type == "volunteer") } do %>
Import Volunteers
<%- end %>
</li>
<li class="nav-item">
<%= content_tag :a,
role: "tab",
href: "#supervisor",
id: "supervisor-tab",
<%= content_tag :a,
role: "tab",
href: "#supervisor",
id: "supervisor-tab",
class: [
"nav-link",
("active" if @import_type == "supervisor")
].compact,
].compact,
data: { toggle: "tab" },
aria: { controls: "supervisor", selected: (@import_type == "supervisor") } do %>
Import Supervisors
<%- end %>
</li>
<li class="nav-item">
<%= content_tag :a,
role: "tab",
href: "#casa-case",
id: "casa-case-tab",
<%= content_tag :a,
role: "tab",
href: "#casa-case",
id: "casa-case-tab",
class: [
"nav-link",
("active" if @import_type == "casa_case")
].compact,
data: { toggle: "tab" },
].compact,
data: { toggle: "tab" },
aria: { controls: "casa-case", selected: (@import_type == "casa_case") } do %>
Import Cases
<%- end %>
</li>
</ul>
<div class="tab-content">
<%= content_tag :div,
role: "tabpanel",
id: "volunteer",
<%= content_tag :div,
role: "tabpanel",
id: "volunteer",
class: [
"tab-pane",
"fade",
("show" if @import_type == "volunteer"),
"tab-pane",
"fade",
("show" if @import_type == "volunteer"),
("active" if @import_type == "volunteer")
].compact,
].compact,
aria: { labelledby: "volunteer-tab" } do %>
<br>
<%= render "volunteers" %>
<%- end %>
<%= content_tag :div,
role: "tabpanel",
id: "supervisor",
<%= content_tag :div,
role: "tabpanel",
id: "supervisor",
class: [
"tab-pane",
"fade",
("show" if @import_type == "supervisor"),
"tab-pane",
"fade",
("show" if @import_type == "supervisor"),
("active" if @import_type == "supervisor")
].compact,
].compact,
aria: { labelledby: "supervisor-tab" } do %>
<br>
<%= render "supervisors" %>
<%- end %>
<%= content_tag :div,
role: "tabpanel",
id: "casa-case",
<%= content_tag :div,
role: "tabpanel",
id: "casa-case",
class: [
"tab-pane",
"fade",
("show" if @import_type == "casa_case"),
"tab-pane",
"fade",
("show" if @import_type == "casa_case"),
("active" if @import_type == "casa_case")
].compact,
].compact,
aria: { labelledby: "casa-case-tab" } do %>
<br>
<%= render "cases" %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/supervisors/new.html.erb
Expand Up @@ -17,7 +17,7 @@

<div class="actions">
<%= form.submit "Create Supervisor", class: "btn btn-primary" %>
<%= link_to 'Return to Dashboard', root_path, class: 'btn btn-info pull-right' %>
<%= return_to_dashboard_button %>
</div>
<% end %>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/views/volunteers/_form.html.erb
Expand Up @@ -25,5 +25,6 @@

<div class="actions">
<%= form.submit "Create User", class: "btn btn-primary" %>
<%= return_to_dashboard_button %>
</div>
<% end %>
4 changes: 1 addition & 3 deletions app/views/volunteers/edit.html.erb
Expand Up @@ -45,9 +45,7 @@
method: :patch,
class: "btn btn-outline-danger",
data:
{ confirm: "WARNING: Marking a volunteer inactive will make them unable to login. They will receive an email saying their account has been marked inactive. Are you sure you want to do this?".html_safe },
hint: "NOTE: This will make connected cases unassigned and<br>
the volunteer won't be able to log in to the system anymore".html_safe %>
{ confirm: "WARNING: Marking a volunteer inactive will make them unable to login. They will receive an email saying their account has been marked inactive. Are you sure you want to do this?"} %>
<% end %>
<% else %>
<div class="alert alert-danger">
Expand Down
1 change: 0 additions & 1 deletion app/views/volunteers/new.html.erb
Expand Up @@ -6,4 +6,3 @@
</div>
</div>
<br>
<%= link_to 'Back', root_path %>

0 comments on commit 1689a22

Please sign in to comment.