Skip to content

Commit 8cf1fb3

Browse files
authored
Merge pull request #41 from lettergram/add_org_logos
Add org logos, copy & improved org page
2 parents 4fabb8b + cd1682a commit 8cf1fb3

9 files changed

Lines changed: 86 additions & 38 deletions

File tree

app/controllers/organizations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def logged_in_org_admin
131131

132132
# Only allow a list of trusted parameters through.
133133
def organization_params
134-
params.require(:organization).permit(:name, :description, :approvals_required)
134+
params.require(:organization).permit(:name, :description, :approvals_required, :logo_link)
135135
end
136136

137137
def sentiment_to_text(sentiment)

app/controllers/sessions_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def create
2525
end
2626

2727
def destroy
28-
log_out if logged_in?
29-
redirect_to root_url
28+
log_out
29+
redirect_to root_url, status: :see_other
3030
end
3131

3232
end

app/controllers/static_pages_controller.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def home
1212
@shared_letter_id = params[:letter_id]
1313
end
1414

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

2627
@referral_org_id = org.id
2728
@referral_org_name = org.name
29+
@referral_org_logo_link = org.logo_link
30+
@referral_org_description = org.description
2831

2932
@current_user_id = 1
3033
if current_user.present?

app/views/layouts/_header.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<li><%= link_to "Settings", edit_user_path(current_user) %></li>
7676
<li class="divider"></li>
7777
<li>
78-
<%= link_to "Log out", logout_path, method: :delete %>
78+
<%= link_to "Log out", logout_path, data: { "turbo-method": :delete } %>
7979
</li>
8080
</ul>
8181
</li>

app/views/organizations/_form.html.erb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
<%= form.label :name %>
1818
<%= form.text_field :name %>
1919
</div>
20+
21+
<div class="field">
22+
<%= form.label :logo_link %>
23+
<%= form.text_field :logo_link %>
24+
</div>
2025

2126
<div class="field">
2227
<%= form.label :description %>

app/views/organizations/show.html.erb

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
21
<div class="row">
2+
<div class="col-md-6 col-md-offset-3">
3+
<h2>
4+
<%= @organization.name %>
5+
</h2>
6+
<h1>
7+
<%= image_tag @organization.logo_link, class: "splashlogo" %>
8+
</h1>
9+
<h4>
10+
<%= @organization.description.html_safe %>
11+
</h4>
12+
</div>
313
<div class="col-md-12">
4-
<p>
5-
<strong>Name:</strong>
6-
<%= @organization.name %><br>
7-
<strong>Description:</strong>
8-
<%= @organization.description %>
9-
</p>
10-
11-
<p>
12-
<strong>Approvals required:</strong>
13-
<%= @organization.approvals_required %>
14-
</p>
15-
14+
<hr>
15+
</div>
16+
</div>
17+
<div class="row">
18+
<div class="col-md-4">
1619
<p>
1720
<strong>Associated Users:</strong>
1821
-> <u><b><%= link_to "Invite New User", new_user_path %></b></u>
@@ -22,29 +25,51 @@
2225
<li>
2326
<% if user.org_admin %>
2427
<b>Org Admin</b> -
28+
<% else %>
29+
Org User
2530
<% end %>
26-
<%= user.name %>, <%= user.email %>
2731
<% if current_user.org_admin or current_user.admin %>
28-
-
2932
<small>
30-
<%= link_to "Remove", remove_user_from_org_path(
33+
<%= link_to "Remove User", remove_user_from_org_path(
3134
user_id: user.id, id: @organization.id) %>
32-
</small>
35+
</small><br>
3336
<% end %>
37+
<%= user.name %>
38+
<br><%= user.email %>
3439
</li>
3540
<% end %>
3641
</ul>
3742
<br>
3843
</p>
3944
</div>
45+
<div class="col-md-4">
46+
<p>
47+
<center>
48+
<% if @organization.approvals_required %>
49+
<strong>Approval Required to Send Letters</strong>
50+
<% else %>
51+
<strong>Approvals <u>NOT</u> Required to Send Letters</strong>
52+
<% end %>
53+
<hr>
54+
<b><%= link_to "Review Letters", posts_path %></b><br>
55+
<b><%= link_to "Review Faxes", faxes_path %></b>
56+
</center>
57+
</p>
58+
</div>
59+
<div class="col-md-4">
60+
<center>
61+
<% if current_user.org_admin or current_user.admin %>
62+
<%= link_to 'Edit Organization Settings', edit_organization_path(@organization) %>
63+
<% end %>
64+
</center>
65+
</div>
4066
</div>
4167
<div class="row">
42-
<% if current_user.org_admin or current_user.admin %>
43-
<%= link_to 'Edit Organization Settings', edit_organization_path(@organization) %>
44-
<% end %>
45-
<br>
46-
<hr>
47-
<br>
68+
<div class="col-md-12">
69+
<hr>
70+
<h2>Statistics</h2>
71+
<hr>
72+
</div>
4873
</div>
4974
<div class="row">
5075
<div class="col-md-6">

app/views/static_pages/home.html.erb

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
<% provide(:title, "Home") %>
22
<div class="center jumbotron">
3-
<h1>
4-
<%= image_tag 'vocalvoters_logos/vocalvoters-beta.png', class: "splashlogo" %>
5-
</h1>
6-
<h2>
7-
Share Your Opinion With Your Representatives<br>
8-
<small>
9-
Send a Letter or Fax in 30 Seconds or Less
10-
</small>
11-
</h2>
3+
<% if @referral_org_logo_link.present? %>
4+
<h1>
5+
<%= image_tag @referral_org_logo_link, class: "splashlogo" %>
6+
</h1>
7+
<h4>
8+
<%= @referral_org_description.html_safe %>
9+
</h4>
10+
<% else %>
11+
<h1>
12+
<%= image_tag 'vocalvoters_logos/vocalvoters-beta.png', class: "splashlogo" %>
13+
</h1>
14+
<h2>
15+
Share Your Opinion With Your Representatives<br>
16+
<small>
17+
Send a Letter or Fax in 30 Seconds or Less
18+
</small>
19+
</h2>
20+
<% end %>
1221
</div>
1322
<div class="row">
1423
<div class="col-md-8 col-md-offset-2">
@@ -151,7 +160,7 @@
151160
class: 'btn btn-info send_button' %><br>
152161
<small>
153162
<span id="letter_price">0</span><br>
154-
<b>Max Impact</b><br>
163+
<b>High Impact</b><br>
155164
14-21 Days
156165
</small>
157166
</center>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddLogoLinkToOrganizations < ActiveRecord::Migration[7.0]
2+
def change
3+
add_column :organizations, :logo_link, :string
4+
end
5+
end

db/schema.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

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

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

0 commit comments

Comments
 (0)