Skip to content

Commit

Permalink
Add SystemSetting to enable peer-to-peer matching
Browse files Browse the repository at this point in the history
  • Loading branch information
indiebrain committed Sep 22, 2020
1 parent 14bb726 commit 6538209
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/system_settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def set_primary_organization

def system_setting_params
params.require(:system_setting).permit(
:allow_peer_to_peer_matching,
:allow_sms,
:exchange_type,
:separate_asks_offers,
Expand Down
2 changes: 2 additions & 0 deletions app/models/system_setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def peer_to_peer?
#
# id :bigint not null, primary key
# about_us_text :text
# allow_peer_to_peer_matching :boolean default(FALSE), not null
# allow_sms :boolean default(FALSE), not null
# announcements_module :boolean default(TRUE), not null
# chat_module :boolean default(TRUE), not null
Expand All @@ -69,6 +70,7 @@ def peer_to_peer?
# confirmation_page_text_footer :string
# confirmation_page_text_header :string
# confirmation_page_text_link_header :string
# display_navbar :boolean default(FALSE)
# donations_module :boolean default(TRUE), not null
# exchange_type :string default("peer_to_peer"), not null
# landing_page_text_how :text
Expand Down
1 change: 1 addition & 0 deletions app/views/system_settings/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<div class="form-inputs">
<%= f.input :exchange_type, as: :select, collection: @exchange_types %>
<%= f.input :separate_asks_offers, as: :radio_buttons, label: "Separate ask and offer forms" %>
<%= f.input :allow_peer_to_peer_matching, as: :radio_buttons %>
<%= f.input :allow_sms, as: :radio_buttons %>
<%= f.input :display_navbar, as: :radio_buttons, hint: "Display the navbar on the Community Resources and Annoucements pages" %>
<%= f.input :community_resources_module, as: :radio_buttons %>
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20200922151556_add_peer_to_peer_matching.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPeerToPeerMatching < ActiveRecord::Migration[6.0]
def change
add_column :system_settings, :allow_peer_to_peer_matching, :boolean, null: false, default: false
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.define(version: 2020_09_06_172102) do
ActiveRecord::Schema.define(version: 2020_09_22_151556) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -446,6 +446,7 @@
t.string "confirmation_page_text_link_header"
t.string "confirmation_page_text_footer"
t.boolean "display_navbar", default: false
t.boolean "allow_peer_to_peer_matching", default: false, null: false
end

create_table "taggings", id: :serial, force: :cascade do |t|
Expand Down
2 changes: 2 additions & 0 deletions spec/factories/system_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#
# id :bigint not null, primary key
# about_us_text :text
# allow_peer_to_peer_matching :boolean default(FALSE), not null
# allow_sms :boolean default(FALSE), not null
# announcements_module :boolean default(TRUE), not null
# chat_module :boolean default(TRUE), not null
Expand All @@ -17,6 +18,7 @@
# confirmation_page_text_footer :string
# confirmation_page_text_header :string
# confirmation_page_text_link_header :string
# display_navbar :boolean default(FALSE)
# donations_module :boolean default(TRUE), not null
# exchange_type :string default("peer_to_peer"), not null
# landing_page_text_how :text
Expand Down

0 comments on commit 6538209

Please sign in to comment.