Skip to content

Commit 720f400

Browse files
authored
Geospatial/places and spaces (#818)
## Summary of Changes This pull request introduces several major features and improvements to the Community Engine, focused on calendar integration, geospatial modeling, contact and file management, and UI enhancements. It also includes extensive code cleanup and minor bug fixes. ### 🗓️ Calendar System - Added `Calendar` model, database migrations, policies, controllers, and views. - Integrated `simple_calendar` gem with support for monthly, weekly, and daily views. - Linked calendars to host communities and ensured correct attribute setting. ### 🗺️ Geospatial Mapping - Introduced `Geography::Map`, `Geography::Space`, `Place`, and supporting join models for geospatial relationships. - Integrated Leaflet.js for map rendering with support for zoom/center customization. - Added `mappable` polymorphic association and geocoding support. - Ensured PostGIS support in GitHub Actions test environment. ### 🏢 Venue Infrastructure - Added `Building`, `Floor`, and `Room` models with address support. - Enhanced slug and identifier handling across models using parameterized values and friendly_id. ### 🧩 UI & UX Improvements - Created responsive image gallery using Masonry.js. - Improved calendar and map controls and default behaviors. - Added a toggle switch partial and associated Stimulus controller. - Enhanced nested tab activation, contact field entry, and hint text styling. ### 📁 Uploads & Files - Introduced `BetterTogether::File` model (renamed to `Upload`) to manage downloadable content. ### 📇 Contact & Info Management - Enabled multiple `Contact` records for a `Contactable`. - Added support for email/phone flags and improved partial rendering for boolean values via `humanize_boolean`. ### 🧼 Code Cleanup & Enhancements - Removed unused Stimulus controllers and replaced legacy references (e.g., Twix → Bluesky). - Added helper methods (e.g., `to_s` on `ApplicationRecord`, `human_attribute_name_for_model`). - Refined default rendering of address formats. - Performed numerous Rubocop and linting fixes. - Updated dependencies and development environment credentials.
2 parents e3e7815 + dd4ecef commit 720f400

File tree

201 files changed

+4400
-400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

201 files changed

+4400
-400
lines changed

.github/workflows/rubyonrails.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
"ES_JAVA_OPTS": "-Xms512m -Xmx512m"
3636
env:
3737
RAILS_ENV: test
38-
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test"
38+
DATABASE_URL: "postgis://rails:password@localhost:5432/rails_test"
3939
ES_HOST: "http://localhost"
4040
steps:
4141
- name: Checkout code

Gemfile.lock

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ GIT
1919
PATH
2020
remote: .
2121
specs:
22-
better_together (0.7.1)
22+
better_together (0.8.0)
2323
active_storage_svg_sanitizer
2424
active_storage_validations
2525
activerecord-import
@@ -34,11 +34,14 @@ PATH
3434
font-awesome-sass (~> 6.5)
3535
friendly_id (>= 5.2, < 5.6)
3636
friendly_id-mobility (~> 1.0.4)
37+
geocoder
3738
groupdate
39+
humanize_boolean
3840
i18n-timezones
3941
image_processing (~> 1.2)
4042
importmap-rails (~> 2.0)
4143
jsonapi-resources (>= 0.10.0)
44+
kaminari
4245
memory_profiler
4346
mobility (>= 1.0.1, < 2.0)
4447
mobility-actiontext (~> 1.1)
@@ -52,6 +55,7 @@ PATH
5255
reform-rails (~> 0.2.0)
5356
rswag (>= 2.3.1, < 2.17.0)
5457
ruby-openai
58+
simple_calendar
5559
sprockets-rails
5660
stackprof
5761
stimulus-rails (~> 1.3)
@@ -160,7 +164,7 @@ GEM
160164
mime-types (>= 2.99)
161165
unf
162166
ast (2.4.2)
163-
autoprefixer-rails (10.4.19.0)
167+
autoprefixer-rails (10.4.21.0)
164168
execjs (~> 2)
165169
aws-eventstream (1.3.1)
166170
aws-partitions (1.1052.0)
@@ -224,16 +228,17 @@ GEM
224228
coercible (1.0.0)
225229
descendants_tracker (~> 0.0.1)
226230
concurrent-ruby (1.3.5)
227-
connection_pool (2.5.0)
231+
connection_pool (2.5.1)
228232
coveralls_reborn (0.28.0)
229233
simplecov (~> 0.22.0)
230234
term-ansicolor (~> 1.7)
231235
thor (~> 1.2)
232236
tins (~> 1.32)
233237
crass (1.0.6)
234-
css_parser (1.21.0)
238+
css_parser (1.21.1)
235239
addressable
236-
dartsass-sprockets (3.2.0)
240+
csv (3.3.4)
241+
dartsass-sprockets (3.2.1)
237242
railties (>= 4.0.0)
238243
sassc-embedded (~> 1.80.1)
239244
sprockets (> 3.0)
@@ -306,15 +311,15 @@ GEM
306311
railties (>= 5.0.0)
307312
faker (3.5.1)
308313
i18n (>= 1.8.11, < 2)
309-
faraday (2.12.2)
314+
faraday (2.13.0)
310315
faraday-net_http (>= 2.0, < 3.5)
311316
json
312317
logger
313318
faraday-multipart (1.1.0)
314319
multipart-post (~> 2.0)
315320
faraday-net_http (3.4.0)
316321
net-http (>= 0.5.0)
317-
ffi (1.17.1-x86_64-linux-gnu)
322+
ffi (1.17.2-x86_64-linux-gnu)
318323
fog-aws (3.30.0)
319324
base64 (~> 0.2.0)
320325
fog-core (~> 2.6)
@@ -342,9 +347,12 @@ GEM
342347
fuubar (2.5.1)
343348
rspec-core (~> 3.0)
344349
ruby-progressbar (~> 1.4)
350+
geocoder (1.8.5)
351+
base64 (>= 0.1.0)
352+
csv (>= 3.0.0)
345353
globalid (1.2.1)
346354
activesupport (>= 6.1)
347-
google-protobuf (4.30.0-x86_64-linux)
355+
google-protobuf (4.30.2-x86_64-linux)
348356
bigdecimal
349357
rake (>= 13)
350358
groupdate (6.5.1)
@@ -353,6 +361,8 @@ GEM
353361
highline (3.1.2)
354362
reline
355363
htmlentities (4.3.4)
364+
humanize_boolean (0.0.2)
365+
i18n
356366
i18n (1.14.7)
357367
concurrent-ruby (~> 1.0)
358368
i18n-tasks (1.0.15)
@@ -381,7 +391,7 @@ GEM
381391
activesupport (>= 6.0.0)
382392
railties (>= 6.0.0)
383393
io-console (0.8.0)
384-
irb (1.15.1)
394+
irb (1.15.2)
385395
pp (>= 0.6.0)
386396
rdoc (>= 4.0.0)
387397
reline (>= 0.4.2)
@@ -396,6 +406,18 @@ GEM
396406
railties (>= 4.1)
397407
jwt (2.10.1)
398408
base64
409+
kaminari (1.2.2)
410+
activesupport (>= 4.1.0)
411+
kaminari-actionview (= 1.2.2)
412+
kaminari-activerecord (= 1.2.2)
413+
kaminari-core (= 1.2.2)
414+
kaminari-actionview (1.2.2)
415+
actionview
416+
kaminari-core (= 1.2.2)
417+
kaminari-activerecord (1.2.2)
418+
activerecord
419+
kaminari-core (= 1.2.2)
420+
kaminari-core (1.2.2)
399421
language_server-protocol (3.17.0.4)
400422
launchy (3.1.1)
401423
addressable (~> 2.8)
@@ -405,7 +427,7 @@ GEM
405427
listen (3.9.0)
406428
rb-fsevent (~> 0.10, >= 0.10.3)
407429
rb-inotify (~> 0.9, >= 0.9.10)
408-
logger (1.6.6)
430+
logger (1.7.0)
409431
loofah (2.24.0)
410432
crass (~> 1.0.2)
411433
nokogiri (>= 1.12.0)
@@ -426,7 +448,7 @@ GEM
426448
benchmark
427449
logger
428450
mini_mime (1.1.5)
429-
minitest (5.25.4)
451+
minitest (5.25.5)
430452
mobility (1.3.2)
431453
i18n (>= 0.6.10, < 2)
432454
request_store (~> 1.0)
@@ -449,7 +471,7 @@ GEM
449471
net-smtp (0.5.1)
450472
net-protocol
451473
nio4r (2.7.4)
452-
nokogiri (1.18.4-x86_64-linux-gnu)
474+
nokogiri (1.18.7-x86_64-linux-gnu)
453475
racc (~> 1.4)
454476
noticed (2.6.0)
455477
rails (>= 6.1.0)
@@ -484,7 +506,7 @@ GEM
484506
pundit (2.5.0)
485507
activesupport (>= 3.0.0)
486508
racc (1.8.1)
487-
rack (3.1.12)
509+
rack (3.1.13)
488510
rack-cors (2.0.2)
489511
rack (>= 2.0.0)
490512
rack-mini-profiler (3.3.1)
@@ -542,7 +564,7 @@ GEM
542564
ffi (>= 1.0.6)
543565
msgpack (>= 0.4.3)
544566
optimist (>= 3.0.0)
545-
rdoc (6.12.0)
567+
rdoc (6.13.1)
546568
psych (>= 4.0.0)
547569
redis (5.4.0)
548570
redis-client (>= 0.22.0)
@@ -556,7 +578,7 @@ GEM
556578
activemodel (>= 5.0)
557579
reform (>= 2.3.1, < 3.0.0)
558580
regexp_parser (2.10.0)
559-
reline (0.6.0)
581+
reline (0.6.1)
560582
io-console (~> 0.5)
561583
representable (3.2.0)
562584
declarative (< 0.1.0)
@@ -625,7 +647,7 @@ GEM
625647
rubocop-rspec (3.5.0)
626648
lint_roller (~> 1.1)
627649
rubocop (~> 1.72, >= 1.72.1)
628-
ruby-openai (8.0.0)
650+
ruby-openai (8.1.0)
629651
event_stream_parser (>= 0.3.0, < 2.0.0)
630652
faraday (>= 1)
631653
faraday-multipart (>= 1)
@@ -634,8 +656,8 @@ GEM
634656
ffi (~> 1.12)
635657
logger
636658
rubyzip (2.4.1)
637-
sass-embedded (1.85.1-x86_64-linux-gnu)
638-
google-protobuf (~> 4.29)
659+
sass-embedded (1.86.3-x86_64-linux-gnu)
660+
google-protobuf (~> 4.30)
639661
sassc (2.4.0)
640662
ffi (~> 1.9)
641663
sassc-embedded (1.80.4)
@@ -663,6 +685,8 @@ GEM
663685
logger (>= 1.6.2)
664686
rack (>= 3.1.0)
665687
redis-client (>= 0.23.2)
688+
simple_calendar (3.1.0)
689+
rails (>= 6.1)
666690
simplecov (0.22.0)
667691
docile (~> 1.1)
668692
simplecov-html (~> 0.11)
@@ -683,7 +707,7 @@ GEM
683707
stackprof (0.2.27)
684708
stimulus-rails (1.3.4)
685709
railties (>= 6.0.0)
686-
stringio (3.1.5)
710+
stringio (3.1.6)
687711
sync (0.5.0)
688712
term-ansicolor (1.11.2)
689713
tins (~> 1.0)

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ end
5252
Add this gem to your Gemfile:
5353

5454
```ruby
55-
gem 'better_together', '~> 0.5.0',
55+
gem 'better_together', '~> 0.8.0',
5656
github: 'better-together-org/community-engine-rails',
5757
branch: 'main'
5858
```
@@ -85,26 +85,26 @@ rails db:migrate
8585

8686
This gem is developed using Docker and Docker Compose. To get the app running, complete the following steps:
8787

88-
Build the application image:
88+
Build the application image using the docker convenience scripts:
8989

9090
```bash
91-
docker compose build
91+
bin/dc build
9292
```
9393

9494
Bundle the gems:
9595

9696
```bash
97-
docker compose run --rm app bundle
97+
bin/dc-run app bundle
9898
```
9999

100100
Setup the database:
101101

102102
```bash
103-
docker compose run --rm app rails db:setup
103+
bin/dc-run app rails db:setup
104104
```
105105

106106
Run the RSpec tests:
107107

108108
```bash
109-
docker compose run --rm app rspec
109+
bin/dc-run app rspec
110110
```

app/assets/config/better_together_manifest.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
//= link_tree ../../javascript .js
44
//= link_tree ../stylesheets .css
5+
//= link_tree ../../../vendor/stylesheets .css
56
//= link_tree ../stylesheets .scss
67
//= link_tree ../images
78

@@ -14,3 +15,10 @@
1415
//= link stimulus.js
1516
//= link stimulus-loading.js
1617
//= link turbo.js
18+
19+
//= link masonry.min.js
20+
//= link imagesloaded.min.js
21+
22+
//= link leaflet.js
23+
//= link leaflet-gesture-handling.js
24+
//= link leaflet-providers.js

app/assets/stylesheets/better_together/application.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* files in this directory. Styles in this file should be added after the last require_* statement.
1111
* It is generally better to create a new file per style scope.
1212
*
13+
*= require leaflet-gesture-handling.min
1314
*= require_self
1415
*/
1516

@@ -25,10 +26,13 @@
2526
@import 'content_blocks';
2627
@import 'conversations';
2728
@import 'forms';
29+
@import 'image-galleries';
30+
@import 'maps';
2831
@import 'metrics';
2932
@import 'navigation';
3033
@import 'notifications';
3134
@import 'profiles';
35+
@import 'simple_calendar';
3236
@import 'share';
3337
@import 'sidebar_nav';
3438
@import 'trix-extensions/richtext';
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
.image-gallery {
3+
// min-height: 50vh;
4+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
.map {
3+
min-height: 500px;
4+
position: relative;
5+
6+
.map-controls {
7+
position: absolute;
8+
top: 10px;
9+
right: 10px;
10+
z-index: 401;
11+
}
12+
}

app/assets/stylesheets/better_together/share.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ a {
5757
&.share-facebook:hover i.bg,
5858
&.share-facebook:focus i.bg { color: #3b5998; }
5959

60-
&.share-twitter:hover i.bg,
61-
&.share-twitter:focus i.bg { color: #1da1f2; }
60+
&.share-bluesky:hover i.bg,
61+
&.share-bluesky:focus i.bg { color: #1185fe; }
6262

6363
&.share-linkedin:hover i.bg,
6464
&.share-linkedin:focus i.bg { color: #0077b5; }
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# frozen_string_literal: true
2+
3+
module BetterTogether
4+
# CRUD for calendars
5+
class CalendarsController < FriendlyResourceController
6+
# GET /better_together/calendars
7+
8+
# GET /better_together/calendars/new
9+
def new
10+
@calendar = resource_instance
11+
end
12+
13+
# GET /better_together/calendars/1/edit
14+
def edit; end
15+
16+
# POST /better_together/calendars
17+
# def create
18+
# @calendar = BetterTogether::Calendar.new(better_together_calendar_params)
19+
20+
# if @calendar.save
21+
# redirect_to @calendar, notice: "Calendar was successfully created."
22+
# else
23+
# render :new, status: :unprocessable_entity
24+
# end
25+
# end
26+
27+
# PATCH/PUT /better_together/calendars/1
28+
# def update
29+
# if @calendar.update(better_together_calendar_params)
30+
# redirect_to @calendar, notice: "Calendar was successfully updated.", status: :see_other
31+
# else
32+
# render :edit, status: :unprocessable_entity
33+
# end
34+
# end
35+
36+
# DELETE /better_together/calendars/1
37+
def destroy
38+
@calendar.destroy!
39+
redirect_to better_together_calendars_url, notice: 'Calendar was successfully destroyed.', status: :see_other
40+
end
41+
42+
private
43+
44+
def permitted_attributes
45+
resource_class.extra_permitted_attributes + %i[community_id]
46+
end
47+
48+
def resource_class
49+
BetterTogether::Calendar
50+
end
51+
end
52+
end

0 commit comments

Comments
 (0)