Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby by the Bay #569

Open
wants to merge 81 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
9f925e9
Fix deprecation warning in rspec
mofo37 Mar 30, 2019
a013857
Add bulk_upload model
mofo37 Mar 30, 2019
689f2a7
Create active storage tables and migrate database
mofo37 Mar 30, 2019
7ee3e53
Add flag to not always setup database on docker-compose run
mofo37 Mar 30, 2019
3537795
Add attachment to bulk_upload model
mofo37 Mar 30, 2019
5baffd2
Add bulk upload link to _formsubmit in views/restrooms
mofo37 Mar 30, 2019
9a59c46
Install delayed_job
calebharris Mar 30, 2019
8aeadf3
Add BulkImportJob stub
calebharris Mar 30, 2019
4600658
Merge from 'refuge/develop' into develop
calebharris Mar 30, 2019
810ac0f
Add ability to upload CSV
mofo37 Mar 30, 2019
815912d
Merge branch 'develop' of github.com:rubyforgood/refugerestrooms into…
mofo37 Mar 30, 2019
2c23856
Configure ActiveJob to use delayed_job
calebharris Mar 30, 2019
057c464
Updates readme to add mitigation strategy for rough docker-compose flows
chelseatroy Mar 30, 2019
8d55add
Install user model for devise
chelseatroy Mar 30, 2019
9c524ff
give access to devise users controller
lisavogtsf Mar 31, 2019
7e65013
reformat routes
lisavogtsf Mar 31, 2019
92a5025
Stand up container for job processor
calebharris Mar 31, 2019
fd2ef21
add Approved column to devise-generated user table
lisavogtsf Mar 31, 2019
e83cdfe
Merge pull request #3 from rubyforgood/devise-attempt-2
lisavogtsf Mar 31, 2019
5b012b9
readd routes for bulk upload
mi-wood Mar 31, 2019
09893e0
Add user authorization to bulk_uploads_controller
mofo37 Mar 31, 2019
cd1d287
Add association between bulk_upload and user
mofo37 Mar 31, 2019
cbf7091
Add signout link
mofo37 Mar 31, 2019
a5cea8f
Fix route for bulk_uploads
mofo37 Mar 31, 2019
7450224
formatting and attempt at mailer
lisavogtsf Mar 31, 2019
594a428
Add link to signin on bulk_uploads view when not signed in
mofo37 Mar 31, 2019
14a6ba1
Merge branch 'develop' of github.com:rubyforgood/refugerestrooms into…
mi-wood Mar 31, 2019
53f3033
put in aws configs for active storage
mi-wood Mar 31, 2019
f606843
fix routes
mi-wood Mar 31, 2019
275bb87
Merge pull request #4 from rubyforgood/r-develop
mi-wood Mar 31, 2019
e28030d
enforce config inheritance
mi-wood Mar 31, 2019
2a2d3b7
Adjust devise routes to get sign_in to access our mailer
lisavogtsf Mar 31, 2019
5370d2b
Merge pull request #5 from rubyforgood/r-develop
mi-wood Mar 31, 2019
00818eb
Merge pull request #6 from rubyforgood/devise-attempt-2
lisavogtsf Mar 31, 2019
ba2ab81
use amazon instead of aws
mi-wood Mar 31, 2019
2350ca4
Merge pull request #7 from rubyforgood/r-develop
mi-wood Mar 31, 2019
ad48e20
add aws gem
mi-wood Mar 31, 2019
027828a
Merge pull request #8 from rubyforgood/r-develop
mi-wood Mar 31, 2019
dd708d2
update lockfile
mi-wood Mar 31, 2019
369cda6
Merge branch 'develop' into r-develop
mi-wood Mar 31, 2019
190026d
First pass at bulk import and geocoding job
calebharris Mar 31, 2019
9e0e7c6
Merge pull request #9 from rubyforgood/r-develop
mi-wood Mar 31, 2019
a0d126b
Conditionally display bulk_upload
mofo37 Mar 31, 2019
5538494
Merge branch 'develop' of github.com:rubyforgood/refugerestrooms into…
mofo37 Mar 31, 2019
f6aa750
Add messages to homepage to inform user of sign in status
lisavogtsf Mar 31, 2019
7c40d70
Merge pull request #10 from rubyforgood/signup-landing-page
lisavogtsf Mar 31, 2019
898689e
Enqueue job on successful upload
calebharris Mar 31, 2019
66acff0
Add messaging after bulk upload completed
mofo37 Mar 31, 2019
ff57a39
Merge branch 'develop' of github.com:rubyforgood/refugerestrooms into…
mofo37 Mar 31, 2019
32384de
conditionally show signout/login, remove remember field
lisavogtsf Mar 31, 2019
aec9fe5
move login/signout link from footer to navbar
lisavogtsf Apr 1, 2019
078455e
update csv
mi-wood Apr 1, 2019
8c9cf72
Merge pull request #11 from rubyforgood/r-develop
mi-wood Apr 1, 2019
e51f357
add default styling to flash messages
chelseatroy Apr 1, 2019
11308f7
Add instructions for uploading CSV and add link to sample downloadabl…
mofo37 Apr 1, 2019
2ca00f0
Merge branch 'develop' of github.com:rubyforgood/refugerestrooms into…
mofo37 Apr 1, 2019
a64532f
db/seeds.rb: Give restroom entries an edit_id (#567)
DeeDeeG Mar 31, 2019
600256d
Tag restrooms with upload; use service to save
calebharris Apr 1, 2019
2d64fd0
hacky error handling for imports
bhaibel Apr 1, 2019
82ad060
Fix CSV download link path
mofo37 Apr 1, 2019
d99d189
Merge branch 'develop' of github.com:rubyforgood/refugerestrooms into…
mofo37 Apr 1, 2019
035a761
Add blurb about bulk uploades to the FAQ.
chelseatroy Apr 1, 2019
337d03e
add notes to user
mi-wood Apr 1, 2019
3636dee
Merge branch 'develop' into r-develop
mi-wood Apr 1, 2019
07fb9cb
Merge pull request #12 from rubyforgood/r-develop
mi-wood Apr 1, 2019
f2c5a05
Add text to thank users for uploading
mofo37 Apr 1, 2019
746c269
Merge branch 'develop' of github.com:rubyforgood/refugerestrooms into…
mofo37 Apr 1, 2019
c40eb61
add error rescue clause
mi-wood Apr 1, 2019
05c9d16
Merge pull request #13 from rubyforgood/r-develop
mi-wood Apr 1, 2019
230b83b
Fix method scoping issues
calebharris Apr 1, 2019
1cf267f
Add example bad CSV file
calebharris Apr 1, 2019
9b5a145
Support directions and comments in bulk import
calebharris Apr 1, 2019
9b403f0
Discard import job on GenericError; disable geocoding for demo
calebharris Apr 1, 2019
c749ef4
Support lat and long in import job
calebharris Apr 1, 2019
2961bc2
Adjust URL in user confirmation email to match in production and staging
chelseatroy Apr 1, 2019
ee21307
Add http, it's late and I'm tired
chelseatroy Apr 1, 2019
247284c
One last URL adjustment
chelseatroy Apr 1, 2019
6cafd79
REVERT AFTER DEMO
chelseatroy Apr 1, 2019
938b3bf
I am so upset
chelseatroy Apr 1, 2019
7c6ee36
Finished
chelseatroy Apr 1, 2019
5eba40b
Fixes conflict in describing docker-compose problems
lisavogtsf Apr 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .env

This file was deleted.

1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export GOOGLE_MAPS_API_KEY=AIzaSyBXcCrqzMlm-ZmtNQve7AuipNdE4vySUF0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ ruby
/node_modules
yarn-debug.log*
.yarn-integrity
/storage/*
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ You can now run the app with:
docker-compose up
```

The web app will be reachable at this address: `localhost:3000`
If this results in a syntax error in cli.js, remove the docker image and re-run `docker-compose build` (this is especially likely to be the issue if your `docker-compose` commands got interrupted and had to be re-run a few times).

The container will be reachable at this address: `localhost:3000`

_(Point your web browser at `localhost:3000` or `127.0.0.1:3000`, or even `[IP address of computer running the container]:3000` from any computer on the same LAN. The last method is useful for testing the app/site on smart phones and tablets.)_

Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ ruby '2.5.3'
gem 'rails', '5.2.2.1'

gem 'activeadmin', '~> 1.4.1'
gem "aws-sdk-s3", '~> 1.36.0', require: false
gem 'bootsnap', require: false
gem 'bootstrap-sass', '>= 3.4.1'
gem 'bugsnag'
gem 'coffee-rails', '~> 4.2'
gem 'country_select'
gem 'delayed_job_active_record'
gem 'devise', '~> 4.6'
gem 'geocoder', '~> 1.2.1'
gem 'grape', '1.1'
Expand Down
24 changes: 24 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ GEM
arel (9.0.0)
autoprefixer-rails (9.5.0)
execjs
aws-eventstream (1.0.2)
aws-partitions (1.148.0)
aws-sdk-core (3.48.3)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.16.0)
aws-sdk-core (~> 3, >= 3.48.2)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.36.0)
aws-sdk-core (~> 3, >= 3.48.2)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0)
aws-sigv4 (1.1.0)
aws-eventstream (~> 1.0, >= 1.0.2)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
Expand Down Expand Up @@ -112,6 +128,11 @@ GEM
crass (1.0.4)
database_cleaner (1.7.0)
debug_inspector (0.0.3)
delayed_job (4.1.5)
activesupport (>= 3.0, < 5.3)
delayed_job_active_record (4.1.3)
activerecord (>= 3.0, < 5.3)
delayed_job (>= 3.0, < 5)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (4.6.1)
Expand Down Expand Up @@ -175,6 +196,7 @@ GEM
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jmespath (1.4.0)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
Expand Down Expand Up @@ -376,6 +398,7 @@ PLATFORMS

DEPENDENCIES
activeadmin (~> 1.4.1)
aws-sdk-s3 (~> 1.36.0)
better_errors (~> 2.4.0)
binding_of_caller
bootsnap
Expand All @@ -385,6 +408,7 @@ DEPENDENCIES
coffee-rails (~> 4.2)
country_select
database_cleaner
delayed_job_active_record
devise (~> 4.6)
dotenv-rails (~> 2.2.1)
factory_bot_rails (~> 4.8.2)
Expand Down
6 changes: 6 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
"AKISMET_KEY": {
"required": true
},
"AWS_ACCESS_KEY_ID": {
"required": true
},
"AWS_SECRET_ACCESS_KEY": {
"required": true
},
"BUGSNAG_API_TOKEN": {
"required": true
},
Expand Down
5 changes: 2 additions & 3 deletions app/admin/restroom.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ActiveAdmin.register Restroom do

permit_params :name, :street, :city, :state, :accessible, :changing_table, :unisex, :directions,
:comment, :latitude, :longitude, :country, :edit_id, :approved
permit_params :name, :street, :city, :state, :accessible, :changing_table, :unisex, :directions,
:comment, :latitude, :longitude, :country, :edit_id, :approved
end
3 changes: 3 additions & 0 deletions app/admin/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ActiveAdmin.register User do
permit_params :email, :approved, :notes
end
5 changes: 5 additions & 0 deletions app/assets/stylesheets/components/alert.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.alert {
margin: 10px;
border-radius: 10px;
background: #ffff0080;
}
44 changes: 44 additions & 0 deletions app/controllers/bulk_uploads_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
class BulkUploadsController < ApplicationController
before_action :authenticate_approved_user!, only: [:create]

def new
@bulk_upload = BulkUpload.new
@user = current_user
end

def create
@bulk_upload = BulkUpload.new(bulk_upload_params)
@bulk_upload.user = current_user
if @bulk_upload.save
BulkImportJob.perform_later @bulk_upload
redirect_to bulk_upload_path(@bulk_upload)
else
Rails.logger.error "Errors saving bulk_upload:"
@bulk_upload.errors.each { |field, message| Rails.logger.error "Field: #{field}, Message: #{message}" }
render action: :new
end
end

def show
end

def download_csv
send_file(
"#{Rails.root}/public/sample.csv",
filename: "sample.csv",
type: ".csv"
)
end

private
def authenticate_approved_user!
unless user_signed_in?
redirect_to new_user_session_path
return false
end
end

def bulk_upload_params
params.require(:bulk_upload).permit(:file)
end
end
30 changes: 30 additions & 0 deletions app/controllers/users/confirmations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true

class Users::ConfirmationsController < Devise::ConfirmationsController
# GET /resource/confirmation/new
# def new
# super
# end

# POST /resource/confirmation
# def create
# super
# end

# GET /resource/confirmation?confirmation_token=abcdef
# def show
# super
# end

# protected

# The path used after resending confirmation instructions.
# def after_resending_confirmation_instructions_path_for(resource_name)
# super(resource_name)
# end

# The path used after confirmation.
# def after_confirmation_path_for(resource_name, resource)
# super(resource_name, resource)
# end
end
30 changes: 30 additions & 0 deletions app/controllers/users/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true

class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
# You should configure your model like this:
# devise :omniauthable, omniauth_providers: [:twitter]

# You should also create an action method in this controller like this:
# def twitter
# end

# More info at:
# https://github.com/plataformatec/devise#omniauth

# GET|POST /resource/auth/twitter
# def passthru
# super
# end

# GET|POST /users/auth/twitter/callback
# def failure
# super
# end

# protected

# The path used when OmniAuth fails
# def after_omniauth_failure_path_for(scope)
# super(scope)
# end
end
34 changes: 34 additions & 0 deletions app/controllers/users/passwords_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: true

class Users::PasswordsController < Devise::PasswordsController
# GET /resource/password/new
# def new
# super
# end

# POST /resource/password
# def create
# super
# end

# GET /resource/password/edit?reset_password_token=abcdef
# def edit
# super
# end

# PUT /resource/password
# def update
# super
# end

# protected

# def after_resetting_password_path_for(resource)
# super(resource)
# end

# The path used after sending reset password instructions
# def after_sending_reset_password_instructions_path_for(resource_name)
# super(resource_name)
# end
end
72 changes: 72 additions & 0 deletions app/controllers/users/registrations_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# frozen_string_literal: true

class Users::RegistrationsController < Devise::RegistrationsController
# before_action :configure_sign_up_params, only: [:create]
# before_action :configure_account_update_params, only: [:update]

# GET /resource/sign_up
# def new
# super
# end

# POST /resource
def create
super
UserMailer.approve_new_user_email(@user).deliver_now
end

private

def sign_up_params
params.require(:user).permit(:email, :password, :password_confirmation, :notes)
end

def account_update_params
params.require(:user).permit(:email, :password, :password_confirmation, :current_password, :notes)
end
# GET /resource/edit
# def edit
# super
# end

# PUT /resource
# def update
# super
# end

# DELETE /resource
# def destroy
# super
# end

# GET /resource/cancel
# Forces the session data which is usually expired after sign
# in to be expired now. This is useful if the user wants to
# cancel oauth signing in/up in the middle of the process,
# removing all OAuth session data.
# def cancel
# super
# end

# protected

# If you have extra params to permit, append them to the sanitizer.
# def configure_sign_up_params
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
# end

# If you have extra params to permit, append them to the sanitizer.
# def configure_account_update_params
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
# end

# The path used after sign up.
# def after_sign_up_path_for(resource)
# super(resource)
# end

# The path used after sign up for inactive accounts.
# def after_inactive_sign_up_path_for(resource)
# super(resource)
# end
end
27 changes: 27 additions & 0 deletions app/controllers/users/sessions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

class Users::SessionsController < Devise::SessionsController
# before_action :configure_sign_in_params, only: [:create]

# GET /resource/sign_in
# def new
# super
# end

# POST /resource/sign_in
# def create
# super
# end

# DELETE /resource/sign_out
# def destroy
# super
# end

# protected

# If you have extra params to permit, append them to the sanitizer.
# def configure_sign_in_params
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
# end
end
30 changes: 30 additions & 0 deletions app/controllers/users/unlocks_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# frozen_string_literal: true

class Users::UnlocksController < Devise::UnlocksController
# GET /resource/unlock/new
# def new
# super
# end

# POST /resource/unlock
# def create
# super
# end

# GET /resource/unlock?unlock_token=abcdef
# def show
# super
# end

# protected

# The path used after sending unlock password instructions
# def after_sending_unlock_instructions_path_for(resource)
# super(resource)
# end

# The path used after unlocking the resource
# def after_unlock_path_for(resource)
# super(resource)
# end
end
Loading