Skip to content

Commit

Permalink
Merge pull request #41 from lettergram/add_org_logos
Browse files Browse the repository at this point in the history
Add org logos, copy & improved org page
  • Loading branch information
lettergram authored Mar 25, 2023
2 parents 4fabb8b + cd1682a commit 8cf1fb3
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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])
Expand All @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions app/views/organizations/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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 %>
Expand Down
71 changes: 48 additions & 23 deletions app/views/organizations/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@

<div class="row">
<div class="col-md-6 col-md-offset-3">
<h2>
<%= @organization.name %>
</h2>
<h1>
<%= image_tag @organization.logo_link, class: "splashlogo" %>
</h1>
<h4>
<%= @organization.description.html_safe %>
</h4>
</div>
<div class="col-md-12">
<p>
<strong>Name:</strong>
<%= @organization.name %><br>
<strong>Description:</strong>
<%= @organization.description %>
</p>

<p>
<strong>Approvals required:</strong>
<%= @organization.approvals_required %>
</p>

<hr>
</div>
</div>
<div class="row">
<div class="col-md-4">
<p>
<strong>Associated Users:</strong>
-> <u><b><%= link_to "Invite New User", new_user_path %></b></u>
Expand All @@ -22,29 +25,51 @@
<li>
<% if user.org_admin %>
<b>Org Admin</b> -
<% else %>
Org User
<% end %>
<%= user.name %>, <%= user.email %>
<% if current_user.org_admin or current_user.admin %>
-
<small>
<%= link_to "Remove", remove_user_from_org_path(
<%= link_to "Remove User", remove_user_from_org_path(
user_id: user.id, id: @organization.id) %>
</small>
</small><br>
<% end %>
<%= user.name %>
<br><%= user.email %>
</li>
<% end %>
</ul>
<br>
</p>
</div>
<div class="col-md-4">
<p>
<center>
<% if @organization.approvals_required %>
<strong>Approval Required to Send Letters</strong>
<% else %>
<strong>Approvals <u>NOT</u> Required to Send Letters</strong>
<% end %>
<hr>
<b><%= link_to "Review Letters", posts_path %></b><br>
<b><%= link_to "Review Faxes", faxes_path %></b>
</center>
</p>
</div>
<div class="col-md-4">
<center>
<% if current_user.org_admin or current_user.admin %>
<%= link_to 'Edit Organization Settings', edit_organization_path(@organization) %>
<% end %>
</center>
</div>
</div>
<div class="row">
<% if current_user.org_admin or current_user.admin %>
<%= link_to 'Edit Organization Settings', edit_organization_path(@organization) %>
<% end %>
<br>
<hr>
<br>
<div class="col-md-12">
<hr>
<h2>Statistics</h2>
<hr>
</div>
</div>
<div class="row">
<div class="col-md-6">
Expand Down
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">
Expand Down Expand Up @@ -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>
Expand Down
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
Expand Up @@ -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
Expand Down Expand Up @@ -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|
Expand Down

0 comments on commit 8cf1fb3

Please sign in to comment.