From 2113e92eec89eaac46123c38059e8ca6affe31f2 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Tue, 4 Mar 2025 09:29:50 -0500 Subject: [PATCH 1/5] Remove Docker configuration files --- .dockerignore | 37 ------------------------- Dockerfile | 75 --------------------------------------------------- 2 files changed, 112 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 9612375..0000000 --- a/.dockerignore +++ /dev/null @@ -1,37 +0,0 @@ -# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files. - -# Ignore git directory. -/.git/ - -# Ignore bundler config. -/.bundle - -# Ignore all environment files (except templates). -/.env* -!/.env*.erb - -# Ignore all default key files. -/config/master.key -/config/credentials/*.key - -# Ignore all logfiles and tempfiles. -/log/* -/tmp/* -!/log/.keep -!/tmp/.keep - -# Ignore pidfiles, but keep the directory. -/tmp/pids/* -!/tmp/pids/.keep - -# Ignore storage (uploaded files in development and any SQLite databases). -/storage/* -!/storage/.keep -/tmp/storage/* -!/tmp/storage/.keep - -# Ignore assets. -/node_modules/ -/app/assets/builds/* -!/app/assets/builds/.keep -/public/assets diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 197516d..0000000 --- a/Dockerfile +++ /dev/null @@ -1,75 +0,0 @@ -# syntax = docker/dockerfile:1 - -# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.0 -FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base - -# Rails app lives here -WORKDIR /rails - -# Set production environment -ENV RAILS_ENV="production" \ - BUNDLE_DEPLOYMENT="1" \ - BUNDLE_PATH="/usr/local/bundle" \ - BUNDLE_WITHOUT="development" - - -# Throw-away build stage to reduce size of final image -FROM base as build - -# Install packages needed to build gems and node modules -RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y build-essential curl git libpq-dev libvips node-gyp pkg-config python-is-python3 - -# Install JavaScript dependencies -ARG NODE_VERSION=21.6.2 -ARG YARN_VERSION=1.22.19 -ENV PATH=/usr/local/node/bin:$PATH -RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \ - /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \ - npm install -g yarn@$YARN_VERSION && \ - rm -rf /tmp/node-build-master - -# Install application gems -COPY Gemfile Gemfile.lock ./ -RUN bundle install && \ - rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ - bundle exec bootsnap precompile --gemfile - -# Install node modules -COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile - -# Copy application code -COPY . . - -# Precompile bootsnap code for faster boot times -RUN bundle exec bootsnap precompile app/ lib/ - -# Precompiling assets for production without requiring secret RAILS_MASTER_KEY -RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile - - -# Final stage for app image -FROM base - -# Install packages needed for deployment -RUN apt-get update -qq && \ - apt-get install --no-install-recommends -y curl libvips postgresql-client && \ - rm -rf /var/lib/apt/lists /var/cache/apt/archives - -# Copy built artifacts: gems, application -COPY --from=build /usr/local/bundle /usr/local/bundle -COPY --from=build /rails /rails - -# Run and own only the runtime files as a non-root user for security -RUN useradd rails --create-home --shell /bin/bash && \ - chown -R rails:rails db log storage tmp -USER rails:rails - -# Entrypoint prepares the database. -ENTRYPOINT ["/rails/bin/docker-entrypoint"] - -# Start the server by default, this can be overwritten at runtime -EXPOSE 3000 -CMD ["./bin/rails", "server"] From cdc66f4e32e723b87ad360a74f1a04258c77abb4 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Tue, 4 Mar 2025 10:42:01 -0500 Subject: [PATCH 2/5] Add Cursor configuration rules file Introduces a new .cursorrules configuration file to document project-specific coding standards, conventions, and preferences for development across Ruby, Rails, JavaScript, and testing frameworks. --- .cursorrules | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .cursorrules diff --git a/.cursorrules b/.cursorrules new file mode 100644 index 0000000..d462b90 --- /dev/null +++ b/.cursorrules @@ -0,0 +1,69 @@ +{ + "expertise": { + "frameworks": ["Ruby on Rails", "MySQL", "PostgreSQL", "sqlite3", "Hotwire", "Tailwind CSS", "Yarn"], + "components": ["Turbo", "Stimulus"] + }, + "codeStyle": { + "general": [ + "Write concise, idiomatic Ruby code", + "Follow Rails conventions and best practices", + "Use object-oriented and functional programming patterns", + "Prefer iteration and modularization over duplication" + ], + "naming": { + "files": "snake_case", + "methods": "snake_case", + "variables": "snake_case", + "classes": "CamelCase", + "modules": "CamelCase" + } + }, + "conventions": { + "ruby": { + "version": "3.x", + "styleGuide": "https://rubystyle.guide/", + "preferences": [ + "Use expressive syntax (unless, ||=, &.)", + "Prefer single quotes unless interpolation needed", + "documentation": "https://www.ruby-lang.org/en/documentation/" + ] + }, + "rails": { + "structure": "MVC with concerns and helpers", + "routing": "RESTful", + "activeRecord": "Use effectively for database operations", + "documentation": "https://guides.rubyonrails.org/" + }, + "javascript": { + "preferred": "Hotwire", + "documentation": "https://hotwired.dev/", + "preferences": [ + "Use Hotwire (Turbo + Stimulus) instead of complex JavaScript libraries/frameworks", + "Implement JavaScript functionality through Stimulus controllers when possible", + "Use Turbo Drive, Frames and Streams for page updates without full reloads" + ] + }, + "tailwind": { + "css": "Use Tailwind CSS for styling", + "documentation": "https://tailwindcss.com/docs" + }, + "yarn": { + "css": "Use Tailwind CSS for styling", + "documentation": "https://classic.yarnpkg.com/lang/en/docs/" + } + }, + "testing": { + "framework": "RSpec", + "approach": "TDD/BDD", + "tools": ["FactoryBot", "Jest"], + "preferences": [ + "Use standard RSpec syntax exclusively", + "Avoid shoulda matchers in favor of explicit RSpec expectations", + "Write clear, descriptive test cases that follow RSpec best practices" + ] + }, + "preferences": { + "architecture": "domain modeling first", + "learning": "visual with analogies" + } +} From 0aa836d54dceffc127ef08760fcb5bdff58acf74 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Tue, 4 Mar 2025 10:42:12 -0500 Subject: [PATCH 3/5] Add Devise pepper to credentials configuration Update encrypted credentials to include a Devise pepper for enhanced authentication security --- config/credentials.yml.enc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index 78512b9..c99f9c1 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -EGdBSHoyjRBr5LIlfWDYynoaQEKA3YnJAPzz+QTgIP15K0a/MGkPKhWaP0isEU9EaogQo/BKkoT2rnarZ7LjnjVK44l/anMKNiqhJp14M7g1KaDtwxfU94tuMHDb7L8xYfxrtXP3vdnobn2ZewePJf89Ky/rP3QpWwcSsw6EQ2XPyHg4MpGMOleLpAZiCKNUGQQNZvftzVRh9Z3MCFuic4mWmnIKBLtWFmOo+CWZJbLpoU9aUWIJ4toTqiWqtPY3mGqsOLNigguTr7sttLMfa9os0Ei/PYLqxpUEapLsTjekiEP7LVRCDRHZIX9gSyQ7JgVkCN3jKPm8d/8pdwcoztowLt49h7EKog+9Q9imHgbO2J8CRXa4r2YAPyo6M5HxWMvTWL/Mv/qRUWhjoA+XTLpP0gLRBIVAVIuitOotlkYvE7qK6fX7LWzuYvOsAuFnoN3wlh1pe855lF/fYb3rsduY2/IrX9i4EA3hk21ifLCwEQHXcqG+9ZXIHoW8btxdqpsx9qYMj8IZXLNkZ9cYncl94TviCk1+poG8rbZ3fXu2pxqPgjq/FDExgU6yhesDiXgS+eZKSQrTBCLNXkJ40da5U+T6zzh73H+Ivlba/mRtPCB6zuWCl5JYopDbVq3AedU+4gEXaEsxELFP8V8V6l67egmx/zKhVbONmKjiCBMXLX0WZjQsIjGtjLIU9dzAamNR70RBFR95XVO+5xqZppD39h6xHwDAxR+L3s9g+h//1zZsBnNOf7jtHFwkGc9oRgyq0jSKSq2O2zES9/2U6tBpyJIM0rTD17uljXVcyLCzFqvZ0l1FPjQb7VA4HNcezbuQgSl8vcKT3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vsu5uUhzeYOg== \ No newline at end of file From 821230b58441150ba660fddac476350d7e0784c0 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Tue, 4 Mar 2025 16:13:26 -0500 Subject: [PATCH 4/5] Add active status to Workshop model and admin interface Implement workshop activation feature: - Add `active` boolean column to workshops table - Update Workshop model with `active` scope - Modify ActiveAdmin workshops interface to display and filter by active status - Update application controller to fetch only active workshops --- app/admin/workshops.rb | 5 +++-- app/controllers/application_controller.rb | 2 +- app/models/workshop.rb | 4 +++- db/migrate/20250304203447_add_column_to_workshops.rb | 5 +++++ db/schema.rb | 3 ++- 5 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20250304203447_add_column_to_workshops.rb diff --git a/app/admin/workshops.rb b/app/admin/workshops.rb index 1a51d31..e015ef8 100644 --- a/app/admin/workshops.rb +++ b/app/admin/workshops.rb @@ -5,7 +5,7 @@ # # Uncomment all parameters which should be permitted for assignment # - permit_params :instructor, :last_name, :first_name + permit_params :instructor, :last_name, :first_name, :active # # or # @@ -16,11 +16,12 @@ # end filter :last_name, as: :select - + filter :active index do selectable_column actions id_column + column :active column :instructor column :last_name column :first_name diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 698a6da..4f1d7e0 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -58,7 +58,7 @@ def payments_open? helper_method :payments_open? def get_workshops - @workshops_available = Workshop.all.order_by_lastname + @workshops_available = Workshop.active.order_by_lastname end helper_method :get_workshops diff --git a/app/models/workshop.rb b/app/models/workshop.rb index c405e4b..d580c86 100644 --- a/app/models/workshop.rb +++ b/app/models/workshop.rb @@ -14,12 +14,14 @@ class Workshop < ApplicationRecord validates :first_name, presence: true validates :last_name, presence: true + scope :active, -> { where(active: true) } + def self.ransackable_associations(auth_object = nil) [] end def self.ransackable_attributes(auth_object = nil) - ["created_at", "first_name", "id", "id_value", "instructor", "last_name", "updated_at"] + ["created_at", "first_name", "id", "active", "id_value", "instructor", "last_name", "updated_at"] end def self.order_by_lastname diff --git a/db/migrate/20250304203447_add_column_to_workshops.rb b/db/migrate/20250304203447_add_column_to_workshops.rb new file mode 100644 index 0000000..252b5e9 --- /dev/null +++ b/db/migrate/20250304203447_add_column_to_workshops.rb @@ -0,0 +1,5 @@ +class AddColumnToWorkshops < ActiveRecord::Migration[7.1] + def change + add_column :workshops, :active, :boolean, default: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 0a782fd..524751e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2023_04_10_181609) do +ActiveRecord::Schema[7.1].define(version: 2025_03_04_203447) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -207,6 +207,7 @@ t.string "first_name" t.datetime "created_at", precision: nil, null: false t.datetime "updated_at", precision: nil, null: false + t.boolean "active", default: true end add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id" From adc5c01dd38b49e011099f488221626ca8d12b0b Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Tue, 4 Mar 2025 16:13:36 -0500 Subject: [PATCH 5/5] Improve birth year input in application form Update birth year field to use a select dropdown with: - Year range from current year to 100 years back - Bootstrap input group with calendar icon - Descriptive helper text - Responsive layout adjustments --- app/views/applications/_form.html.erb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/views/applications/_form.html.erb b/app/views/applications/_form.html.erb index bfcd75d..e8bf178 100644 --- a/app/views/applications/_form.html.erb +++ b/app/views/applications/_form.html.erb @@ -89,8 +89,17 @@
<%= f.label :birth_year, 'Year of Birth', class: 'col-sm-3 col-form-label required' %> -
- <%= f.number_field :birth_year, class: 'form-control' %> +
+
+ + + + <%= f.select :birth_year, + (Time.current.year - 100..Time.current.year).step(1).to_a.reverse, + { prompt: "Year" }, + { class: 'form-select form-select-sm' } %> +
+ Select your birth year