Remove everything related to mapping nonprofits and supporters

This commit is contained in:
Eric Schultz 2021-02-03 19:32:36 -06:00 committed by Eric Schultz
parent ed177e03d6
commit 16a6b63e05
20 changed files with 2 additions and 689 deletions

View file

@ -148,10 +148,6 @@ app/javascript/legacy/components/duplicate_fundraiser.js
app/javascript/legacy/components/encode-plain-email.js app/javascript/legacy/components/encode-plain-email.js
app/javascript/legacy/components/field-with-error.js app/javascript/legacy/components/field-with-error.js
app/javascript/legacy/components/fundraising/add_header_image.js app/javascript/legacy/components/fundraising/add_header_image.js
app/javascript/legacy/components/maps/cc_map.js
app/javascript/legacy/components/maps/default_options.js
app/javascript/legacy/components/maps/npo_coordinates.js
app/javascript/legacy/components/maps/styles.js
app/javascript/legacy/components/modal.js app/javascript/legacy/components/modal.js
app/javascript/legacy/components/nonprofit-branding.js app/javascript/legacy/components/nonprofit-branding.js
app/javascript/legacy/components/number-input.js app/javascript/legacy/components/number-input.js

View file

@ -1,29 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
class MapsController < ApplicationController
include Controllers::Nonprofit::Current
include Controllers::Nonprofit::Authorization
before_action :authenticate_super_associate!, only: :all_supporters
before_action :authenticate_nonprofit_user!, only: %i[all_npo_supporters specific_npo_supporters]
# used on admin/supporters_map
def all_supporters
@map_data = Supporter.where('latitude IS NOT NULL').last(1000)
end
# used on npo dashboard
def all_npo_supporters
@map_data = Nonprofit.find(params['npo_id']).supporters.where('latitude IS NOT NULL').last(100)
end
# used on supporter dashboard
def specific_npo_supporters
supporter_ids = params['supporter_ids'].split(',').map(&:to_i)
supporters = Nonprofit.find(params['npo_id']).supporters.find(supporter_ids).last(500)
@map_data = supporters.map { |s| s if s.latitude != '' }
end
end

View file

@ -1,110 +0,0 @@
// License: LGPL-3.0-or-later
var request = require('../../common/client')
var map_options = require('./default_options')
var cc_map = {}
var info_window = false
var map_data
// the endpoint is the only required param
// see maps_controller for endpoint options
cc_map.init = function(endpoint, options_obj, query) {
endpoint = window.location.origin + '/maps/' + endpoint
request.get(endpoint)
.query(query)
.end(function(err, resp) {
map_data = resp.body.data
var has_map = document.getElementById('google_maps')
if (app.map_provider === 'google') {
if (!has_map) {
var script = document.createElement('script')
script.type = 'text/javascript'
script.id = 'google_maps'
let key = ""
if (app.map_provider_options && app.map_provider_options.key) {
key = `key=${app.map_provider_options.key}&`
}
script.src = `https://maps.googleapis.com/maps/api/js?${key}callback=draw_map`
document.body.appendChild(script)
set_extra_options(options_obj)
} else {
set_extra_options(options_obj)
draw_map()
}
}
else {
if (has_map)
{
has_map.innerText = "Sorry, no map provider is installed"
}
else
{
var map = document.getElementById('googleMap')
map.innerText = "Sorry, no map provider is installed"
}
}
})
}
function set_extra_options(obj){
if(!obj){
return
}
if(obj.center && obj.center.lat) {
map_options.lat = obj.center.lat
map_options.lng = obj.center.lng
}
map_options.disableDefaultUI = obj.disable_ui ? true : false
map_options.zoom = obj.zoom ? obj.zoom : map_options.zoom
map_options.fit_all = obj.fit_all ? true : false
}
window.draw_map = function () {
map_options.center = new google.maps.LatLng(map_options.lat, map_options.lng)
map_options.mapTypeId = google.maps.MapTypeId.NORMAL
var map = new google.maps.Map(document.getElementById('googleMap'), map_options)
add_markers(map)
}
function add_markers(map){
var markers = []
appl.def('map_data_count', map_data.length)
map_data.forEach(function(data){
if (!data.latitude) {
return
}
var coordinates = new google.maps.LatLng(data.latitude, data.longitude)
var marker = new google.maps.Marker({
position: coordinates,
map: map,
draggable: false,
icon: 'https://raw.githubusercontent.com/CommitChange/public-resources/master/images/cc-map-marker-pick-22.png',
data: data
})
google.maps.event.addListener(marker, 'click', function() {
if (info_window) {
info_window.close()
}
info_window = new google.maps.InfoWindow({ content: this.data.name })
info_window.open(map,this)
var map_data = this.data
if(map_data.total_raised) {
map_data.total_raised = utils.cents_to_dollars(map_data.total_raised)
}
appl.def('map_data', map_data)
})
markers.push(marker)
})
if(map_options.fit_all) {
var bounds = new google.maps.LatLngBounds();
for(var i = 0; i < markers.length; i++) {
bounds.extend(markers[i].getPosition());
}
map.fitBounds(bounds);
}
}
module.exports = cc_map

View file

@ -1,14 +0,0 @@
// License: LGPL-3.0-or-later
var styles = require('./styles');
module.exports = {
zoom: 4,
lat: 38.8794,
lng : -97.3222,
styles: styles.discreet,
mapTypeControl: false,
scrollwheel: false,
scaleControl: false,
streetViewControl: false,
overviewMapControl: false
}

View file

@ -1,9 +0,0 @@
// License: LGPL-3.0-or-later
module.exports = function(){
if(app.nonprofit.latitude) {
return {
lat: app.nonprofit.latitude,
lng: app.nonprofit.longitude,
}
}
}

View file

@ -1,269 +0,0 @@
// License: LGPL-3.0-or-later
var Styles = {}
// style credit: https://snazzymaps.com/style/1735/discreet
// Originally under CC0 1.0
Styles.discreet = [
{
"featureType": "administrative",
"elementType": "all",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "administrative",
"elementType": "geometry.stroke",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "administrative",
"elementType": "labels",
"stylers": [
{
"visibility": "on"
},
{
"color": "#716464"
},
{
"weight": "0.01"
}
]
},
{
"featureType": "administrative.country",
"elementType": "labels",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "landscape",
"elementType": "all",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "landscape.natural",
"elementType": "geometry",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "landscape.natural.landcover",
"elementType": "geometry",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "poi",
"elementType": "all",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "poi",
"elementType": "geometry.fill",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "poi",
"elementType": "geometry.stroke",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "poi",
"elementType": "labels.text",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "poi",
"elementType": "labels.text.stroke",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "poi.attraction",
"elementType": "geometry",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "road",
"elementType": "all",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "road.highway",
"elementType": "all",
"stylers": [
{
"visibility": "off"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry.fill",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry.stroke",
"stylers": [
{
"visibility": "simplified"
},
{
"color": "#a05519"
},
{
"saturation": "-13"
}
]
},
{
"featureType": "road.local",
"elementType": "all",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "transit",
"elementType": "all",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "transit",
"elementType": "geometry",
"stylers": [
{
"visibility": "simplified"
}
]
},
{
"featureType": "transit.station",
"elementType": "geometry",
"stylers": [
{
"visibility": "on"
}
]
},
{
"featureType": "water",
"elementType": "all",
"stylers": [
{
"visibility": "simplified"
},
{
"color": "#84afa3"
},
{
"lightness": 52
}
]
},
{
"featureType": "water",
"elementType": "geometry",
"stylers": [
{
"visibility": "on"
}
]
},
{
featureType: "poi.business",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
},
{
"featureType": "water",
"elementType": "geometry.fill",
"stylers": [
{
"visibility": "on"
}
]
}
]
module.exports = Styles

View file

@ -16,8 +16,6 @@ client.get('/nonprofits/' + app.nonprofit_id + '/dashboard_metrics')
appl.def('metrics.data', resp.body.data) appl.def('metrics.data', resp.body.data)
}) })
var map = require('../../components/maps/cc_map')
var todos = require('../../components/todos') var todos = require('../../components/todos')
appl.def('todos_action', '/dashboard_todos') appl.def('todos_action', '/dashboard_todos')

View file

@ -1,7 +1,6 @@
// License: LGPL-3.0-or-later // License: LGPL-3.0-or-later
const flyd = require('flimflam/flyd') // for ajaxing /index_metrics, line 27 const flyd = require('flimflam/flyd') // for ajaxing /index_metrics, line 27
const request = require('../../../common/request') // for ajaxing /index_metrics const request = require('../../../common/request') // for ajaxing /index_metrics
var map = require('../../../components/maps/cc_map')
appl.def('supporters.selected', []) appl.def('supporters.selected', [])
@ -21,7 +20,6 @@ appl.def('supporters.index', function() {
supp.tags = supp.tags ? supp.tags.slice(0,5) : [] supp.tags = supp.tags ? supp.tags.slice(0,5) : []
return supp return supp
})) }))
map.init('specific-npo-supporters', {fit_all: true}, {npo_id: app.nonprofit.id, supporter_ids: supporter_ids})
}) })
appl.def('metrics_loading', true) appl.def('metrics_loading', true)

View file

@ -75,7 +75,7 @@
<!--= wizard.set_step 'new_event_wiz' 'Location' --> <!--= wizard.set_step 'new_event_wiz' 'Location' -->
<form parsley-validate> <form parsley-validate>
<!--= on 'submit' (def 'new_event' form_object) (wizard.advance 'new_event_wiz') --> <!--= on 'submit' create_event -->
<div class='layout--two'> <div class='layout--two'>
@ -106,38 +106,10 @@
<textarea name='event[directions]' parsley-maxlength='500'></textarea> <textarea name='event[directions]' parsley-maxlength='500'></textarea>
</fieldset> </fieldset>
<%= render 'components/forms/submit_button', button_text: 'Next', scope: 'new_event_wiz', branded: true %>
</form>
</div><!-- .location-step -->
<div class='wizard-step images-step'>
<!--= wizard.set_step 'new_event_wiz' 'Images' -->
<form parsley-validate>
<!--= on 'submit' create_event -->
<fieldset>
<div class='image-upload u-floatR' if-branded='border-color, light'>
<span><i class='fa fa-image'></i> Upload</span>
<input type='file' name='event[main_image]' required parsley-trigger='change'>
</div>
<p class='u-color--red'>
<!--= show_if (length image_upload.error) -->
<small><!--= put image_upload.error --></small>
</p>
<div class='col-left-8'>
<label>Preview Image <small>(used for sharing on social media)</small></label>
<p>You'll have a chance to upload an additional header image once you've created your event.</p>
</div>
</fieldset>
<%= render 'components/forms/submit_button', button_text: 'Preview Event!', scope: 'new_event_wiz', branded: true %> <%= render 'components/forms/submit_button', button_text: 'Preview Event!', scope: 'new_event_wiz', branded: true %>
</form> </form>
</div><!-- .images-step --> </div><!-- .location-step -->
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
json.data @map_data do |md|
json.extract! md, :name, :latitude, :longitude, :id
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
json.data @map_data do |md|
json.extract! md, :name, :latitude, :longitude, :id, :email, :phone, :website
end

View file

@ -1,7 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
json.data @map_data do |md|
json.extract! md, :name, :latitude, :longitude, :id, :email, :phone
end

View file

@ -1,8 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
json.data @map_data do |md|
json.extract! md, :name, :latitude, :longitude, :id, :email, :phone,
:address, :city, :state_code, :total_raised
end

View file

@ -34,11 +34,6 @@
<%= render 'components/todos', title: 'checklist' %> <%= render 'components/todos', title: 'checklist' %>
</div> </div>
</div> </div>
<div class='googleMapWrapper u-marginBottom--15'>
<p><!--= put map_data_count --> most recent supporters</p>
<div class='googleMap tour-map' id='googleMap'></div>
</div>
<%= render 'nonprofits/dashboard/campaign_listing' %> <%= render 'nonprofits/dashboard/campaign_listing' %>
<%= render 'nonprofits/dashboard/event_listing' %> <%= render 'nonprofits/dashboard/event_listing' %>
</div> </div>

View file

@ -1,48 +0,0 @@
<%- # License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE -%>
<div class='modal fullScreen' id='supportersMapModal'>
<header class='modal-header'>
<h4 class='modal-header-title'>Showing <!--= put map_data_count --> out of <!--= put supporters.total_count --> Supporters</h4>
<%= render 'common/modal_close' %>
</header>
<div class='modal-body'>
<section class='supportersMap group'>
<div class='legend'>
<!--= scope 'map_data' -->
<div>
<!--= hide_if map_data -->
<p>Click on a marker to see a supporter's details</p>
</div>
<div>
<!--= show_if map_data -->
<p><strong>Supporter Details</strong></p>
<p class='detail'>
<!--= show_if this.name -->
<i class='fa fa-user'></i> <!--= put this.name -->
</p>
<p class='detail'>
<!--= show_if this.phone -->
<i class='fa fa-phone'></i> <!--= put this.phone -->
</p>
<p class='detail'>
<!--= show_if this.email -->
<i>@</i> <!--= put this.email -->
</p>
<p class='detail'>
<!--= show_if this.total_raised -->
<i class='fa fa-dollar'></i> <!--= put this.total_raised -->
</p>
<p class='detail'>
<!--= show_if this.address -->
<i class='fa fa-home'></i> <!--= put this.address --> <!--= put this.city --> <!--= put this.state_code -->
</p>
<button class='button--micro u-marginY--10'>
More Details
<!--= on 'click' (supporter_details.toggle_panel this) -->
</button>
</div>
</div>
<div class='googleMap' id='googleMap'></div>
</section>
</div>
</div>

View file

@ -100,11 +100,6 @@
<!--= on 'click' (open_modal 'exportSupportersS3Modal') --> <!--= on 'click' (open_modal 'exportSupportersS3Modal') -->
<i class='fa fa-file-text'></i> Export <i class='fa fa-file-text'></i> Export
</a> </a>
<a class='table-meta-button white'>
<!--= on 'click' (open_modal 'supportersMapModal') (def 'map_data' false) -->
<i class='fa fa-map-marker'></i> Map
</a>
</span> </span>
</div><!-- .container --> </div><!-- .container -->

View file

@ -72,11 +72,6 @@
<%= render 'edit_custom_fields_modal' %> <%= render 'edit_custom_fields_modal' %>
<%= render 'edit_bulk_custom_fields_modal' %> <%= render 'edit_bulk_custom_fields_modal' %>
<%= render 'map_modal' %>
<%# render 'email_modal' %>
<%# render 'email_preview_modal' %>
<%# render 'email_read_only_modal' %>
<%= render 'manage_email_drafts_modal' %> <%= render 'manage_email_drafts_modal' %>
<%= render 'create_or_update_email_draft_modal' %> <%= render 'create_or_update_email_draft_modal' %>

View file

@ -261,12 +261,6 @@ Rails.application.routes.draw do
# Misc # Misc
get '/pages/wp-plugin', to: redirect('/help/wordpress-plugin') # temporary, until WP plugin updated get '/pages/wp-plugin', to: redirect('/help/wordpress-plugin') # temporary, until WP plugin updated
# Maps
get '/maps/all-npos' => 'maps#all_npos'
get '/maps/all-supporters' => 'maps#all_supporters'
get '/maps/all-npo-supporters' => 'maps#all_npo_supporters'
get '/maps/specific-npo-supporters' => 'maps#specific_npo_supporters'
# Mailchimp Landing # Mailchimp Landing
match '/mailchimp-landing' => 'nonprofits/nonprofit_keys#mailchimp_landing', via: %i[get post] match '/mailchimp-landing' => 'nonprofits/nonprofit_keys#mailchimp_landing', via: %i[get post]

View file

@ -4,101 +4,10 @@
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE # Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
<%= wrap_in_modules <<~rb <%= wrap_in_modules <<~rb
class Railtie < ::Rails::Railtie class Railtie < ::Rails::Railtie
config.houdini = ActiveSupport::OrderedOptions.new
config.houdini.general = ActiveSupport::OrderedOptions.new
config.houdini.general.name = "Houdini Project"
config.houdini.general.logo = "logos/houdini_project_bug.svg"
config.houdini.general.logo_full = "logos/houdini_project_full.svg"
config.houdini.general.poweredby_logo = "logos/houdini_project_rectangle_150.png"
config.houdini.defaults = ActiveSupport::OrderedOptions.new
config.houdini.defaults.image = ActiveSupport::OrderedOptions.new
config.houdini.defaults.image.profile = "public/images/fallback/default-profile.png"
config.houdini.defaults.image.nonprofit = "public/images/fallback/default-nonprofit.png"
config.houdini.defaults.image.campaign = "public/fallback/default-campaign-background.jpg"
config.houdini.defaults.image.event = "public/fallback/default-campaign-background.jpg"
config.houdini.payment_providers = ActiveSupport::OrderedOptions.new
config.houdini.payment_providers.stripe = ActiveSupport::OrderedOptions.new
config.houdini.payment_providers.stripe.public_key = ENV['STRIPE_API_PUBLIC']
config.houdini.payment_providers.stripe.private_key = ENV['STRIPE_API_KEY']
config.houdini.payment_providers.stripe.connect = false
config.houdini.payment_providers.stripe.proprietary_v2_js = false
config.houdini.maps = ActiveSupport::OrderedOptions.new
config.houdini.default_bp = ActiveSupport::OrderedOptions.new
config.houdini.default_bp.id = 1
config.houdini.page_editor = ActiveSupport::OrderedOptions.new
config.houdini.page_editor.editor = 'quill'
config.houdini.source_tokens = ActiveSupport::OrderedOptions.new
config.houdini.source_tokens.max_uses = 1
config.houdini.source_tokens.expiration_time = 20.minutes
config.houdini.source_tokens.event_donation_source = ActiveSupport::OrderedOptions.new
config.houdini.source_tokens.event_donation_source.max_uses = 20
config.houdini.source_tokens.event_donation_source.expiration_after_event = 20.days
config.houdini.show_state_field = true
config.houdini.intl = ActiveSupport::OrderedOptions.new
config.houdini.intl.language = :en
config.houdini.intl.available_locales = [:en, :de, :es, :fr, :it, :nl, :pl, :ro]
config.houdini.intl.all_countries = nil
config.houdini.intl.currencies = ["usd"]
config.houdini.intl.all_currencies = nil
config.houdini.nonprofits_must_be_vetted = false
config.houdini.terms_and_privacy = ActiveSupport::OrderedOptions.new
config.houdini.ccs = :local_tar_gz
config.houdini.ccs_options = nil
config.houdini.maintenance = ActiveSupport::OrderedOptions.new
config.houdini.maintenance.active = false
initializer 'houdini.set_configuration', before: 'factory_bot.set_fixture_replacement' do initializer 'houdini.set_configuration', before: 'factory_bot.set_fixture_replacement' do
config.before_initialize do |app| config.before_initialize do |app|
Bess.support_email = app.config.houdini.support_email || ActionMailer::Base.default[:from]
Bess.button_host = app.config.houdini.button_host ||
ActionMailer::Base.default_url_options[:host]
Bess.payment_providers = Bess::PaymentProvider::Registry.new(app.config.houdini.payment_providers).build_all
Bess.general = app.config.houdini.general
Bess.defaults = app.config.houdini.defaults
ccs = app.config.houdini.ccs
options = app.config.houdini.ccs_options || {}
Bess.ccs = Bess::Ccs.build(ccs,
**options)
Bess.terms_and_privacy = app.config.houdini.terms_and_privacy
Bess.intl = Bess::Intl.new(app.config.houdini.intl)
Bess.intl.all_countries ||= ISO3166::Country.all.map(&:alpha2)
Bess.intl.all_currencies ||= Money::Currency.table
raise("The language #{Bess.intl.language} is not listed \
in the provided locales: #{Bess.intl.available_locales.join(', ')}") if Bess.intl.available_locales.map(&:to_s)
.none?{|l| l == Bess.intl.language.to_s}
Bess.maintenance = Bess::Maintenance.new(app.config.houdini.maintenance)
Bess.source_tokens = app.config.houdini.source_tokens
Bess.page_editor = app.config.houdini.page_editor
Bess.maps = app.config.houdini.maps
Bess.nonprofits_must_be_vetted = app.config.houdini.nonprofits_must_be_vetted
Bess.show_state_fields = app.config.houdini.show_state_fields
Bess.default_bp = app.config.houdini.default_bp.id
end end
end end
end end

View file

@ -1,31 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
require 'rails_helper'
require 'controllers/support/shared_user_context'
describe MapsController, type: :controller do
describe 'authorization' do
include_context :shared_user_context
describe 'rejects unauthorized users' do
describe 'all_supporters' do
include_context :open_to_super_admin, :get, :all_supporters, without_json_view: true
end
describe 'all_npo_supporters' do
include_context :open_to_np_associate, :get, :all_npo_supporters, nonprofit_id: :__our_np, without_json_view: true
end
describe 'specific_npo_supporters' do
include_context :open_to_np_associate, :get, :specific_npo_supporters, nonprofit_id: :__our_np, without_json_view: true
end
end
describe 'open_to_all' do
describe 'all_npos' do
include_context :open_to_all, :get, :all_npos, nonprofit_id: :__our_np, without_json_view: true
end
end
end
end