Skip to content

Commit

Permalink
Merge branch 'zinc-collective:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zspencer committed Feb 12, 2024
2 parents 2563dcf + 83db1ff commit da0601b
Show file tree
Hide file tree
Showing 45 changed files with 746 additions and 156 deletions.
154 changes: 154 additions & 0 deletions .github/workflows/test-convene-journal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Test Journal
on: push

env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
# Connect to locally-running Maildev for tests
SMTP_PORT: 1025
SMTP_DOMAIN: localhost
SMTP_ENABLE_TLS: false
REDIS_HOST: redis
REDIS_PORT: 6379
HEADLESS: true

jobs:
setup:
name: Install and cache dependencies
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Update apt
env:
DEBIAN_FRONTEND: noninteractive
run:
sudo apt-get update -qq -o Acquire::Retries=3

- name: Install libvips
env:
DEBIAN_FRONTEND: noninteractive
run:
# we only need the library
sudo apt-get install --fix-missing -qq -o Acquire::Retries=3
libvips

- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Setup Node with cache
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'

- name: Install Node dependencies
run: yarn install

test:
name: Run Tests
runs-on: ubuntu-latest
needs: [setup]

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis
ports:
# Maps port 6379 on service container to the host
- 6379:6379
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Update apt
env:
DEBIAN_FRONTEND: noninteractive
run:
sudo apt-get update -qq -o Acquire::Retries=3

- name: Install libvips
env:
DEBIAN_FRONTEND: noninteractive
run:
# we only need the library
sudo apt-get install --fix-missing -qq -o Acquire::Retries=3
libvips

- name: Install Firefox
uses: browser-actions/setup-firefox@latest

- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Setup Node with cache
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'

- name: Allow Ruby process to access port 80
run: sudo setcap 'cap_net_bind_service=+ep' `which ruby`

- name: Setup CI database.yml
run: cp config/database.yml.github-actions config/database.yml

- name: Setup rails
run: bin/setup-rails && bin/rails assets:precompile

- name: Run Tests
env:
HEADLESS: true
run: bundle exec rspec spec/furniture/journal
- name: Upload RSpec Screenshots
uses: actions/upload-artifact@v2
if: failure()
with:
name: rspec-failed-screenshot
path: tmp/capybara/*.png

lint:
name: Run style checks
runs-on: ubuntu-latest
needs: [setup]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Ruby and install gems
uses: ruby/setup-ruby@v1
with:
bundler-cache: true

- name: Setup Node with cache
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'

- name: Install Node dependencies
run: yarn install

- run: bundle exec rubocop --parallel --config .rubocop.yml
- run: yarn prettier --check "./**/*.{scss,css,js}"
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.2
3.2.3
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ gem "ranked-model", "~> 0.4.9"
gem "friendly_id", "~> 5.5.1"
# Hashing / Encrypting data at rest
gem "bcrypt", "~> 3.1.20"
gem "lockbox", "1.3.2"
gem "lockbox", "1.3.3"
gem "rotp", "~> 6.3"
gem "strong_migrations", "~> 1.7"
# Soft Deletion
Expand All @@ -87,7 +87,7 @@ gem "tzinfo-data", "~> 1.2021", platforms: %i[mingw mswin x64_mingw jruby]
# Performance Optimization
#
# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", "~> 1.17", require: false
gem "bootsnap", "~> 1.18", require: false

# Permissions and policies
gem "pundit", "~> 2.3"
Expand Down
39 changes: 20 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ GEM
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.5)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
apimatic_core (0.3.4)
apimatic_core_interfaces (~> 0.2.0)
Expand Down Expand Up @@ -134,15 +134,15 @@ GEM
bindex (0.8.1)
binding_of_caller (1.0.0)
debug_inspector (>= 0.0.1)
bootsnap (1.17.1)
bootsnap (1.18.3)
msgpack (~> 1.2)
builder (3.2.4)
byebug (11.1.3)
capybara (3.39.2)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
Expand All @@ -153,7 +153,8 @@ GEM
coderay (1.1.3)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
crack (0.4.5)
crack (0.4.6)
bigdecimal
rexml
crass (1.0.6)
css_parser (1.16.0)
Expand Down Expand Up @@ -208,7 +209,7 @@ GEM
gretel (5.0.0)
actionview (>= 5.1, < 7.2)
railties (>= 5.1, < 7.2)
hashdiff (1.0.1)
hashdiff (1.1.0)
htmlbeautifier (1.4.2)
htmlentities (4.3.4)
i18n (1.14.1)
Expand All @@ -219,7 +220,7 @@ GEM
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
io-console (0.7.2)
irb (1.11.1)
irb (1.11.2)
rdoc
reline (>= 0.4.2)
jbuilder (2.11.5)
Expand All @@ -237,11 +238,11 @@ GEM
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
lockbox (1.3.2)
lockbox (1.3.3)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
lookbook (2.2.0)
lookbook (2.2.1)
activemodel
css_parser
htmlbeautifier (~> 1.3)
Expand All @@ -264,7 +265,7 @@ GEM
mini_magick (4.12.0)
mini_mime (1.1.5)
mini_portile2 (2.8.5)
minitest (5.21.2)
minitest (5.22.2)
monetize (1.12.0)
money (~> 6.12)
money (6.16.0)
Expand All @@ -291,7 +292,7 @@ GEM
net-smtp (0.4.0)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.0)
nokogiri (1.16.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
pagy (6.4.3)
Expand Down Expand Up @@ -372,7 +373,7 @@ GEM
redcarpet (3.6.0)
redis-client (0.19.1)
connection_pool
regexp_parser (2.8.3)
regexp_parser (2.9.0)
reline (0.4.2)
io-console (~> 0.5)
rexml (3.2.6)
Expand Down Expand Up @@ -498,12 +499,12 @@ GEM
stringio (3.1.0)
strip_attributes (1.13.0)
activemodel (>= 3.0, < 8.0)
stripe (10.6.0)
stripe (10.8.0)
strong_migrations (1.7.0)
activerecord (>= 5.2)
thor (1.3.0)
timeout (0.4.1)
turbo-rails (1.5.0)
turbo-rails (2.0.2)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
Expand All @@ -520,7 +521,7 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webmock (3.19.1)
webmock (3.20.0)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand All @@ -532,7 +533,7 @@ GEM
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.34)
zeitwerk (2.6.12)
zeitwerk (2.6.13)
zlib (2.1.1)

PLATFORMS
Expand All @@ -545,7 +546,7 @@ DEPENDENCIES
bcrypt (~> 3.1.20)
better_errors
binding_of_caller
bootsnap (~> 1.17)
bootsnap (~> 1.18)
capybara
cssbundling-rails
decent_exposure (~> 3.0)
Expand All @@ -560,7 +561,7 @@ DEPENDENCIES
jbuilder (~> 2.11)
jsbundling-rails
listen (~> 3.8)
lockbox (= 1.3.2)
lockbox (= 1.3.3)
lookbook (>= 2.0.0.beta.4)
money-rails
pagy (~> 6.4)
Expand Down Expand Up @@ -603,7 +604,7 @@ DEPENDENCIES
webmock

RUBY VERSION
ruby 3.2.2p53
ruby 3.2.3p157

BUNDLED WITH
2.4.12
10 changes: 10 additions & 0 deletions app/components/svg_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class SvgComponent < ApplicationComponent
#
# Format: { symbol: method returning path for symbol }
ICON_MAPPINGS = {
cake: :cake,
cart: :cart,
money: :money,
exclamation_triangle: :exclamation_triangle,
Expand Down Expand Up @@ -119,4 +120,13 @@ def pencil
<path stroke-linecap="round" stroke-linejoin="round" d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125" />
SVG
end

def cake
<<~SVG
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 8.25v-1.5m0 1.5c-1.355 0-2.697.056-4.024.166C6.845 8.51 6 9.473 6 10.608v2.513m6-4.871c1.355 0 2.697.056 4.024.166C17.155 8.51 18 9.473 18 10.608v2.513M15 8.25v-1.5m-6 1.5v-1.5m12 9.75-1.5.75a3.354 3.354 0 0 1-3 0 3.354 3.354 0 0 0-3 0 3.354 3.354 0 0 1-3 0 3.354 3.354 0 0 0-3 0 3.354 3.354 0 0 1-3 0L3 16.5m15-3.379a48.474 48.474 0 0 0-6-.371c-2.032 0-4.034.126-6 .371m12 0c.39.049.777.102 1.163.16 1.07.16 1.837 1.094 1.837 2.175v5.169c0 .621-.504 1.125-1.125 1.125H4.125A1.125 1.125 0 0 1 3 20.625v-5.17c0-1.08.768-2.014 1.837-2.174A47.78 47.78 0 0 1 6 13.12M12.265 3.11a.375.375 0 1 1-.53 0L12 2.845l.265.265Zm-3 0a.375.375 0 1 1-.53 0L9 2.845l.265.265Zm6 0a.375.375 0 1 1-.53 0L15 2.845l.265.265Z" />
</svg>
SVG
end
end
26 changes: 26 additions & 0 deletions app/controllers/room/hero_images_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class Room
class HeroImagesController < ApplicationController
def create
old_hero_image = room.hero_image
new_media = Media.create
new_media.upload.attach(media_params[:upload])

if room.update(hero_image: new_media)
old_hero_image&.destroy
flash[:notice] = t(".success", room_name: room.name)
redirect_to [:edit, room.space, room]
else
flash[:notice] = t(".failure", room_name: room.name)
render :new, status: :unprocessable_entity
end
end

def media_params
params.require(:media).permit(:upload)
end

helper_method def room
@room ||= authorize(policy_scope(Room).friendly.find(params[:room_id]))
end
end
end
Loading

0 comments on commit da0601b

Please sign in to comment.