Skip to content

Commit

Permalink
if referral link is provided, utilize their logos
Browse files Browse the repository at this point in the history
lettergram committed Mar 25, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 4fabb8b commit bb482d2
Showing 8 changed files with 38 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ def logged_in_org_admin

# Only allow a list of trusted parameters through.
def organization_params
params.require(:organization).permit(:name, :description, :approvals_required)
params.require(:organization).permit(:name, :description, :approvals_required, :logo_link)
end

def sentiment_to_text(sentiment)
4 changes: 2 additions & 2 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@ def create
end

def destroy
log_out if logged_in?
redirect_to root_url
log_out
redirect_to root_url, status: :see_other
end

end
3 changes: 3 additions & 0 deletions app/controllers/static_pages_controller.rb
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ def home
@shared_letter_id = params[:letter_id]
end

@referral_org_logo_link = ""
@referral_org_id = ""
if params.has_key?(:referral_org_id)
org = Organization.find_by(id: params[:referral_org_id])
@@ -25,6 +26,8 @@ def home

@referral_org_id = org.id
@referral_org_name = org.name
@referral_org_logo_link = org.logo_link
@referral_org_description = org.description

@current_user_id = 1
if current_user.present?
2 changes: 1 addition & 1 deletion app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@
<li><%= link_to "Settings", edit_user_path(current_user) %></li>
<li class="divider"></li>
<li>
<%= link_to "Log out", logout_path, method: :delete %>
<%= link_to "Log out", logout_path, data: { "turbo-method": :delete } %>
</li>
</ul>
</li>
5 changes: 5 additions & 0 deletions app/views/organizations/_form.html.erb
Original file line number Diff line number Diff line change
@@ -17,6 +17,11 @@
<%= form.label :name %>
<%= form.text_field :name %>
</div>

<div class="field">
<%= form.label :logo_link %>
<%= form.text_field :logo_link %>
</div>

<div class="field">
<%= form.label :description %>
29 changes: 19 additions & 10 deletions app/views/static_pages/home.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
<% provide(:title, "Home") %>
<div class="center jumbotron">
<h1>
<%= image_tag 'vocalvoters_logos/vocalvoters-beta.png', class: "splashlogo" %>
</h1>
<h2>
Share Your Opinion With Your Representatives<br>
<small>
Send a Letter or Fax in 30 Seconds or Less
</small>
</h2>
<% if @referral_org_logo_link.present? %>
<h1>
<%= image_tag @referral_org_logo_link, class: "splashlogo" %>
</h1>
<h4>
<%= @referral_org_description.html_safe %>
</h4>
<% else %>
<h1>
<%= image_tag 'vocalvoters_logos/vocalvoters-beta.png', class: "splashlogo" %>
</h1>
<h2>
Share Your Opinion With Your Representatives<br>
<small>
Send a Letter or Fax in 30 Seconds or Less
</small>
</h2>
<% end %>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2">
@@ -151,7 +160,7 @@
class: 'btn btn-info send_button' %><br>
<small>
<span id="letter_price">0</span><br>
<b>Max Impact</b><br>
<b>High Impact</b><br>
14-21 Days
</small>
</center>
5 changes: 5 additions & 0 deletions db/migrate/20230325200705_add_logo_link_to_organizations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddLogoLinkToOrganizations < ActiveRecord::Migration[7.0]
def change
add_column :organizations, :logo_link, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_03_24_153452) do
ActiveRecord::Schema[7.0].define(version: 2023_03_25_200705) do
create_table "emails", force: :cascade do |t|
t.string "email_address"
t.boolean "success", default: true
@@ -68,6 +68,7 @@
t.boolean "approvals_required", default: true
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "logo_link"
end

create_table "pay_charges", force: :cascade do |t|

0 comments on commit bb482d2

Please sign in to comment.