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 Casa logos to landing page Issue #4475 #4865

Merged
merged 2 commits into from
Jul 8, 2023
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
1 change: 1 addition & 0 deletions app/controllers/static_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class StaticController < ApplicationController

def index
redirect_to dashboard_path_from_current_role if current_user
@casa_logos = CasaOrg.with_logo
end

def register
Expand Down
2 changes: 2 additions & 0 deletions app/models/casa_org.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ class CasaOrg < ApplicationRecord
CASA_DEFAULT_COURT_REPORT = File.new(Rails.root.join("app", "documents", "templates", "default_report_template.docx"), "r")
CASA_DEFAULT_LOGO = Rails.root.join("public", "logo.jpeg")

scope :with_logo, -> { joins(:logo_attachment) }

before_create :set_slug
before_update :sanitize_svg
before_save :normalize_phone_number
Expand Down
31 changes: 25 additions & 6 deletions app/views/static/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
.app-images {
height: 400px;
}

.org_logo {
height: 200px;
}
</style>
</head>

Expand Down Expand Up @@ -165,14 +169,29 @@
</div>
</div>
</div>
<div class="container max-w-7xl mx-auto py-32" id="contact">

<div class="w-3/4 mx-auto py-24" id="organizations">
<div class="text-center">
<h2 class="text-4xl">Want to use the CASA Volunteer Tracking App?</h2>
<!-- <p class="text-gray-500 mt-2">After the demo, you will be able to request your own account.</p>-->
<!-- <a href=<%#="#{new_account_request_path}"%>><button type="button" class="text-lg bg-green-500 text-white px-3 py-2 mt-5 rounded-2xl">Request A Demo</button></a>-->
<h2 class="text-4xl"> CASA Organizations Powered by Our App </h2>
</div>
<div class="flex flex-col flex-wrap md:flex-row justify-center py-14">
<% @casa_logos.each do |org| %>
<div class="flex flex-col justify-center items-center w-full sm:w-1/3">
<div class="py-8">
<%= image_tag org.logo, class: "org_logo" %>
</div>
</div>
<% end %>
</div>
</div>

<br><br>
<p class="text-gray-500">Have questions? Email us at <a class="text-blue-800" href="mailto:casa@rubyforgood.org?Subject=CASA%20Interest" target="_top">casa@rubyforgood.org</a></p>
<div class="py-5 px-0 bg-blue-600 text-white">
<div class="container max-w-7xl mx-auto py-32 bg-blue-600 text-white" id="contact">
<div class="text-center">
<h2 class="text-4xl">Want to use the CASA Volunteer Tracking App?</h2>
<br><br>
<p>Have questions? Email us at <a class="text-green-400" href="mailto:casa@rubyforgood.org?Subject=CASA%20Interest" target="_top">casa@rubyforgood.org</a></p>
</div>
</div>
</div>
</main>
Expand Down
4 changes: 4 additions & 0 deletions spec/factories/casa_orgs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
twilio_api_key_secret { "open sesame" }
twilio_api_key_sid { "Aladdin" }
twilio_phone_number { "+15555555555" }

trait :with_logo do
logo { Rack::Test::UploadedFile.new(Rails.root.join("spec", "fixtures", "org_logo.jpeg")) }
end
twilio_enabled { true }
end
end
Binary file added spec/fixtures/org_logo.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions spec/system/static/index_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require "rails_helper"

RSpec.describe "static/index", type: :system do
context "when visiting the CASA volunteer landing page", js: true do
describe "when all organizations have logos" do
before do
3.times { create(:casa_org, :with_logo) }
visit root_path
end

it "has CASA organizations section" do
expect(page).to have_text "CASA Organizations Powered by Our App"
end

it "displays all organizations that have attached logos" do
within("#organizations") do
expect(page).to have_css(".org_logo", count: 3)
end
end
end

describe "when some orgs are missing logos" do
before do
4.times { create(:casa_org, :with_logo) }
4.times { create(:casa_org) }
visit root_path
end

it "does not display organizations that don't have attached logos" do
within("#organizations") do
expect(page).to have_css(".org_logo", count: 4)
end
end
end
end
end