From 2526cac4e40c2be3388b9d1d96506dc21b7e9702 Mon Sep 17 00:00:00 2001 From: Kamil Grabowski Date: Wed, 25 Apr 2018 11:28:55 +0200 Subject: [PATCH 01/81] Change ruby version from 2.3.6 to 2.3.x We should accept all ruby version in branch 2.3.x. --- .ruby-version | 2 +- Gemfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruby-version b/.ruby-version index e75da3e6..bb576dbd 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.6 +2.3 diff --git a/Gemfile b/Gemfile index 88b0285c..327ad5f8 100755 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,6 @@ source 'https://rubygems.org' -ruby '2.3.6' +ruby '~> 2.3.6' gem 'rake' gem 'rails', '3.2.22.5' gem 'rails_12factor' From 2b4ee068323939664a9bfda7de5660d2436a0f52 Mon Sep 17 00:00:00 2001 From: Kamil Grabowski Date: Wed, 25 Apr 2018 11:31:24 +0200 Subject: [PATCH 02/81] Add capistrano --- Capfile | 41 +++++++++++++++++++++++++++++++++++++++++ Gemfile | 2 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Capfile diff --git a/Capfile b/Capfile new file mode 100644 index 00000000..7f4821ba --- /dev/null +++ b/Capfile @@ -0,0 +1,41 @@ +# Load DSL and set up stages +require "capistrano/setup" + +# Include default deployment tasks +require "capistrano/deploy" + +# Load the SCM plugin appropriate to your project: +# +# require "capistrano/scm/hg" +# install_plugin Capistrano::SCM::Hg +# or +# require "capistrano/scm/svn" +# install_plugin Capistrano::SCM::Svn +# or +require "capistrano/scm/git" +install_plugin Capistrano::SCM::Git + +# Include tasks from other gems included in your Gemfile +# +# For documentation on these, see for example: +# +# https://github.com/capistrano/rvm +# https://github.com/capistrano/rbenv +# https://github.com/capistrano/chruby +# https://github.com/capistrano/bundler +# https://github.com/capistrano/rails +# https://github.com/capistrano/passenger +# +# require "capistrano/rvm" +# require "capistrano/rbenv" +# require "capistrano/chruby" +require "capistrano/bundler" +require "capistrano/rails/assets" +require "capistrano/rails/migrations" +# require "capistrano/passenger" + +require 'capistrano/puma' +install_plugin Capistrano::Puma + +# Load custom tasks from `lib/capistrano/tasks` if you have any defined +Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } diff --git a/Gemfile b/Gemfile index 327ad5f8..ed134f19 100755 --- a/Gemfile +++ b/Gemfile @@ -27,7 +27,7 @@ gem 'hamster' gem 'aws-ses' gem 'aws-sdk' - + # for blocking ip addressses gem 'rack-attack' From 9f4a808c205a2b0ef3717f83ca8b9cbf5d6149c1 Mon Sep 17 00:00:00 2001 From: Kamil Grabowski Date: Thu, 26 Apr 2018 11:18:26 +0200 Subject: [PATCH 03/81] Add npm support to capistrano configuration --- Capfile | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 Capfile diff --git a/Capfile b/Capfile deleted file mode 100644 index 7f4821ba..00000000 --- a/Capfile +++ /dev/null @@ -1,41 +0,0 @@ -# Load DSL and set up stages -require "capistrano/setup" - -# Include default deployment tasks -require "capistrano/deploy" - -# Load the SCM plugin appropriate to your project: -# -# require "capistrano/scm/hg" -# install_plugin Capistrano::SCM::Hg -# or -# require "capistrano/scm/svn" -# install_plugin Capistrano::SCM::Svn -# or -require "capistrano/scm/git" -install_plugin Capistrano::SCM::Git - -# Include tasks from other gems included in your Gemfile -# -# For documentation on these, see for example: -# -# https://github.com/capistrano/rvm -# https://github.com/capistrano/rbenv -# https://github.com/capistrano/chruby -# https://github.com/capistrano/bundler -# https://github.com/capistrano/rails -# https://github.com/capistrano/passenger -# -# require "capistrano/rvm" -# require "capistrano/rbenv" -# require "capistrano/chruby" -require "capistrano/bundler" -require "capistrano/rails/assets" -require "capistrano/rails/migrations" -# require "capistrano/passenger" - -require 'capistrano/puma' -install_plugin Capistrano::Puma - -# Load custom tasks from `lib/capistrano/tasks` if you have any defined -Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } From b99f7959ce545af0d94225e9702d99eec3878fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 11 Apr 2018 22:36:23 +0200 Subject: [PATCH 04/81] Add CampaignTemplate Read S3 bucket name and AWS region from env Add /postgres-data to .gitignore Custom campaign layout Adjust custom layout wip fix wizard init on campaign page wip adjust design adjust campaigner profile section wider banner, fix button colours Fix custom layout Add custom_layout to nonprofit and render, if exists Fallback profile picture wip --- .gitignore | 3 +- .../safety_around_water.css.scss | 78 ++++++++ app/controllers/campaigns_controller.rb | 8 +- app/models/campaign.rb | 4 + app/models/campaign_template.rb | 24 +++ .../campaign_custom_banner_uploader.rb | 39 ++++ app/views/campaigns/_settings_modal.html.erb | 17 +- app/views/campaigns/show.html.erb | 3 +- .../safety_around_water.html.erb | 169 ++++++++++++++++++ client/js/nonprofits/donate/wizard.js | 27 +-- config/routes.rb | 3 + config/settings.yml | 2 +- .../201810202124316_add_campaign_templates.rb | 22 +++ ...02124317_add_custom_layout_to_nonprofit.rb | 5 + .../201810202124318_add_banner_to_campaign.rb | 5 + db/structure.sql | 70 +++++++- 16 files changed, 458 insertions(+), 21 deletions(-) create mode 100644 app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss create mode 100644 app/models/campaign_template.rb create mode 100644 app/uploaders/campaign_custom_banner_uploader.rb create mode 100644 app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb create mode 100644 db/migrate/201810202124316_add_campaign_templates.rb create mode 100644 db/migrate/201810202124317_add_custom_layout_to_nonprofit.rb create mode 100644 db/migrate/201810202124318_add_banner_to_campaign.rb diff --git a/.gitignore b/.gitignore index 75fe283a..2a4f41ce 100755 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ client/js/nonprofits/donate/plugins-enabled .DS_Store +/postgres-data # Ignore bundler config /.bundle @@ -62,4 +63,4 @@ javascripts/api !public/css/donate-button.css !public/css/donate-button.v2.css !public/svgs -!public/svgs/* \ No newline at end of file +!public/svgs/* diff --git a/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss b/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss new file mode 100644 index 00000000..0be0266f --- /dev/null +++ b/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss @@ -0,0 +1,78 @@ +@import 'mixins'; +@import 'common/fundraisers'; + +button, a.js-contributeButton { + background: #01a490 !important; +} + +main a.button { + background: #0089d0 !important; + color: white; +} + +main .button.edit, main .button--tiny.edit { + color: white; +} + +main { + width: 1200px; + margin: auto; +} + +main > header { + display: flex; + justify-content: center; + align-items: center; + margin: auto; +} + +body > .ymca-banner { + margin: auto; + width: 100vw; + height: 120px; + background-color: #01a490; +} + +main > header div.fundraisingHeader--image-container { + background-position: 0 -80px; +} + +img.fundraisingHeader--image-aspectRatio { + width: 1200px; + height: 500px; +} + +main > .container { + max-width: none; + margin-top: 15px; +} + +.campaigner-profile { + display: flex; + flex-wrap: nowrap; + align-items: baseline; +} + +.campaigner-profile > figure { + display: flex; + flex-direction: column; + align-items: center; + margin-right: 20px; + align-self: flex-start; +} + +.campaigner-profile > figure > .avatar { + flex-basis: 20%; +} + +.avatar > img { + width: 150px; + height: 150px; + clip-path: circle(50% at center); +} + +.campaigner-profile > figure > figcaption { + flex-basis: 55%; + padding: 15px; + text-align: left; +} diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index 21c57919..121e40c8 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -38,8 +38,12 @@ class CampaignsController < ApplicationController @campaign_background_image = FetchBackgroundImage.with_model(@campaign) - respond_to do |format| - format.html + if @nonprofit.custom_layout.blank? + respond_to do |format| + format.html + end + else + render template: "nonprofits/custom_campaign_layouts/" + @nonprofit.custom_layout end end diff --git a/app/models/campaign.rb b/app/models/campaign.rb index f19278a4..fbc09bb5 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -13,6 +13,8 @@ class Campaign < ActiveRecord::Base :remove_main_image, # for carrierwave :background_image, :remove_background_image, #bool carrierwave + :custom_banner, + :remove_custom_banner, :published, :video_url, #str :vimeo_video_id, @@ -47,6 +49,7 @@ class Campaign < ActiveRecord::Base mount_uploader :main_image, CampaignMainImageUploader mount_uploader :background_image, CampaignBackgroundImageUploader + mount_uploader :custom_banner, CampaignCustomBannerUploader has_many :donations has_many :charges, through: :donations @@ -60,6 +63,7 @@ class Campaign < ActiveRecord::Base has_many :activities, as: :host, dependent: :destroy belongs_to :profile belongs_to :nonprofit + belongs_to :campaign_template scope :published, -> {where(:published => true)} scope :active, -> {where(:published => true).where("end_datetime IS NULL OR end_datetime >= ?", Date.today)} diff --git a/app/models/campaign_template.rb b/app/models/campaign_template.rb new file mode 100644 index 00000000..fcfe7d63 --- /dev/null +++ b/app/models/campaign_template.rb @@ -0,0 +1,24 @@ +class CampaignTemplate < ActiveRecord::Base + # these are very arbitrary names – some are attrs of campaign, some are not + # might be a good idea to get the default list from settings + CUSTOMIZABLE_ATTR = %i(goal_amount_dollars campaigner_photo reason_for_supporting) + + attr_accessible \ + :template_name, + :name, # refers to campaign name + :tagline, + :goal_amount, + :main_image, + :remove_main_image, # for carrierwave + :video_url, + :vimeo_video_id, + :youtube_video_id, + :summary, + :body + + has_many :campaigns + + def customizable_attribute?(attribute_name) + CUSTOMIZABLE_ATTR.include? attribute_name.to_sym + end +end diff --git a/app/uploaders/campaign_custom_banner_uploader.rb b/app/uploaders/campaign_custom_banner_uploader.rb new file mode 100644 index 00000000..bfc2d652 --- /dev/null +++ b/app/uploaders/campaign_custom_banner_uploader.rb @@ -0,0 +1,39 @@ +class CampaignCustomBannerUploader < CarrierWave::Uploader::Base + + # Include RMagick or MiniMagick support: + # include CarrierWave::RMagick + include CarrierWave::MiniMagick + + # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility: + # include Sprockets::Helpers::RailsHelper + # include Sprockets::Helpers::IsolatedHelper + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "uploads/campaigns/#{mounted_as}/#{model.id}" + end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + def extension_white_list + %w(jpg jpeg png) + end + + # Override the filename of the uploaded files: + # Avoid using model.id or version_name here, see uploader/store.rb for details. + # def filename + # "something.jpg" if original_filename + # end + + def cache_dir + "#{Rails.root}/tmp/uploads" + end +end diff --git a/app/views/campaigns/_settings_modal.html.erb b/app/views/campaigns/_settings_modal.html.erb index 51838193..199fb825 100644 --- a/app/views/campaigns/_settings_modal.html.erb +++ b/app/views/campaigns/_settings_modal.html.erb @@ -92,6 +92,21 @@ + <% if @nonprofit.custom_layout %> +
+ +
+
+ +

Custom image at the very top of the campaign page

+
+ Edit + +
+
+
+ <% end %> +
@@ -141,7 +156,7 @@ <% end %>
- + > diff --git a/app/views/campaigns/show.html.erb b/app/views/campaigns/show.html.erb index 0fb8f954..6218ffa3 100644 --- a/app/views/campaigns/show.html.erb +++ b/app/views/campaigns/show.html.erb @@ -84,7 +84,7 @@ Manage Gift Options <% end %> - +
@@ -141,4 +141,3 @@ <%= render 'components/share_modal', name: @campaign.name, type: 'campaign' %> <%= render 'common/email_share_modal', fundraiser: @campaign.name, fundraiser_url: @url %> - diff --git a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb new file mode 100644 index 00000000..078fc99f --- /dev/null +++ b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb @@ -0,0 +1,169 @@ +<%= content_for(:title_prefix) { "#{@campaign.name} - #{@campaign.nonprofit.name} | ".html_safe } %> +<% content_for(:fixed_position_cta_hidden) {'hidden'} %> +<%= content_for(:meta_description) {raw @campaign.summary} %> +<% @brand_color = @nonprofit.brand_color ? @nonprofit.brand_color : nil %> + +<%= content_for :javascripts do %> + + <%= render 'schema', campaign: @campaign, url: @url %> + <%= render 'common/froala' if current_campaign_editor? %> + + <%= IncludeAsset.js '/client/js/campaigns/show/page.js' %> +<% end %> + +<%= content_for :stylesheets do %> + <%= stylesheet_link_tag 'campaigns/show/page' %> + <%= stylesheet_link_tag 'campaigns/edit/page' %> + <%= stylesheet_link_tag 'campaigns/custom_layout/safety_around_water' %> + +<% end %> + +<% content_for :head do %> + +<% end %> + +<%= content_for :facebook_tags do %> + + + +<% end %> + +<%= content_for :twitter_tags do %> + + + +<% end %> + +<% if current_campaign_editor? %> + <%= render 'admin_top_nav' %> +<% end %> + +<%= render '/components/trial_bar' if QueryBillingSubscriptions.currently_in_trial?(@nonprofit.id) %> + +<% hide_title = @campaign.hide_title && @campaign_background_image ? true : false %> +<% css_style = current_campaign_editor? ? "style='margin-top: 0'" : '' %> + +
+ +
+ + <%= render 'components/fundraising_pages/header', + image_url: @campaign_background_image, + is_editor: current_campaign_editor?, + hide_title: @campaign.hide_title && @campaign_background_image, + header_content_partial: 'header_content' %> + + <%= render 'components/preview_mode_notification' %> + +
+
+ <%= render 'campaign_media' %> +
+ +
+ + <% if current_campaign_editor? %> + + + <% end %> + + +
+ + + +
+ +
+ +
+
+
+ /> +
+
+

<%= @campaign.profile.name %>

+

<%= @campaign.profile.city %>

+
+
+ +
+
I am supporting the Y because…
+
+ (customizable reason) +
+ + <% unless current_campaign_editor? %> + + Start Your Own Campaign for <%= @nonprofit.name %> + + <% end %> +
+
+
+ +
+

<%= @campaign.name %>

+ +
+ <%= raw @campaign.body %> +
+ + <% unless @campaign.hide_activity_feed %> +
+ <%= render 'components/activity_feed' %> +
+ <% end %> +
+
+
+ +<% if current_campaign_editor? %> + <%= render 'settings_modal' %> + <%= render 'video_modal' %> + <%= render 'donations/campaign_new_offline_modal' %> + <%= render 'campaign_gift_options/manage_modal'%> + <%= render 'campaign_gift_options/form_modal'%> + <%= render 'components/upload_background_image', + end_point: "/nonprofits/#{@nonprofit.id}/campaigns/#{@campaign.id}", + image_url: @campaign_background_image, + input_name: 'campaign[background_image]' %> + <%= render 'components/custom_receipt_modal', + title: 'Campaign Receipt Message', + type: 'campaign', + path: nonprofit_campaign_path(@nonprofit, @campaign), + key: 'campaign[receipt_message]', + text: @campaign.receipt_message %> + <%= render 'components/duplicate_fundraiser_modal', type: 'campaign' %> +<% end %> + +<%= render 'components/share_modal', name: @campaign.name, type: 'campaign' %> +<%= render 'common/email_share_modal', fundraiser: @campaign.name, fundraiser_url: @url %> diff --git a/client/js/nonprofits/donate/wizard.js b/client/js/nonprofits/donate/wizard.js index 1d4a547f..59c945bd 100644 --- a/client/js/nonprofits/donate/wizard.js +++ b/client/js/nonprofits/donate/wizard.js @@ -27,6 +27,7 @@ renderStyles()(brandedWizard(null)) // pass in a stream of configuration parameters const init = params$ => { + console.log(params$()) var state = { error$: flyd.stream() , loading$: flyd.stream() @@ -99,10 +100,10 @@ const init = params$ => { (ev, params) => { if(!parent) return if(params.redirect) parent.postMessage(`commitchange:redirect:${params.redirect}`, '*') - else if(params.mode !== 'embedded'){ + else if(params.mode !== 'embedded'){ parent.postMessage('commitchange:close', '*'); } else { - if (window.parent) {window.parent.postMessage('commitchange:close', '*');}; + if (window.parent) {window.parent.postMessage('commitchange:close', '*');}; } } , state.clickFinish$, state.params$ ) @@ -193,16 +194,18 @@ const headerDesignation = state => { } const wizardWrapper = state => { - return h('div.wizard-steps.donation-steps', [ - wizard.view(R.merge(state.wizard, { - steps: [ - {name: I18n.t('nonprofits.donate.amount.label'), body: amountStep.view(state.amountStep)} - , {name: I18n.t('nonprofits.donate.info.label'), body: infoStep.view(state.infoStep)} - , {name: I18n.t('nonprofits.donate.payment.label'), body: paymentStep.view(state.paymentStep)} - ] - , followup: followupStep.view(state) - })) - ]) + // return h('div.wizard-steps.donation-steps', [ + // wizard.view(R.merge(state.wizard, { + // steps: [ + // {name: I18n.t('nonprofits.donate.amount.label'), body: amountStep.view(state.amountStep)} + // , {name: I18n.t('nonprofits.donate.info.label'), body: infoStep.view(state.infoStep)} + // , {name: I18n.t('nonprofits.donate.payment.label'), body: paymentStep.view(state.paymentStep)} + // ] + // , followup: followupStep.view(state) + // })) + // ]) + + return h('div.wizard-steps.donation-steps', 'Donation widget should be here.') } module.exports = {view, init} diff --git a/config/routes.rb b/config/routes.rb index a9520158..39f0f3e5 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -147,6 +147,8 @@ Commitchange::Application.routes.draw do resources(:campaign_gift_options, {only: [:index, :show, :create, :update, :destroy]}) do put(:update_order, {on: :collection}) end + + get 'custom_layout', controller: 'campaigns', action: 'custom_layout' end resource(:billing_subscription, {only: [:create]}) do @@ -224,6 +226,7 @@ Commitchange::Application.routes.draw do # Campaigns match ':state_code/:city/:name/campaigns' => 'campaigns#index' match ':state_code/:city/:name/campaigns/:campaign_slug' => 'campaigns#show', :as => :campaign_loc + match ':state_code/:city/:name/campaigns/:campaign_slug/custom_layout' => 'campaigns#custom_layout', :as => :campaign_loc match ':state_code/:city/:name/campaigns/:campaign_slug/supporters' => 'campaigns/supporters#index', :as => :campaign_loc match '/peer-to-peer' => 'campaigns#peer_to_peer' diff --git a/config/settings.yml b/config/settings.yml index c465193b..f657c967 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -20,7 +20,7 @@ default: aws: access_key_id: <%= ENV['AWS_ACCESS_KEY'] %> secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> - region: test + region: <%= ENV['AWS_REGION'] %> bucket: <%= ENV['S3_BUCKET_NAME'] %> mailer: diff --git a/db/migrate/201810202124316_add_campaign_templates.rb b/db/migrate/201810202124316_add_campaign_templates.rb new file mode 100644 index 00000000..062f37b2 --- /dev/null +++ b/db/migrate/201810202124316_add_campaign_templates.rb @@ -0,0 +1,22 @@ +class AddCampaignTemplates < ActiveRecord::Migration + def change + create_table :campaign_templates do |t| + t.string :template_name, null: false + t.string :name + t.string :tagline + t.integer :goal_amount + t.string :main_image + t.text :video_url + t.string :vimeo_video_id + t.string :youtube_video_id + t.text :summary + t.text :body + + t.timestamps + end + + change_table :campaigns do |t| + t.references :campaign_template + end + end +end diff --git a/db/migrate/201810202124317_add_custom_layout_to_nonprofit.rb b/db/migrate/201810202124317_add_custom_layout_to_nonprofit.rb new file mode 100644 index 00000000..db58866a --- /dev/null +++ b/db/migrate/201810202124317_add_custom_layout_to_nonprofit.rb @@ -0,0 +1,5 @@ +class AddCustomLayoutToNonprofit < ActiveRecord::Migration + def change + add_column :nonprofits, :custom_layout, :string + end +end diff --git a/db/migrate/201810202124318_add_banner_to_campaign.rb b/db/migrate/201810202124318_add_banner_to_campaign.rb new file mode 100644 index 00000000..c1fe6406 --- /dev/null +++ b/db/migrate/201810202124318_add_banner_to_campaign.rb @@ -0,0 +1,5 @@ +class AddBannerToCampaign < ActiveRecord::Migration + def change + add_column :campaigns, :custom_banner, :string + end +end diff --git a/db/structure.sql b/db/structure.sql index 0844371c..b146ebc2 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2,8 +2,13 @@ -- PostgreSQL database dump -- +<<<<<<< HEAD -- Dumped from database version 9.6.5 -- Dumped by pg_dump version 9.6.10 +======= +-- Dumped from database version 9.6.8 +-- Dumped by pg_dump version 9.6.8 +>>>>>>> Add CampaignTemplate SET statement_timeout = 0; SET lock_timeout = 0; @@ -355,6 +360,46 @@ CREATE SEQUENCE public.campaign_gifts_id_seq ALTER SEQUENCE public.campaign_gifts_id_seq OWNED BY public.campaign_gifts.id; +-- +-- Name: campaign_templates; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.campaign_templates ( + id integer NOT NULL, + template_name character varying(255) NOT NULL, + name character varying(255), + tagline character varying(255), + goal_amount integer, + main_image character varying(255), + video_url text, + vimeo_video_id character varying(255), + youtube_video_id character varying(255), + summary text, + body text, + created_at timestamp without time zone NOT NULL, + updated_at timestamp without time zone NOT NULL +); + + +-- +-- Name: campaign_templates_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.campaign_templates_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: campaign_templates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.campaign_templates_id_seq OWNED BY public.campaign_templates.id; + + -- -- Name: campaigns; Type: TABLE; Schema: public; Owner: - -- @@ -392,7 +437,8 @@ CREATE TABLE public.campaigns ( hide_custom_amounts boolean, show_recurring_amount boolean DEFAULT false, end_datetime timestamp without time zone, - external_identifier character varying(255) + external_identifier character varying(255), + campaign_template_id integer ); @@ -1412,7 +1458,8 @@ CREATE TABLE public.nonprofits ( card_failure_message_bottom text, fields_needed text, autocomplete_supporter_address boolean DEFAULT false, - currency character varying(255) DEFAULT 'usd'::character varying + currency character varying(255) DEFAULT 'usd'::character varying, + custom_layout character varying(255) ); @@ -2305,6 +2352,13 @@ ALTER TABLE ONLY public.campaign_gift_options ALTER COLUMN id SET DEFAULT nextva ALTER TABLE ONLY public.campaign_gifts ALTER COLUMN id SET DEFAULT nextval('public.campaign_gifts_id_seq'::regclass); +-- +-- Name: campaign_templates id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.campaign_templates ALTER COLUMN id SET DEFAULT nextval('public.campaign_templates_id_seq'::regclass); + + -- -- Name: campaigns id; Type: DEFAULT; Schema: public; Owner: - -- @@ -2690,6 +2744,14 @@ ALTER TABLE ONLY public.campaign_gifts ADD CONSTRAINT campaign_gifts_pkey PRIMARY KEY (id); +-- +-- Name: campaign_templates campaign_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.campaign_templates + ADD CONSTRAINT campaign_templates_pkey PRIMARY KEY (id); + + -- -- Name: campaigns campaigns_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -4347,3 +4409,7 @@ INSERT INTO schema_migrations (version) VALUES ('20181002160627'); INSERT INTO schema_migrations (version) VALUES ('20181003212559'); +INSERT INTO schema_migrations (version) VALUES ('201810202124316'); + +INSERT INTO schema_migrations (version) VALUES ('201810202124317'); + From 399f6ff0c61cb5895f86c64d10fb7decf2918a9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 16 May 2018 21:25:16 +0200 Subject: [PATCH 05/81] Merge branch 'p2p-campaigns' into h-custom-layout --- .../stylesheets/campaign_templates.css.scss | 1 + .../safety_around_water.css.scss | 2 +- .../campaigns/peer_to_peer/page.css.scss | 8 ++ app/controllers/campaigns_controller.rb | 63 +++++++++- .../campaign_templates_controller.rb | 18 +++ app/models/campaign.rb | 25 +++- .../_new_peer_to_peer_modal.html.erb | 84 +++++++++++++ app/views/campaigns/index.html.erb | 4 + app/views/campaigns/peer_to_peer.html.erb | 61 +++++++--- .../campaign_templates/_new_modal.html.erb | 115 ++++++++++++++++++ .../campaign_templates/index.html.erb | 64 ++++++++++ .../safety_around_water.html.erb | 60 +++++++++ client/js/campaign_templates/index/page.js | 2 + client/js/campaign_templates/new/wizard.js | 50 ++++++++ .../js/campaigns/new/peer_to_peer_wizard.js | 40 ++++++ client/js/campaigns/new/wizard.js | 2 + client/js/campaigns/peer_to_peer/page.js | 5 + config/routes.rb | 2 + ...317_add_parent_campaign_id_to_campaigns.rb | 5 + ..._add_reason_for_supporting_to_campaigns.rb | 5 + db/structure.sql | 11 ++ .../campaign_templates_controller_spec.rb | 12 ++ .../helpers/campaign_templates_helper_spec.rb | 15 +++ .../campaign_templates/index.html.erb_spec.rb | 5 + 24 files changed, 639 insertions(+), 20 deletions(-) create mode 100644 app/assets/stylesheets/campaign_templates.css.scss create mode 100644 app/controllers/nonprofits/campaign_templates_controller.rb create mode 100644 app/views/campaigns/_new_peer_to_peer_modal.html.erb create mode 100644 app/views/nonprofits/campaign_templates/_new_modal.html.erb create mode 100644 app/views/nonprofits/campaign_templates/index.html.erb create mode 100644 client/js/campaign_templates/index/page.js create mode 100644 client/js/campaign_templates/new/wizard.js create mode 100644 client/js/campaigns/new/peer_to_peer_wizard.js create mode 100644 db/migrate/201810202124317_add_parent_campaign_id_to_campaigns.rb create mode 100644 db/migrate/201810202124318_add_reason_for_supporting_to_campaigns.rb create mode 100644 spec/controllers/campaign_templates_controller_spec.rb create mode 100644 spec/helpers/campaign_templates_helper_spec.rb create mode 100644 spec/views/campaign_templates/index.html.erb_spec.rb diff --git a/app/assets/stylesheets/campaign_templates.css.scss b/app/assets/stylesheets/campaign_templates.css.scss new file mode 100644 index 00000000..a4fd6cfc --- /dev/null +++ b/app/assets/stylesheets/campaign_templates.css.scss @@ -0,0 +1 @@ +@import 'common/fundraisers'; diff --git a/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss b/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss index 0be0266f..c6d8efe4 100644 --- a/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss +++ b/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss @@ -1,7 +1,7 @@ @import 'mixins'; @import 'common/fundraisers'; -button, a.js-contributeButton { +main button, main a.js-contributeButton { background: #01a490 !important; } diff --git a/app/assets/stylesheets/campaigns/peer_to_peer/page.css.scss b/app/assets/stylesheets/campaigns/peer_to_peer/page.css.scss index 76fb21a7..bab7abff 100644 --- a/app/assets/stylesheets/campaigns/peer_to_peer/page.css.scss +++ b/app/assets/stylesheets/campaigns/peer_to_peer/page.css.scss @@ -11,6 +11,14 @@ body { padding: 0; background: $fog; } + +body > .ymca-banner { + margin: auto; + width: 100vw; + height: 120px; + background-color: #01a490; +} + main { display: block; padding: 60px 0 50px 0; diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index 121e40c8..00fa75c3 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -36,6 +36,13 @@ class CampaignsController < ApplicationController @nonprofit = current_nonprofit @url = Format::Url.concat(root_url, @campaign.url) + if @campaign.parent_campaign + @parent_campaign = @campaign.parent_campaign + @peer_to_peer_campaign_param = @parent_campaign.id + else + @peer_to_peer_campaign_param = @campaign.id + end + @campaign_background_image = FetchBackgroundImage.with_model(@campaign) if @nonprofit.custom_layout.blank? @@ -55,7 +62,15 @@ class CampaignsController < ApplicationController Time.use_zone(current_nonprofit.timezone || 'UTC') do params[:campaign][:end_datetime] = Chronic.parse(params[:campaign][:end_datetime]) if params[:campaign][:end_datetime].present? end - campaign = current_nonprofit.campaigns.create params[:campaign] + + if !params[:campaign][:parent_campaign_id] + campaign = current_nonprofit.campaigns.create params[:campaign] + else + profile_id = params[:campaign][:profile_id] + Profile.find(profile_id).update_attributes params[:profile] + campaign = create_peer_to_peer_campaign params[:campaign], profile_id + end + json_saved campaign, 'Campaign created! Well done.' end @@ -103,6 +118,31 @@ class CampaignsController < ApplicationController def peer_to_peer session[:donor_signup_url] = request.env["REQUEST_URI"] @npo = Nonprofit.find_by_id(params[:npo_id]) + @campaign = Campaign.find_by_id(params[:campaign_id]) + @profile = current_user.profile if current_user + end + + def custom_layout + @campaign = current_campaign + @timezone = Format::Timezone.to_proxy(current_nonprofit.timezone) + if @campaign.deleted && !current_campaign_editor? + redirect_to nonprofit_path(current_nonprofit) + flash[:notice] = "Sorry, we couldn't find that campaign" + return + end + @nonprofit = current_nonprofit + @url = Format::Url.concat(root_url, @campaign.url) + + if @campaign.parent_campaign + @parent_campaign = @campaign.parent_campaign + @peer_to_peer_campaign_param = @parent_campaign.id + else + @peer_to_peer_campaign_param = @campaign.id + end + + @campaign_background_image = FetchBackgroundImage.with_model(@campaign) + + render template: "nonprofits/custom_campaign_layouts/safety_around_water" end private @@ -113,4 +153,25 @@ class CampaignsController < ApplicationController end end + # TODO: refactor + def create_peer_to_peer_campaign(params, profile_id) + parent_campaign = Campaign.find(params[:parent_campaign_id]) + profile = Profile.find(profile_id) + + p2p_params = params.except(:nonprofit_id, :summary,:goal_amount) + p2p_params.merge!(parent_campaign.child_params) + p2p_params[:slug] = Format::Url.convert_to_slug "#{p2p_params[:name]}-#{profile.name}" + + campaign = Campaign.create(p2p_params) + + return campaign unless campaign.errors.empty? + + gift_option_params = [] + parent_campaign.campaign_gift_options.each do |option| + excluded_for_peer_to_peer = %w(id campaign_id created_at updated_at) + campaign.campaign_gift_options.create option.attributes.except(*excluded_for_peer_to_peer) + end + + campaign + end end diff --git a/app/controllers/nonprofits/campaign_templates_controller.rb b/app/controllers/nonprofits/campaign_templates_controller.rb new file mode 100644 index 00000000..72d4ba64 --- /dev/null +++ b/app/controllers/nonprofits/campaign_templates_controller.rb @@ -0,0 +1,18 @@ +module Nonprofits + class CampaignTemplatesController < ApplicationController + include NonprofitHelper + + before_filter :authenticate_nonprofit_admin!, only: :create + before_filter :authenticate_nonprofit_user!, only: [:index, :show] + + def index + @templates = CampaignTemplate.all + end + + def create + puts params + + render :status_ok + end + end +end diff --git a/app/models/campaign.rb b/app/models/campaign.rb index fbc09bb5..a8d4b241 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -32,7 +32,9 @@ class Campaign < ActiveRecord::Base :hide_thermometer, #bool :hide_title, # bool :receipt_message, # text - :hide_custom_amounts # boolean + :hide_custom_amounts, # boolean + :parent_campaign_id, + :reason_for_supporting validate :end_datetime_cannot_be_in_past, :on => :create validates :profile, :presence => true @@ -65,6 +67,9 @@ class Campaign < ActiveRecord::Base belongs_to :nonprofit belongs_to :campaign_template + belongs_to :parent_campaign, class_name: 'Campaign' + has_many :children_campaigns, class_name: 'Campaign', foreign_key: 'parent_campaign_id' + scope :published, -> {where(:published => true)} scope :active, -> {where(:published => true).where("end_datetime IS NULL OR end_datetime >= ?", Date.today)} scope :past, -> {where(:published => true).where("end_datetime < ?", Date.today)} @@ -159,4 +164,22 @@ class Campaign < ActiveRecord::Base (self.end_datetime.to_date - Date.today).to_i end + def self.create_from_template(template_id) + # building params handled by another object + # not sure this method is needed eventually + end + + def customizable_attributes_list + campaign_template.customizable_attributes_list if campaign_template + end + + def child_params + excluded_for_peer_to_peer = %w( + id created_at updated_at slug profile_id campaign_template_id url + total_raised show_recurring_amount external_identifier parent_campaign_id + reason_for_supporting + ) + excluded_for_peer_to_peer.push(customizable_attributes_list) + attributes.except(*excluded_for_peer_to_peer) + end end diff --git a/app/views/campaigns/_new_peer_to_peer_modal.html.erb b/app/views/campaigns/_new_peer_to_peer_modal.html.erb new file mode 100644 index 00000000..7d32811d --- /dev/null +++ b/app/views/campaigns/_new_peer_to_peer_modal.html.erb @@ -0,0 +1,84 @@ + + + + + + diff --git a/app/views/campaigns/index.html.erb b/app/views/campaigns/index.html.erb index 87a824f3..5a3be09b 100644 --- a/app/views/campaigns/index.html.erb +++ b/app/views/campaigns/index.html.erb @@ -25,6 +25,10 @@ has_mosaic: true %> New Campaign <% end %> + + Campaign templates + + <% if @active_campaigns.empty? %>

No active campaigns

<% else %> diff --git a/app/views/campaigns/peer_to_peer.html.erb b/app/views/campaigns/peer_to_peer.html.erb index 5cbdfa6c..7aa041db 100644 --- a/app/views/campaigns/peer_to_peer.html.erb +++ b/app/views/campaigns/peer_to_peer.html.erb @@ -11,8 +11,20 @@ <% content_for :javascripts do %> + <%= IncludeAsset.js '/client/js/campaigns/index/page.js' %> +<% end %> + + +<%= render 'components/header', + icon_class: 'icon-thermometer-medium', + title: 'Campaign Templates', + profile: @nonprofit, + has_mosaic: true +%> + +
+ <% if current_user %> + New Template + <% end %> + + <% if @templates.empty? %> +

No templates yet

+ <% else %> +
+ + + + <% @templates.each do |template|%> + + + + + <% end %> +
+ + +
+ <%= template.template_name %> +
+

+ Campaign title: <%= template.name %> +

+ +

+ Campaign summary:<%= template.summary ? strip_tags(template.summary) : strip_tags(template.tagline) %> +

+ +

+ Customizable attributes: <%= template.customizable_attributes_list %> +

+
+ +
+ <% end %> +
+ +<% if current_user %> + <%= render 'nonprofits/campaign_templates/new_modal' %> +<% end %> diff --git a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb index 078fc99f..3920dc02 100644 --- a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb +++ b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb @@ -90,6 +90,20 @@ <% end %> +<<<<<<< HEAD +======= +<<<<<<< HEAD + <% if !@campaign.parent_campaign %> + + <% end %> + +======= +>>>>>>> custom-layout +>>>>>>> p2p-campaigns
@@ -102,6 +116,41 @@
+<<<<<<< HEAD +======= +<<<<<<< HEAD + <% if @campaign.parent_campaign %> +
+ +
+
+
+ /> +
+
+

<%= @campaign.profile.name %>

+

<%= @campaign.profile.city %>

+ <% if @campaign.profile.state_code && @campaign.profile.city %> +

<%= @campaign.profile.city_state %> <%= @campaign.profile.state_code %>

+ <% end %> +
+
+ +
+
I am supporting the Y because…
+
+ <%= @campaign.reason_for_supporting %> +
+ + + Start Your Own Campaign for <%= @nonprofit.name %> + +
+
+
+ <% end %> +======= +>>>>>>> p2p-campaigns
@@ -121,6 +170,7 @@ (customizable reason) +<<<<<<< HEAD <% unless current_campaign_editor? %> Start Your Own Campaign for <%= @nonprofit.name %> @@ -129,6 +179,16 @@
+======= + + + Start Your Own Campaign for <%= @nonprofit.name %> + + + + +>>>>>>> custom-layout +>>>>>>> p2p-campaigns

<%= @campaign.name %>

diff --git a/client/js/campaign_templates/index/page.js b/client/js/campaign_templates/index/page.js new file mode 100644 index 00000000..6c565463 --- /dev/null +++ b/client/js/campaign_templates/index/page.js @@ -0,0 +1,2 @@ +if(app.user) + require('../new/wizard') diff --git a/client/js/campaign_templates/new/wizard.js b/client/js/campaign_templates/new/wizard.js new file mode 100644 index 00000000..172a4a6a --- /dev/null +++ b/client/js/campaign_templates/new/wizard.js @@ -0,0 +1,50 @@ +require('../../common/pikaday-timepicker') +require('../../components/wizard') +require('../../common/image_uploader') +var checkName = require('../../common/ajax/check_campaign_or_event_name') +var format_err = require('../../common/format_response_error') + +appl.def('advance_campaign_template_name_step', function(form_obj) { + appl.def('new_campaign_template', form_obj) + appl.wizard.advance('new_campaign_template_wiz') +}) + +// Post a new campaign template +appl.def('create_campaign_template', function(el) { + var form_data = utils.toFormData(appl.prev_elem(el)) + form_data = utils.mergeFormData(form_data, appl.new_campaign_template) + appl.def('new_campaign_template_wiz.loading', true) + + post_campaign_template(form_data) + .then(function(req) { + appl.notify("Redirecting to your campaign template...") + appl.redirect(JSON.parse(req.response).url) + }) + .catch(function(req) { + appl.def('new_campaign_template_wiz.loading', false) + appl.def('new_campaign_template_wiz.error', req.responseText) + }) +}) + + +var Pikaday = require('pikaday') +var moment = require('moment') +new Pikaday({ + field: document.querySelector('.js-date-picker'), + format: 'M/D/YYYY', + minDate: moment().toDate() +}) + +// Using the bare-bones XMLHttpRequest API so we can post form data and upload the image +function post_campaign_template(form_data) { + return new Promise(function(resolve, reject) { + var req = new XMLHttpRequest() + req.open("POST", '/nonprofits/' + app.nonprofit_id + '/campaign_templates') + req.setRequestHeader('X-CSRF-Token', window._csrf) + req.send(form_data) + req.onload = function(ev) { + if(req.status === 200) resolve(req) + else reject(req) + } + }) +} diff --git a/client/js/campaigns/new/peer_to_peer_wizard.js b/client/js/campaigns/new/peer_to_peer_wizard.js new file mode 100644 index 00000000..5070c5c2 --- /dev/null +++ b/client/js/campaigns/new/peer_to_peer_wizard.js @@ -0,0 +1,40 @@ +require('../../components/wizard') +var format_err = require('../../common/format_response_error') + +appl.def('advance_p2p_campaign_name_step', function(form_obj) { + var name = form_obj['campaign[name]'] + appl.def('new_p2p_campaign', form_obj) + appl.wizard.advance('new_p2p_campaign_wiz') +}) + +// Post a new campaign. +appl.def('create_p2p_campaign', function(el) { + var form_data = utils.toFormData(appl.prev_elem(el)) + form_data = utils.mergeFormData(form_data, appl.new_p2p_campaign) + appl.def('new_p2p_campaign_wiz.loading', true) + + post_campaign(form_data) + .then(function(req) { + appl.notify("Redirecting to your campaign...") + appl.redirect(JSON.parse(req.response).url) + }) + .catch(function(req) { + appl.def('new_p2p_campaign_wiz.loading', false) + appl.def('new_p2p_campaign_wiz.error', req.responseText) + }) +}) + +// Using the bare-bones XMLHttpRequest API so we can post form data and upload the image +function post_campaign(form_data) { + return new Promise(function(resolve, reject) { + var req = new XMLHttpRequest() + req.open("POST", '/nonprofits/' + app.nonprofit_id + '/campaigns') + req.setRequestHeader('X-CSRF-Token', window._csrf) + console.log(form_data) + req.send(form_data) + req.onload = function(ev) { + if(req.status === 200) resolve(req) + else reject(req) + } + }) +} diff --git a/client/js/campaigns/new/wizard.js b/client/js/campaigns/new/wizard.js index 2c73149b..ab107da1 100644 --- a/client/js/campaigns/new/wizard.js +++ b/client/js/campaigns/new/wizard.js @@ -20,6 +20,8 @@ appl.def('create_campaign', function(el) { form_data = utils.mergeFormData(form_data, appl.new_campaign) appl.def('new_campaign_wiz.loading', true) +// TODO: for p2p capmaigns, merge with preset campaing params + post_campaign(form_data) .then(function(req) { appl.notify("Redirecting to your campaign...") diff --git a/client/js/campaigns/peer_to_peer/page.js b/client/js/campaigns/peer_to_peer/page.js index a51ea457..63e828be 100644 --- a/client/js/campaigns/peer_to_peer/page.js +++ b/client/js/campaigns/peer_to_peer/page.js @@ -1,3 +1,4 @@ +<<<<<<< HEAD // License: LGPL-3.0-or-later require('../new/wizard') @@ -114,3 +115,7 @@ main.onclick = function(ev) { } appl.def('search_results', []) } +======= +require('../new/peer_to_peer_wizard') +require('../../common/image_uploader') +>>>>>>> 2dc48070e... Merge branch 'p2p-campaigns' into h-custom-layout diff --git a/config/routes.rb b/config/routes.rb index 39f0f3e5..6fbd3c1e 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -110,6 +110,8 @@ Commitchange::Application.routes.draw do post(:send_code) end + resources(:campaign_templates, {only: [:index, :create]}) + post 'tracking', controller: 'trackings', action: 'create' end diff --git a/db/migrate/201810202124317_add_parent_campaign_id_to_campaigns.rb b/db/migrate/201810202124317_add_parent_campaign_id_to_campaigns.rb new file mode 100644 index 00000000..bcb567ec --- /dev/null +++ b/db/migrate/201810202124317_add_parent_campaign_id_to_campaigns.rb @@ -0,0 +1,5 @@ +class AddParentCampaignIdToCampaigns < ActiveRecord::Migration + def change + add_column :campaigns, :parent_campaign_id, :integer + end +end diff --git a/db/migrate/201810202124318_add_reason_for_supporting_to_campaigns.rb b/db/migrate/201810202124318_add_reason_for_supporting_to_campaigns.rb new file mode 100644 index 00000000..2f6791ca --- /dev/null +++ b/db/migrate/201810202124318_add_reason_for_supporting_to_campaigns.rb @@ -0,0 +1,5 @@ +class AddReasonForSupportingToCampaigns < ActiveRecord::Migration + def change + add_column :campaigns, :reason_for_supporting, :text + end +end diff --git a/db/structure.sql b/db/structure.sql index b146ebc2..2c2dd0f5 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -438,7 +438,13 @@ CREATE TABLE public.campaigns ( show_recurring_amount boolean DEFAULT false, end_datetime timestamp without time zone, external_identifier character varying(255), +<<<<<<< HEAD campaign_template_id integer +======= + campaign_template_id integer, + parent_campaign_id integer, + reason_for_supporting text +>>>>>>> p2p-campaigns ); @@ -4413,3 +4419,8 @@ INSERT INTO schema_migrations (version) VALUES ('201810202124316'); INSERT INTO schema_migrations (version) VALUES ('201810202124317'); +<<<<<<< HEAD +======= +INSERT INTO schema_migrations (version) VALUES ('201810202124318'); + +>>>>>>> p2p-campaigns diff --git a/spec/controllers/campaign_templates_controller_spec.rb b/spec/controllers/campaign_templates_controller_spec.rb new file mode 100644 index 00000000..a9c4283b --- /dev/null +++ b/spec/controllers/campaign_templates_controller_spec.rb @@ -0,0 +1,12 @@ +require 'rails_helper' + +RSpec.describe CampaignTemplatesController, :type => :controller do + + describe "GET #index" do + it "returns http success" do + get :index + expect(response).to have_http_status(:success) + end + end + +end diff --git a/spec/helpers/campaign_templates_helper_spec.rb b/spec/helpers/campaign_templates_helper_spec.rb new file mode 100644 index 00000000..dcf22e0f --- /dev/null +++ b/spec/helpers/campaign_templates_helper_spec.rb @@ -0,0 +1,15 @@ +require 'rails_helper' + +# Specs in this file have access to a helper object that includes +# the CampaignTemplatesHelper. For example: +# +# describe CampaignTemplatesHelper do +# describe "string concat" do +# it "concats two strings with spaces" do +# expect(helper.concat_strings("this","that")).to eq("this that") +# end +# end +# end +RSpec.describe CampaignTemplatesHelper, :type => :helper do + pending "add some examples to (or delete) #{__FILE__}" +end diff --git a/spec/views/campaign_templates/index.html.erb_spec.rb b/spec/views/campaign_templates/index.html.erb_spec.rb new file mode 100644 index 00000000..d0b202bf --- /dev/null +++ b/spec/views/campaign_templates/index.html.erb_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe "campaign_templates/index.html.erb", :type => :view do + pending "add some examples to (or delete) #{__FILE__}" +end From a7f0c809b4aa4ad4c69e2aba17f929b1558db8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 16 May 2018 21:39:27 +0200 Subject: [PATCH 06/81] Fixes after merge --- .../safety_around_water.html.erb | 49 -------- client/js/campaigns/peer_to_peer/page.js | 118 ------------------ .../201810202124318_add_banner_to_campaign.rb | 5 - db/structure.sql | 16 +-- 4 files changed, 4 insertions(+), 184 deletions(-) delete mode 100644 db/migrate/201810202124318_add_banner_to_campaign.rb diff --git a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb index 3920dc02..52e080c1 100644 --- a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb +++ b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb @@ -90,9 +90,6 @@ <% end %> -<<<<<<< HEAD -======= -<<<<<<< HEAD <% if !@campaign.parent_campaign %> <% end %> -======= ->>>>>>> custom-layout ->>>>>>> p2p-campaigns
@@ -116,9 +110,6 @@
-<<<<<<< HEAD -======= -<<<<<<< HEAD <% if @campaign.parent_campaign %>
@@ -149,46 +140,6 @@
<% end %> -======= ->>>>>>> p2p-campaigns -
- -
-
-
- /> -
-
-

<%= @campaign.profile.name %>

-

<%= @campaign.profile.city %>

-
-
- -
-
I am supporting the Y because…
-
- (customizable reason) -
- -<<<<<<< HEAD - <% unless current_campaign_editor? %> -
- Start Your Own Campaign for <%= @nonprofit.name %> - - <% end %> -
-
-
-======= - - - Start Your Own Campaign for <%= @nonprofit.name %> - - - - ->>>>>>> custom-layout ->>>>>>> p2p-campaigns

<%= @campaign.name %>

diff --git a/client/js/campaigns/peer_to_peer/page.js b/client/js/campaigns/peer_to_peer/page.js index 63e828be..e7afcee6 100644 --- a/client/js/campaigns/peer_to_peer/page.js +++ b/client/js/campaigns/peer_to_peer/page.js @@ -1,121 +1,3 @@ -<<<<<<< HEAD // License: LGPL-3.0-or-later - -require('../new/wizard') -var request = require("../../common/client") - -require('../../common/onboard') - -// setting up some default values -appl.def('is_signing_up', true) - .def('selected_result_index', -1) - - -appl.def('search_nonprofits', function(value){ - // keyCode 13 is the return key. - // this conditional just clears the dropdown - if(event.keyCode === 13) { - appl.def('search_results', []) - return - } - // when the user starts typing, - // it sets the selected_results key to false - appl.def('selected_result', false) - - // if the the input is empty, it clears the dropdown - if (!value) { - appl.def('search_results', []) - return - } - - // logic for controlling the dropdown options with up - // and down arrows - if (returnUpOrDownArrow() && appl.search_results && appl.search_results.length) { - event.preventDefault() - setIndexWithArrows(returnUpOrDownArrow()) - return - } - - // if the input is not an up or down arrow or an empty string - // or a return key, then it searches for nonprofits - utils.delay(300, function(){ajax_nonprofit_search(value)}) -}) - - -function ajax_nonprofit_search(value){ - request.get('/nonprofits/search?npo_name=' + value).end(function(err, resp){ - if(!resp.body) { - appl.def('search_results', []) - appl.notify("Sorry, we couldn't find any nonprofits containing the word '" + value + "'") - } else { - appl.def('selected_result_index', -1) - appl.def('search_results', resp.body) - } - }) -} - - -function returnUpOrDownArrow() { - var keyCode = event.keyCode - if(keyCode === 38) - return 'up' - if(keyCode === 40) - return 'down' -} - - -function setIndexWithArrows(dir) { - if(dir === 'down') { - var search_length = appl.search_results.length -1 - appl.def('selected_result_index', appl.selected_result_index === search_length - ? search_length - : appl.selected_result_index += 1) - } else { - appl.def('selected_result_index', appl.selected_result_index === 0 - ? 0 - : appl.selected_result_index -= 1) - } -} - -appl.def('select_result', { - with_arrows: function(i, node) { - addSelectedClass(appl.prev_elem(node)) - var selected = appl.search_results[appl.selected_result_index] - app.nonprofit_id = selected.id - appl.def('selected_result', selected) - utils.change_url_param('npo_id', selected.id, '/peer-to-peer') - }, - with_click: function(i, node) { - appl.def('selected_result_index', i) - addSelectedClass(appl.prev_elem(node)) - var selected = appl.search_results[i] - app.nonprofit_id = selected.id - appl.def('selected_result', selected) - appl.def('search_results', []) - utils.change_url_param('npo_id', selected.id, '/peer-to-peer') - } -}) - - -function addSelectedClass(node) { - if(!node || !node.parentElement) return - var siblings = node.parentElement.querySelectorAll('li') - var len = siblings.length - while(len--){siblings[len].className=''} - node.className = 'is-selected' -} - -// this is for clearing the dropdown -var main = document.querySelector('main') - -main.onclick = function(ev) { - var node = ev.target.nodeName - if(node === 'INPUT' || node === 'BUTTON') { - return - } - appl.def('search_results', []) -} -======= require('../new/peer_to_peer_wizard') require('../../common/image_uploader') ->>>>>>> 2dc48070e... Merge branch 'p2p-campaigns' into h-custom-layout diff --git a/db/migrate/201810202124318_add_banner_to_campaign.rb b/db/migrate/201810202124318_add_banner_to_campaign.rb deleted file mode 100644 index c1fe6406..00000000 --- a/db/migrate/201810202124318_add_banner_to_campaign.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddBannerToCampaign < ActiveRecord::Migration - def change - add_column :campaigns, :custom_banner, :string - end -end diff --git a/db/structure.sql b/db/structure.sql index 2c2dd0f5..3ec71e38 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -102,14 +102,14 @@ SELECT supporters.id, concat_ws(' ' , payments.kind , payments.towards ) AS search_blob -FROM supporters +FROM supporters LEFT OUTER JOIN payments - ON payments.supporter_id=supporters.id + ON payments.supporter_id=supporters.id LEFT OUTER JOIN donations - ON donations.supporter_id=supporters.id + ON donations.supporter_id=supporters.id LEFT OUTER JOIN ( SELECT string_agg(value::text, ' ') AS value, supporter_id -FROM custom_field_joins +FROM custom_field_joins GROUP BY supporter_id) AS custom_field_joins ON custom_field_joins.supporter_id=supporters.id WHERE (supporters.id=NEW.supporter_id)) AS data @@ -438,13 +438,9 @@ CREATE TABLE public.campaigns ( show_recurring_amount boolean DEFAULT false, end_datetime timestamp without time zone, external_identifier character varying(255), -<<<<<<< HEAD - campaign_template_id integer -======= campaign_template_id integer, parent_campaign_id integer, reason_for_supporting text ->>>>>>> p2p-campaigns ); @@ -4419,8 +4415,4 @@ INSERT INTO schema_migrations (version) VALUES ('201810202124316'); INSERT INTO schema_migrations (version) VALUES ('201810202124317'); -<<<<<<< HEAD -======= INSERT INTO schema_migrations (version) VALUES ('201810202124318'); - ->>>>>>> p2p-campaigns From dd90261d74a156bbf1d638a75d7f4e3e0adac8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 16 May 2018 22:01:53 +0200 Subject: [PATCH 07/81] Fix migrations name --- ...b => 201810202124318_add_parent_campaign_id_to_campaigns.rb} | 0 ...> 201810202124319_add_reason_for_supporting_to_campaigns.rb} | 0 db/structure.sql | 2 ++ 3 files changed, 2 insertions(+) rename db/migrate/{201810202124317_add_parent_campaign_id_to_campaigns.rb => 201810202124318_add_parent_campaign_id_to_campaigns.rb} (100%) rename db/migrate/{201810202124318_add_reason_for_supporting_to_campaigns.rb => 201810202124319_add_reason_for_supporting_to_campaigns.rb} (100%) diff --git a/db/migrate/201810202124317_add_parent_campaign_id_to_campaigns.rb b/db/migrate/201810202124318_add_parent_campaign_id_to_campaigns.rb similarity index 100% rename from db/migrate/201810202124317_add_parent_campaign_id_to_campaigns.rb rename to db/migrate/201810202124318_add_parent_campaign_id_to_campaigns.rb diff --git a/db/migrate/201810202124318_add_reason_for_supporting_to_campaigns.rb b/db/migrate/201810202124319_add_reason_for_supporting_to_campaigns.rb similarity index 100% rename from db/migrate/201810202124318_add_reason_for_supporting_to_campaigns.rb rename to db/migrate/201810202124319_add_reason_for_supporting_to_campaigns.rb diff --git a/db/structure.sql b/db/structure.sql index 3ec71e38..e63f858a 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -4416,3 +4416,5 @@ INSERT INTO schema_migrations (version) VALUES ('201810202124316'); INSERT INTO schema_migrations (version) VALUES ('201810202124317'); INSERT INTO schema_migrations (version) VALUES ('201810202124318'); + +INSERT INTO schema_migrations (version) VALUES ('201810202124319'); From be98ec94b728a412028a1306ad2fd3904333312f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Thu, 17 May 2018 20:49:27 +0200 Subject: [PATCH 08/81] Puts AWS config --- app/controllers/profiles_controller.rb | 1 + config/initializers/aws.rb | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index d219c4e2..c0b717a8 100755 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -47,6 +47,7 @@ class ProfilesController < ApplicationController @profile = current_user.profile end @profile.update_attributes(params[:profile]) + puts Settings.image&.host json_saved @profile, 'Profile updated' end diff --git a/config/initializers/aws.rb b/config/initializers/aws.rb index fe7dd48c..5335306f 100644 --- a/config/initializers/aws.rb +++ b/config/initializers/aws.rb @@ -8,4 +8,3 @@ AWS.config({ s3 = AWS::S3.new S3Bucket = s3.buckets[Settings.aws.bucket] - From f1027ab5643757a837df6d424ddfeb2cbf7989a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Thu, 17 May 2018 23:06:24 +0200 Subject: [PATCH 09/81] WIP fix aws address issue --- app/controllers/profiles_controller.rb | 1 - config/initializers/carrierwave.rb | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index c0b717a8..d219c4e2 100755 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -47,7 +47,6 @@ class ProfilesController < ApplicationController @profile = current_user.profile end @profile.update_attributes(params[:profile]) - puts Settings.image&.host json_saved @profile, 'Profile updated' end diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 59b7bfc0..0542a856 100755 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -4,7 +4,8 @@ CarrierWave.configure do |config| config.storage = :aws config.aws_bucket = Settings.aws.bucket config.aws_acl = :public_read - config.asset_host = Settings.image&.host || "https://s3-#{Settings.aws.region}.amazonaws.com/#{Settings.aws.bucket}" + # config.asset_host = Settings.image&.host || "https://s3-#{Settings.aws.region}.amazonaws.com/#{Settings.aws.bucket}" + config.asset_host = "https://s3.amazonaws.com/#{Settings.aws.bucket}" config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365 config.aws_credentials = { access_key_id: Settings.aws.access_key_id, From 02868b5e1747e4c83d503624a9cbf3d3dc41f19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Thu, 17 May 2018 23:52:15 +0200 Subject: [PATCH 10/81] WIP no, seriously fix the bucket address bug --- app/controllers/profiles_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index d219c4e2..739c15ee 100755 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -46,6 +46,8 @@ class ProfilesController < ApplicationController else @profile = current_user.profile end + puts "______________awsbucketaddress: #{Settings.image.host}" + puts "______________awsbucketaddress: #{Settings.image&.host}" @profile.update_attributes(params[:profile]) json_saved @profile, 'Profile updated' end From abd5fbe63ea29966542ecebfbfa8fb27776c4d2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Fri, 18 May 2018 14:25:07 +0200 Subject: [PATCH 11/81] WIP use s3 without region --- app/controllers/profiles_controller.rb | 2 -- config/environment.rb | 3 +-- config/initializers/carrierwave.rb | 3 +-- config/settings.yml | 4 +++- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb index 739c15ee..d219c4e2 100755 --- a/app/controllers/profiles_controller.rb +++ b/app/controllers/profiles_controller.rb @@ -46,8 +46,6 @@ class ProfilesController < ApplicationController else @profile = current_user.profile end - puts "______________awsbucketaddress: #{Settings.image.host}" - puts "______________awsbucketaddress: #{Settings.image&.host}" @profile.update_attributes(params[:profile]) json_saved @profile, 'Profile updated' end diff --git a/config/environment.rb b/config/environment.rb index 74e95206..b8401d16 100755 --- a/config/environment.rb +++ b/config/environment.rb @@ -63,7 +63,7 @@ Config.schema do required(:aws).schema do # the region your AWS bucket is in - required(:region).filled(:str?) + # required(:region).filled(:str?) # the name of your aws bucket required(:bucket).filled(:str?) @@ -295,4 +295,3 @@ Settings.reload! # Initialize the rails application Commitchange::Application.initialize! - diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 0542a856..59b7bfc0 100755 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -4,8 +4,7 @@ CarrierWave.configure do |config| config.storage = :aws config.aws_bucket = Settings.aws.bucket config.aws_acl = :public_read - # config.asset_host = Settings.image&.host || "https://s3-#{Settings.aws.region}.amazonaws.com/#{Settings.aws.bucket}" - config.asset_host = "https://s3.amazonaws.com/#{Settings.aws.bucket}" + config.asset_host = Settings.image&.host || "https://s3-#{Settings.aws.region}.amazonaws.com/#{Settings.aws.bucket}" config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365 config.aws_credentials = { access_key_id: Settings.aws.access_key_id, diff --git a/config/settings.yml b/config/settings.yml index f657c967..f6a5c812 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -20,9 +20,11 @@ default: aws: access_key_id: <%= ENV['AWS_ACCESS_KEY'] %> secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> - region: <%= ENV['AWS_REGION'] %> bucket: <%= ENV['S3_BUCKET_NAME'] %> +image: + host: "https://#{Settings.aws.bucket}.s3.amazonaws.com" + mailer: delivery_method: "sendmail" address: "localhost" From d888be02422ab52f848e4defc9692e331cfd1132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Fri, 18 May 2018 17:18:46 +0200 Subject: [PATCH 12/81] Campaign template create, delete --- .../campaign_templates_controller.rb | 12 ++- app/models/campaign_template.rb | 77 ++++++++++++++++++- .../campaign_templates/index.html.erb | 8 +- client/js/campaign_templates/new/wizard.js | 26 ++++++- config/routes.rb | 2 +- ..._add_nonprofit_id_to_campaign_templates.rb | 7 ++ db/structure.sql | 6 +- 7 files changed, 127 insertions(+), 11 deletions(-) create mode 100644 db/migrate/201810202124320_add_nonprofit_id_to_campaign_templates.rb diff --git a/app/controllers/nonprofits/campaign_templates_controller.rb b/app/controllers/nonprofits/campaign_templates_controller.rb index 72d4ba64..8188900e 100644 --- a/app/controllers/nonprofits/campaign_templates_controller.rb +++ b/app/controllers/nonprofits/campaign_templates_controller.rb @@ -7,12 +7,20 @@ module Nonprofits def index @templates = CampaignTemplate.all + @nonprofit = current_nonprofit end def create - puts params + template = CampaignTemplate.create(params[:campaign_template]) - render :status_ok + json_saved template + end + + def destroy + campaign = CampaignTemplate.find(params[:id]) + campaign.destroy + + render json: {}, status: :no_content end end end diff --git a/app/models/campaign_template.rb b/app/models/campaign_template.rb index fcfe7d63..099dea01 100644 --- a/app/models/campaign_template.rb +++ b/app/models/campaign_template.rb @@ -1,24 +1,97 @@ class CampaignTemplate < ActiveRecord::Base # these are very arbitrary names – some are attrs of campaign, some are not # might be a good idea to get the default list from settings - CUSTOMIZABLE_ATTR = %i(goal_amount_dollars campaigner_photo reason_for_supporting) + CUSTOMIZABLE_ATTR = %i(goal_amount) attr_accessible \ :template_name, :name, # refers to campaign name :tagline, :goal_amount, + :goal_amount_dollars, # accessor: translated into goal_amount (cents) :main_image, :remove_main_image, # for carrierwave :video_url, :vimeo_video_id, :youtube_video_id, :summary, - :body + :body, + :end_datetime, + :goal_customizable + + attr_accessor :goal_amount_dollars + attr_accessor :goal_customizable + attr_accessor :end_datetime + attr_accessor :hide_activity_feed + attr_accessor :deleted + attr_accessor :hide_title + attr_accessor :slug + attr_accessor :custom_banner_url + attr_accessor :published + attr_accessor :show_total_raised + attr_accessor :show_total_count + attr_accessor :hide_goal + attr_accessor :hide_thermometer + attr_accessor :hide_custom_amounts + attr_accessor :receipt_message has_many :campaigns + belongs_to :nonprofit def customizable_attribute?(attribute_name) CUSTOMIZABLE_ATTR.include? attribute_name.to_sym end + + def recurring_fund? + end + + def main_image_url(url) + end + + def slug + Format::Url.convert_to_slug(template_name) + end + + def customizable_attributes_list + CUSTOMIZABLE_ATTR + end + + def name + if self[:name] + self[:name] + else + 'no name' + end + end + + def url + "#{self.nonprofit.url}/campaigns/#{self.slug}" + end + + def days_left + return 0 if self.end_datetime.nil? + (self.end_datetime.to_date - Date.today).to_i + end + + before_validation do + if self.goal_amount_dollars.present? + self.goal_amount = (self.goal_amount_dollars.gsub(',','').to_f * 100).to_i + end + self + end + + after_create do + # user = self.profile.user + # Role.create(name: :campaign_editor, user_id: user.id, host: self) + end + + before_validation(on: :create) do + self.set_defaults + self + end + + def set_defaults + # self.total_supporters = 1 + # self.published = false if self.published.nil? + end end diff --git a/app/views/nonprofits/campaign_templates/index.html.erb b/app/views/nonprofits/campaign_templates/index.html.erb index 1b420ae8..f1890623 100644 --- a/app/views/nonprofits/campaign_templates/index.html.erb +++ b/app/views/nonprofits/campaign_templates/index.html.erb @@ -6,8 +6,9 @@ <%= content_for :javascripts do %> - <%= IncludeAsset.js '/client/js/campaigns/index/page.js' %> + <%= IncludeAsset.js '/client/js/campaign_templates/index/page.js' %> <% end %> @@ -33,7 +34,7 @@ <% @templates.each do |template|%> - + #
@@ -50,6 +51,9 @@

Customizable attributes: <%= template.customizable_attributes_list %>

+ + Delete template + <% end %> diff --git a/client/js/campaign_templates/new/wizard.js b/client/js/campaign_templates/new/wizard.js index 172a4a6a..c1a79bb8 100644 --- a/client/js/campaign_templates/new/wizard.js +++ b/client/js/campaign_templates/new/wizard.js @@ -1,7 +1,6 @@ require('../../common/pikaday-timepicker') require('../../components/wizard') require('../../common/image_uploader') -var checkName = require('../../common/ajax/check_campaign_or_event_name') var format_err = require('../../common/format_response_error') appl.def('advance_campaign_template_name_step', function(form_obj) { @@ -17,8 +16,9 @@ appl.def('create_campaign_template', function(el) { post_campaign_template(form_data) .then(function(req) { - appl.notify("Redirecting to your campaign template...") - appl.redirect(JSON.parse(req.response).url) + appl.notify("Campaign template created!") + var template_id = JSON.parse(req.response).id + appl.redirect('/nonprofits/' + app.nonprofit_id + '/campaign_templates') }) .catch(function(req) { appl.def('new_campaign_template_wiz.loading', false) @@ -48,3 +48,23 @@ function post_campaign_template(form_data) { } }) } + +appl.def('delete_template', function(id) { + appl.def('loading', true) + var url = '/nonprofits/' + app.nonprofit_id + '/campaign_templates/' + id + + return new Promise(function(resolve, reject) { + var req = new XMLHttpRequest() + req.open("DELETE", url) + req.setRequestHeader('X-CSRF-Token', window._csrf) + req.send({ campaign_template: {id: id} }) + req.onload = function(ev) { + if(req.status === 204) resolve(req) + else reject(req) + } + }).then(function() { + appl.def('loading', false) + appl.notify('Successfully deleted template.') + appl.redirect('/nonprofits/' + app.nonprofit_id + '/campaign_templates') + }) +}) diff --git a/config/routes.rb b/config/routes.rb index 6fbd3c1e..df8e90a1 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -110,7 +110,7 @@ Commitchange::Application.routes.draw do post(:send_code) end - resources(:campaign_templates, {only: [:index, :create]}) + resources(:campaign_templates, {only: [:index, :create, :show, :destroy]}) post 'tracking', controller: 'trackings', action: 'create' end diff --git a/db/migrate/201810202124320_add_nonprofit_id_to_campaign_templates.rb b/db/migrate/201810202124320_add_nonprofit_id_to_campaign_templates.rb new file mode 100644 index 00000000..59693ac6 --- /dev/null +++ b/db/migrate/201810202124320_add_nonprofit_id_to_campaign_templates.rb @@ -0,0 +1,7 @@ +class AddNonprofitIdToCampaignTemplates < ActiveRecord::Migration + def change + change_table :campaign_templates do |t| + t.references :nonprofit + end + end +end diff --git a/db/structure.sql b/db/structure.sql index e63f858a..7df2d0c1 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -377,7 +377,8 @@ CREATE TABLE public.campaign_templates ( summary text, body text, created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL + updated_at timestamp without time zone NOT NULL, + nonprofit_id integer ); @@ -4418,3 +4419,6 @@ INSERT INTO schema_migrations (version) VALUES ('201810202124317'); INSERT INTO schema_migrations (version) VALUES ('201810202124318'); INSERT INTO schema_migrations (version) VALUES ('201810202124319'); + +INSERT INTO schema_migrations (version) VALUES ('201810202124320'); + From bb0bebe8f75708a8759f71ebe99afd8b86e9523b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Fri, 18 May 2018 17:18:57 +0200 Subject: [PATCH 13/81] Fix loading avatar image --- app/views/layouts/_user_menu.html.erb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/views/layouts/_user_menu.html.erb b/app/views/layouts/_user_menu.html.erb index c66c4bc7..1f8bb3b3 100644 --- a/app/views/layouts/_user_menu.html.erb +++ b/app/views/layouts/_user_menu.html.erb @@ -4,7 +4,7 @@
<% if current_user.profile.picture? %> - + <% else %> <% end %> @@ -46,4 +46,3 @@
<% end %> - From 2db5e72bcbe0beb08916d9f7be20a68121d31092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Fri, 18 May 2018 17:59:17 +0200 Subject: [PATCH 14/81] Add a confirm dialog when deleting templates --- .../campaign_templates/index.html.erb | 2 +- client/js/campaign_templates/new/wizard.js | 36 ++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/app/views/nonprofits/campaign_templates/index.html.erb b/app/views/nonprofits/campaign_templates/index.html.erb index f1890623..70c16c5d 100644 --- a/app/views/nonprofits/campaign_templates/index.html.erb +++ b/app/views/nonprofits/campaign_templates/index.html.erb @@ -53,7 +53,7 @@

Delete template - + <% end %> diff --git a/client/js/campaign_templates/new/wizard.js b/client/js/campaign_templates/new/wizard.js index c1a79bb8..ca29497a 100644 --- a/client/js/campaign_templates/new/wizard.js +++ b/client/js/campaign_templates/new/wizard.js @@ -1,6 +1,7 @@ require('../../common/pikaday-timepicker') require('../../components/wizard') require('../../common/image_uploader') +var confirmation = require('../../common/confirmation') var format_err = require('../../common/format_response_error') appl.def('advance_campaign_template_name_step', function(form_obj) { @@ -50,21 +51,24 @@ function post_campaign_template(form_data) { } appl.def('delete_template', function(id) { - appl.def('loading', true) - var url = '/nonprofits/' + app.nonprofit_id + '/campaign_templates/' + id + var result = confirmation('Are you sure?') + result.confirmed = function() { + appl.def('loading', true) + var url = '/nonprofits/' + app.nonprofit_id + '/campaign_templates/' + id - return new Promise(function(resolve, reject) { - var req = new XMLHttpRequest() - req.open("DELETE", url) - req.setRequestHeader('X-CSRF-Token', window._csrf) - req.send({ campaign_template: {id: id} }) - req.onload = function(ev) { - if(req.status === 204) resolve(req) - else reject(req) - } - }).then(function() { - appl.def('loading', false) - appl.notify('Successfully deleted template.') - appl.redirect('/nonprofits/' + app.nonprofit_id + '/campaign_templates') - }) + return new Promise(function(resolve, reject) { + var req = new XMLHttpRequest() + req.open("DELETE", url) + req.setRequestHeader('X-CSRF-Token', window._csrf) + req.send({ campaign_template: {id: id} }) + req.onload = function(ev) { + if(req.status === 204) resolve(req) + else reject(req) + } + }).then(function() { + appl.def('loading', false) + appl.notify('Successfully deleted template.') + appl.redirect('/nonprofits/' + app.nonprofit_id + '/campaign_templates') + }) + } }) From aedb12ee03cfba17b0bb130c36dc22c205f5f2df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Mon, 21 May 2018 21:24:13 +0200 Subject: [PATCH 15/81] Create campaign from template --- app/models/campaign_template.rb | 7 +++++ .../campaign_templates/index.html.erb | 4 +++ client/js/campaign_templates/new/wizard.js | 31 +++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/app/models/campaign_template.rb b/app/models/campaign_template.rb index 099dea01..21d0bcd6 100644 --- a/app/models/campaign_template.rb +++ b/app/models/campaign_template.rb @@ -94,4 +94,11 @@ class CampaignTemplate < ActiveRecord::Base # self.total_supporters = 1 # self.published = false if self.published.nil? end + + def create_campaign_params + excluded = %w( + id template_name created_at updated_at + ) + attributes.except!(*excluded) + end end diff --git a/app/views/nonprofits/campaign_templates/index.html.erb b/app/views/nonprofits/campaign_templates/index.html.erb index 70c16c5d..1a1da3f9 100644 --- a/app/views/nonprofits/campaign_templates/index.html.erb +++ b/app/views/nonprofits/campaign_templates/index.html.erb @@ -7,6 +7,7 @@ <%= IncludeAsset.js '/client/js/campaign_templates/index/page.js' %> <% end %> @@ -52,6 +53,9 @@ Customizable attributes: <%= template.customizable_attributes_list %>

+ Create campaign from template + + Delete template diff --git a/client/js/campaign_templates/new/wizard.js b/client/js/campaign_templates/new/wizard.js index ca29497a..130dc20b 100644 --- a/client/js/campaign_templates/new/wizard.js +++ b/client/js/campaign_templates/new/wizard.js @@ -72,3 +72,34 @@ appl.def('delete_template', function(id) { }) } }) + + +appl.def('create_campaign', function(campaign_params) { + appl.def('loading', true) + + var url = '/nonprofits/' + app.nonprofit_id + '/campaigns' + var params = new Object + params.campaign = JSON.parse(campaign_params) + params.campaign.profile_id = app.profile_id + + return new Promise(function(resolve, reject) { + var req = new XMLHttpRequest() + req.open("POST", url) + req.setRequestHeader('X-CSRF-Token', window._csrf) + req.setRequestHeader('Content-Type', 'application/json') + req.send(JSON.stringify(params)) + req.onload = function(ev) { + if(req.status === 200) resolve(req) + else reject(req) + } + }).then(function(req) { + appl.def('loading', false) + appl.notify('Redirecting you to your campaign…') + var campaign_id = JSON.parse(req.response).id + appl.redirect(url + '/' + campaign_id) + }) + .catch(function(req) { + appl.def('loading', false) + appl.notify(req.responseText) + }) +}) From a5bc158628e196283af837dc88e0132f45fec3ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Mon, 21 May 2018 21:25:03 +0200 Subject: [PATCH 16/81] Show only templates belonging to current nonprofit --- app/controllers/nonprofits/campaign_templates_controller.rb | 2 +- app/models/campaign_template.rb | 3 ++- app/models/nonprofit.rb | 1 + app/views/nonprofits/campaign_templates/_new_modal.html.erb | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/nonprofits/campaign_templates_controller.rb b/app/controllers/nonprofits/campaign_templates_controller.rb index 8188900e..49804707 100644 --- a/app/controllers/nonprofits/campaign_templates_controller.rb +++ b/app/controllers/nonprofits/campaign_templates_controller.rb @@ -6,8 +6,8 @@ module Nonprofits before_filter :authenticate_nonprofit_user!, only: [:index, :show] def index - @templates = CampaignTemplate.all @nonprofit = current_nonprofit + @templates = @nonprofit.campaign_templates end def create diff --git a/app/models/campaign_template.rb b/app/models/campaign_template.rb index 21d0bcd6..4d72b717 100644 --- a/app/models/campaign_template.rb +++ b/app/models/campaign_template.rb @@ -17,7 +17,8 @@ class CampaignTemplate < ActiveRecord::Base :summary, :body, :end_datetime, - :goal_customizable + :goal_customizable, + :nonprofit_id attr_accessor :goal_amount_dollars attr_accessor :goal_customizable diff --git a/app/models/nonprofit.rb b/app/models/nonprofit.rb index 421b59b1..2d512444 100755 --- a/app/models/nonprofit.rb +++ b/app/models/nonprofit.rb @@ -62,6 +62,7 @@ class Nonprofit < ActiveRecord::Base has_many :supporter_notes, through: :supporters has_many :profiles, through: :donations has_many :campaigns, dependent: :destroy + has_many :campaign_templates, dependent: :destroy has_many :events, dependent: :destroy has_many :tickets, through: :events has_many :users, through: :roles diff --git a/app/views/nonprofits/campaign_templates/_new_modal.html.erb b/app/views/nonprofits/campaign_templates/_new_modal.html.erb index c8640896..6fba6cb8 100644 --- a/app/views/nonprofits/campaign_templates/_new_modal.html.erb +++ b/app/views/nonprofits/campaign_templates/_new_modal.html.erb @@ -18,7 +18,7 @@
- +
From 546b37f0988c140b6bbbf2627704ef5bd73ed958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Tue, 22 May 2018 11:25:47 +0200 Subject: [PATCH 17/81] Clean up templates, fix main image upload --- app/models/campaign.rb | 5 -- app/models/campaign_template.rb | 67 ++----------------- .../campaign_template_main_image_uploader.rb | 29 ++++++++ .../campaign_templates/_new_modal.html.erb | 4 +- .../campaign_templates/index.html.erb | 2 +- 5 files changed, 37 insertions(+), 70 deletions(-) create mode 100644 app/uploaders/campaign_template_main_image_uploader.rb diff --git a/app/models/campaign.rb b/app/models/campaign.rb index a8d4b241..ab7605d8 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -164,11 +164,6 @@ class Campaign < ActiveRecord::Base (self.end_datetime.to_date - Date.today).to_i end - def self.create_from_template(template_id) - # building params handled by another object - # not sure this method is needed eventually - end - def customizable_attributes_list campaign_template.customizable_attributes_list if campaign_template end diff --git a/app/models/campaign_template.rb b/app/models/campaign_template.rb index 4d72b717..306ebb60 100644 --- a/app/models/campaign_template.rb +++ b/app/models/campaign_template.rb @@ -1,6 +1,4 @@ class CampaignTemplate < ActiveRecord::Base - # these are very arbitrary names – some are attrs of campaign, some are not - # might be a good idea to get the default list from settings CUSTOMIZABLE_ATTR = %i(goal_amount) attr_accessible \ @@ -20,59 +18,13 @@ class CampaignTemplate < ActiveRecord::Base :goal_customizable, :nonprofit_id - attr_accessor :goal_amount_dollars - attr_accessor :goal_customizable attr_accessor :end_datetime - attr_accessor :hide_activity_feed - attr_accessor :deleted - attr_accessor :hide_title - attr_accessor :slug - attr_accessor :custom_banner_url - attr_accessor :published - attr_accessor :show_total_raised - attr_accessor :show_total_count - attr_accessor :hide_goal - attr_accessor :hide_thermometer - attr_accessor :hide_custom_amounts - attr_accessor :receipt_message + attr_accessor :goal_amount_dollars has_many :campaigns belongs_to :nonprofit - def customizable_attribute?(attribute_name) - CUSTOMIZABLE_ATTR.include? attribute_name.to_sym - end - - def recurring_fund? - end - - def main_image_url(url) - end - - def slug - Format::Url.convert_to_slug(template_name) - end - - def customizable_attributes_list - CUSTOMIZABLE_ATTR - end - - def name - if self[:name] - self[:name] - else - 'no name' - end - end - - def url - "#{self.nonprofit.url}/campaigns/#{self.slug}" - end - - def days_left - return 0 if self.end_datetime.nil? - (self.end_datetime.to_date - Date.today).to_i - end + mount_uploader :main_image, CampaignTemplateMainImageUploader before_validation do if self.goal_amount_dollars.present? @@ -81,19 +33,12 @@ class CampaignTemplate < ActiveRecord::Base self end - after_create do - # user = self.profile.user - # Role.create(name: :campaign_editor, user_id: user.id, host: self) + def customizable_attribute?(attribute_name) + CUSTOMIZABLE_ATTR.include? attribute_name.to_sym end - before_validation(on: :create) do - self.set_defaults - self - end - - def set_defaults - # self.total_supporters = 1 - # self.published = false if self.published.nil? + def customizable_attributes_list + CUSTOMIZABLE_ATTR end def create_campaign_params diff --git a/app/uploaders/campaign_template_main_image_uploader.rb b/app/uploaders/campaign_template_main_image_uploader.rb new file mode 100644 index 00000000..400331ef --- /dev/null +++ b/app/uploaders/campaign_template_main_image_uploader.rb @@ -0,0 +1,29 @@ +# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later + +class CampaignTemplateMainImageUploader < CarrierWave::Uploader::Base + include CarrierWave::MiniMagick + + def store_dir + "uploads/campaign_templates/#{mounted_as}/#{model.id}" + end + + def default_url + return Image::DefaultProfileUrl + end + + version :normal do + process :resize_to_fill => [524, 360] + end + + version :thumb do + process :resize_to_fill => [180, 150] + end + + def extension_white_list + %w(jpg jpeg png) + end + + def cache_dir + "#{Rails.root}/tmp/uploads" + end +end diff --git a/app/views/nonprofits/campaign_templates/_new_modal.html.erb b/app/views/nonprofits/campaign_templates/_new_modal.html.erb index 6fba6cb8..dfc089fe 100644 --- a/app/views/nonprofits/campaign_templates/_new_modal.html.erb +++ b/app/views/nonprofits/campaign_templates/_new_modal.html.erb @@ -57,8 +57,6 @@
- -

@@ -95,7 +93,7 @@
Upload - +
diff --git a/app/views/nonprofits/campaign_templates/index.html.erb b/app/views/nonprofits/campaign_templates/index.html.erb index 1a1da3f9..5f767909 100644 --- a/app/views/nonprofits/campaign_templates/index.html.erb +++ b/app/views/nonprofits/campaign_templates/index.html.erb @@ -35,7 +35,7 @@ <% @templates.each do |template|%> - # +
From e6aa64cb52f895d0663a8bb314daf2e94256000b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Tue, 22 May 2018 11:26:48 +0200 Subject: [PATCH 18/81] Fixup: remove image.host from Settings --- config/initializers/carrierwave.rb | 2 +- config/settings.yml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/config/initializers/carrierwave.rb b/config/initializers/carrierwave.rb index 59b7bfc0..18e4d95b 100755 --- a/config/initializers/carrierwave.rb +++ b/config/initializers/carrierwave.rb @@ -4,7 +4,7 @@ CarrierWave.configure do |config| config.storage = :aws config.aws_bucket = Settings.aws.bucket config.aws_acl = :public_read - config.asset_host = Settings.image&.host || "https://s3-#{Settings.aws.region}.amazonaws.com/#{Settings.aws.bucket}" + config.asset_host = Settings.image&.host || "https://#{Settings.aws.bucket}.s3.amazonaws.com" config.aws_authenticated_url_expiration = 60 * 60 * 24 * 365 config.aws_credentials = { access_key_id: Settings.aws.access_key_id, diff --git a/config/settings.yml b/config/settings.yml index f6a5c812..9dfbfa19 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -22,9 +22,6 @@ aws: secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %> bucket: <%= ENV['S3_BUCKET_NAME'] %> -image: - host: "https://#{Settings.aws.bucket}.s3.amazonaws.com" - mailer: delivery_method: "sendmail" address: "localhost" From f621d89d515ae8836057f6926529c827d669cf29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Tue, 22 May 2018 23:04:53 +0300 Subject: [PATCH 19/81] Revert "Merge pull request #1 from idengager/staging" This reverts commit ba8944eff7530b4f9dfd56f74d9a37f4ac9be9f4, reversing changes made to a0fbceb5a3c914dcee65027d8eeec76f49010e03. --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index bb576dbd..e75da3e6 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3 +2.3.6 From 9d20974abd971228a21a5a00feef42480763fb49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Tue, 29 May 2018 17:31:55 +0200 Subject: [PATCH 20/81] wip --- app/models/campaign.rb | 11 +- .../_new_peer_to_peer_modal.html.erb | 21 +- ...ault_reason_for_supporting_to_campaigns.rb | 5 + db/structure.sql | 663 +++++++++--------- 4 files changed, 362 insertions(+), 338 deletions(-) create mode 100644 db/migrate/201810202124321_add_default_reason_for_supporting_to_campaigns.rb diff --git a/app/models/campaign.rb b/app/models/campaign.rb index ab7605d8..9570760e 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -34,7 +34,8 @@ class Campaign < ActiveRecord::Base :receipt_message, # text :hide_custom_amounts, # boolean :parent_campaign_id, - :reason_for_supporting + :reason_for_supporting, + :default_reason_for_supporting validate :end_datetime_cannot_be_in_past, :on => :create validates :profile, :presence => true @@ -177,4 +178,12 @@ class Campaign < ActiveRecord::Base excluded_for_peer_to_peer.push(customizable_attributes_list) attributes.except(*excluded_for_peer_to_peer) end + + def user_reason_for_supporting + if reason_for_supporting.present? + reason_for_supporting + else + default_reason_for_supporting + end + end end diff --git a/app/views/campaigns/_new_peer_to_peer_modal.html.erb b/app/views/campaigns/_new_peer_to_peer_modal.html.erb index 7d32811d..2a83360a 100644 --- a/app/views/campaigns/_new_peer_to_peer_modal.html.erb +++ b/app/views/campaigns/_new_peer_to_peer_modal.html.erb @@ -38,18 +38,16 @@
-
- -
+
+ + Uploading your picture will greatly increase the chances of a successful campaign. +
Upload
- -
- - -
<%= render 'components/forms/submit_button', button_text: 'Next', scope: 'new_p2p_campaign_wiz', branded: true %> @@ -64,6 +62,13 @@
+
+ + Be concise and honest about your intentions. + + +
+
diff --git a/db/migrate/201810202124321_add_default_reason_for_supporting_to_campaigns.rb b/db/migrate/201810202124321_add_default_reason_for_supporting_to_campaigns.rb new file mode 100644 index 00000000..521ade97 --- /dev/null +++ b/db/migrate/201810202124321_add_default_reason_for_supporting_to_campaigns.rb @@ -0,0 +1,5 @@ +class AddDefaultReasonForSupportingToCampaigns < ActiveRecord::Migration + def change + add_column :campaigns, :default_reason_for_supporting, :text + end +end diff --git a/db/structure.sql b/db/structure.sql index 7df2d0c1..5c08fffa 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2,6 +2,7 @@ -- PostgreSQL database dump -- +<<<<<<< HEAD <<<<<<< HEAD -- Dumped from database version 9.6.5 -- Dumped by pg_dump version 9.6.10 @@ -9,13 +10,16 @@ -- Dumped from database version 9.6.8 -- Dumped by pg_dump version 9.6.8 >>>>>>> Add CampaignTemplate +======= +-- Dumped from database version 10.1 +-- Dumped by pg_dump version 10.1 +>>>>>>> wip SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; -SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET client_min_messages = warning; SET row_security = off; @@ -62,6 +66,8 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public; COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)'; +SET search_path = public, pg_catalog; + -- -- Name: is_valid_json(text); Type: FUNCTION; Schema: public; Owner: - -- @@ -82,7 +88,7 @@ $$; -- Name: update_supporter_assoc_search_vectors(); Type: FUNCTION; Schema: public; Owner: - -- -CREATE FUNCTION public.update_supporter_assoc_search_vectors() RETURNS trigger +CREATE FUNCTION update_supporter_assoc_search_vectors() RETURNS trigger LANGUAGE plpgsql AS $$ BEGIN IF pg_trigger_depth() <> 1 THEN RETURN new; END IF; @@ -126,7 +132,7 @@ SET default_with_oids = false; -- Name: activities; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.activities ( +CREATE TABLE activities ( id integer NOT NULL, supporter_id integer, host_id integer, @@ -149,7 +155,7 @@ CREATE TABLE public.activities ( -- Name: activities_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.activities_id_seq +CREATE SEQUENCE activities_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -161,14 +167,14 @@ CREATE SEQUENCE public.activities_id_seq -- Name: activities_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.activities_id_seq OWNED BY public.activities.id; +ALTER SEQUENCE activities_id_seq OWNED BY activities.id; -- -- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.ar_internal_metadata ( +CREATE TABLE ar_internal_metadata ( key character varying NOT NULL, value character varying, created_at timestamp without time zone NOT NULL, @@ -180,7 +186,7 @@ CREATE TABLE public.ar_internal_metadata ( -- Name: bank_accounts; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.bank_accounts ( +CREATE TABLE bank_accounts ( id integer NOT NULL, name character varying(255), account_number character varying(255), @@ -202,7 +208,7 @@ CREATE TABLE public.bank_accounts ( -- Name: bank_accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.bank_accounts_id_seq +CREATE SEQUENCE bank_accounts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -214,14 +220,14 @@ CREATE SEQUENCE public.bank_accounts_id_seq -- Name: bank_accounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.bank_accounts_id_seq OWNED BY public.bank_accounts.id; +ALTER SEQUENCE bank_accounts_id_seq OWNED BY bank_accounts.id; -- -- Name: billing_plans; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.billing_plans ( +CREATE TABLE billing_plans ( id integer NOT NULL, name character varying(255), stripe_plan_id character varying(255), @@ -238,7 +244,7 @@ CREATE TABLE public.billing_plans ( -- Name: billing_plans_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.billing_plans_id_seq +CREATE SEQUENCE billing_plans_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -250,14 +256,14 @@ CREATE SEQUENCE public.billing_plans_id_seq -- Name: billing_plans_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.billing_plans_id_seq OWNED BY public.billing_plans.id; +ALTER SEQUENCE billing_plans_id_seq OWNED BY billing_plans.id; -- -- Name: billing_subscriptions; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.billing_subscriptions ( +CREATE TABLE billing_subscriptions ( id integer NOT NULL, nonprofit_id integer, billing_plan_id integer, @@ -272,7 +278,7 @@ CREATE TABLE public.billing_subscriptions ( -- Name: billing_subscriptions_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.billing_subscriptions_id_seq +CREATE SEQUENCE billing_subscriptions_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -284,14 +290,14 @@ CREATE SEQUENCE public.billing_subscriptions_id_seq -- Name: billing_subscriptions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.billing_subscriptions_id_seq OWNED BY public.billing_subscriptions.id; +ALTER SEQUENCE billing_subscriptions_id_seq OWNED BY billing_subscriptions.id; -- -- Name: campaign_gift_options; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.campaign_gift_options ( +CREATE TABLE campaign_gift_options ( id integer NOT NULL, amount_one_time integer, description text, @@ -312,7 +318,7 @@ CREATE TABLE public.campaign_gift_options ( -- Name: campaign_gift_options_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.campaign_gift_options_id_seq +CREATE SEQUENCE campaign_gift_options_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -324,14 +330,14 @@ CREATE SEQUENCE public.campaign_gift_options_id_seq -- Name: campaign_gift_options_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.campaign_gift_options_id_seq OWNED BY public.campaign_gift_options.id; +ALTER SEQUENCE campaign_gift_options_id_seq OWNED BY campaign_gift_options.id; -- -- Name: campaign_gifts; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.campaign_gifts ( +CREATE TABLE campaign_gifts ( id integer NOT NULL, donation_id integer, campaign_gift_option_id integer, @@ -345,7 +351,7 @@ CREATE TABLE public.campaign_gifts ( -- Name: campaign_gifts_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.campaign_gifts_id_seq +CREATE SEQUENCE campaign_gifts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -357,14 +363,14 @@ CREATE SEQUENCE public.campaign_gifts_id_seq -- Name: campaign_gifts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.campaign_gifts_id_seq OWNED BY public.campaign_gifts.id; +ALTER SEQUENCE campaign_gifts_id_seq OWNED BY campaign_gifts.id; -- -- Name: campaign_templates; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.campaign_templates ( +CREATE TABLE campaign_templates ( id integer NOT NULL, template_name character varying(255) NOT NULL, name character varying(255), @@ -386,7 +392,8 @@ CREATE TABLE public.campaign_templates ( -- Name: campaign_templates_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.campaign_templates_id_seq +CREATE SEQUENCE campaign_templates_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -398,14 +405,14 @@ CREATE SEQUENCE public.campaign_templates_id_seq -- Name: campaign_templates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.campaign_templates_id_seq OWNED BY public.campaign_templates.id; +ALTER SEQUENCE campaign_templates_id_seq OWNED BY campaign_templates.id; -- -- Name: campaigns; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.campaigns ( +CREATE TABLE campaigns ( id integer NOT NULL, name character varying(255), url character varying(255), @@ -441,7 +448,8 @@ CREATE TABLE public.campaigns ( external_identifier character varying(255), campaign_template_id integer, parent_campaign_id integer, - reason_for_supporting text + reason_for_supporting text, + default_reason_for_supporting text ); @@ -449,7 +457,7 @@ CREATE TABLE public.campaigns ( -- Name: campaigns_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.campaigns_id_seq +CREATE SEQUENCE campaigns_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -461,14 +469,14 @@ CREATE SEQUENCE public.campaigns_id_seq -- Name: campaigns_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.campaigns_id_seq OWNED BY public.campaigns.id; +ALTER SEQUENCE campaigns_id_seq OWNED BY campaigns.id; -- -- Name: cards; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.cards ( +CREATE TABLE cards ( id integer NOT NULL, name character varying(255), created_at timestamp without time zone NOT NULL, @@ -493,7 +501,7 @@ CREATE TABLE public.cards ( -- Name: cards_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.cards_id_seq +CREATE SEQUENCE cards_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -505,14 +513,14 @@ CREATE SEQUENCE public.cards_id_seq -- Name: cards_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.cards_id_seq OWNED BY public.cards.id; +ALTER SEQUENCE cards_id_seq OWNED BY cards.id; -- -- Name: charges; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.charges ( +CREATE TABLE charges ( id integer NOT NULL, amount integer, stripe_charge_id character varying(255), @@ -537,7 +545,7 @@ CREATE TABLE public.charges ( -- Name: charges_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.charges_id_seq +CREATE SEQUENCE charges_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -549,14 +557,14 @@ CREATE SEQUENCE public.charges_id_seq -- Name: charges_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.charges_id_seq OWNED BY public.charges.id; +ALTER SEQUENCE charges_id_seq OWNED BY charges.id; -- -- Name: comments; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.comments ( +CREATE TABLE comments ( id integer NOT NULL, profile_id integer, body text, @@ -571,7 +579,7 @@ CREATE TABLE public.comments ( -- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.comments_id_seq +CREATE SEQUENCE comments_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -583,14 +591,14 @@ CREATE SEQUENCE public.comments_id_seq -- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.comments_id_seq OWNED BY public.comments.id; +ALTER SEQUENCE comments_id_seq OWNED BY comments.id; -- -- Name: custom_field_joins; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.custom_field_joins ( +CREATE TABLE custom_field_joins ( id integer NOT NULL, custom_field_master_id integer, supporter_id integer, @@ -604,7 +612,7 @@ CREATE TABLE public.custom_field_joins ( -- Name: custom_field_joins_backup; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.custom_field_joins_backup ( +CREATE TABLE custom_field_joins_backup ( id integer NOT NULL, custom_field_master_id integer, supporter_id integer, @@ -619,7 +627,7 @@ CREATE TABLE public.custom_field_joins_backup ( -- Name: custom_field_joins_backup_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.custom_field_joins_backup_id_seq +CREATE SEQUENCE custom_field_joins_backup_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -631,14 +639,14 @@ CREATE SEQUENCE public.custom_field_joins_backup_id_seq -- Name: custom_field_joins_backup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.custom_field_joins_backup_id_seq OWNED BY public.custom_field_joins_backup.id; +ALTER SEQUENCE custom_field_joins_backup_id_seq OWNED BY custom_field_joins_backup.id; -- -- Name: custom_field_joins_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.custom_field_joins_id_seq +CREATE SEQUENCE custom_field_joins_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -650,14 +658,14 @@ CREATE SEQUENCE public.custom_field_joins_id_seq -- Name: custom_field_joins_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.custom_field_joins_id_seq OWNED BY public.custom_field_joins.id; +ALTER SEQUENCE custom_field_joins_id_seq OWNED BY custom_field_joins.id; -- -- Name: custom_field_masters; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.custom_field_masters ( +CREATE TABLE custom_field_masters ( id integer NOT NULL, name character varying(255), nonprofit_id integer, @@ -671,7 +679,7 @@ CREATE TABLE public.custom_field_masters ( -- Name: custom_field_masters_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.custom_field_masters_id_seq +CREATE SEQUENCE custom_field_masters_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -683,14 +691,14 @@ CREATE SEQUENCE public.custom_field_masters_id_seq -- Name: custom_field_masters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.custom_field_masters_id_seq OWNED BY public.custom_field_masters.id; +ALTER SEQUENCE custom_field_masters_id_seq OWNED BY custom_field_masters.id; -- -- Name: delayed_jobs; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.delayed_jobs ( +CREATE TABLE delayed_jobs ( id integer NOT NULL, priority integer DEFAULT 0 NOT NULL, attempts integer DEFAULT 0 NOT NULL, @@ -710,7 +718,7 @@ CREATE TABLE public.delayed_jobs ( -- Name: delayed_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.delayed_jobs_id_seq +CREATE SEQUENCE delayed_jobs_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -722,14 +730,14 @@ CREATE SEQUENCE public.delayed_jobs_id_seq -- Name: delayed_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.delayed_jobs_id_seq OWNED BY public.delayed_jobs.id; +ALTER SEQUENCE delayed_jobs_id_seq OWNED BY delayed_jobs.id; -- -- Name: direct_debit_details; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.direct_debit_details ( +CREATE TABLE direct_debit_details ( id integer NOT NULL, iban character varying(255), account_holder_name character varying(255), @@ -744,7 +752,7 @@ CREATE TABLE public.direct_debit_details ( -- Name: direct_debit_details_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.direct_debit_details_id_seq +CREATE SEQUENCE direct_debit_details_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -756,14 +764,14 @@ CREATE SEQUENCE public.direct_debit_details_id_seq -- Name: direct_debit_details_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.direct_debit_details_id_seq OWNED BY public.direct_debit_details.id; +ALTER SEQUENCE direct_debit_details_id_seq OWNED BY direct_debit_details.id; -- -- Name: disputes; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.disputes ( +CREATE TABLE disputes ( id integer NOT NULL, gross_amount integer, charge_id integer, @@ -780,7 +788,7 @@ CREATE TABLE public.disputes ( -- Name: disputes_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.disputes_id_seq +CREATE SEQUENCE disputes_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -792,14 +800,14 @@ CREATE SEQUENCE public.disputes_id_seq -- Name: disputes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.disputes_id_seq OWNED BY public.disputes.id; +ALTER SEQUENCE disputes_id_seq OWNED BY disputes.id; -- -- Name: donations; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.donations ( +CREATE TABLE donations ( id integer NOT NULL, amount integer, profile_id integer, @@ -834,7 +842,7 @@ CREATE TABLE public.donations ( -- Name: donations_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.donations_id_seq +CREATE SEQUENCE donations_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -846,14 +854,14 @@ CREATE SEQUENCE public.donations_id_seq -- Name: donations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.donations_id_seq OWNED BY public.donations.id; +ALTER SEQUENCE donations_id_seq OWNED BY donations.id; -- -- Name: donations_payment_imports; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.donations_payment_imports ( +CREATE TABLE donations_payment_imports ( donation_id integer, payment_import_id integer ); @@ -863,7 +871,7 @@ CREATE TABLE public.donations_payment_imports ( -- Name: email_lists; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.email_lists ( +CREATE TABLE email_lists ( id integer NOT NULL, nonprofit_id integer NOT NULL, tag_master_id integer NOT NULL, @@ -878,7 +886,7 @@ CREATE TABLE public.email_lists ( -- Name: email_lists_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.email_lists_id_seq +CREATE SEQUENCE email_lists_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -890,14 +898,14 @@ CREATE SEQUENCE public.email_lists_id_seq -- Name: email_lists_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.email_lists_id_seq OWNED BY public.email_lists.id; +ALTER SEQUENCE email_lists_id_seq OWNED BY email_lists.id; -- -- Name: email_settings; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.email_settings ( +CREATE TABLE email_settings ( id integer NOT NULL, user_id integer, nonprofit_id integer, @@ -913,7 +921,7 @@ CREATE TABLE public.email_settings ( -- Name: email_settings_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.email_settings_id_seq +CREATE SEQUENCE email_settings_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -925,14 +933,14 @@ CREATE SEQUENCE public.email_settings_id_seq -- Name: email_settings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.email_settings_id_seq OWNED BY public.email_settings.id; +ALTER SEQUENCE email_settings_id_seq OWNED BY email_settings.id; -- -- Name: event_discounts; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.event_discounts ( +CREATE TABLE event_discounts ( id integer NOT NULL, name character varying(255), code character varying(255), @@ -947,7 +955,7 @@ CREATE TABLE public.event_discounts ( -- Name: event_discounts_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.event_discounts_id_seq +CREATE SEQUENCE event_discounts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -959,14 +967,14 @@ CREATE SEQUENCE public.event_discounts_id_seq -- Name: event_discounts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.event_discounts_id_seq OWNED BY public.event_discounts.id; +ALTER SEQUENCE event_discounts_id_seq OWNED BY event_discounts.id; -- -- Name: events; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.events ( +CREATE TABLE events ( id integer NOT NULL, name character varying(255), tagline character varying(255), @@ -1006,7 +1014,7 @@ CREATE TABLE public.events ( -- Name: events_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.events_id_seq +CREATE SEQUENCE events_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1018,14 +1026,14 @@ CREATE SEQUENCE public.events_id_seq -- Name: events_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.events_id_seq OWNED BY public.events.id; +ALTER SEQUENCE events_id_seq OWNED BY events.id; -- -- Name: exports; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.exports ( +CREATE TABLE exports ( id integer NOT NULL, user_id integer, nonprofit_id integer, @@ -1044,7 +1052,7 @@ CREATE TABLE public.exports ( -- Name: exports_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.exports_id_seq +CREATE SEQUENCE exports_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1056,14 +1064,14 @@ CREATE SEQUENCE public.exports_id_seq -- Name: exports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.exports_id_seq OWNED BY public.exports.id; +ALTER SEQUENCE exports_id_seq OWNED BY exports.id; -- -- Name: full_contact_infos; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.full_contact_infos ( +CREATE TABLE full_contact_infos ( id integer NOT NULL, email character varying(255), full_name character varying(255), @@ -1087,7 +1095,7 @@ CREATE TABLE public.full_contact_infos ( -- Name: full_contact_infos_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.full_contact_infos_id_seq +CREATE SEQUENCE full_contact_infos_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1099,14 +1107,14 @@ CREATE SEQUENCE public.full_contact_infos_id_seq -- Name: full_contact_infos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.full_contact_infos_id_seq OWNED BY public.full_contact_infos.id; +ALTER SEQUENCE full_contact_infos_id_seq OWNED BY full_contact_infos.id; -- -- Name: full_contact_jobs; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.full_contact_jobs ( +CREATE TABLE full_contact_jobs ( id integer NOT NULL, supporter_id integer ); @@ -1116,7 +1124,7 @@ CREATE TABLE public.full_contact_jobs ( -- Name: full_contact_jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.full_contact_jobs_id_seq +CREATE SEQUENCE full_contact_jobs_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1128,14 +1136,14 @@ CREATE SEQUENCE public.full_contact_jobs_id_seq -- Name: full_contact_jobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.full_contact_jobs_id_seq OWNED BY public.full_contact_jobs.id; +ALTER SEQUENCE full_contact_jobs_id_seq OWNED BY full_contact_jobs.id; -- -- Name: full_contact_orgs; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.full_contact_orgs ( +CREATE TABLE full_contact_orgs ( id integer NOT NULL, is_primary boolean, name character varying(255), @@ -1153,7 +1161,7 @@ CREATE TABLE public.full_contact_orgs ( -- Name: full_contact_orgs_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.full_contact_orgs_id_seq +CREATE SEQUENCE full_contact_orgs_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1165,14 +1173,14 @@ CREATE SEQUENCE public.full_contact_orgs_id_seq -- Name: full_contact_orgs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.full_contact_orgs_id_seq OWNED BY public.full_contact_orgs.id; +ALTER SEQUENCE full_contact_orgs_id_seq OWNED BY full_contact_orgs.id; -- -- Name: full_contact_photos; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.full_contact_photos ( +CREATE TABLE full_contact_photos ( id integer NOT NULL, full_contact_info_id integer, type_id character varying(255), @@ -1187,7 +1195,7 @@ CREATE TABLE public.full_contact_photos ( -- Name: full_contact_photos_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.full_contact_photos_id_seq +CREATE SEQUENCE full_contact_photos_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1199,14 +1207,14 @@ CREATE SEQUENCE public.full_contact_photos_id_seq -- Name: full_contact_photos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.full_contact_photos_id_seq OWNED BY public.full_contact_photos.id; +ALTER SEQUENCE full_contact_photos_id_seq OWNED BY full_contact_photos.id; -- -- Name: full_contact_social_profiles; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.full_contact_social_profiles ( +CREATE TABLE full_contact_social_profiles ( id integer NOT NULL, full_contact_info_id integer, type_id character varying(255), @@ -1225,7 +1233,7 @@ CREATE TABLE public.full_contact_social_profiles ( -- Name: full_contact_social_profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.full_contact_social_profiles_id_seq +CREATE SEQUENCE full_contact_social_profiles_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1237,14 +1245,14 @@ CREATE SEQUENCE public.full_contact_social_profiles_id_seq -- Name: full_contact_social_profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.full_contact_social_profiles_id_seq OWNED BY public.full_contact_social_profiles.id; +ALTER SEQUENCE full_contact_social_profiles_id_seq OWNED BY full_contact_social_profiles.id; -- -- Name: full_contact_topics; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.full_contact_topics ( +CREATE TABLE full_contact_topics ( id integer NOT NULL, provider character varying(255), value character varying(255), @@ -1258,7 +1266,7 @@ CREATE TABLE public.full_contact_topics ( -- Name: full_contact_topics_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.full_contact_topics_id_seq +CREATE SEQUENCE full_contact_topics_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1270,14 +1278,14 @@ CREATE SEQUENCE public.full_contact_topics_id_seq -- Name: full_contact_topics_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.full_contact_topics_id_seq OWNED BY public.full_contact_topics.id; +ALTER SEQUENCE full_contact_topics_id_seq OWNED BY full_contact_topics.id; -- -- Name: image_attachments; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.image_attachments ( +CREATE TABLE image_attachments ( id integer NOT NULL, file character varying(255), parent_id integer, @@ -1291,7 +1299,7 @@ CREATE TABLE public.image_attachments ( -- Name: image_attachments_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.image_attachments_id_seq +CREATE SEQUENCE image_attachments_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1303,14 +1311,14 @@ CREATE SEQUENCE public.image_attachments_id_seq -- Name: image_attachments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.image_attachments_id_seq OWNED BY public.image_attachments.id; +ALTER SEQUENCE image_attachments_id_seq OWNED BY image_attachments.id; -- -- Name: imports; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.imports ( +CREATE TABLE imports ( id integer NOT NULL, row_count integer, date timestamp without time zone, @@ -1326,7 +1334,7 @@ CREATE TABLE public.imports ( -- Name: imports_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.imports_id_seq +CREATE SEQUENCE imports_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1338,14 +1346,14 @@ CREATE SEQUENCE public.imports_id_seq -- Name: imports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.imports_id_seq OWNED BY public.imports.id; +ALTER SEQUENCE imports_id_seq OWNED BY imports.id; -- -- Name: miscellaneous_np_infos; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.miscellaneous_np_infos ( +CREATE TABLE miscellaneous_np_infos ( id integer NOT NULL, donate_again_url character varying(255), nonprofit_id integer, @@ -1359,7 +1367,8 @@ CREATE TABLE public.miscellaneous_np_infos ( -- Name: miscellaneous_np_infos_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.miscellaneous_np_infos_id_seq +CREATE SEQUENCE miscellaneous_np_infos_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1371,14 +1380,14 @@ CREATE SEQUENCE public.miscellaneous_np_infos_id_seq -- Name: miscellaneous_np_infos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.miscellaneous_np_infos_id_seq OWNED BY public.miscellaneous_np_infos.id; +ALTER SEQUENCE miscellaneous_np_infos_id_seq OWNED BY miscellaneous_np_infos.id; -- -- Name: nonprofit_keys; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.nonprofit_keys ( +CREATE TABLE nonprofit_keys ( id integer NOT NULL, nonprofit_id integer, mailchimp_token text, @@ -1391,7 +1400,7 @@ CREATE TABLE public.nonprofit_keys ( -- Name: nonprofit_keys_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.nonprofit_keys_id_seq +CREATE SEQUENCE nonprofit_keys_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1403,14 +1412,14 @@ CREATE SEQUENCE public.nonprofit_keys_id_seq -- Name: nonprofit_keys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.nonprofit_keys_id_seq OWNED BY public.nonprofit_keys.id; +ALTER SEQUENCE nonprofit_keys_id_seq OWNED BY nonprofit_keys.id; -- -- Name: nonprofits; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.nonprofits ( +CREATE TABLE nonprofits ( id integer NOT NULL, created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, @@ -1461,7 +1470,7 @@ CREATE TABLE public.nonprofits ( card_failure_message_bottom text, fields_needed text, autocomplete_supporter_address boolean DEFAULT false, - currency character varying(255) DEFAULT 'usd'::character varying, + currency character varying(255) DEFAULT 'eur'::character varying, custom_layout character varying(255) ); @@ -1470,7 +1479,7 @@ CREATE TABLE public.nonprofits ( -- Name: nonprofits_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.nonprofits_id_seq +CREATE SEQUENCE nonprofits_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1482,14 +1491,14 @@ CREATE SEQUENCE public.nonprofits_id_seq -- Name: nonprofits_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.nonprofits_id_seq OWNED BY public.nonprofits.id; +ALTER SEQUENCE nonprofits_id_seq OWNED BY nonprofits.id; -- -- Name: offsite_payments; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.offsite_payments ( +CREATE TABLE offsite_payments ( id integer NOT NULL, gross_amount integer, kind character varying(255), @@ -1509,7 +1518,7 @@ CREATE TABLE public.offsite_payments ( -- Name: offsite_payments_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.offsite_payments_id_seq +CREATE SEQUENCE offsite_payments_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1521,14 +1530,14 @@ CREATE SEQUENCE public.offsite_payments_id_seq -- Name: offsite_payments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.offsite_payments_id_seq OWNED BY public.offsite_payments.id; +ALTER SEQUENCE offsite_payments_id_seq OWNED BY offsite_payments.id; -- -- Name: payment_imports; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.payment_imports ( +CREATE TABLE payment_imports ( id integer NOT NULL, user_id integer, nonprofit_id integer, @@ -1541,7 +1550,8 @@ CREATE TABLE public.payment_imports ( -- Name: payment_imports_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.payment_imports_id_seq +CREATE SEQUENCE payment_imports_id_seq + AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1553,14 +1563,14 @@ CREATE SEQUENCE public.payment_imports_id_seq -- Name: payment_imports_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.payment_imports_id_seq OWNED BY public.payment_imports.id; +ALTER SEQUENCE payment_imports_id_seq OWNED BY payment_imports.id; -- -- Name: payment_payouts; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.payment_payouts ( +CREATE TABLE payment_payouts ( id integer NOT NULL, donation_id integer, payout_id integer, @@ -1576,7 +1586,7 @@ CREATE TABLE public.payment_payouts ( -- Name: payment_payouts_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.payment_payouts_id_seq +CREATE SEQUENCE payment_payouts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1588,14 +1598,14 @@ CREATE SEQUENCE public.payment_payouts_id_seq -- Name: payment_payouts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.payment_payouts_id_seq OWNED BY public.payment_payouts.id; +ALTER SEQUENCE payment_payouts_id_seq OWNED BY payment_payouts.id; -- -- Name: payments; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.payments ( +CREATE TABLE payments ( id integer NOT NULL, gross_amount integer, refund_total integer, @@ -1617,7 +1627,7 @@ CREATE TABLE public.payments ( -- Name: payments_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.payments_id_seq +CREATE SEQUENCE payments_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1629,14 +1639,14 @@ CREATE SEQUENCE public.payments_id_seq -- Name: payments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.payments_id_seq OWNED BY public.payments.id; +ALTER SEQUENCE payments_id_seq OWNED BY payments.id; -- -- Name: payouts; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.payouts ( +CREATE TABLE payouts ( id integer NOT NULL, net_amount integer, nonprofit_id integer, @@ -1661,7 +1671,7 @@ CREATE TABLE public.payouts ( -- Name: payouts_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.payouts_id_seq +CREATE SEQUENCE payouts_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1673,14 +1683,14 @@ CREATE SEQUENCE public.payouts_id_seq -- Name: payouts_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.payouts_id_seq OWNED BY public.payouts.id; +ALTER SEQUENCE payouts_id_seq OWNED BY payouts.id; -- -- Name: profiles; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.profiles ( +CREATE TABLE profiles ( id integer NOT NULL, name character varying(255), created_at timestamp without time zone NOT NULL, @@ -1707,7 +1717,7 @@ CREATE TABLE public.profiles ( -- Name: profiles_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.profiles_id_seq +CREATE SEQUENCE profiles_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1719,14 +1729,14 @@ CREATE SEQUENCE public.profiles_id_seq -- Name: profiles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.profiles_id_seq OWNED BY public.profiles.id; +ALTER SEQUENCE profiles_id_seq OWNED BY profiles.id; -- -- Name: recurring_donations; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.recurring_donations ( +CREATE TABLE recurring_donations ( id integer NOT NULL, active boolean, paydate integer, @@ -1758,7 +1768,7 @@ CREATE TABLE public.recurring_donations ( -- Name: recurring_donations_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.recurring_donations_id_seq +CREATE SEQUENCE recurring_donations_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1770,14 +1780,14 @@ CREATE SEQUENCE public.recurring_donations_id_seq -- Name: recurring_donations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.recurring_donations_id_seq OWNED BY public.recurring_donations.id; +ALTER SEQUENCE recurring_donations_id_seq OWNED BY recurring_donations.id; -- -- Name: refunds; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.refunds ( +CREATE TABLE refunds ( id integer NOT NULL, amount integer, comment text, @@ -1796,7 +1806,7 @@ CREATE TABLE public.refunds ( -- Name: refunds_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.refunds_id_seq +CREATE SEQUENCE refunds_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1808,14 +1818,14 @@ CREATE SEQUENCE public.refunds_id_seq -- Name: refunds_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.refunds_id_seq OWNED BY public.refunds.id; +ALTER SEQUENCE refunds_id_seq OWNED BY refunds.id; -- -- Name: roles; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.roles ( +CREATE TABLE roles ( id integer NOT NULL, name character varying(255), user_id integer, @@ -1830,7 +1840,7 @@ CREATE TABLE public.roles ( -- Name: roles_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.roles_id_seq +CREATE SEQUENCE roles_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1842,14 +1852,14 @@ CREATE SEQUENCE public.roles_id_seq -- Name: roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.roles_id_seq OWNED BY public.roles.id; +ALTER SEQUENCE roles_id_seq OWNED BY roles.id; -- -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.schema_migrations ( +CREATE TABLE schema_migrations ( version character varying(255) NOT NULL ); @@ -1858,7 +1868,7 @@ CREATE TABLE public.schema_migrations ( -- Name: sessions; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.sessions ( +CREATE TABLE sessions ( id integer NOT NULL, session_id character varying(255) NOT NULL, data text, @@ -1871,7 +1881,7 @@ CREATE TABLE public.sessions ( -- Name: sessions_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.sessions_id_seq +CREATE SEQUENCE sessions_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1883,14 +1893,14 @@ CREATE SEQUENCE public.sessions_id_seq -- Name: sessions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.sessions_id_seq OWNED BY public.sessions.id; +ALTER SEQUENCE sessions_id_seq OWNED BY sessions.id; -- -- Name: source_tokens; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.source_tokens ( +CREATE TABLE source_tokens ( token uuid NOT NULL, expiration timestamp without time zone, tokenizable_id integer, @@ -1907,7 +1917,7 @@ CREATE TABLE public.source_tokens ( -- Name: supporter_emails; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.supporter_emails ( +CREATE TABLE supporter_emails ( id integer NOT NULL, "to" text, "from" character varying(255), @@ -1927,7 +1937,7 @@ CREATE TABLE public.supporter_emails ( -- Name: supporter_emails_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.supporter_emails_id_seq +CREATE SEQUENCE supporter_emails_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1939,14 +1949,14 @@ CREATE SEQUENCE public.supporter_emails_id_seq -- Name: supporter_emails_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.supporter_emails_id_seq OWNED BY public.supporter_emails.id; +ALTER SEQUENCE supporter_emails_id_seq OWNED BY supporter_emails.id; -- -- Name: supporter_notes; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.supporter_notes ( +CREATE TABLE supporter_notes ( id integer NOT NULL, content text, supporter_id integer, @@ -1961,7 +1971,7 @@ CREATE TABLE public.supporter_notes ( -- Name: supporter_notes_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.supporter_notes_id_seq +CREATE SEQUENCE supporter_notes_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1973,14 +1983,14 @@ CREATE SEQUENCE public.supporter_notes_id_seq -- Name: supporter_notes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.supporter_notes_id_seq OWNED BY public.supporter_notes.id; +ALTER SEQUENCE supporter_notes_id_seq OWNED BY supporter_notes.id; -- -- Name: supporters; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.supporters ( +CREATE TABLE supporters ( id integer NOT NULL, profile_id integer, nonprofit_id integer, @@ -2020,7 +2030,7 @@ CREATE TABLE public.supporters ( -- Name: supporters_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.supporters_id_seq +CREATE SEQUENCE supporters_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2032,14 +2042,14 @@ CREATE SEQUENCE public.supporters_id_seq -- Name: supporters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.supporters_id_seq OWNED BY public.supporters.id; +ALTER SEQUENCE supporters_id_seq OWNED BY supporters.id; -- -- Name: tag_joins; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.tag_joins ( +CREATE TABLE tag_joins ( id integer NOT NULL, tag_master_id integer, supporter_id integer, @@ -2052,7 +2062,7 @@ CREATE TABLE public.tag_joins ( -- Name: tag_joins_backup; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.tag_joins_backup ( +CREATE TABLE tag_joins_backup ( id integer NOT NULL, tag_master_id integer, supporter_id integer, @@ -2066,7 +2076,7 @@ CREATE TABLE public.tag_joins_backup ( -- Name: tag_joins_backup_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.tag_joins_backup_id_seq +CREATE SEQUENCE tag_joins_backup_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2078,14 +2088,14 @@ CREATE SEQUENCE public.tag_joins_backup_id_seq -- Name: tag_joins_backup_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.tag_joins_backup_id_seq OWNED BY public.tag_joins_backup.id; +ALTER SEQUENCE tag_joins_backup_id_seq OWNED BY tag_joins_backup.id; -- -- Name: tag_joins_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.tag_joins_id_seq +CREATE SEQUENCE tag_joins_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2097,14 +2107,14 @@ CREATE SEQUENCE public.tag_joins_id_seq -- Name: tag_joins_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.tag_joins_id_seq OWNED BY public.tag_joins.id; +ALTER SEQUENCE tag_joins_id_seq OWNED BY tag_joins.id; -- -- Name: tag_masters; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.tag_masters ( +CREATE TABLE tag_masters ( id integer NOT NULL, name character varying(255), nonprofit_id integer, @@ -2118,7 +2128,7 @@ CREATE TABLE public.tag_masters ( -- Name: tag_masters_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.tag_masters_id_seq +CREATE SEQUENCE tag_masters_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2130,14 +2140,14 @@ CREATE SEQUENCE public.tag_masters_id_seq -- Name: tag_masters_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.tag_masters_id_seq OWNED BY public.tag_masters.id; +ALTER SEQUENCE tag_masters_id_seq OWNED BY tag_masters.id; -- -- Name: ticket_levels; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.ticket_levels ( +CREATE TABLE ticket_levels ( id integer NOT NULL, event_id integer, amount integer, @@ -2158,7 +2168,7 @@ CREATE TABLE public.ticket_levels ( -- Name: ticket_levels_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.ticket_levels_id_seq +CREATE SEQUENCE ticket_levels_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2170,14 +2180,14 @@ CREATE SEQUENCE public.ticket_levels_id_seq -- Name: ticket_levels_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.ticket_levels_id_seq OWNED BY public.ticket_levels.id; +ALTER SEQUENCE ticket_levels_id_seq OWNED BY ticket_levels.id; -- -- Name: tickets; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.tickets ( +CREATE TABLE tickets ( id integer NOT NULL, ticket_level_id integer, charge_id integer, @@ -2202,7 +2212,7 @@ CREATE TABLE public.tickets ( -- Name: tickets_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.tickets_id_seq +CREATE SEQUENCE tickets_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2214,14 +2224,14 @@ CREATE SEQUENCE public.tickets_id_seq -- Name: tickets_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.tickets_id_seq OWNED BY public.tickets.id; +ALTER SEQUENCE tickets_id_seq OWNED BY tickets.id; -- -- Name: trackings; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.trackings ( +CREATE TABLE trackings ( id integer NOT NULL, utm_campaign character varying(255), utm_medium character varying(255), @@ -2237,7 +2247,7 @@ CREATE TABLE public.trackings ( -- Name: trackings_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.trackings_id_seq +CREATE SEQUENCE trackings_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2249,14 +2259,14 @@ CREATE SEQUENCE public.trackings_id_seq -- Name: trackings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.trackings_id_seq OWNED BY public.trackings.id; +ALTER SEQUENCE trackings_id_seq OWNED BY trackings.id; -- -- Name: users; Type: TABLE; Schema: public; Owner: - -- -CREATE TABLE public.users ( +CREATE TABLE users ( id integer NOT NULL, email character varying(255) DEFAULT ''::character varying NOT NULL, encrypted_password character varying(255) DEFAULT ''::character varying NOT NULL, @@ -2298,7 +2308,7 @@ CREATE TABLE public.users ( -- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- -CREATE SEQUENCE public.users_id_seq +CREATE SEQUENCE users_id_seq START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -2310,392 +2320,385 @@ CREATE SEQUENCE public.users_id_seq -- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - -- -ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id; +ALTER SEQUENCE users_id_seq OWNED BY users.id; -- -- Name: activities id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.activities ALTER COLUMN id SET DEFAULT nextval('public.activities_id_seq'::regclass); +ALTER TABLE ONLY activities ALTER COLUMN id SET DEFAULT nextval('activities_id_seq'::regclass); -- -- Name: bank_accounts id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.bank_accounts ALTER COLUMN id SET DEFAULT nextval('public.bank_accounts_id_seq'::regclass); +ALTER TABLE ONLY bank_accounts ALTER COLUMN id SET DEFAULT nextval('bank_accounts_id_seq'::regclass); -- -- Name: billing_plans id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.billing_plans ALTER COLUMN id SET DEFAULT nextval('public.billing_plans_id_seq'::regclass); +ALTER TABLE ONLY billing_plans ALTER COLUMN id SET DEFAULT nextval('billing_plans_id_seq'::regclass); -- -- Name: billing_subscriptions id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.billing_subscriptions ALTER COLUMN id SET DEFAULT nextval('public.billing_subscriptions_id_seq'::regclass); +ALTER TABLE ONLY billing_subscriptions ALTER COLUMN id SET DEFAULT nextval('billing_subscriptions_id_seq'::regclass); -- -- Name: campaign_gift_options id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.campaign_gift_options ALTER COLUMN id SET DEFAULT nextval('public.campaign_gift_options_id_seq'::regclass); +ALTER TABLE ONLY campaign_gift_options ALTER COLUMN id SET DEFAULT nextval('campaign_gift_options_id_seq'::regclass); -- -- Name: campaign_gifts id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.campaign_gifts ALTER COLUMN id SET DEFAULT nextval('public.campaign_gifts_id_seq'::regclass); +ALTER TABLE ONLY campaign_gifts ALTER COLUMN id SET DEFAULT nextval('campaign_gifts_id_seq'::regclass); -- -- Name: campaign_templates id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.campaign_templates ALTER COLUMN id SET DEFAULT nextval('public.campaign_templates_id_seq'::regclass); +ALTER TABLE ONLY campaign_templates ALTER COLUMN id SET DEFAULT nextval('campaign_templates_id_seq'::regclass); -- -- Name: campaigns id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.campaigns ALTER COLUMN id SET DEFAULT nextval('public.campaigns_id_seq'::regclass); +ALTER TABLE ONLY campaigns ALTER COLUMN id SET DEFAULT nextval('campaigns_id_seq'::regclass); -- -- Name: cards id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.cards ALTER COLUMN id SET DEFAULT nextval('public.cards_id_seq'::regclass); +ALTER TABLE ONLY cards ALTER COLUMN id SET DEFAULT nextval('cards_id_seq'::regclass); -- -- Name: charges id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.charges ALTER COLUMN id SET DEFAULT nextval('public.charges_id_seq'::regclass); +ALTER TABLE ONLY charges ALTER COLUMN id SET DEFAULT nextval('charges_id_seq'::regclass); -- -- Name: comments id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.comments ALTER COLUMN id SET DEFAULT nextval('public.comments_id_seq'::regclass); +ALTER TABLE ONLY comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass); -- -- Name: custom_field_joins id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.custom_field_joins ALTER COLUMN id SET DEFAULT nextval('public.custom_field_joins_id_seq'::regclass); +ALTER TABLE ONLY custom_field_joins ALTER COLUMN id SET DEFAULT nextval('custom_field_joins_id_seq'::regclass); -- -- Name: custom_field_joins_backup id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.custom_field_joins_backup ALTER COLUMN id SET DEFAULT nextval('public.custom_field_joins_backup_id_seq'::regclass); +ALTER TABLE ONLY custom_field_joins_backup ALTER COLUMN id SET DEFAULT nextval('custom_field_joins_backup_id_seq'::regclass); -- -- Name: custom_field_masters id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.custom_field_masters ALTER COLUMN id SET DEFAULT nextval('public.custom_field_masters_id_seq'::regclass); +ALTER TABLE ONLY custom_field_masters ALTER COLUMN id SET DEFAULT nextval('custom_field_masters_id_seq'::regclass); -- -- Name: delayed_jobs id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.delayed_jobs ALTER COLUMN id SET DEFAULT nextval('public.delayed_jobs_id_seq'::regclass); +ALTER TABLE ONLY delayed_jobs ALTER COLUMN id SET DEFAULT nextval('delayed_jobs_id_seq'::regclass); -- -- Name: direct_debit_details id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.direct_debit_details ALTER COLUMN id SET DEFAULT nextval('public.direct_debit_details_id_seq'::regclass); +ALTER TABLE ONLY direct_debit_details ALTER COLUMN id SET DEFAULT nextval('direct_debit_details_id_seq'::regclass); -- -- Name: disputes id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.disputes ALTER COLUMN id SET DEFAULT nextval('public.disputes_id_seq'::regclass); +ALTER TABLE ONLY disputes ALTER COLUMN id SET DEFAULT nextval('disputes_id_seq'::regclass); -- -- Name: donations id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.donations ALTER COLUMN id SET DEFAULT nextval('public.donations_id_seq'::regclass); +ALTER TABLE ONLY donations ALTER COLUMN id SET DEFAULT nextval('donations_id_seq'::regclass); -- -- Name: email_lists id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.email_lists ALTER COLUMN id SET DEFAULT nextval('public.email_lists_id_seq'::regclass); +ALTER TABLE ONLY email_lists ALTER COLUMN id SET DEFAULT nextval('email_lists_id_seq'::regclass); -- -- Name: email_settings id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.email_settings ALTER COLUMN id SET DEFAULT nextval('public.email_settings_id_seq'::regclass); +ALTER TABLE ONLY email_settings ALTER COLUMN id SET DEFAULT nextval('email_settings_id_seq'::regclass); -- -- Name: event_discounts id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.event_discounts ALTER COLUMN id SET DEFAULT nextval('public.event_discounts_id_seq'::regclass); +ALTER TABLE ONLY event_discounts ALTER COLUMN id SET DEFAULT nextval('event_discounts_id_seq'::regclass); -- -- Name: events id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.events ALTER COLUMN id SET DEFAULT nextval('public.events_id_seq'::regclass); +ALTER TABLE ONLY events ALTER COLUMN id SET DEFAULT nextval('events_id_seq'::regclass); -- -- Name: exports id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.exports ALTER COLUMN id SET DEFAULT nextval('public.exports_id_seq'::regclass); +ALTER TABLE ONLY exports ALTER COLUMN id SET DEFAULT nextval('exports_id_seq'::regclass); -- -- Name: full_contact_infos id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_infos ALTER COLUMN id SET DEFAULT nextval('public.full_contact_infos_id_seq'::regclass); +ALTER TABLE ONLY full_contact_infos ALTER COLUMN id SET DEFAULT nextval('full_contact_infos_id_seq'::regclass); -- -- Name: full_contact_jobs id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_jobs ALTER COLUMN id SET DEFAULT nextval('public.full_contact_jobs_id_seq'::regclass); +ALTER TABLE ONLY full_contact_jobs ALTER COLUMN id SET DEFAULT nextval('full_contact_jobs_id_seq'::regclass); -- -- Name: full_contact_orgs id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_orgs ALTER COLUMN id SET DEFAULT nextval('public.full_contact_orgs_id_seq'::regclass); +ALTER TABLE ONLY full_contact_orgs ALTER COLUMN id SET DEFAULT nextval('full_contact_orgs_id_seq'::regclass); -- -- Name: full_contact_photos id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_photos ALTER COLUMN id SET DEFAULT nextval('public.full_contact_photos_id_seq'::regclass); +ALTER TABLE ONLY full_contact_photos ALTER COLUMN id SET DEFAULT nextval('full_contact_photos_id_seq'::regclass); -- -- Name: full_contact_social_profiles id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_social_profiles ALTER COLUMN id SET DEFAULT nextval('public.full_contact_social_profiles_id_seq'::regclass); +ALTER TABLE ONLY full_contact_social_profiles ALTER COLUMN id SET DEFAULT nextval('full_contact_social_profiles_id_seq'::regclass); -- -- Name: full_contact_topics id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_topics ALTER COLUMN id SET DEFAULT nextval('public.full_contact_topics_id_seq'::regclass); +ALTER TABLE ONLY full_contact_topics ALTER COLUMN id SET DEFAULT nextval('full_contact_topics_id_seq'::regclass); -- -- Name: image_attachments id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.image_attachments ALTER COLUMN id SET DEFAULT nextval('public.image_attachments_id_seq'::regclass); +ALTER TABLE ONLY image_attachments ALTER COLUMN id SET DEFAULT nextval('image_attachments_id_seq'::regclass); -- -- Name: imports id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.imports ALTER COLUMN id SET DEFAULT nextval('public.imports_id_seq'::regclass); +ALTER TABLE ONLY imports ALTER COLUMN id SET DEFAULT nextval('imports_id_seq'::regclass); -- -- Name: miscellaneous_np_infos id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.miscellaneous_np_infos ALTER COLUMN id SET DEFAULT nextval('public.miscellaneous_np_infos_id_seq'::regclass); +ALTER TABLE ONLY miscellaneous_np_infos ALTER COLUMN id SET DEFAULT nextval('miscellaneous_np_infos_id_seq'::regclass); -- -- Name: nonprofit_keys id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.nonprofit_keys ALTER COLUMN id SET DEFAULT nextval('public.nonprofit_keys_id_seq'::regclass); +ALTER TABLE ONLY nonprofit_keys ALTER COLUMN id SET DEFAULT nextval('nonprofit_keys_id_seq'::regclass); -- -- Name: nonprofits id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.nonprofits ALTER COLUMN id SET DEFAULT nextval('public.nonprofits_id_seq'::regclass); +ALTER TABLE ONLY nonprofits ALTER COLUMN id SET DEFAULT nextval('nonprofits_id_seq'::regclass); -- -- Name: offsite_payments id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.offsite_payments ALTER COLUMN id SET DEFAULT nextval('public.offsite_payments_id_seq'::regclass); +ALTER TABLE ONLY offsite_payments ALTER COLUMN id SET DEFAULT nextval('offsite_payments_id_seq'::regclass); -- -- Name: payment_imports id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.payment_imports ALTER COLUMN id SET DEFAULT nextval('public.payment_imports_id_seq'::regclass); +ALTER TABLE ONLY payment_imports ALTER COLUMN id SET DEFAULT nextval('payment_imports_id_seq'::regclass); -- -- Name: payment_payouts id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.payment_payouts ALTER COLUMN id SET DEFAULT nextval('public.payment_payouts_id_seq'::regclass); +ALTER TABLE ONLY payment_payouts ALTER COLUMN id SET DEFAULT nextval('payment_payouts_id_seq'::regclass); -- -- Name: payments id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.payments ALTER COLUMN id SET DEFAULT nextval('public.payments_id_seq'::regclass); +ALTER TABLE ONLY payments ALTER COLUMN id SET DEFAULT nextval('payments_id_seq'::regclass); -- -- Name: payouts id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.payouts ALTER COLUMN id SET DEFAULT nextval('public.payouts_id_seq'::regclass); +ALTER TABLE ONLY payouts ALTER COLUMN id SET DEFAULT nextval('payouts_id_seq'::regclass); -- -- Name: profiles id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.profiles ALTER COLUMN id SET DEFAULT nextval('public.profiles_id_seq'::regclass); +ALTER TABLE ONLY profiles ALTER COLUMN id SET DEFAULT nextval('profiles_id_seq'::regclass); -- -- Name: recurring_donations id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.recurring_donations ALTER COLUMN id SET DEFAULT nextval('public.recurring_donations_id_seq'::regclass); +ALTER TABLE ONLY recurring_donations ALTER COLUMN id SET DEFAULT nextval('recurring_donations_id_seq'::regclass); -- -- Name: refunds id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.refunds ALTER COLUMN id SET DEFAULT nextval('public.refunds_id_seq'::regclass); +ALTER TABLE ONLY refunds ALTER COLUMN id SET DEFAULT nextval('refunds_id_seq'::regclass); -- -- Name: roles id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.roles ALTER COLUMN id SET DEFAULT nextval('public.roles_id_seq'::regclass); +ALTER TABLE ONLY roles ALTER COLUMN id SET DEFAULT nextval('roles_id_seq'::regclass); -- -- Name: sessions id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.sessions ALTER COLUMN id SET DEFAULT nextval('public.sessions_id_seq'::regclass); +ALTER TABLE ONLY sessions ALTER COLUMN id SET DEFAULT nextval('sessions_id_seq'::regclass); -- -- Name: supporter_emails id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.supporter_emails ALTER COLUMN id SET DEFAULT nextval('public.supporter_emails_id_seq'::regclass); +ALTER TABLE ONLY supporter_emails ALTER COLUMN id SET DEFAULT nextval('supporter_emails_id_seq'::regclass); -- -- Name: supporter_notes id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.supporter_notes ALTER COLUMN id SET DEFAULT nextval('public.supporter_notes_id_seq'::regclass); +ALTER TABLE ONLY supporter_notes ALTER COLUMN id SET DEFAULT nextval('supporter_notes_id_seq'::regclass); -- -- Name: supporters id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.supporters ALTER COLUMN id SET DEFAULT nextval('public.supporters_id_seq'::regclass); +ALTER TABLE ONLY supporters ALTER COLUMN id SET DEFAULT nextval('supporters_id_seq'::regclass); -- -- Name: tag_joins id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.tag_joins ALTER COLUMN id SET DEFAULT nextval('public.tag_joins_id_seq'::regclass); +ALTER TABLE ONLY tag_joins ALTER COLUMN id SET DEFAULT nextval('tag_joins_id_seq'::regclass); -- -- Name: tag_joins_backup id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.tag_joins_backup ALTER COLUMN id SET DEFAULT nextval('public.tag_joins_backup_id_seq'::regclass); +ALTER TABLE ONLY tag_joins_backup ALTER COLUMN id SET DEFAULT nextval('tag_joins_backup_id_seq'::regclass); -- -- Name: tag_masters id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.tag_masters ALTER COLUMN id SET DEFAULT nextval('public.tag_masters_id_seq'::regclass); +ALTER TABLE ONLY tag_masters ALTER COLUMN id SET DEFAULT nextval('tag_masters_id_seq'::regclass); -- -- Name: ticket_levels id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.ticket_levels ALTER COLUMN id SET DEFAULT nextval('public.ticket_levels_id_seq'::regclass); +ALTER TABLE ONLY ticket_levels ALTER COLUMN id SET DEFAULT nextval('ticket_levels_id_seq'::regclass); -- -- Name: tickets id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.tickets ALTER COLUMN id SET DEFAULT nextval('public.tickets_id_seq'::regclass); - - --- --- Name: trackings id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.trackings ALTER COLUMN id SET DEFAULT nextval('public.trackings_id_seq'::regclass); +ALTER TABLE ONLY tickets ALTER COLUMN id SET DEFAULT nextval('tickets_id_seq'::regclass); -- -- Name: users id; Type: DEFAULT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass); +ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass); -- -- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.ar_internal_metadata +ALTER TABLE ONLY ar_internal_metadata ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key); @@ -2703,7 +2706,7 @@ ALTER TABLE ONLY public.ar_internal_metadata -- Name: billing_plans billing_plan_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.billing_plans +ALTER TABLE ONLY billing_plans ADD CONSTRAINT billing_plan_pkey PRIMARY KEY (id); @@ -2711,7 +2714,7 @@ ALTER TABLE ONLY public.billing_plans -- Name: billing_subscriptions billing_subscriptions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.billing_subscriptions +ALTER TABLE ONLY billing_subscriptions ADD CONSTRAINT billing_subscriptions_pkey PRIMARY KEY (id); @@ -2719,7 +2722,7 @@ ALTER TABLE ONLY public.billing_subscriptions -- Name: activities campaign_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.activities +ALTER TABLE ONLY activities ADD CONSTRAINT campaign_activities_pkey PRIMARY KEY (id); @@ -2727,7 +2730,7 @@ ALTER TABLE ONLY public.activities -- Name: comments campaign_comments_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.comments +ALTER TABLE ONLY comments ADD CONSTRAINT campaign_comments_pkey PRIMARY KEY (id); @@ -2735,7 +2738,7 @@ ALTER TABLE ONLY public.comments -- Name: campaign_gift_options campaign_gift_options_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.campaign_gift_options +ALTER TABLE ONLY campaign_gift_options ADD CONSTRAINT campaign_gift_options_pkey PRIMARY KEY (id); @@ -2743,7 +2746,7 @@ ALTER TABLE ONLY public.campaign_gift_options -- Name: campaign_gifts campaign_gifts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.campaign_gifts +ALTER TABLE ONLY campaign_gifts ADD CONSTRAINT campaign_gifts_pkey PRIMARY KEY (id); @@ -2751,7 +2754,7 @@ ALTER TABLE ONLY public.campaign_gifts -- Name: campaign_templates campaign_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.campaign_templates +ALTER TABLE ONLY campaign_templates ADD CONSTRAINT campaign_templates_pkey PRIMARY KEY (id); @@ -2759,7 +2762,7 @@ ALTER TABLE ONLY public.campaign_templates -- Name: campaigns campaigns_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.campaigns +ALTER TABLE ONLY campaigns ADD CONSTRAINT campaigns_pkey PRIMARY KEY (id); @@ -2767,7 +2770,7 @@ ALTER TABLE ONLY public.campaigns -- Name: charges charges_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.charges +ALTER TABLE ONLY charges ADD CONSTRAINT charges_pkey PRIMARY KEY (id); @@ -2775,7 +2778,7 @@ ALTER TABLE ONLY public.charges -- Name: custom_field_joins_backup custom_field_joins_backup_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.custom_field_joins_backup +ALTER TABLE ONLY custom_field_joins_backup ADD CONSTRAINT custom_field_joins_backup_pkey PRIMARY KEY (id); @@ -2783,7 +2786,7 @@ ALTER TABLE ONLY public.custom_field_joins_backup -- Name: custom_field_joins custom_field_joins_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.custom_field_joins +ALTER TABLE ONLY custom_field_joins ADD CONSTRAINT custom_field_joins_pkey PRIMARY KEY (id); @@ -2791,7 +2794,7 @@ ALTER TABLE ONLY public.custom_field_joins -- Name: custom_field_masters custom_field_masters_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.custom_field_masters +ALTER TABLE ONLY custom_field_masters ADD CONSTRAINT custom_field_masters_pkey PRIMARY KEY (id); @@ -2799,7 +2802,7 @@ ALTER TABLE ONLY public.custom_field_masters -- Name: delayed_jobs delayed_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.delayed_jobs +ALTER TABLE ONLY delayed_jobs ADD CONSTRAINT delayed_jobs_pkey PRIMARY KEY (id); @@ -2807,7 +2810,7 @@ ALTER TABLE ONLY public.delayed_jobs -- Name: direct_debit_details direct_debit_details_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.direct_debit_details +ALTER TABLE ONLY direct_debit_details ADD CONSTRAINT direct_debit_details_pkey PRIMARY KEY (id); @@ -2815,7 +2818,7 @@ ALTER TABLE ONLY public.direct_debit_details -- Name: disputes disputes_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.disputes +ALTER TABLE ONLY disputes ADD CONSTRAINT disputes_pkey PRIMARY KEY (id); @@ -2823,7 +2826,7 @@ ALTER TABLE ONLY public.disputes -- Name: payment_payouts donation_disbursals_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.payment_payouts +ALTER TABLE ONLY payment_payouts ADD CONSTRAINT donation_disbursals_pkey PRIMARY KEY (id); @@ -2831,7 +2834,7 @@ ALTER TABLE ONLY public.payment_payouts -- Name: donations donations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.donations +ALTER TABLE ONLY donations ADD CONSTRAINT donations_pkey PRIMARY KEY (id); @@ -2839,7 +2842,7 @@ ALTER TABLE ONLY public.donations -- Name: profiles donor_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.profiles +ALTER TABLE ONLY profiles ADD CONSTRAINT donor_profiles_pkey PRIMARY KEY (id); @@ -2847,7 +2850,7 @@ ALTER TABLE ONLY public.profiles -- Name: email_settings email_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.email_settings +ALTER TABLE ONLY email_settings ADD CONSTRAINT email_settings_pkey PRIMARY KEY (id); @@ -2855,7 +2858,7 @@ ALTER TABLE ONLY public.email_settings -- Name: event_discounts event_discounts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.event_discounts +ALTER TABLE ONLY event_discounts ADD CONSTRAINT event_discounts_pkey PRIMARY KEY (id); @@ -2863,7 +2866,7 @@ ALTER TABLE ONLY public.event_discounts -- Name: events events_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.events +ALTER TABLE ONLY events ADD CONSTRAINT events_pkey PRIMARY KEY (id); @@ -2871,7 +2874,7 @@ ALTER TABLE ONLY public.events -- Name: exports exports_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.exports +ALTER TABLE ONLY exports ADD CONSTRAINT exports_pkey PRIMARY KEY (id); @@ -2879,7 +2882,7 @@ ALTER TABLE ONLY public.exports -- Name: full_contact_infos full_contact_infos_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_infos +ALTER TABLE ONLY full_contact_infos ADD CONSTRAINT full_contact_infos_pkey PRIMARY KEY (id); @@ -2887,7 +2890,7 @@ ALTER TABLE ONLY public.full_contact_infos -- Name: full_contact_jobs full_contact_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_jobs +ALTER TABLE ONLY full_contact_jobs ADD CONSTRAINT full_contact_jobs_pkey PRIMARY KEY (id); @@ -2895,7 +2898,7 @@ ALTER TABLE ONLY public.full_contact_jobs -- Name: full_contact_orgs full_contact_orgs_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_orgs +ALTER TABLE ONLY full_contact_orgs ADD CONSTRAINT full_contact_orgs_pkey PRIMARY KEY (id); @@ -2903,7 +2906,7 @@ ALTER TABLE ONLY public.full_contact_orgs -- Name: full_contact_photos full_contact_photos_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_photos +ALTER TABLE ONLY full_contact_photos ADD CONSTRAINT full_contact_photos_pkey PRIMARY KEY (id); @@ -2911,7 +2914,7 @@ ALTER TABLE ONLY public.full_contact_photos -- Name: full_contact_social_profiles full_contact_social_profiles_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_social_profiles +ALTER TABLE ONLY full_contact_social_profiles ADD CONSTRAINT full_contact_social_profiles_pkey PRIMARY KEY (id); @@ -2919,7 +2922,7 @@ ALTER TABLE ONLY public.full_contact_social_profiles -- Name: full_contact_topics full_contact_topics_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.full_contact_topics +ALTER TABLE ONLY full_contact_topics ADD CONSTRAINT full_contact_topics_pkey PRIMARY KEY (id); @@ -2927,7 +2930,7 @@ ALTER TABLE ONLY public.full_contact_topics -- Name: image_attachments image_attachments_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.image_attachments +ALTER TABLE ONLY image_attachments ADD CONSTRAINT image_attachments_pkey PRIMARY KEY (id); @@ -2935,7 +2938,7 @@ ALTER TABLE ONLY public.image_attachments -- Name: imports imports_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.imports +ALTER TABLE ONLY imports ADD CONSTRAINT imports_pkey PRIMARY KEY (id); @@ -2943,7 +2946,7 @@ ALTER TABLE ONLY public.imports -- Name: email_lists mailchimp_email_lists_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.email_lists +ALTER TABLE ONLY email_lists ADD CONSTRAINT mailchimp_email_lists_pkey PRIMARY KEY (id); @@ -2951,7 +2954,7 @@ ALTER TABLE ONLY public.email_lists -- Name: miscellaneous_np_infos miscellaneous_np_infos_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.miscellaneous_np_infos +ALTER TABLE ONLY miscellaneous_np_infos ADD CONSTRAINT miscellaneous_np_infos_pkey PRIMARY KEY (id); @@ -2959,7 +2962,7 @@ ALTER TABLE ONLY public.miscellaneous_np_infos -- Name: bank_accounts nonprofit_bank_accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.bank_accounts +ALTER TABLE ONLY bank_accounts ADD CONSTRAINT nonprofit_bank_accounts_pkey PRIMARY KEY (id); @@ -2967,7 +2970,7 @@ ALTER TABLE ONLY public.bank_accounts -- Name: payouts nonprofit_credits_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.payouts +ALTER TABLE ONLY payouts ADD CONSTRAINT nonprofit_credits_pkey PRIMARY KEY (id); @@ -2975,7 +2978,7 @@ ALTER TABLE ONLY public.payouts -- Name: nonprofit_keys nonprofit_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.nonprofit_keys +ALTER TABLE ONLY nonprofit_keys ADD CONSTRAINT nonprofit_keys_pkey PRIMARY KEY (id); @@ -2983,7 +2986,7 @@ ALTER TABLE ONLY public.nonprofit_keys -- Name: nonprofits npos_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.nonprofits +ALTER TABLE ONLY nonprofits ADD CONSTRAINT npos_pkey PRIMARY KEY (id); @@ -2991,7 +2994,7 @@ ALTER TABLE ONLY public.nonprofits -- Name: offsite_payments offsite_payments_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.offsite_payments +ALTER TABLE ONLY offsite_payments ADD CONSTRAINT offsite_payments_pkey PRIMARY KEY (id); @@ -2999,7 +3002,7 @@ ALTER TABLE ONLY public.offsite_payments -- Name: payment_imports payment_imports_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.payment_imports +ALTER TABLE ONLY payment_imports ADD CONSTRAINT payment_imports_pkey PRIMARY KEY (id); @@ -3007,7 +3010,7 @@ ALTER TABLE ONLY public.payment_imports -- Name: cards payment_methods_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.cards +ALTER TABLE ONLY cards ADD CONSTRAINT payment_methods_pkey PRIMARY KEY (id); @@ -3015,7 +3018,7 @@ ALTER TABLE ONLY public.cards -- Name: payments payments_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.payments +ALTER TABLE ONLY payments ADD CONSTRAINT payments_pkey PRIMARY KEY (id); @@ -3023,7 +3026,7 @@ ALTER TABLE ONLY public.payments -- Name: recurring_donations recurring_donations_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.recurring_donations +ALTER TABLE ONLY recurring_donations ADD CONSTRAINT recurring_donations_pkey PRIMARY KEY (id); @@ -3031,7 +3034,7 @@ ALTER TABLE ONLY public.recurring_donations -- Name: refunds refunds_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.refunds +ALTER TABLE ONLY refunds ADD CONSTRAINT refunds_pkey PRIMARY KEY (id); @@ -3039,7 +3042,7 @@ ALTER TABLE ONLY public.refunds -- Name: roles roles_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.roles +ALTER TABLE ONLY roles ADD CONSTRAINT roles_pkey PRIMARY KEY (id); @@ -3047,7 +3050,7 @@ ALTER TABLE ONLY public.roles -- Name: sessions sessions_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.sessions +ALTER TABLE ONLY sessions ADD CONSTRAINT sessions_pkey PRIMARY KEY (id); @@ -3055,7 +3058,7 @@ ALTER TABLE ONLY public.sessions -- Name: supporters supporter_data_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.supporters +ALTER TABLE ONLY supporters ADD CONSTRAINT supporter_data_pkey PRIMARY KEY (id); @@ -3063,7 +3066,7 @@ ALTER TABLE ONLY public.supporters -- Name: supporter_emails supporter_emails_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.supporter_emails +ALTER TABLE ONLY supporter_emails ADD CONSTRAINT supporter_emails_pkey PRIMARY KEY (id); @@ -3071,7 +3074,7 @@ ALTER TABLE ONLY public.supporter_emails -- Name: supporter_notes supporter_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.supporter_notes +ALTER TABLE ONLY supporter_notes ADD CONSTRAINT supporter_notes_pkey PRIMARY KEY (id); @@ -3079,7 +3082,7 @@ ALTER TABLE ONLY public.supporter_notes -- Name: tag_joins_backup tag_joins_backup_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.tag_joins_backup +ALTER TABLE ONLY tag_joins_backup ADD CONSTRAINT tag_joins_backup_pkey PRIMARY KEY (id); @@ -3087,7 +3090,7 @@ ALTER TABLE ONLY public.tag_joins_backup -- Name: tag_joins tag_joins_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.tag_joins +ALTER TABLE ONLY tag_joins ADD CONSTRAINT tag_joins_pkey PRIMARY KEY (id); @@ -3095,7 +3098,7 @@ ALTER TABLE ONLY public.tag_joins -- Name: tag_masters tag_masters_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.tag_masters +ALTER TABLE ONLY tag_masters ADD CONSTRAINT tag_masters_pkey PRIMARY KEY (id); @@ -3103,7 +3106,7 @@ ALTER TABLE ONLY public.tag_masters -- Name: ticket_levels ticket_levels_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.ticket_levels +ALTER TABLE ONLY ticket_levels ADD CONSTRAINT ticket_levels_pkey PRIMARY KEY (id); @@ -3111,7 +3114,7 @@ ALTER TABLE ONLY public.ticket_levels -- Name: tickets tickets_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.tickets +ALTER TABLE ONLY tickets ADD CONSTRAINT tickets_pkey PRIMARY KEY (id); @@ -3119,7 +3122,7 @@ ALTER TABLE ONLY public.tickets -- Name: trackings trackings_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.trackings +ALTER TABLE ONLY trackings ADD CONSTRAINT trackings_pkey PRIMARY KEY (id); @@ -3127,7 +3130,7 @@ ALTER TABLE ONLY public.trackings -- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.users +ALTER TABLE ONLY users ADD CONSTRAINT users_pkey PRIMARY KEY (id); @@ -3135,91 +3138,91 @@ ALTER TABLE ONLY public.users -- Name: custom_field_join_supporter_unique_idx; Type: INDEX; Schema: public; Owner: - -- -CREATE UNIQUE INDEX custom_field_join_supporter_unique_idx ON public.custom_field_joins USING btree (custom_field_master_id, supporter_id); +CREATE UNIQUE INDEX custom_field_join_supporter_unique_idx ON custom_field_joins USING btree (custom_field_master_id, supporter_id); -- -- Name: custom_field_joins_custom_field_master_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX custom_field_joins_custom_field_master_id ON public.custom_field_joins USING btree (custom_field_master_id); +CREATE INDEX custom_field_joins_custom_field_master_id ON custom_field_joins USING btree (custom_field_master_id); -- -- Name: delayed_jobs_priority; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX delayed_jobs_priority ON public.delayed_jobs USING btree (priority, run_at); +CREATE INDEX delayed_jobs_priority ON delayed_jobs USING btree (priority, run_at); -- -- Name: donations_amount; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX donations_amount ON public.donations USING btree (amount); +CREATE INDEX donations_amount ON donations USING btree (amount); -- -- Name: donations_campaign_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX donations_campaign_id ON public.donations USING btree (campaign_id); +CREATE INDEX donations_campaign_id ON donations USING btree (campaign_id); -- -- Name: donations_designation; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX donations_designation ON public.donations USING btree (lower(designation)); +CREATE INDEX donations_designation ON donations USING btree (lower(designation)); -- -- Name: donations_event_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX donations_event_id ON public.donations USING btree (event_id); +CREATE INDEX donations_event_id ON donations USING btree (event_id); -- -- Name: donations_supporter_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX donations_supporter_id ON public.donations USING btree (supporter_id); +CREATE INDEX donations_supporter_id ON donations USING btree (supporter_id); -- -- Name: index_activities_on_nonprofit_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_activities_on_nonprofit_id ON public.activities USING btree (nonprofit_id); +CREATE INDEX index_activities_on_nonprofit_id ON activities USING btree (nonprofit_id); -- -- Name: index_activities_on_supporter_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_activities_on_supporter_id ON public.activities USING btree (supporter_id); +CREATE INDEX index_activities_on_supporter_id ON activities USING btree (supporter_id); -- -- Name: index_campaign_gifts_on_campaign_gift_option_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_campaign_gifts_on_campaign_gift_option_id ON public.campaign_gifts USING btree (campaign_gift_option_id); +CREATE INDEX index_campaign_gifts_on_campaign_gift_option_id ON campaign_gifts USING btree (campaign_gift_option_id); -- -- Name: index_cards_on_id_and_holder_type_and_holder_id_and_inactive; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_cards_on_id_and_holder_type_and_holder_id_and_inactive ON public.cards USING btree (id, holder_type, holder_id, inactive); +CREATE INDEX index_cards_on_id_and_holder_type_and_holder_id_and_inactive ON cards USING btree (id, holder_type, holder_id, inactive); -- -- Name: index_charges_on_payment_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_charges_on_payment_id ON public.charges USING btree (payment_id); +CREATE INDEX index_charges_on_payment_id ON charges USING btree (payment_id); -- @@ -3233,14 +3236,14 @@ CREATE INDEX index_donations_on_event_id ON public.donations USING btree (event_ -- Name: index_exports_on_nonprofit_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_exports_on_nonprofit_id ON public.exports USING btree (nonprofit_id); +CREATE INDEX index_exports_on_nonprofit_id ON exports USING btree (nonprofit_id); -- -- Name: index_exports_on_user_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_exports_on_user_id ON public.exports USING btree (user_id); +CREATE INDEX index_exports_on_user_id ON exports USING btree (user_id); -- @@ -3261,35 +3264,35 @@ CREATE INDEX index_refunds_on_payment_id ON public.refunds USING btree (payment_ -- Name: index_sessions_on_session_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_sessions_on_session_id ON public.sessions USING btree (session_id); +CREATE INDEX index_sessions_on_session_id ON sessions USING btree (session_id); -- -- Name: index_sessions_on_updated_at; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_sessions_on_updated_at ON public.sessions USING btree (updated_at); +CREATE INDEX index_sessions_on_updated_at ON sessions USING btree (updated_at); -- -- Name: index_source_tokens_on_expiration; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_source_tokens_on_expiration ON public.source_tokens USING btree (expiration); +CREATE INDEX index_source_tokens_on_expiration ON source_tokens USING btree (expiration); -- -- Name: index_source_tokens_on_token; Type: INDEX; Schema: public; Owner: - -- -CREATE UNIQUE INDEX index_source_tokens_on_token ON public.source_tokens USING btree (token); +CREATE UNIQUE INDEX index_source_tokens_on_token ON source_tokens USING btree (token); -- -- Name: index_source_tokens_on_tokenizable_id_and_tokenizable_type; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_source_tokens_on_tokenizable_id_and_tokenizable_type ON public.source_tokens USING btree (tokenizable_id, tokenizable_type); +CREATE INDEX index_source_tokens_on_tokenizable_id_and_tokenizable_type ON source_tokens USING btree (tokenizable_id, tokenizable_type); -- @@ -3303,21 +3306,21 @@ CREATE INDEX index_supporter_notes_on_supporter_id ON public.supporter_notes USI -- Name: index_supporters_on_deleted; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_supporters_on_deleted ON public.supporters USING btree (deleted); +CREATE INDEX index_supporters_on_deleted ON supporters USING btree (deleted); -- -- Name: index_supporters_on_import_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_supporters_on_import_id ON public.supporters USING btree (import_id); +CREATE INDEX index_supporters_on_import_id ON supporters USING btree (import_id); -- -- Name: index_supporters_on_name; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_supporters_on_name ON public.supporters USING btree (name); +CREATE INDEX index_supporters_on_name ON supporters USING btree (name); -- @@ -3345,147 +3348,147 @@ CREATE INDEX index_tickets_on_supporter_id ON public.tickets USING btree (suppor -- Name: index_users_on_confirmation_token; Type: INDEX; Schema: public; Owner: - -- -CREATE UNIQUE INDEX index_users_on_confirmation_token ON public.users USING btree (confirmation_token); +CREATE UNIQUE INDEX index_users_on_confirmation_token ON users USING btree (confirmation_token); -- -- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: - -- -CREATE UNIQUE INDEX index_users_on_email ON public.users USING btree (email); +CREATE UNIQUE INDEX index_users_on_email ON users USING btree (email); -- -- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: - -- -CREATE UNIQUE INDEX index_users_on_reset_password_token ON public.users USING btree (reset_password_token); +CREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token); -- -- Name: payments_date; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX payments_date ON public.payments USING btree (date); +CREATE INDEX payments_date ON payments USING btree (date); -- -- Name: payments_donation_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX payments_donation_id ON public.payments USING btree (donation_id); +CREATE INDEX payments_donation_id ON payments USING btree (donation_id); -- -- Name: payments_gross_amount; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX payments_gross_amount ON public.payments USING btree (gross_amount); +CREATE INDEX payments_gross_amount ON payments USING btree (gross_amount); -- -- Name: payments_kind; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX payments_kind ON public.payments USING btree (kind); +CREATE INDEX payments_kind ON payments USING btree (kind); -- -- Name: payments_nonprofit_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX payments_nonprofit_id ON public.payments USING btree (nonprofit_id); +CREATE INDEX payments_nonprofit_id ON payments USING btree (nonprofit_id); -- -- Name: payments_search_idx; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX payments_search_idx ON public.payments USING gin (search_vectors); +CREATE INDEX payments_search_idx ON payments USING gin (search_vectors); -- -- Name: payments_supporter_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX payments_supporter_id ON public.payments USING btree (supporter_id); +CREATE INDEX payments_supporter_id ON payments USING btree (supporter_id); -- -- Name: payments_towards; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX payments_towards ON public.payments USING btree (lower((towards)::text)); +CREATE INDEX payments_towards ON payments USING btree (lower((towards)::text)); -- -- Name: supporters_created_at; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX supporters_created_at ON public.supporters USING btree (created_at) WHERE (deleted <> true); +CREATE INDEX supporters_created_at ON supporters USING btree (created_at) WHERE (deleted <> true); -- -- Name: supporters_email; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX supporters_email ON public.supporters USING btree (lower((email)::text)) WHERE (deleted <> true); +CREATE INDEX supporters_email ON supporters USING btree (lower((email)::text)) WHERE (deleted <> true); -- -- Name: supporters_general_idx; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX supporters_general_idx ON public.supporters USING gin (to_tsvector('english'::regconfig, (((COALESCE(name, ''::character varying))::text || ' '::text) || (COALESCE(email, ''::character varying))::text))); +CREATE INDEX supporters_general_idx ON supporters USING gin (to_tsvector('english'::regconfig, (((COALESCE(name, ''::character varying))::text || ' '::text) || (COALESCE(email, ''::character varying))::text))); -- -- Name: supporters_lower_name; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX supporters_lower_name ON public.supporters USING btree (lower((name)::text)) WHERE (deleted <> true); +CREATE INDEX supporters_lower_name ON supporters USING btree (lower((name)::text)) WHERE (deleted <> true); -- -- Name: supporters_nonprofit_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX supporters_nonprofit_id ON public.supporters USING btree (nonprofit_id) WHERE (deleted <> true); +CREATE INDEX supporters_nonprofit_id ON supporters USING btree (nonprofit_id) WHERE (deleted <> true); -- -- Name: supporters_search_idx; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX supporters_search_idx ON public.supporters USING gin (search_vectors); +CREATE INDEX supporters_search_idx ON supporters USING gin (search_vectors); -- -- Name: tag_join_supporter_unique_idx; Type: INDEX; Schema: public; Owner: - -- -CREATE UNIQUE INDEX tag_join_supporter_unique_idx ON public.tag_joins USING btree (tag_master_id, supporter_id); +CREATE UNIQUE INDEX tag_join_supporter_unique_idx ON tag_joins USING btree (tag_master_id, supporter_id); -- -- Name: tag_joins_supporter_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX tag_joins_supporter_id ON public.tag_joins USING btree (supporter_id); +CREATE INDEX tag_joins_supporter_id ON tag_joins USING btree (supporter_id); -- -- Name: tag_joins_tag_master_id; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX tag_joins_tag_master_id ON public.tag_joins USING btree (tag_master_id); +CREATE INDEX tag_joins_tag_master_id ON tag_joins USING btree (tag_master_id); -- -- Name: unique_schema_migrations; Type: INDEX; Schema: public; Owner: - -- -CREATE UNIQUE INDEX unique_schema_migrations ON public.schema_migrations USING btree (version); +CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version); -- @@ -4422,3 +4425,5 @@ INSERT INTO schema_migrations (version) VALUES ('201810202124319'); INSERT INTO schema_migrations (version) VALUES ('201810202124320'); +INSERT INTO schema_migrations (version) VALUES ('201810202124321'); + From dcb4a375852a9091588e49c917721748f110e94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 30 May 2018 16:49:18 +0200 Subject: [PATCH 21/81] Add banner to campaigns --- app/models/campaign.rb | 6 +-- .../campaign_banner_image_uploader.rb | 16 ++++++++ .../campaign_custom_banner_uploader.rb | 39 ------------------- app/views/campaigns/_settings_modal.html.erb | 27 +++++++------ .../components/_upload_banner_image.html.erb | 31 +++++++++++++++ .../safety_around_water.html.erb | 9 ++++- ...202124322_add_banner_image_to_campaigns.rb | 5 +++ db/structure.sql | 5 ++- 8 files changed, 82 insertions(+), 56 deletions(-) create mode 100644 app/uploaders/campaign_banner_image_uploader.rb delete mode 100644 app/uploaders/campaign_custom_banner_uploader.rb create mode 100644 app/views/components/_upload_banner_image.html.erb create mode 100644 db/migrate/201810202124322_add_banner_image_to_campaigns.rb diff --git a/app/models/campaign.rb b/app/models/campaign.rb index 9570760e..3185816e 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -13,8 +13,8 @@ class Campaign < ActiveRecord::Base :remove_main_image, # for carrierwave :background_image, :remove_background_image, #bool carrierwave - :custom_banner, - :remove_custom_banner, + :banner_image, + :remove_banner_image, :published, :video_url, #str :vimeo_video_id, @@ -52,7 +52,7 @@ class Campaign < ActiveRecord::Base mount_uploader :main_image, CampaignMainImageUploader mount_uploader :background_image, CampaignBackgroundImageUploader - mount_uploader :custom_banner, CampaignCustomBannerUploader + mount_uploader :banner_image, CampaignBannerImageUploader has_many :donations has_many :charges, through: :donations diff --git a/app/uploaders/campaign_banner_image_uploader.rb b/app/uploaders/campaign_banner_image_uploader.rb new file mode 100644 index 00000000..1c4010d7 --- /dev/null +++ b/app/uploaders/campaign_banner_image_uploader.rb @@ -0,0 +1,16 @@ +# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later +class CampaignBannerImageUploader < CarrierWave::Uploader::Base + include CarrierWave::MiniMagick + + def store_dir + "uploads/campaigns/#{mounted_as}/#{model.id}" + end + + def extension_white_list + %w(jpg jpeg png) + end + + def cache_dir + "#{Rails.root}/tmp/uploads" + end +end diff --git a/app/uploaders/campaign_custom_banner_uploader.rb b/app/uploaders/campaign_custom_banner_uploader.rb deleted file mode 100644 index bfc2d652..00000000 --- a/app/uploaders/campaign_custom_banner_uploader.rb +++ /dev/null @@ -1,39 +0,0 @@ -class CampaignCustomBannerUploader < CarrierWave::Uploader::Base - - # Include RMagick or MiniMagick support: - # include CarrierWave::RMagick - include CarrierWave::MiniMagick - - # Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility: - # include Sprockets::Helpers::RailsHelper - # include Sprockets::Helpers::IsolatedHelper - - # Override the directory where uploaded files will be stored. - # This is a sensible default for uploaders that are meant to be mounted: - def store_dir - "uploads/campaigns/#{mounted_as}/#{model.id}" - end - - # Process files as they are uploaded: - # process :scale => [200, 300] - # - # def scale(width, height) - # # do something - # end - - # Add a white list of extensions which are allowed to be uploaded. - # For images you might use something like this: - def extension_white_list - %w(jpg jpeg png) - end - - # Override the filename of the uploaded files: - # Avoid using model.id or version_name here, see uploader/store.rb for details. - # def filename - # "something.jpg" if original_filename - # end - - def cache_dir - "#{Rails.root}/tmp/uploads" - end -end diff --git a/app/views/campaigns/_settings_modal.html.erb b/app/views/campaigns/_settings_modal.html.erb index 199fb825..a9e6dca3 100644 --- a/app/views/campaigns/_settings_modal.html.erb +++ b/app/views/campaigns/_settings_modal.html.erb @@ -92,20 +92,25 @@
- <% if @nonprofit.custom_layout %> -
- -
+
+
+ <% if @nonprofit.custom_layout %>
- +

Custom image at the very top of the campaign page

-
- Edit - -
+ <% if @campaign.banner_image_url.present? %> +
+ + Edit +
+ <% else %> + + + Add Image + + <% end %>
-
- <% end %> + <% end %>
diff --git a/app/views/components/_upload_banner_image.html.erb b/app/views/components/_upload_banner_image.html.erb new file mode 100644 index 00000000..39eeec10 --- /dev/null +++ b/app/views/components/_upload_banner_image.html.erb @@ -0,0 +1,31 @@ +<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%> + diff --git a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb index 52e080c1..f0e5319e 100644 --- a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb +++ b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb @@ -63,9 +63,10 @@ <% hide_title = @campaign.hide_title && @campaign_background_image ? true : false %> <% css_style = current_campaign_editor? ? "style='margin-top: 0'" : '' %> -
-
+
+ +
<%= render 'components/fundraising_pages/header', image_url: @campaign_background_image, @@ -167,6 +168,10 @@ end_point: "/nonprofits/#{@nonprofit.id}/campaigns/#{@campaign.id}", image_url: @campaign_background_image, input_name: 'campaign[background_image]' %> + <%= render 'components/upload_banner_image', + end_point: "/nonprofits/#{@nonprofit.id}/campaigns/#{@campaign.id}", + image_url: @campaign.banner_image.url, + input_name: 'campaign[banner_image]' %> <%= render 'components/custom_receipt_modal', title: 'Campaign Receipt Message', type: 'campaign', diff --git a/db/migrate/201810202124322_add_banner_image_to_campaigns.rb b/db/migrate/201810202124322_add_banner_image_to_campaigns.rb new file mode 100644 index 00000000..8be6b2a9 --- /dev/null +++ b/db/migrate/201810202124322_add_banner_image_to_campaigns.rb @@ -0,0 +1,5 @@ +class AddBannerImageToCampaigns < ActiveRecord::Migration + def change + add_column :campaigns, :banner_image, :string + end +end diff --git a/db/structure.sql b/db/structure.sql index 5c08fffa..10aa0424 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -449,7 +449,8 @@ CREATE TABLE campaigns ( campaign_template_id integer, parent_campaign_id integer, reason_for_supporting text, - default_reason_for_supporting text + default_reason_for_supporting text, + banner_image character varying(255) ); @@ -4427,3 +4428,5 @@ INSERT INTO schema_migrations (version) VALUES ('201810202124320'); INSERT INTO schema_migrations (version) VALUES ('201810202124321'); +INSERT INTO schema_migrations (version) VALUES ('201810202124322'); + From 79427774e512dc46344677877065d058d4d8f6f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 30 May 2018 16:49:48 +0200 Subject: [PATCH 22/81] Allow setting banner on campaing --- app/views/campaigns/_settings_modal.html.erb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/views/campaigns/_settings_modal.html.erb b/app/views/campaigns/_settings_modal.html.erb index a9e6dca3..00a6a8be 100644 --- a/app/views/campaigns/_settings_modal.html.erb +++ b/app/views/campaigns/_settings_modal.html.erb @@ -112,6 +112,13 @@ <% end %> +
+ +

Use it to suggest a good, pre-filled reason for campaigners

+ +
+
+
From e1287683f598d2c0c12f1e0211da77da3160b5cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 30 May 2018 17:00:06 +0200 Subject: [PATCH 23/81] Better slugs for campaigns --- app/controllers/campaigns_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index 00fa75c3..815959a1 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -160,7 +160,10 @@ class CampaignsController < ApplicationController p2p_params = params.except(:nonprofit_id, :summary,:goal_amount) p2p_params.merge!(parent_campaign.child_params) - p2p_params[:slug] = Format::Url.convert_to_slug "#{p2p_params[:name]}-#{profile.name}" + + base_slug = Format::Url.convert_to_slug "#{p2p_params[:name]}-#{profile.name}" + algo = SlugP2pCampaignNamingAlgorithm.new(p2p_params[:nonprofit_id]) + p2p_params[:slug] = algo.create_copy_name(base_slug) campaign = Campaign.create(p2p_params) From 3167a53da8b838c4e6d6d532a0ecce4d50ce6bbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 30 May 2018 17:35:37 +0200 Subject: [PATCH 24/81] Style banner uploading, show banner for all campaings --- .../common/image_uploader.css.scss | 10 ++++ app/views/campaigns/_settings_modal.html.erb | 47 ++++++++++--------- .../components/_upload_banner_image.html.erb | 4 +- 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/app/assets/stylesheets/common/image_uploader.css.scss b/app/assets/stylesheets/common/image_uploader.css.scss index 7956c881..be673d96 100644 --- a/app/assets/stylesheets/common/image_uploader.css.scss +++ b/app/assets/stylesheets/common/image_uploader.css.scss @@ -19,6 +19,11 @@ width: 192px; } +.image-upload--banner { + width: 100%; + height: auto; +} + .image-upload span { margin-top: 30px; padding: 5px; @@ -28,6 +33,11 @@ @include basicShadow; } +.image-upload--banner span { + margin-top: 30px; + margin-bottom: 30px; +} + .image-upload--large span { margin-top: 60px; } diff --git a/app/views/campaigns/_settings_modal.html.erb b/app/views/campaigns/_settings_modal.html.erb index 00a6a8be..a8a80de0 100644 --- a/app/views/campaigns/_settings_modal.html.erb +++ b/app/views/campaigns/_settings_modal.html.erb @@ -93,32 +93,35 @@

-
- <% if @nonprofit.custom_layout %> -
- -

Custom image at the very top of the campaign page

- <% if @campaign.banner_image_url.present? %> -
- - Edit -
- <% else %> - - - Add Image - - <% end %> -
- <% end %> - +
- -

Use it to suggest a good, pre-filled reason for campaigners

- + +

Custom image at the very top of the campaign page

+ <% if @campaign.banner_image_url.present? %> +
+ + Edit +
+ <% else %> + + + Add Image + + <% end %>
+ <% if @campaign.parent_campaign.blank? %> +
+
+
+ +

Use it to suggest a good, pre-filled reason for campaigners

+ +
+
+ <% end %> +
diff --git a/app/views/components/_upload_banner_image.html.erb b/app/views/components/_upload_banner_image.html.erb index 39eeec10..b21bb7d2 100644 --- a/app/views/components/_upload_banner_image.html.erb +++ b/app/views/components/_upload_banner_image.html.erb @@ -7,7 +7,7 @@

Select and upload a banner image for this page.

For best results, the image should be 1000px by 120px in size.

-
)'> +
)'> Select
@@ -15,7 +15,7 @@

-
+
From e948b0ce4558b11eb1f31176a7ebd1b6384b3eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 30 May 2018 19:15:44 +0200 Subject: [PATCH 25/81] Fix showing default reason in p2p creation form --- app/views/campaigns/_new_peer_to_peer_modal.html.erb | 8 ++++---- app/views/campaigns/_settings_modal.html.erb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/campaigns/_new_peer_to_peer_modal.html.erb b/app/views/campaigns/_new_peer_to_peer_modal.html.erb index 2a83360a..2c472c0c 100644 --- a/app/views/campaigns/_new_peer_to_peer_modal.html.erb +++ b/app/views/campaigns/_new_peer_to_peer_modal.html.erb @@ -19,11 +19,12 @@ +

Personalize your campaign page with your name and photo to greatly increase the success of your campaign.

- +
@@ -42,7 +43,6 @@ - Uploading your picture will greatly increase the chances of a successful campaign.
Upload @@ -64,9 +64,9 @@
- Be concise and honest about your intentions. +

Your passion is contagious! Inspire giving by telling your network why you’re getting involved in this campaign.

- +
diff --git a/app/views/campaigns/_settings_modal.html.erb b/app/views/campaigns/_settings_modal.html.erb index a8a80de0..d6c39777 100644 --- a/app/views/campaigns/_settings_modal.html.erb +++ b/app/views/campaigns/_settings_modal.html.erb @@ -117,7 +117,7 @@

Use it to suggest a good, pre-filled reason for campaigners

- +
<% end %> From 0a5d78b7f4695a27050cf5bfd3c1f011da83c4e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 30 May 2018 19:16:24 +0200 Subject: [PATCH 26/81] Remove custom ERB file, add campaigner profile and p2p button to campaign page --- .../safety_around_water.css.scss | 78 -------- .../stylesheets/campaigns/show/page.css.scss | 37 ++++ app/controllers/campaigns_controller.rb | 33 +--- app/views/campaigns/show.html.erb | 28 ++- .../_campaigner_profile.html.erb | 23 +++ .../fundraising_pages/_header.html.erb | 5 + .../safety_around_water.html.erb | 185 ------------------ 7 files changed, 91 insertions(+), 298 deletions(-) delete mode 100644 app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss create mode 100644 app/views/components/fundraising_pages/_campaigner_profile.html.erb delete mode 100644 app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb diff --git a/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss b/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss deleted file mode 100644 index c6d8efe4..00000000 --- a/app/assets/stylesheets/campaigns/custom_layout/safety_around_water.css.scss +++ /dev/null @@ -1,78 +0,0 @@ -@import 'mixins'; -@import 'common/fundraisers'; - -main button, main a.js-contributeButton { - background: #01a490 !important; -} - -main a.button { - background: #0089d0 !important; - color: white; -} - -main .button.edit, main .button--tiny.edit { - color: white; -} - -main { - width: 1200px; - margin: auto; -} - -main > header { - display: flex; - justify-content: center; - align-items: center; - margin: auto; -} - -body > .ymca-banner { - margin: auto; - width: 100vw; - height: 120px; - background-color: #01a490; -} - -main > header div.fundraisingHeader--image-container { - background-position: 0 -80px; -} - -img.fundraisingHeader--image-aspectRatio { - width: 1200px; - height: 500px; -} - -main > .container { - max-width: none; - margin-top: 15px; -} - -.campaigner-profile { - display: flex; - flex-wrap: nowrap; - align-items: baseline; -} - -.campaigner-profile > figure { - display: flex; - flex-direction: column; - align-items: center; - margin-right: 20px; - align-self: flex-start; -} - -.campaigner-profile > figure > .avatar { - flex-basis: 20%; -} - -.avatar > img { - width: 150px; - height: 150px; - clip-path: circle(50% at center); -} - -.campaigner-profile > figure > figcaption { - flex-basis: 55%; - padding: 15px; - text-align: left; -} diff --git a/app/assets/stylesheets/campaigns/show/page.css.scss b/app/assets/stylesheets/campaigns/show/page.css.scss index 53e60010..d603ffc2 100644 --- a/app/assets/stylesheets/campaigns/show/page.css.scss +++ b/app/assets/stylesheets/campaigns/show/page.css.scss @@ -103,6 +103,43 @@ margin-right: 1px; } +.campaigner-profile { + display: flex; + flex-wrap: nowrap; + align-items: baseline; +} + +.campaigner-profile > figure { + display: flex; + flex-direction: column; + align-items: center; + margin: auto 10px; + align-self: flex-start; +} + +.campaigner-profile > figure > .avatar { + flex-basis: 20%; + min-width: 100px; + height: auto; +} + +.avatar > img { + clip-path: circle(50% at center); +} + +.campaigner-profile > figure > figcaption { + flex-basis: 40%; + padding: 15px; + text-align: left; +} + +.campaigner-profile .reason { + flex-basis: 60%; +} + +.campaigner-profile .pastelBox-body { + min-height: 100px; +} @media screen and (max-width: 1000px) { .box, diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index 815959a1..12fcdefa 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -44,14 +44,6 @@ class CampaignsController < ApplicationController end @campaign_background_image = FetchBackgroundImage.with_model(@campaign) - - if @nonprofit.custom_layout.blank? - respond_to do |format| - format.html - end - else - render template: "nonprofits/custom_campaign_layouts/" + @nonprofit.custom_layout - end end def activities @@ -122,29 +114,6 @@ class CampaignsController < ApplicationController @profile = current_user.profile if current_user end - def custom_layout - @campaign = current_campaign - @timezone = Format::Timezone.to_proxy(current_nonprofit.timezone) - if @campaign.deleted && !current_campaign_editor? - redirect_to nonprofit_path(current_nonprofit) - flash[:notice] = "Sorry, we couldn't find that campaign" - return - end - @nonprofit = current_nonprofit - @url = Format::Url.concat(root_url, @campaign.url) - - if @campaign.parent_campaign - @parent_campaign = @campaign.parent_campaign - @peer_to_peer_campaign_param = @parent_campaign.id - else - @peer_to_peer_campaign_param = @campaign.id - end - - @campaign_background_image = FetchBackgroundImage.with_model(@campaign) - - render template: "nonprofits/custom_campaign_layouts/safety_around_water" - end - private def check_nonprofit_status @@ -160,7 +129,7 @@ class CampaignsController < ApplicationController p2p_params = params.except(:nonprofit_id, :summary,:goal_amount) p2p_params.merge!(parent_campaign.child_params) - + base_slug = Format::Url.convert_to_slug "#{p2p_params[:name]}-#{profile.name}" algo = SlugP2pCampaignNamingAlgorithm.new(p2p_params[:nonprofit_id]) p2p_params[:slug] = algo.create_copy_name(base_slug) diff --git a/app/views/campaigns/show.html.erb b/app/views/campaigns/show.html.erb index 6218ffa3..b88c22a6 100644 --- a/app/views/campaigns/show.html.erb +++ b/app/views/campaigns/show.html.erb @@ -64,14 +64,14 @@ image_url: @campaign_background_image, is_editor: current_campaign_editor?, hide_title: @campaign.hide_title && @campaign_background_image, - header_content_partial: 'header_content' %> + header_content_partial: 'header_content', + banner_image_url: @campaign.banner_image&.url %> <%= render 'components/preview_mode_notification' %>
- -
+
<%= render 'campaign_media' %>
@@ -85,6 +85,14 @@ <% end %> + <% if !@campaign.parent_campaign %> + + <% end %> +
@@ -105,6 +113,20 @@
+ <% if @campaign.parent_campaign %> + <%= render 'components/fundraising_pages/campaigner_profile', + profile: @campaign.profile, + campaign_name: @campaign.name, + reason_for_supporting: @campaign.reason_for_supporting + %> + +
+ + Start Your Own Campaign for <%= @nonprofit.name %> + +
+ <% end %> +
diff --git a/app/views/components/fundraising_pages/_campaigner_profile.html.erb b/app/views/components/fundraising_pages/_campaigner_profile.html.erb new file mode 100644 index 00000000..79aca61c --- /dev/null +++ b/app/views/components/fundraising_pages/_campaigner_profile.html.erb @@ -0,0 +1,23 @@ +
+
+
+
+ +
+
+

<%= profile.name %>

+

<%= profile.city %>

+ <% if profile.state_code && profile.city %> +

<%= profile.city_state %> <%= profile.state_code %>

+ <% end %> +
+
+ +
+
What's your reason for supporting <%= campaign_name %>?
+
+ <%= reason_for_supporting %> +
+
+
+
diff --git a/app/views/components/fundraising_pages/_header.html.erb b/app/views/components/fundraising_pages/_header.html.erb index af6f2574..4acb733b 100644 --- a/app/views/components/fundraising_pages/_header.html.erb +++ b/app/views/components/fundraising_pages/_header.html.erb @@ -6,6 +6,11 @@
id='js-fundraisingHeader'> + <% if banner_image_url %> +
+ +
+ <% end %> diff --git a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb b/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb deleted file mode 100644 index f0e5319e..00000000 --- a/app/views/nonprofits/custom_campaign_layouts/safety_around_water.html.erb +++ /dev/null @@ -1,185 +0,0 @@ -<%= content_for(:title_prefix) { "#{@campaign.name} - #{@campaign.nonprofit.name} | ".html_safe } %> -<% content_for(:fixed_position_cta_hidden) {'hidden'} %> -<%= content_for(:meta_description) {raw @campaign.summary} %> -<% @brand_color = @nonprofit.brand_color ? @nonprofit.brand_color : nil %> - -<%= content_for :javascripts do %> - - <%= render 'schema', campaign: @campaign, url: @url %> - <%= render 'common/froala' if current_campaign_editor? %> - - <%= IncludeAsset.js '/client/js/campaigns/show/page.js' %> -<% end %> - -<%= content_for :stylesheets do %> - <%= stylesheet_link_tag 'campaigns/show/page' %> - <%= stylesheet_link_tag 'campaigns/edit/page' %> - <%= stylesheet_link_tag 'campaigns/custom_layout/safety_around_water' %> - -<% end %> - -<% content_for :head do %> - -<% end %> - -<%= content_for :facebook_tags do %> - - - -<% end %> - -<%= content_for :twitter_tags do %> - - - -<% end %> - -<% if current_campaign_editor? %> - <%= render 'admin_top_nav' %> -<% end %> - -<%= render '/components/trial_bar' if QueryBillingSubscriptions.currently_in_trial?(@nonprofit.id) %> - -<% hide_title = @campaign.hide_title && @campaign_background_image ? true : false %> -<% css_style = current_campaign_editor? ? "style='margin-top: 0'" : '' %> - -
-
- -
- - <%= render 'components/fundraising_pages/header', - image_url: @campaign_background_image, - is_editor: current_campaign_editor?, - hide_title: @campaign.hide_title && @campaign_background_image, - header_content_partial: 'header_content' %> - - <%= render 'components/preview_mode_notification' %> - -
-
- <%= render 'campaign_media' %> -
- -
- - <% if current_campaign_editor? %> - - - <% end %> - - <% if !@campaign.parent_campaign %> - - <% end %> - - -
- - - -
- - <% if @campaign.parent_campaign %> -
- -
-
-
- /> -
-
-

<%= @campaign.profile.name %>

-

<%= @campaign.profile.city %>

- <% if @campaign.profile.state_code && @campaign.profile.city %> -

<%= @campaign.profile.city_state %> <%= @campaign.profile.state_code %>

- <% end %> -
-
- -
-
I am supporting the Y because…
-
- <%= @campaign.reason_for_supporting %> -
- - - Start Your Own Campaign for <%= @nonprofit.name %> - -
-
-
- <% end %> - -
-

<%= @campaign.name %>

- -
- <%= raw @campaign.body %> -
- - <% unless @campaign.hide_activity_feed %> -
- <%= render 'components/activity_feed' %> -
- <% end %> -
-
-
- -<% if current_campaign_editor? %> - <%= render 'settings_modal' %> - <%= render 'video_modal' %> - <%= render 'donations/campaign_new_offline_modal' %> - <%= render 'campaign_gift_options/manage_modal'%> - <%= render 'campaign_gift_options/form_modal'%> - <%= render 'components/upload_background_image', - end_point: "/nonprofits/#{@nonprofit.id}/campaigns/#{@campaign.id}", - image_url: @campaign_background_image, - input_name: 'campaign[background_image]' %> - <%= render 'components/upload_banner_image', - end_point: "/nonprofits/#{@nonprofit.id}/campaigns/#{@campaign.id}", - image_url: @campaign.banner_image.url, - input_name: 'campaign[banner_image]' %> - <%= render 'components/custom_receipt_modal', - title: 'Campaign Receipt Message', - type: 'campaign', - path: nonprofit_campaign_path(@nonprofit, @campaign), - key: 'campaign[receipt_message]', - text: @campaign.receipt_message %> - <%= render 'components/duplicate_fundraiser_modal', type: 'campaign' %> -<% end %> - -<%= render 'components/share_modal', name: @campaign.name, type: 'campaign' %> -<%= render 'common/email_share_modal', fundraiser: @campaign.name, fundraiser_url: @url %> From 74ba1cf069673624828d499173ecafbfd238a808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 30 May 2018 19:22:02 +0200 Subject: [PATCH 27/81] Remove custom_layout from nonprofit --- config/routes.rb | 3 --- db/migrate/201810202124317_add_custom_layout_to_nonprofit.rb | 5 ----- db/structure.sql | 3 +-- 3 files changed, 1 insertion(+), 10 deletions(-) delete mode 100644 db/migrate/201810202124317_add_custom_layout_to_nonprofit.rb diff --git a/config/routes.rb b/config/routes.rb index df8e90a1..11259460 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -149,8 +149,6 @@ Commitchange::Application.routes.draw do resources(:campaign_gift_options, {only: [:index, :show, :create, :update, :destroy]}) do put(:update_order, {on: :collection}) end - - get 'custom_layout', controller: 'campaigns', action: 'custom_layout' end resource(:billing_subscription, {only: [:create]}) do @@ -228,7 +226,6 @@ Commitchange::Application.routes.draw do # Campaigns match ':state_code/:city/:name/campaigns' => 'campaigns#index' match ':state_code/:city/:name/campaigns/:campaign_slug' => 'campaigns#show', :as => :campaign_loc - match ':state_code/:city/:name/campaigns/:campaign_slug/custom_layout' => 'campaigns#custom_layout', :as => :campaign_loc match ':state_code/:city/:name/campaigns/:campaign_slug/supporters' => 'campaigns/supporters#index', :as => :campaign_loc match '/peer-to-peer' => 'campaigns#peer_to_peer' diff --git a/db/migrate/201810202124317_add_custom_layout_to_nonprofit.rb b/db/migrate/201810202124317_add_custom_layout_to_nonprofit.rb deleted file mode 100644 index db58866a..00000000 --- a/db/migrate/201810202124317_add_custom_layout_to_nonprofit.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCustomLayoutToNonprofit < ActiveRecord::Migration - def change - add_column :nonprofits, :custom_layout, :string - end -end diff --git a/db/structure.sql b/db/structure.sql index 10aa0424..e01c9ee5 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1471,8 +1471,7 @@ CREATE TABLE nonprofits ( card_failure_message_bottom text, fields_needed text, autocomplete_supporter_address boolean DEFAULT false, - currency character varying(255) DEFAULT 'eur'::character varying, - custom_layout character varying(255) + currency character varying(255) DEFAULT 'eur'::character varying ); From 539d8f472a3f167bfb3ac0b1884849864bbcef1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasia=20Jarmo=C5=82kowicz?= Date: Wed, 30 May 2018 19:45:51 +0200 Subject: [PATCH 28/81] Peer-to-peer editors can only edit goal amount --- app/controllers/campaigns_controller.rb | 2 +- app/models/campaign.rb | 4 + app/views/campaigns/_settings_modal.html.erb | 331 +++++++++++-------- app/views/campaigns/show.html.erb | 6 +- 4 files changed, 204 insertions(+), 139 deletions(-) diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index 12fcdefa..4939fdfb 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -36,7 +36,7 @@ class CampaignsController < ApplicationController @nonprofit = current_nonprofit @url = Format::Url.concat(root_url, @campaign.url) - if @campaign.parent_campaign + if @campaign.child_campaign? @parent_campaign = @campaign.parent_campaign @peer_to_peer_campaign_param = @parent_campaign.id else diff --git a/app/models/campaign.rb b/app/models/campaign.rb index 3185816e..b9a49488 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -179,6 +179,10 @@ class Campaign < ActiveRecord::Base attributes.except(*excluded_for_peer_to_peer) end + def child_campaign? + true if parent_campaign.present? + end + def user_reason_for_supporting if reason_for_supporting.present? reason_for_supporting diff --git a/app/views/campaigns/_settings_modal.html.erb b/app/views/campaigns/_settings_modal.html.erb index d6c39777..cf6dc367 100644 --- a/app/views/campaigns/_settings_modal.html.erb +++ b/app/views/campaigns/_settings_modal.html.erb @@ -4,6 +4,19 @@ <%= render 'common/modal_header', title: 'Campaign Settings' %> + <% if @campaign.child_campaign? %> + + + <% else %> +
+ <% end %> -
- -
- - -
- -

-
- -
- - - - - + <% end %> From 9db02dd4093e5495cddcf3682a7e4020729dcc91 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 7 Nov 2018 10:59:04 -0600 Subject: [PATCH 50/81] Fix missing tag --- app/views/nonprofits/campaign_templates/_new_modal.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/nonprofits/campaign_templates/_new_modal.html.erb b/app/views/nonprofits/campaign_templates/_new_modal.html.erb index dfc089fe..dcbbab09 100644 --- a/app/views/nonprofits/campaign_templates/_new_modal.html.erb +++ b/app/views/nonprofits/campaign_templates/_new_modal.html.erb @@ -94,6 +94,7 @@
Upload +
From 758cbf11342bee568371197d69df5c69381bdb0e Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 7 Nov 2018 11:42:53 -0600 Subject: [PATCH 51/81] Add create_from_template route --- config/routes.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 11259460..52784d25 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -110,7 +110,9 @@ Commitchange::Application.routes.draw do post(:send_code) end - resources(:campaign_templates, {only: [:index, :create, :show, :destroy]}) + resources(:campaign_templates, {only: [:index, :create, :show, :destroy]}) do + post :create_from_template, on: :collection + end post 'tracking', controller: 'trackings', action: 'create' end From e378434b30730edd38641430d189fdaf73c29b61 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 7 Nov 2018 11:43:23 -0600 Subject: [PATCH 52/81] Add in create_from_template call --- app/views/nonprofits/campaign_templates/index.html.erb | 2 +- client/js/campaign_templates/new/wizard.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/views/nonprofits/campaign_templates/index.html.erb b/app/views/nonprofits/campaign_templates/index.html.erb index 5f767909..67ef2622 100644 --- a/app/views/nonprofits/campaign_templates/index.html.erb +++ b/app/views/nonprofits/campaign_templates/index.html.erb @@ -54,7 +54,7 @@

Create campaign from template - + Delete template diff --git a/client/js/campaign_templates/new/wizard.js b/client/js/campaign_templates/new/wizard.js index 130dc20b..5c78e588 100644 --- a/client/js/campaign_templates/new/wizard.js +++ b/client/js/campaign_templates/new/wizard.js @@ -74,10 +74,10 @@ appl.def('delete_template', function(id) { }) -appl.def('create_campaign', function(campaign_params) { +appl.def('create_campaign_from_template', function(campaign_params) { appl.def('loading', true) - var url = '/nonprofits/' + app.nonprofit_id + '/campaigns' + var url = '/nonprofits/' + app.nonprofit_id + '/campaigns/create_from_template' var params = new Object params.campaign = JSON.parse(campaign_params) params.campaign.profile_id = app.profile_id @@ -103,3 +103,5 @@ appl.def('create_campaign', function(campaign_params) { appl.notify(req.responseText) }) }) + + From 4a1f86c121b4dfae1cadeb96d0cf4f2ecf3da0b6 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 7 Nov 2018 13:53:08 -0600 Subject: [PATCH 53/81] Fix routes --- config/routes.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 52784d25..3453e80e 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -110,9 +110,7 @@ Commitchange::Application.routes.draw do post(:send_code) end - resources(:campaign_templates, {only: [:index, :create, :show, :destroy]}) do - post :create_from_template, on: :collection - end + resources(:campaign_templates, {only: [:index, :create, :show, :destroy]}) post 'tracking', controller: 'trackings', action: 'create' end @@ -148,6 +146,7 @@ Commitchange::Application.routes.draw do get(:activities, {on: :member}) put(:soft_delete, {on: :member}) get(:name_and_id, {on: :collection}) + post :create_from_template, on: :collection resources(:campaign_gift_options, {only: [:index, :show, :create, :update, :destroy]}) do put(:update_order, {on: :collection}) end From 743fd2a15ec20edf0ef2c0a1bc46fc2873f59e17 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 7 Nov 2018 13:54:46 -0600 Subject: [PATCH 54/81] remove empty spec --- spec/views/campaign_templates/index.html.erb_spec.rb | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 spec/views/campaign_templates/index.html.erb_spec.rb diff --git a/spec/views/campaign_templates/index.html.erb_spec.rb b/spec/views/campaign_templates/index.html.erb_spec.rb deleted file mode 100644 index d0b202bf..00000000 --- a/spec/views/campaign_templates/index.html.erb_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe "campaign_templates/index.html.erb", :type => :view do - pending "add some examples to (or delete) #{__FILE__}" -end From 4dddccdf46fca401b75533c4a4a2393b196ba093 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 7 Nov 2018 14:17:55 -0600 Subject: [PATCH 55/81] Create from template campaigns handles name collisions --- app/controllers/campaigns_controller.rb | 18 ++++++++++++++++++ .../campaign_templates/index.html.erb | 2 +- client/js/campaign_templates/new/wizard.js | 6 +++--- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index 24256c7c..a41bc556 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -5,6 +5,7 @@ class CampaignsController < ApplicationController helper_method :current_campaign_editor? before_filter :authenticate_confirmed_user!, only: [:create, :name_and_id, :duplicate] before_filter :authenticate_campaign_editor!, only: [:update, :soft_delete] + before_filter :authenticate_nonprofit_user!, only: [:create_via_template] before_filter :check_nonprofit_status, only: [:index, :show] def index @@ -65,6 +66,23 @@ class CampaignsController < ApplicationController end end + def create_from_template + Qx.transaction do + campaign_template = current_nonprofit.campaign_templates.find(params[:campaign_template_id]) + + save_params = campaign_template.create_campaign_params + + save_params['slug'] = SlugCopyNamingAlgorithm.new(Campaign, current_nonprofit.id).create_copy_name(Format::Url.convert_to_slug(save_params['name'])) + + save_params['name'] = NameCopyNamingAlgorithm.new(Campaign, current_nonprofit.id).create_copy_name(save_params['name']) + save_params['profile_id'] = params[:profile_id] + campaign = current_nonprofit.campaigns.create save_params + campaign.update_attribute(:main_image, campaign_template.main_image) unless !campaign_template.main_image rescue AWS::S3::Errors::NoSuchKey + + json_saved campaign, 'Campaign created! Well done.' + end + end + def update Time.use_zone(current_nonprofit.timezone || 'UTC') do params[:campaign][:end_datetime] = Chronic.parse(params[:campaign][:end_datetime]) if params[:campaign][:end_datetime].present? diff --git a/app/views/nonprofits/campaign_templates/index.html.erb b/app/views/nonprofits/campaign_templates/index.html.erb index 67ef2622..2a76891a 100644 --- a/app/views/nonprofits/campaign_templates/index.html.erb +++ b/app/views/nonprofits/campaign_templates/index.html.erb @@ -54,7 +54,7 @@

Create campaign from template - + Delete template diff --git a/client/js/campaign_templates/new/wizard.js b/client/js/campaign_templates/new/wizard.js index 5c78e588..062464a8 100644 --- a/client/js/campaign_templates/new/wizard.js +++ b/client/js/campaign_templates/new/wizard.js @@ -79,8 +79,8 @@ appl.def('create_campaign_from_template', function(campaign_params) { var url = '/nonprofits/' + app.nonprofit_id + '/campaigns/create_from_template' var params = new Object - params.campaign = JSON.parse(campaign_params) - params.campaign.profile_id = app.profile_id + params = JSON.parse(campaign_params) + params.profile_id = app.profile_id return new Promise(function(resolve, reject) { var req = new XMLHttpRequest() @@ -96,7 +96,7 @@ appl.def('create_campaign_from_template', function(campaign_params) { appl.def('loading', false) appl.notify('Redirecting you to your campaign…') var campaign_id = JSON.parse(req.response).id - appl.redirect(url + '/' + campaign_id) + appl.redirect('/nonprofits/' + app.nonprofit_id + '/campaigns/' + campaign_id) }) .catch(function(req) { appl.def('loading', false) From 293fa1d63a417ad8d86243a7f1a0828374ddda59 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 7 Nov 2018 14:48:11 -0600 Subject: [PATCH 56/81] WIP --- app/assets/stylesheets/campaigns/common.css.scss | 8 ++++++++ .../stylesheets/campaigns/peer_to_peer/page.css.scss | 7 +------ app/assets/stylesheets/campaigns/show/page.css.scss | 1 + app/views/components/_upload_banner_image.html.erb | 2 +- app/views/components/fundraising_pages/_header.html.erb | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 app/assets/stylesheets/campaigns/common.css.scss diff --git a/app/assets/stylesheets/campaigns/common.css.scss b/app/assets/stylesheets/campaigns/common.css.scss new file mode 100644 index 00000000..b57d4e68 --- /dev/null +++ b/app/assets/stylesheets/campaigns/common.css.scss @@ -0,0 +1,8 @@ +/* License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later */ + +body > .campaign-banner { + margin: auto; + width: 980px; + max-height: 120px; + text-align: center; +} \ No newline at end of file diff --git a/app/assets/stylesheets/campaigns/peer_to_peer/page.css.scss b/app/assets/stylesheets/campaigns/peer_to_peer/page.css.scss index 9c4a8ee2..826971ee 100644 --- a/app/assets/stylesheets/campaigns/peer_to_peer/page.css.scss +++ b/app/assets/stylesheets/campaigns/peer_to_peer/page.css.scss @@ -6,18 +6,13 @@ @import 'components/simple_tabs'; @import 'pikaday'; @import 'common/image_uploader'; +@import '../common'; body { padding: 0; background: $fog; } -body > .campaign-banner { - margin: auto; - width: 980px; - max-height: 120px; - text-align: center; -} main { display: block; diff --git a/app/assets/stylesheets/campaigns/show/page.css.scss b/app/assets/stylesheets/campaigns/show/page.css.scss index d603ffc2..2ae85615 100644 --- a/app/assets/stylesheets/campaigns/show/page.css.scss +++ b/app/assets/stylesheets/campaigns/show/page.css.scss @@ -13,6 +13,7 @@ @import 'components/draggable'; @import 'gift_levels'; @import '../../nonprofits/donation_form/form'; +@import '../common'; .button--gift { font-size: 17px; diff --git a/app/views/components/_upload_banner_image.html.erb b/app/views/components/_upload_banner_image.html.erb index 2f9fd633..e397bb60 100644 --- a/app/views/components/_upload_banner_image.html.erb +++ b/app/views/components/_upload_banner_image.html.erb @@ -5,7 +5,7 @@

Select and upload a banner image for this page.

-

For best results, the image should be 1000px by 120px in size.

+

For best results, the image should be 980px by 120px in size.

)'> Select diff --git a/app/views/components/fundraising_pages/_header.html.erb b/app/views/components/fundraising_pages/_header.html.erb index 4acb733b..2a1a1f22 100644 --- a/app/views/components/fundraising_pages/_header.html.erb +++ b/app/views/components/fundraising_pages/_header.html.erb @@ -7,7 +7,7 @@
id='js-fundraisingHeader'> <% if banner_image_url %> -
+
<% end %> @@ -21,4 +21,4 @@ <% end %>
- + From a3795b660109e62d9439a226dc1ea07fd0e357c2 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 7 Nov 2018 16:10:46 -0600 Subject: [PATCH 57/81] remove profile image --- app/views/campaigns/_new_peer_to_peer_modal.html.erb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/app/views/campaigns/_new_peer_to_peer_modal.html.erb b/app/views/campaigns/_new_peer_to_peer_modal.html.erb index 7b0a14cd..7e3e0df2 100644 --- a/app/views/campaigns/_new_peer_to_peer_modal.html.erb +++ b/app/views/campaigns/_new_peer_to_peer_modal.html.erb @@ -38,18 +38,6 @@
-
-
- -
- Upload - -
-
-
- <%= render 'components/forms/submit_button', button_text: 'Next', scope: 'new_p2p_campaign_wiz', branded: true %> From 64db067e2c2985408d2fd7aa62cb19186ec55f06 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Wed, 7 Nov 2018 16:48:34 -0600 Subject: [PATCH 58/81] Fix lack of styling of campaign banners and properly clips images --- app/assets/stylesheets/campaigns/common.css.scss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/campaigns/common.css.scss b/app/assets/stylesheets/campaigns/common.css.scss index b57d4e68..accf7b7c 100644 --- a/app/assets/stylesheets/campaigns/common.css.scss +++ b/app/assets/stylesheets/campaigns/common.css.scss @@ -1,8 +1,9 @@ /* License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later */ -body > .campaign-banner { +body .campaign-banner { margin: auto; width: 980px; max-height: 120px; text-align: center; + overflow: hidden; } \ No newline at end of file From f255d6e3ecd22a84d2ce2c9b571678550d73767f Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 8 Nov 2018 12:38:02 -0600 Subject: [PATCH 59/81] Simplify the child_campaign? code --- app/models/campaign.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/models/campaign.rb b/app/models/campaign.rb index dfce67e7..0f568f72 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -180,11 +180,7 @@ class Campaign < ActiveRecord::Base end def child_campaign? - if parent_campaign.present? - true - else - false - end + parent_campaign.present? end def parent_campaign? From aa4e2c37b736b69b87dac346b7075938337634cf Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 8 Nov 2018 12:50:50 -0600 Subject: [PATCH 60/81] remove campaign_template in DB --- .../20180703165400_add_campaign_templates.rb | 22 -------- ..._add_nonprofit_id_to_campaign_templates.rb | 7 --- db/structure.sql | 56 ------------------- 3 files changed, 85 deletions(-) delete mode 100644 db/migrate/20180703165400_add_campaign_templates.rb delete mode 100644 db/migrate/20180703165403_add_nonprofit_id_to_campaign_templates.rb diff --git a/db/migrate/20180703165400_add_campaign_templates.rb b/db/migrate/20180703165400_add_campaign_templates.rb deleted file mode 100644 index 062f37b2..00000000 --- a/db/migrate/20180703165400_add_campaign_templates.rb +++ /dev/null @@ -1,22 +0,0 @@ -class AddCampaignTemplates < ActiveRecord::Migration - def change - create_table :campaign_templates do |t| - t.string :template_name, null: false - t.string :name - t.string :tagline - t.integer :goal_amount - t.string :main_image - t.text :video_url - t.string :vimeo_video_id - t.string :youtube_video_id - t.text :summary - t.text :body - - t.timestamps - end - - change_table :campaigns do |t| - t.references :campaign_template - end - end -end diff --git a/db/migrate/20180703165403_add_nonprofit_id_to_campaign_templates.rb b/db/migrate/20180703165403_add_nonprofit_id_to_campaign_templates.rb deleted file mode 100644 index 59693ac6..00000000 --- a/db/migrate/20180703165403_add_nonprofit_id_to_campaign_templates.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddNonprofitIdToCampaignTemplates < ActiveRecord::Migration - def change - change_table :campaign_templates do |t| - t.references :nonprofit - end - end -end diff --git a/db/structure.sql b/db/structure.sql index ac514211..7e06a244 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -355,47 +355,6 @@ CREATE SEQUENCE public.campaign_gifts_id_seq ALTER SEQUENCE public.campaign_gifts_id_seq OWNED BY public.campaign_gifts.id; --- --- Name: campaign_templates; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.campaign_templates ( - id integer NOT NULL, - template_name character varying(255) NOT NULL, - name character varying(255), - tagline character varying(255), - goal_amount integer, - main_image character varying(255), - video_url text, - vimeo_video_id character varying(255), - youtube_video_id character varying(255), - summary text, - body text, - created_at timestamp without time zone NOT NULL, - updated_at timestamp without time zone NOT NULL, - nonprofit_id integer -); - - --- --- Name: campaign_templates_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.campaign_templates_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: campaign_templates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.campaign_templates_id_seq OWNED BY public.campaign_templates.id; - - -- -- Name: campaigns; Type: TABLE; Schema: public; Owner: - -- @@ -2351,13 +2310,6 @@ ALTER TABLE ONLY public.campaign_gift_options ALTER COLUMN id SET DEFAULT nextva ALTER TABLE ONLY public.campaign_gifts ALTER COLUMN id SET DEFAULT nextval('public.campaign_gifts_id_seq'::regclass); --- --- Name: campaign_templates id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.campaign_templates ALTER COLUMN id SET DEFAULT nextval('public.campaign_templates_id_seq'::regclass); - - -- -- Name: campaigns id; Type: DEFAULT; Schema: public; Owner: - -- @@ -2743,14 +2695,6 @@ ALTER TABLE ONLY public.campaign_gifts ADD CONSTRAINT campaign_gifts_pkey PRIMARY KEY (id); --- --- Name: campaign_templates campaign_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.campaign_templates - ADD CONSTRAINT campaign_templates_pkey PRIMARY KEY (id); - - -- -- Name: campaigns campaigns_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- From a79a508ff01a5ea7b673f647730174acfcec1050 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 8 Nov 2018 12:51:14 -0600 Subject: [PATCH 61/81] Remove CampaignTemplate model --- app/models/campaign.rb | 1 - app/models/campaign_template.rb | 51 --------------------------------- app/models/nonprofit.rb | 1 - 3 files changed, 53 deletions(-) delete mode 100644 app/models/campaign_template.rb diff --git a/app/models/campaign.rb b/app/models/campaign.rb index 0f568f72..efc145bd 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -66,7 +66,6 @@ class Campaign < ActiveRecord::Base has_many :activities, as: :host, dependent: :destroy belongs_to :profile belongs_to :nonprofit - belongs_to :campaign_template belongs_to :parent_campaign, class_name: 'Campaign' has_many :children_campaigns, class_name: 'Campaign', foreign_key: 'parent_campaign_id' diff --git a/app/models/campaign_template.rb b/app/models/campaign_template.rb deleted file mode 100644 index 1ae38662..00000000 --- a/app/models/campaign_template.rb +++ /dev/null @@ -1,51 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class CampaignTemplate < ActiveRecord::Base - CUSTOMIZABLE_ATTR = %i(goal_amount) - - attr_accessible \ - :template_name, - :name, # refers to campaign name - :tagline, - :goal_amount, - :goal_amount_dollars, # accessor: translated into goal_amount (cents) - :main_image, - :remove_main_image, # for carrierwave - :video_url, - :vimeo_video_id, - :youtube_video_id, - :summary, - :body, - :end_datetime, - :goal_customizable, - :nonprofit_id - - attr_accessor :end_datetime - attr_accessor :goal_amount_dollars - - has_many :campaigns - belongs_to :nonprofit - - mount_uploader :main_image, CampaignTemplateMainImageUploader - - before_validation do - if self.goal_amount_dollars.present? - self.goal_amount = (self.goal_amount_dollars.gsub(',','').to_f * 100).to_i - end - self - end - - def customizable_attribute?(attribute_name) - CUSTOMIZABLE_ATTR.include? attribute_name.to_sym - end - - def customizable_attributes_list - CUSTOMIZABLE_ATTR - end - - def create_campaign_params - excluded = %w( - id template_name created_at updated_at - ) - attributes.except!(*excluded) - end -end diff --git a/app/models/nonprofit.rb b/app/models/nonprofit.rb index 2d512444..421b59b1 100755 --- a/app/models/nonprofit.rb +++ b/app/models/nonprofit.rb @@ -62,7 +62,6 @@ class Nonprofit < ActiveRecord::Base has_many :supporter_notes, through: :supporters has_many :profiles, through: :donations has_many :campaigns, dependent: :destroy - has_many :campaign_templates, dependent: :destroy has_many :events, dependent: :destroy has_many :tickets, through: :events has_many :users, through: :roles From a838f45cbe0a99581c6f0ae1df6a1cd89229ecc2 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 8 Nov 2018 12:52:24 -0600 Subject: [PATCH 62/81] remove campaign_template_id from something --- db/structure.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/db/structure.sql b/db/structure.sql index 7e06a244..be1d81c5 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -393,7 +393,6 @@ CREATE TABLE public.campaigns ( show_recurring_amount boolean DEFAULT false, end_datetime timestamp without time zone, external_identifier character varying(255), - campaign_template_id integer, parent_campaign_id integer, reason_for_supporting text, default_reason_for_supporting text, From 87dc491ef4e902b5758b8fb51412ddc116581e7a Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 8 Nov 2018 14:07:39 -0600 Subject: [PATCH 63/81] remove last of campaign template features --- app/controllers/campaigns_controller.rb | 18 --- .../campaign_templates_controller.rb | 27 ----- app/models/campaign.rb | 7 +- .../campaign_template_main_image_uploader.rb | 28 ----- app/views/campaigns/index.html.erb | 4 - app/views/campaigns/peer_to_peer.html.erb | 1 - .../campaign_templates/_new_modal.html.erb | 114 ------------------ .../campaign_templates/index.html.erb | 72 ----------- client/js/campaign_templates/index/page.js | 2 - client/js/campaign_templates/new/wizard.js | 107 ---------------- config/routes.rb | 2 - spec/lib/insert/insert_duplicate_spec.rb | 3 +- 12 files changed, 7 insertions(+), 378 deletions(-) delete mode 100644 app/controllers/nonprofits/campaign_templates_controller.rb delete mode 100644 app/uploaders/campaign_template_main_image_uploader.rb delete mode 100644 app/views/nonprofits/campaign_templates/_new_modal.html.erb delete mode 100644 app/views/nonprofits/campaign_templates/index.html.erb delete mode 100644 client/js/campaign_templates/index/page.js delete mode 100644 client/js/campaign_templates/new/wizard.js diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index a41bc556..3ec142f2 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -66,23 +66,6 @@ class CampaignsController < ApplicationController end end - def create_from_template - Qx.transaction do - campaign_template = current_nonprofit.campaign_templates.find(params[:campaign_template_id]) - - save_params = campaign_template.create_campaign_params - - save_params['slug'] = SlugCopyNamingAlgorithm.new(Campaign, current_nonprofit.id).create_copy_name(Format::Url.convert_to_slug(save_params['name'])) - - save_params['name'] = NameCopyNamingAlgorithm.new(Campaign, current_nonprofit.id).create_copy_name(save_params['name']) - save_params['profile_id'] = params[:profile_id] - campaign = current_nonprofit.campaigns.create save_params - campaign.update_attribute(:main_image, campaign_template.main_image) unless !campaign_template.main_image rescue AWS::S3::Errors::NoSuchKey - - json_saved campaign, 'Campaign created! Well done.' - end - end - def update Time.use_zone(current_nonprofit.timezone || 'UTC') do params[:campaign][:end_datetime] = Chronic.parse(params[:campaign][:end_datetime]) if params[:campaign][:end_datetime].present? @@ -91,7 +74,6 @@ class CampaignsController < ApplicationController json_saved current_campaign, 'Successfully updated!' end - # post 'nonprofits/:np_id/campaigns/:campaign_id/duplicate' def duplicate diff --git a/app/controllers/nonprofits/campaign_templates_controller.rb b/app/controllers/nonprofits/campaign_templates_controller.rb deleted file mode 100644 index 17bf797d..00000000 --- a/app/controllers/nonprofits/campaign_templates_controller.rb +++ /dev/null @@ -1,27 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -module Nonprofits - class CampaignTemplatesController < ApplicationController - include Controllers::NonprofitHelper - - before_filter :authenticate_nonprofit_admin!, only: :create - before_filter :authenticate_nonprofit_user!, only: [:index, :show] - - def index - @nonprofit = current_nonprofit - @templates = @nonprofit.campaign_templates - end - - def create - template = CampaignTemplate.create(params[:campaign_template]) - - json_saved template - end - - def destroy - campaign = CampaignTemplate.find(params[:id]) - campaign.destroy - - render json: {}, status: :no_content - end - end -end diff --git a/app/models/campaign.rb b/app/models/campaign.rb index efc145bd..dfce67e7 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -66,6 +66,7 @@ class Campaign < ActiveRecord::Base has_many :activities, as: :host, dependent: :destroy belongs_to :profile belongs_to :nonprofit + belongs_to :campaign_template belongs_to :parent_campaign, class_name: 'Campaign' has_many :children_campaigns, class_name: 'Campaign', foreign_key: 'parent_campaign_id' @@ -179,7 +180,11 @@ class Campaign < ActiveRecord::Base end def child_campaign? - parent_campaign.present? + if parent_campaign.present? + true + else + false + end end def parent_campaign? diff --git a/app/uploaders/campaign_template_main_image_uploader.rb b/app/uploaders/campaign_template_main_image_uploader.rb deleted file mode 100644 index 61623c23..00000000 --- a/app/uploaders/campaign_template_main_image_uploader.rb +++ /dev/null @@ -1,28 +0,0 @@ -# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -class CampaignTemplateMainImageUploader < CarrierWave::Uploader::Base - include CarrierWave::MiniMagick - - def store_dir - "uploads/campaign_templates/#{mounted_as}/#{model.id}" - end - - def default_url - return Image::DefaultProfileUrl - end - - version :normal do - process :resize_to_fill => [524, 360] - end - - version :thumb do - process :resize_to_fill => [180, 150] - end - - def extension_white_list - %w(jpg jpeg png) - end - - def cache_dir - "#{Rails.root}/tmp/uploads" - end -end diff --git a/app/views/campaigns/index.html.erb b/app/views/campaigns/index.html.erb index 5a3be09b..87a824f3 100644 --- a/app/views/campaigns/index.html.erb +++ b/app/views/campaigns/index.html.erb @@ -25,10 +25,6 @@ has_mosaic: true %> New Campaign <% end %> - - Campaign templates - - <% if @active_campaigns.empty? %>

No active campaigns

<% else %> diff --git a/app/views/campaigns/peer_to_peer.html.erb b/app/views/campaigns/peer_to_peer.html.erb index 40072e98..dbe6bb2a 100644 --- a/app/views/campaigns/peer_to_peer.html.erb +++ b/app/views/campaigns/peer_to_peer.html.erb @@ -69,7 +69,6 @@

My campaign

<%= @parent_campaign.name %>

-

See our other <%= link_to 'active campaigns', @parent_campaign.nonprofit.url || @nonprofit.url %>.

<% else %> diff --git a/app/views/nonprofits/campaign_templates/_new_modal.html.erb b/app/views/nonprofits/campaign_templates/_new_modal.html.erb deleted file mode 100644 index dcbbab09..00000000 --- a/app/views/nonprofits/campaign_templates/_new_modal.html.erb +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - diff --git a/app/views/nonprofits/campaign_templates/index.html.erb b/app/views/nonprofits/campaign_templates/index.html.erb deleted file mode 100644 index 2a76891a..00000000 --- a/app/views/nonprofits/campaign_templates/index.html.erb +++ /dev/null @@ -1,72 +0,0 @@ -<%= content_for :stylesheets do %> - <%= stylesheet_link_tag 'campaigns/index/page' %> - <%= stylesheet_link_tag 'campaign_templates' %> -<% end %> - -<%= content_for :javascripts do %> - - <%= IncludeAsset.js '/client/js/campaign_templates/index/page.js' %> -<% end %> - - -<%= render 'components/header', - icon_class: 'icon-thermometer-medium', - title: 'Campaign Templates', - profile: @nonprofit, - has_mosaic: true -%> - -
- <% if current_user %> - New Template - <% end %> - - <% if @templates.empty? %> -

No templates yet

- <% else %> -
- - - - <% @templates.each do |template|%> - - - - - <% end %> -
- - -
- <%= template.template_name %> -
-

- Campaign title: <%= template.name %> -

- -

- Campaign summary:<%= template.summary ? strip_tags(template.summary) : strip_tags(template.tagline) %> -

- -

- Customizable attributes: <%= template.customizable_attributes_list %> -

- - Create campaign from template - - - Delete template - -
- -
- <% end %> -
- -<% if current_user %> - <%= render 'nonprofits/campaign_templates/new_modal' %> -<% end %> diff --git a/client/js/campaign_templates/index/page.js b/client/js/campaign_templates/index/page.js deleted file mode 100644 index 6c565463..00000000 --- a/client/js/campaign_templates/index/page.js +++ /dev/null @@ -1,2 +0,0 @@ -if(app.user) - require('../new/wizard') diff --git a/client/js/campaign_templates/new/wizard.js b/client/js/campaign_templates/new/wizard.js deleted file mode 100644 index 062464a8..00000000 --- a/client/js/campaign_templates/new/wizard.js +++ /dev/null @@ -1,107 +0,0 @@ -require('../../common/pikaday-timepicker') -require('../../components/wizard') -require('../../common/image_uploader') -var confirmation = require('../../common/confirmation') -var format_err = require('../../common/format_response_error') - -appl.def('advance_campaign_template_name_step', function(form_obj) { - appl.def('new_campaign_template', form_obj) - appl.wizard.advance('new_campaign_template_wiz') -}) - -// Post a new campaign template -appl.def('create_campaign_template', function(el) { - var form_data = utils.toFormData(appl.prev_elem(el)) - form_data = utils.mergeFormData(form_data, appl.new_campaign_template) - appl.def('new_campaign_template_wiz.loading', true) - - post_campaign_template(form_data) - .then(function(req) { - appl.notify("Campaign template created!") - var template_id = JSON.parse(req.response).id - appl.redirect('/nonprofits/' + app.nonprofit_id + '/campaign_templates') - }) - .catch(function(req) { - appl.def('new_campaign_template_wiz.loading', false) - appl.def('new_campaign_template_wiz.error', req.responseText) - }) -}) - - -var Pikaday = require('pikaday') -var moment = require('moment') -new Pikaday({ - field: document.querySelector('.js-date-picker'), - format: 'M/D/YYYY', - minDate: moment().toDate() -}) - -// Using the bare-bones XMLHttpRequest API so we can post form data and upload the image -function post_campaign_template(form_data) { - return new Promise(function(resolve, reject) { - var req = new XMLHttpRequest() - req.open("POST", '/nonprofits/' + app.nonprofit_id + '/campaign_templates') - req.setRequestHeader('X-CSRF-Token', window._csrf) - req.send(form_data) - req.onload = function(ev) { - if(req.status === 200) resolve(req) - else reject(req) - } - }) -} - -appl.def('delete_template', function(id) { - var result = confirmation('Are you sure?') - result.confirmed = function() { - appl.def('loading', true) - var url = '/nonprofits/' + app.nonprofit_id + '/campaign_templates/' + id - - return new Promise(function(resolve, reject) { - var req = new XMLHttpRequest() - req.open("DELETE", url) - req.setRequestHeader('X-CSRF-Token', window._csrf) - req.send({ campaign_template: {id: id} }) - req.onload = function(ev) { - if(req.status === 204) resolve(req) - else reject(req) - } - }).then(function() { - appl.def('loading', false) - appl.notify('Successfully deleted template.') - appl.redirect('/nonprofits/' + app.nonprofit_id + '/campaign_templates') - }) - } -}) - - -appl.def('create_campaign_from_template', function(campaign_params) { - appl.def('loading', true) - - var url = '/nonprofits/' + app.nonprofit_id + '/campaigns/create_from_template' - var params = new Object - params = JSON.parse(campaign_params) - params.profile_id = app.profile_id - - return new Promise(function(resolve, reject) { - var req = new XMLHttpRequest() - req.open("POST", url) - req.setRequestHeader('X-CSRF-Token', window._csrf) - req.setRequestHeader('Content-Type', 'application/json') - req.send(JSON.stringify(params)) - req.onload = function(ev) { - if(req.status === 200) resolve(req) - else reject(req) - } - }).then(function(req) { - appl.def('loading', false) - appl.notify('Redirecting you to your campaign…') - var campaign_id = JSON.parse(req.response).id - appl.redirect('/nonprofits/' + app.nonprofit_id + '/campaigns/' + campaign_id) - }) - .catch(function(req) { - appl.def('loading', false) - appl.notify(req.responseText) - }) -}) - - diff --git a/config/routes.rb b/config/routes.rb index 3453e80e..0de6178e 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -110,8 +110,6 @@ Commitchange::Application.routes.draw do post(:send_code) end - resources(:campaign_templates, {only: [:index, :create, :show, :destroy]}) - post 'tracking', controller: 'trackings', action: 'create' end diff --git a/spec/lib/insert/insert_duplicate_spec.rb b/spec/lib/insert/insert_duplicate_spec.rb index 61fdf7ff..9da7feaf 100644 --- a/spec/lib/insert/insert_duplicate_spec.rb +++ b/spec/lib/insert/insert_duplicate_spec.rb @@ -115,8 +115,7 @@ describe InsertDuplicate do { id: result.id, end_datetime: nil, - banner_image: nil, - campaign_template_id: nil + banner_image: nil }).with_indifferent_access) validate_cgo(result) end From cc225ba6fdeeb92ff61cad4d40129241b69930bb Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 8 Nov 2018 15:02:35 -0600 Subject: [PATCH 64/81] WIP --- app/models/campaign.rb | 6 +-- .../_campaigner_profile.html.erb | 45 ++++++++++--------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/app/models/campaign.rb b/app/models/campaign.rb index dfce67e7..0f568f72 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -180,11 +180,7 @@ class Campaign < ActiveRecord::Base end def child_campaign? - if parent_campaign.present? - true - else - false - end + parent_campaign.present? end def parent_campaign? diff --git a/app/views/components/fundraising_pages/_campaigner_profile.html.erb b/app/views/components/fundraising_pages/_campaigner_profile.html.erb index 79aca61c..86556f5e 100644 --- a/app/views/components/fundraising_pages/_campaigner_profile.html.erb +++ b/app/views/components/fundraising_pages/_campaigner_profile.html.erb @@ -1,23 +1,26 @@ -
-
-
-
- -
-
-

<%= profile.name %>

-

<%= profile.city %>

- <% if profile.state_code && profile.city %> -

<%= profile.city_state %> <%= profile.state_code %>

- <% end %> -
-
+
+
+

<%= profile.name %> (<%= profile.city %><% if profile.state_code && profile.city %><%= profile.city_state %> <%= profile.state_code %><% end %>)

+

"<%= reason_for_supporting %>"

+ + + + + + + + + <%# if profile.state_code && profile.city %> + + <%# end %> + + -
-
What's your reason for supporting <%= campaign_name %>?
-
- <%= reason_for_supporting %> -
-
-
+ + + + <%#= reason_for_supporting %> + + +
From 1c1e62d0911d2f3e5ddb52babb9ce3c55d057c0e Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 12 Nov 2018 11:25:43 -0600 Subject: [PATCH 65/81] Fix bug where old p2p method of getting there by npo doesn't work --- app/controllers/campaigns_controller.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/controllers/campaigns_controller.rb b/app/controllers/campaigns_controller.rb index 3ec142f2..c33bec5b 100644 --- a/app/controllers/campaigns_controller.rb +++ b/app/controllers/campaigns_controller.rb @@ -117,10 +117,12 @@ class CampaignsController < ApplicationController if current_user @profile = current_user.profile - @child_campaign = Campaign.where( - profile_id: @profile.id, - parent_campaign_id: @parent_campaign.id - ).first + if (@parent_campaign) + @child_campaign = Campaign.where( + profile_id: @profile.id, + parent_campaign_id: @parent_campaign.id + ).first + end end end From 478825a47af753234dd849935d7bea609e58f291 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Mon, 19 Nov 2018 13:53:15 -0600 Subject: [PATCH 66/81] Improve formatting of p2p campaigns --- app/views/campaigns/show.html.erb | 6 ++--- .../_campaigner_profile.html.erb | 25 ++----------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/app/views/campaigns/show.html.erb b/app/views/campaigns/show.html.erb index 36e6477f..7e99863d 100644 --- a/app/views/campaigns/show.html.erb +++ b/app/views/campaigns/show.html.erb @@ -103,7 +103,7 @@ - <% unless current_campaign_editor? %> + <% unless current_campaign_editor? || @campaign.child_campaign? %>