-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Regional Organizations' application form to the website.
- Loading branch information
1 parent
99210a1
commit fb64450
Showing
13 changed files
with
179 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class RegionalOrganizationsMailer < ApplicationMailer | ||
def notify_board_of_new_regional_organization_application(user_who_applied, regional_organization) | ||
I18n.with_locale :en do | ||
@user_who_applied = user_who_applied | ||
@regional_organization = regional_organization | ||
to = ["board@worldcubeassociation.org"] | ||
cc = [@user_who_applied.email, @regional_organization.email] | ||
mail( | ||
to: to, | ||
cc: cc, | ||
subject: "Regional Organization application - #{@regional_organization.name}", | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...ional_organizations_mailer/notify_board_of_new_regional_organization_application.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<h1> | ||
<%= @user_who_applied.name %> has submitted an application for <%= @regional_organization.name %> to be acknowledged as a WCA Regional Organization. | ||
</h1> | ||
<p> | ||
Here's the Regional Organization data: | ||
<ul> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.name' %>:</b> <%= @regional_organization.name %></li> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.country' %>:</b> <%= @regional_organization.country %></li> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.website' %>:</b> <%= link_to "#{@regional_organization.website}", @regional_organization.website %></li> | ||
<% if @regional_organization.logo.attached? %> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.logo' %>:</b></li> | ||
<%= link_to(image_tag(@regional_organization.logo.variant(resize: "200x200")), rails_blob_url(@regional_organization.logo, disposition: "attachment")) %> | ||
<% end %> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.email' %>:</b> <%= mail_to @regional_organization.email, "#{@regional_organization.email}" %></li> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.address' %>:</b> <%= @regional_organization.address %></li> | ||
<% if @regional_organization.bylaws.attached? && @regional_organization.bylaws.previewable? %> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.bylaws' %>:</b></li> | ||
<%= link_to(image_tag(@regional_organization.bylaws.preview(resize: "200x200")), rails_blob_url(@regional_organization.bylaws, disposition: "attachment")) %> | ||
<% end %> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.directors_and_officers' %>:</b> <%= @regional_organization.directors_and_officers %></li> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.area_description' %>:</b> <%= @regional_organization.area_description %></li> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.past_and_current_activities' %>:</b> <%= @regional_organization.past_and_current_activities %></li> | ||
<li><b><%= t 'activerecord.attributes.regional_organization.future_plans' %>:</b> <%= @regional_organization.future_plans %></li> | ||
<% if @regional_organization.extra_information? %> | ||
<li><b>Extra information:</b> <%= @regional_organization.extra_information %></li> | ||
<% end %> | ||
<% if @regional_organization.extra_file.attached? && @regional_organization.extra_file.previewable? %> | ||
<li><b>Extra file:</b></li> | ||
<%= link_to(image_tag(@regional_organization.extra_file.preview(resize: "200x200")), rails_blob_url(@regional_organization.extra_file, disposition: "attachment")) %> | ||
<% end %> | ||
</ul> | ||
</p> | ||
<p> | ||
@Board: You can check all the information and approve or reject the application in the <%= link_to "Edit Regional Organization", edit_regional_organization_url(@regional_organization) %> page. | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
WcaOnRails/db/migrate/20190622173635_allow_null_start_date_for_regional_organizations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
class AllowNullStartDateForRegionalOrganizations < ActiveRecord::Migration[5.2] | ||
def change | ||
change_column_null(:regional_organizations, :start_date, true) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
WcaOnRails/spec/mailers/previews/regional_organizations_mailer_preview.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
# Preview all emails at http://localhost:3000/rails/mailers/regional_organizations_mailer | ||
class RegionalOrganizationsMailerPreview < ActionMailer::Preview | ||
def notify_board_of_new_regional_organization_application | ||
user = User.first | ||
regional_organization = FactoryBot.create(:regional_organization) | ||
RegionalOrganizationsMailer.notify_board_of_new_regional_organization_application(user, regional_organization) | ||
end | ||
end |
24 changes: 24 additions & 0 deletions
24
WcaOnRails/spec/mailers/regional_organizations_mailer_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
RSpec.describe RegionalOrganizationsMailer, type: :mailer do | ||
describe "notify_board_of_new_regional_organization_application" do | ||
let(:user) { FactoryBot.create :user } | ||
let(:regional_organization) { FactoryBot.create :regional_organization } | ||
let(:mail) do | ||
I18n.locale = :es | ||
RegionalOrganizationsMailer.notify_board_of_new_regional_organization_application(user, regional_organization) | ||
end | ||
|
||
it "renders in English" do | ||
expect(mail.to).to eq(["board@worldcubeassociation.org"]) | ||
expect(mail.cc).to eq([user.email, regional_organization.email]) | ||
expect(mail.from).to eq(["notifications@worldcubeassociation.org"]) | ||
|
||
expect(mail.subject).to eq("Regional Organization application - #{regional_organization.name}") | ||
expect(mail.body.encoded).to match("#{user.name} has submitted an application for #{regional_organization.name} to be acknowledged as a WCA Regional Organization.") | ||
expect(mail.body.encoded).to match(edit_regional_organization_url(regional_organization)) | ||
end | ||
end | ||
end |
Oops, something went wrong.