Skip to content

Add Agreements and Agreement Terms#884

Merged
rsmithlal merged 38 commits intomainfrom
feature/agreements
Aug 19, 2025
Merged

Add Agreements and Agreement Terms#884
rsmithlal merged 38 commits intomainfrom
feature/agreements

Conversation

@rsmithlal
Copy link
Member

@rsmithlal rsmithlal commented Jul 5, 2025

Pull Request #884: Add Agreements and Agreement Terms

Overview

  • Base branch: main
  • Feature branch: feature/agreements
  • Commits: 38 commits (from May to August 2025)
  • File changes: 238 files changed (+3644 / -2463)

Key Highlights by File

  1. app/builders/better_together/agreement_builder.rb

    • Introduces a seeding builder for default agreements:
      • Privacy Policy
      • Terms of Service
      • Code of Conduct
    • Sets default titles, descriptions, and privacy settings.
    • Includes linking to existing pages if available.
  2. app/controllers/better_together/agreements_controller.rb

    • New AgreementsController (inherits from FriendlyResourceController).
    • Handles show action:
      • If @agreement.page exists, renders within the appropriate layout.
      • Supports Turbo Frame responses for modal display.
  3. app/controllers/better_together/users/registrations_controller.rb

    • Adds flows for agreement acceptance during user signup:
      • set_required_agreements to load required Agreement records (privacy_policy, terms_of_service, and optionally code_of_conduct).
      • Validates checkbox acceptance in agreements_accepted?.
      • Creates AgreementParticipant records upon successful signup to track acceptance.
  4. Styling & Layout

    • Adds CSS classes in app/assets/stylesheets/better_together/forms.scss for agreement modals and spacing (e.g., .agreement-modal-link, .bt-mb-3).
  5. Helper Module

    • Adds an empty helper module BetterTogether::AgreementsHelper for future use.

Summary

This PR lays the groundwork for a structured agreements system:

  • Seeds default agreements for users to consent to during signup.
  • Renders agreements via modals using Turbo Frames for smooth UX.
  • Tracks agreement acceptance per user via AgreementParticipant records.

Next Steps / Considerations

  • Review and refine acceptance flows and error messaging UX.
  • Confirm localization support and styling for agreement modals.
  • Ensure existing migrations (e.g., agreement_participants) are applied without conflict.

@rsmithlal rsmithlal requested a review from Copilot July 5, 2025 15:16
Signed-off-by: Robert Smith <rob@bettertogethersolutions.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds the initial scaffold for Agreements and Agreement Terms in the BetterTogether engine, including models, migrations, controllers, views, routes, policies, and placeholder tests.

  • Introduces Agreement and AgreementTerm models with associations, nested attributes, and translations.
  • Adds migrations and updates spec/dummy/db/schema.rb and config/routes.rb to support the new tables and resource routes.
  • Scaffolds views (including Bootstrap markup), policies, empty factories, and pending RSpec examples for views, models, helpers, and requests.

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
db/migrate/20250516130902_create_better_together_agreements.rb Creates agreements table with bt_* helpers
db/migrate/20250516133320_create_better_together_agreement_terms.rb Creates agreement_terms table with references
spec/views/better_together/agreements/show.html.erb_spec.rb Adds pending view spec
spec/views/better_together/agreements/index.html.erb_spec.rb Adds pending view spec
spec/requests/better_together/agreements_spec.rb Adds basic request spec for index/show
spec/models/better_together/agreement_term_spec.rb Adds pending model spec
spec/models/better_together/agreement_spec.rb Adds pending model spec
spec/helpers/better_together/agreements_helper_spec.rb Adds pending helper spec
spec/factories/better_together/agreements.rb Defines empty agreement factory
spec/factories/better_together/agreement_terms.rb Defines empty agreement_term factory
spec/dummy/db/schema.rb Updates dummy database schema to include new tables
config/routes.rb Adds resources :agreements under authenticated user
app/models/better_together/agreement.rb Introduces Agreement model with nested terms
app/models/better_together/agreement_term.rb Introduces AgreementTerm model
app/controllers/better_together/agreements_controller.rb Sets up AgreementsController
app/views/better_together/agreements/_form.html.erb Adds form partial with tabbed interface
app/views/better_together/agreements/index.html.erb Adds index view table for agreements
app/views/better_together/agreements/show.html.erb Adds show view for agreements
app/views/better_together/agreements/new.html.erb Adds new agreement view
app/views/better_together/agreements/edit.html.erb Adds edit agreement view
app/views/better_together/calendars/new.html.erb Updates calendar new view styling
app/views/better_together/agreement_terms/_fields.html.erb Defines nested fields partial
app/views/better_together/agreement_terms/_agreement_terms.html.erb Defines dynamic fields UI
app/policies/better_together/agreement_policy.rb Adds authorization policy for agreements
app/helpers/better_together/agreements_helper.rb Adds empty helper module
Comments suppressed due to low confidence (9)

spec/views/better_together/agreements/show.html.erb_spec.rb:4

  • This spec is marked pending without any examples. Add at least one example to verify the rendered content or remove the spec if it’s not needed.
  pending "add some examples to (or delete) #{__FILE__}"

spec/views/better_together/agreements/index.html.erb_spec.rb:4

  • This spec is pending with no assertions. Provide examples to verify the index view or remove the placeholder.
  pending "add some examples to (or delete) #{__FILE__}"

spec/requests/better_together/agreements_spec.rb:3

  • The request spec only covers GET index and show. Consider adding tests for create, update, and destroy actions to ensure full coverage.
RSpec.describe "Agreements", type: :request do

spec/models/better_together/agreement_term_spec.rb:5

  • Empty model spec—add validations and association tests for AgreementTerm or remove the spec if not needed.
    pending "add some examples to (or delete) #{__FILE__}"

spec/models/better_together/agreement_spec.rb:5

  • Empty model spec—add tests for validations, associations, and nested attributes on Agreement or remove the placeholder.
    pending "add some examples to (or delete) #{__FILE__}"

spec/helpers/better_together/agreements_helper_spec.rb:15

  • Empty helper spec—either add examples to cover any helper methods or remove the file if it remains blank.
    pending "add some examples to (or delete) #{__FILE__}"

spec/factories/better_together/agreements.rb:2

  • Empty factory—define default attributes so Agreement instances created in tests are valid by default.
  factory :agreement do

spec/factories/better_together/agreement_terms.rb:2

  • Empty factory—add required attributes (e.g., identifier, position, agreement association) so test objects are valid.
  factory :agreement_term do

config/routes.rb:36

  • [nitpick] Indent this resources :agreements line consistently under the authenticated :user do block for readability.
        resources :agreements

…l.erb

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Robert Smith <rob@bettertogethersolutions.com>
## Summary
- Add `AgreementParticipant` to link people to agreements and extend
agreement terms with summaries
- Require acceptance of Terms of Service and Privacy Policy during
registration and record consent
- Seed default agreements (privacy policy & terms of service) with
builder

## Testing
- `bin/codex_style_guard`
- `bundle exec rubocop`
- `bundle exec brakeman -q -w2`
- `bundle exec bundler-audit --update`
- `bin/ci` *(fails: ActiveRecord::DatabaseConnectionError: could not
connect to community-engine-db)*

------
https://chatgpt.com/codex/tasks/task_e_68923a04971883218ee3e203ba9cc4e0
…ith-participants-and-terms

Signed-off-by: Robert Smith <rob@bettertogethersolutions.com>
## Summary
- add AgreementParticipant model and associations for tracking who
accepted each agreement
- require privacy policy and terms-of-service consent during
registration with accessible summaries
- seed initial privacy and terms agreements for managers via
AgreementBuilder

## Testing
- `bin/ci` *(no examples found)*
- `bundle exec rspec
spec/models/better_together/agreement_participant_spec.rb
spec/features/agreements/registration_consent_spec.rb --format
documentation`
- `bundle exec rubocop`
- `bundle exec brakeman -q -w2`
- `bundle exec bundler-audit --update`


------
https://chatgpt.com/codex/tasks/task_e_6892377c88c4832196740a9acbdfce2b
Signed-off-by: Robert Smith <rob@bettertogethersolutions.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Robert Smith <rob@bettertogethersolutions.com>
@rsmithlal rsmithlal changed the title WIP: Add Agreements and Agreement Terms Add Agreements and Agreement Terms Aug 19, 2025
@rsmithlal rsmithlal merged commit 54d1f87 into main Aug 19, 2025
11 checks passed
@rsmithlal rsmithlal deleted the feature/agreements branch August 19, 2025 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant