first commit
This commit is contained in:
commit
f17c95d999
|
|
@ -0,0 +1,51 @@
|
||||||
|
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
|
||||||
|
|
||||||
|
# Ignore git directory.
|
||||||
|
/.git/
|
||||||
|
/.gitignore
|
||||||
|
|
||||||
|
# Ignore bundler config.
|
||||||
|
/.bundle
|
||||||
|
|
||||||
|
# Ignore all environment files.
|
||||||
|
/.env*
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Ignore CI service files.
|
||||||
|
/.github
|
||||||
|
|
||||||
|
# Ignore Kamal files.
|
||||||
|
/config/deploy*.yml
|
||||||
|
/.kamal
|
||||||
|
|
||||||
|
# Ignore development files
|
||||||
|
/.devcontainer
|
||||||
|
|
||||||
|
# Ignore Docker-related files
|
||||||
|
/.dockerignore
|
||||||
|
/Dockerfile*
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
|
||||||
|
|
||||||
|
# Mark the database schema as having been generated.
|
||||||
|
db/schema.rb linguist-generated
|
||||||
|
|
||||||
|
# Mark any vendored files as having been vendored.
|
||||||
|
vendor/* linguist-vendored
|
||||||
|
config/credentials/*.yml.enc diff=rails_credentials
|
||||||
|
config/credentials.yml.enc diff=rails_credentials
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: bundler
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
open-pull-requests-limit: 10
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
open-pull-requests-limit: 10
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
scan_ruby:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: .ruby-version
|
||||||
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Scan for common Rails security vulnerabilities using static analysis
|
||||||
|
run: bin/brakeman --no-pager
|
||||||
|
|
||||||
|
scan_js:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: .ruby-version
|
||||||
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Scan for security vulnerabilities in JavaScript dependencies
|
||||||
|
run: bin/importmap audit
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: .ruby-version
|
||||||
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Lint code for consistent style
|
||||||
|
run: bin/rubocop -f github
|
||||||
|
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# services:
|
||||||
|
# redis:
|
||||||
|
# image: redis
|
||||||
|
# ports:
|
||||||
|
# - 6379:6379
|
||||||
|
# options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
|
||||||
|
steps:
|
||||||
|
- name: Install packages
|
||||||
|
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config google-chrome-stable
|
||||||
|
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Ruby
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: .ruby-version
|
||||||
|
bundler-cache: true
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
env:
|
||||||
|
RAILS_ENV: test
|
||||||
|
# REDIS_URL: redis://localhost:6379/0
|
||||||
|
run: bin/rails db:test:prepare test test:system
|
||||||
|
|
||||||
|
- name: Keep screenshots from failed system tests
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
name: screenshots
|
||||||
|
path: ${{ github.workspace }}/tmp/screenshots
|
||||||
|
if-no-files-found: ignore
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
||||||
|
#
|
||||||
|
# Temporary files generated by your text editor or operating system
|
||||||
|
# belong in git's global ignore instead:
|
||||||
|
# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`
|
||||||
|
|
||||||
|
# Ignore bundler config.
|
||||||
|
/.bundle
|
||||||
|
|
||||||
|
# Ignore all environment files.
|
||||||
|
/.env*
|
||||||
|
|
||||||
|
# Ignore all logfiles and tempfiles.
|
||||||
|
/log/*
|
||||||
|
/tmp/*
|
||||||
|
!/log/.keep
|
||||||
|
!/tmp/.keep
|
||||||
|
|
||||||
|
# Ignore pidfiles, but keep the directory.
|
||||||
|
/tmp/pids/*
|
||||||
|
!/tmp/pids/
|
||||||
|
!/tmp/pids/.keep
|
||||||
|
|
||||||
|
# Ignore storage (uploaded files in development and any SQLite databases).
|
||||||
|
/storage/*
|
||||||
|
!/storage/.keep
|
||||||
|
/tmp/storage/*
|
||||||
|
!/tmp/storage/
|
||||||
|
!/tmp/storage/.keep
|
||||||
|
|
||||||
|
/public/assets
|
||||||
|
|
||||||
|
# Ignore master key for decrypting credentials and more.
|
||||||
|
/config/master.key
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Docker set up on $KAMAL_HOSTS..."
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Booted app version $KAMAL_VERSION on $KAMAL_HOSTS..."
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# A sample post-deploy hook
|
||||||
|
#
|
||||||
|
# These environment variables are available:
|
||||||
|
# KAMAL_RECORDED_AT
|
||||||
|
# KAMAL_PERFORMER
|
||||||
|
# KAMAL_VERSION
|
||||||
|
# KAMAL_HOSTS
|
||||||
|
# KAMAL_ROLES (if set)
|
||||||
|
# KAMAL_DESTINATION (if set)
|
||||||
|
# KAMAL_RUNTIME
|
||||||
|
|
||||||
|
echo "$KAMAL_PERFORMER deployed $KAMAL_VERSION to $KAMAL_DESTINATION in $KAMAL_RUNTIME seconds"
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Rebooted kamal-proxy on $KAMAL_HOSTS"
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Booting app version $KAMAL_VERSION on $KAMAL_HOSTS..."
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# A sample pre-build hook
|
||||||
|
#
|
||||||
|
# Checks:
|
||||||
|
# 1. We have a clean checkout
|
||||||
|
# 2. A remote is configured
|
||||||
|
# 3. The branch has been pushed to the remote
|
||||||
|
# 4. The version we are deploying matches the remote
|
||||||
|
#
|
||||||
|
# These environment variables are available:
|
||||||
|
# KAMAL_RECORDED_AT
|
||||||
|
# KAMAL_PERFORMER
|
||||||
|
# KAMAL_VERSION
|
||||||
|
# KAMAL_HOSTS
|
||||||
|
# KAMAL_ROLES (if set)
|
||||||
|
# KAMAL_DESTINATION (if set)
|
||||||
|
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
echo "Git checkout is not clean, aborting..." >&2
|
||||||
|
git status --porcelain >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
first_remote=$(git remote)
|
||||||
|
|
||||||
|
if [ -z "$first_remote" ]; then
|
||||||
|
echo "No git remote set, aborting..." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
current_branch=$(git branch --show-current)
|
||||||
|
|
||||||
|
if [ -z "$current_branch" ]; then
|
||||||
|
echo "Not on a git branch, aborting..." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
remote_head=$(git ls-remote $first_remote --tags $current_branch | cut -f1)
|
||||||
|
|
||||||
|
if [ -z "$remote_head" ]; then
|
||||||
|
echo "Branch not pushed to remote, aborting..." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$KAMAL_VERSION" != "$remote_head" ]; then
|
||||||
|
echo "Version ($KAMAL_VERSION) does not match remote HEAD ($remote_head), aborting..." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
# A sample pre-connect check
|
||||||
|
#
|
||||||
|
# Warms DNS before connecting to hosts in parallel
|
||||||
|
#
|
||||||
|
# These environment variables are available:
|
||||||
|
# KAMAL_RECORDED_AT
|
||||||
|
# KAMAL_PERFORMER
|
||||||
|
# KAMAL_VERSION
|
||||||
|
# KAMAL_HOSTS
|
||||||
|
# KAMAL_ROLES (if set)
|
||||||
|
# KAMAL_DESTINATION (if set)
|
||||||
|
# KAMAL_RUNTIME
|
||||||
|
|
||||||
|
hosts = ENV["KAMAL_HOSTS"].split(",")
|
||||||
|
results = nil
|
||||||
|
max = 3
|
||||||
|
|
||||||
|
elapsed = Benchmark.realtime do
|
||||||
|
results = hosts.map do |host|
|
||||||
|
Thread.new do
|
||||||
|
tries = 1
|
||||||
|
|
||||||
|
begin
|
||||||
|
Socket.getaddrinfo(host, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)
|
||||||
|
rescue SocketError
|
||||||
|
if tries < max
|
||||||
|
puts "Retrying DNS warmup: #{host}"
|
||||||
|
tries += 1
|
||||||
|
sleep rand
|
||||||
|
retry
|
||||||
|
else
|
||||||
|
puts "DNS warmup failed: #{host}"
|
||||||
|
host
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
tries
|
||||||
|
end
|
||||||
|
end.map(&:value)
|
||||||
|
end
|
||||||
|
|
||||||
|
retries = results.sum - hosts.size
|
||||||
|
nopes = results.count { |r| r == max }
|
||||||
|
|
||||||
|
puts "Prewarmed %d DNS lookups in %.2f sec: %d retries, %d failures" % [ hosts.size, elapsed, retries, nopes ]
|
||||||
|
|
@ -0,0 +1,122 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
# A sample pre-deploy hook
|
||||||
|
#
|
||||||
|
# Checks the Github status of the build, waiting for a pending build to complete for up to 720 seconds.
|
||||||
|
#
|
||||||
|
# Fails unless the combined status is "success"
|
||||||
|
#
|
||||||
|
# These environment variables are available:
|
||||||
|
# KAMAL_RECORDED_AT
|
||||||
|
# KAMAL_PERFORMER
|
||||||
|
# KAMAL_VERSION
|
||||||
|
# KAMAL_HOSTS
|
||||||
|
# KAMAL_COMMAND
|
||||||
|
# KAMAL_SUBCOMMAND
|
||||||
|
# KAMAL_ROLES (if set)
|
||||||
|
# KAMAL_DESTINATION (if set)
|
||||||
|
|
||||||
|
# Only check the build status for production deployments
|
||||||
|
if ENV["KAMAL_COMMAND"] == "rollback" || ENV["KAMAL_DESTINATION"] != "production"
|
||||||
|
exit 0
|
||||||
|
end
|
||||||
|
|
||||||
|
require "bundler/inline"
|
||||||
|
|
||||||
|
# true = install gems so this is fast on repeat invocations
|
||||||
|
gemfile(true, quiet: true) do
|
||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
gem "octokit"
|
||||||
|
gem "faraday-retry"
|
||||||
|
end
|
||||||
|
|
||||||
|
MAX_ATTEMPTS = 72
|
||||||
|
ATTEMPTS_GAP = 10
|
||||||
|
|
||||||
|
def exit_with_error(message)
|
||||||
|
$stderr.puts message
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
class GithubStatusChecks
|
||||||
|
attr_reader :remote_url, :git_sha, :github_client, :combined_status
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@remote_url = github_repo_from_remote_url
|
||||||
|
@git_sha = `git rev-parse HEAD`.strip
|
||||||
|
@github_client = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"])
|
||||||
|
refresh!
|
||||||
|
end
|
||||||
|
|
||||||
|
def refresh!
|
||||||
|
@combined_status = github_client.combined_status(remote_url, git_sha)
|
||||||
|
end
|
||||||
|
|
||||||
|
def state
|
||||||
|
combined_status[:state]
|
||||||
|
end
|
||||||
|
|
||||||
|
def first_status_url
|
||||||
|
first_status = combined_status[:statuses].find { |status| status[:state] == state }
|
||||||
|
first_status && first_status[:target_url]
|
||||||
|
end
|
||||||
|
|
||||||
|
def complete_count
|
||||||
|
combined_status[:statuses].count { |status| status[:state] != "pending"}
|
||||||
|
end
|
||||||
|
|
||||||
|
def total_count
|
||||||
|
combined_status[:statuses].count
|
||||||
|
end
|
||||||
|
|
||||||
|
def current_status
|
||||||
|
if total_count > 0
|
||||||
|
"Completed #{complete_count}/#{total_count} checks, see #{first_status_url} ..."
|
||||||
|
else
|
||||||
|
"Build not started..."
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def github_repo_from_remote_url
|
||||||
|
url = `git config --get remote.origin.url`.strip.delete_suffix(".git")
|
||||||
|
if url.start_with?("https://github.com/")
|
||||||
|
url.delete_prefix("https://github.com/")
|
||||||
|
elsif url.start_with?("git@github.com:")
|
||||||
|
url.delete_prefix("git@github.com:")
|
||||||
|
else
|
||||||
|
url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
$stdout.sync = true
|
||||||
|
|
||||||
|
begin
|
||||||
|
puts "Checking build status..."
|
||||||
|
|
||||||
|
attempts = 0
|
||||||
|
checks = GithubStatusChecks.new
|
||||||
|
|
||||||
|
loop do
|
||||||
|
case checks.state
|
||||||
|
when "success"
|
||||||
|
puts "Checks passed, see #{checks.first_status_url}"
|
||||||
|
exit 0
|
||||||
|
when "failure"
|
||||||
|
exit_with_error "Checks failed, see #{checks.first_status_url}"
|
||||||
|
when "pending"
|
||||||
|
attempts += 1
|
||||||
|
end
|
||||||
|
|
||||||
|
exit_with_error "Checks are still pending, gave up after #{MAX_ATTEMPTS * ATTEMPTS_GAP} seconds" if attempts == MAX_ATTEMPTS
|
||||||
|
|
||||||
|
puts checks.current_status
|
||||||
|
sleep(ATTEMPTS_GAP)
|
||||||
|
checks.refresh!
|
||||||
|
end
|
||||||
|
rescue Octokit::NotFound
|
||||||
|
exit_with_error "Build status could not be found"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
echo "Rebooting kamal-proxy on $KAMAL_HOSTS..."
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
# Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,
|
||||||
|
# and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
|
||||||
|
# password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.
|
||||||
|
|
||||||
|
# Example of extracting secrets from 1password (or another compatible pw manager)
|
||||||
|
# SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)
|
||||||
|
# KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})
|
||||||
|
# RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})
|
||||||
|
|
||||||
|
# Use a GITHUB_TOKEN if private repositories are needed for the image
|
||||||
|
# GITHUB_TOKEN=$(gh config get -h github.com oauth_token)
|
||||||
|
|
||||||
|
# Grab the registry password from ENV
|
||||||
|
KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
|
||||||
|
|
||||||
|
# Improve security by using a password manager. Never check config/master.key into git!
|
||||||
|
RAILS_MASTER_KEY=$(cat config/master.key)
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Omakase Ruby styling for Rails
|
||||||
|
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
|
||||||
|
|
||||||
|
# Overwrite or add rules to create your own house style
|
||||||
|
#
|
||||||
|
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
|
||||||
|
# Layout/SpaceInsideArrayLiteralBrackets:
|
||||||
|
# Enabled: false
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
ruby-3.2.3
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
# check=error=true
|
||||||
|
|
||||||
|
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
|
||||||
|
# docker build -t badar_madeena .
|
||||||
|
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name badar_madeena badar_madeena
|
||||||
|
|
||||||
|
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
|
||||||
|
|
||||||
|
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
|
||||||
|
ARG RUBY_VERSION=3.2.3
|
||||||
|
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
|
||||||
|
|
||||||
|
# Rails app lives here
|
||||||
|
WORKDIR /rails
|
||||||
|
|
||||||
|
# Install base packages
|
||||||
|
RUN apt-get update -qq && \
|
||||||
|
apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \
|
||||||
|
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||||
|
|
||||||
|
# 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
|
||||||
|
RUN apt-get update -qq && \
|
||||||
|
apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config && \
|
||||||
|
rm -rf /var/lib/apt/lists /var/cache/apt/archives
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# Copy built artifacts: gems, application
|
||||||
|
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
|
||||||
|
COPY --from=build /rails /rails
|
||||||
|
|
||||||
|
# Run and own only the runtime files as a non-root user for security
|
||||||
|
RUN groupadd --system --gid 1000 rails && \
|
||||||
|
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
|
||||||
|
chown -R rails:rails db log storage tmp
|
||||||
|
USER 1000:1000
|
||||||
|
|
||||||
|
# Entrypoint prepares the database.
|
||||||
|
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
|
||||||
|
|
||||||
|
# Start server via Thruster by default, this can be overwritten at runtime
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["./bin/thrust", "./bin/rails", "server"]
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
||||||
|
gem "rails", "~> 8.0.3"
|
||||||
|
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
|
||||||
|
gem "propshaft"
|
||||||
|
# Use sqlite3 as the database for Active Record
|
||||||
|
gem "sqlite3", ">= 2.1"
|
||||||
|
# Use the Puma web server [https://github.com/puma/puma]
|
||||||
|
gem "puma", ">= 5.0"
|
||||||
|
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
||||||
|
gem "importmap-rails"
|
||||||
|
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
||||||
|
gem "turbo-rails"
|
||||||
|
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
||||||
|
gem "stimulus-rails"
|
||||||
|
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
||||||
|
gem "jbuilder"
|
||||||
|
|
||||||
|
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
||||||
|
# gem "bcrypt", "~> 3.1.7"
|
||||||
|
|
||||||
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||||
|
gem "tzinfo-data", platforms: %i[ windows jruby ]
|
||||||
|
|
||||||
|
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
|
||||||
|
gem "solid_cache"
|
||||||
|
gem "solid_queue"
|
||||||
|
gem "solid_cable"
|
||||||
|
|
||||||
|
# Reduces boot times through caching; required in config/boot.rb
|
||||||
|
gem "bootsnap", require: false
|
||||||
|
|
||||||
|
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
|
||||||
|
gem "kamal", require: false
|
||||||
|
|
||||||
|
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
|
||||||
|
gem "thruster", require: false
|
||||||
|
|
||||||
|
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
|
||||||
|
# gem "image_processing", "~> 1.2"
|
||||||
|
|
||||||
|
group :development, :test do
|
||||||
|
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
||||||
|
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
|
||||||
|
|
||||||
|
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
|
||||||
|
gem "brakeman", require: false
|
||||||
|
|
||||||
|
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
|
||||||
|
gem "rubocop-rails-omakase", require: false
|
||||||
|
end
|
||||||
|
|
||||||
|
group :development do
|
||||||
|
# Use console on exceptions pages [https://github.com/rails/web-console]
|
||||||
|
gem "web-console"
|
||||||
|
end
|
||||||
|
|
||||||
|
group :test do
|
||||||
|
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
|
||||||
|
gem "capybara"
|
||||||
|
gem "selenium-webdriver"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,362 @@
|
||||||
|
GEM
|
||||||
|
remote: https://rubygems.org/
|
||||||
|
specs:
|
||||||
|
actioncable (8.0.3)
|
||||||
|
actionpack (= 8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
nio4r (~> 2.0)
|
||||||
|
websocket-driver (>= 0.6.1)
|
||||||
|
zeitwerk (~> 2.6)
|
||||||
|
actionmailbox (8.0.3)
|
||||||
|
actionpack (= 8.0.3)
|
||||||
|
activejob (= 8.0.3)
|
||||||
|
activerecord (= 8.0.3)
|
||||||
|
activestorage (= 8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
mail (>= 2.8.0)
|
||||||
|
actionmailer (8.0.3)
|
||||||
|
actionpack (= 8.0.3)
|
||||||
|
actionview (= 8.0.3)
|
||||||
|
activejob (= 8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
mail (>= 2.8.0)
|
||||||
|
rails-dom-testing (~> 2.2)
|
||||||
|
actionpack (8.0.3)
|
||||||
|
actionview (= 8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
nokogiri (>= 1.8.5)
|
||||||
|
rack (>= 2.2.4)
|
||||||
|
rack-session (>= 1.0.1)
|
||||||
|
rack-test (>= 0.6.3)
|
||||||
|
rails-dom-testing (~> 2.2)
|
||||||
|
rails-html-sanitizer (~> 1.6)
|
||||||
|
useragent (~> 0.16)
|
||||||
|
actiontext (8.0.3)
|
||||||
|
actionpack (= 8.0.3)
|
||||||
|
activerecord (= 8.0.3)
|
||||||
|
activestorage (= 8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
globalid (>= 0.6.0)
|
||||||
|
nokogiri (>= 1.8.5)
|
||||||
|
actionview (8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
builder (~> 3.1)
|
||||||
|
erubi (~> 1.11)
|
||||||
|
rails-dom-testing (~> 2.2)
|
||||||
|
rails-html-sanitizer (~> 1.6)
|
||||||
|
activejob (8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
globalid (>= 0.3.6)
|
||||||
|
activemodel (8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
activerecord (8.0.3)
|
||||||
|
activemodel (= 8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
timeout (>= 0.4.0)
|
||||||
|
activestorage (8.0.3)
|
||||||
|
actionpack (= 8.0.3)
|
||||||
|
activejob (= 8.0.3)
|
||||||
|
activerecord (= 8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
marcel (~> 1.0)
|
||||||
|
activesupport (8.0.3)
|
||||||
|
base64
|
||||||
|
benchmark (>= 0.3)
|
||||||
|
bigdecimal
|
||||||
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
||||||
|
connection_pool (>= 2.2.5)
|
||||||
|
drb
|
||||||
|
i18n (>= 1.6, < 2)
|
||||||
|
logger (>= 1.4.2)
|
||||||
|
minitest (>= 5.1)
|
||||||
|
securerandom (>= 0.3)
|
||||||
|
tzinfo (~> 2.0, >= 2.0.5)
|
||||||
|
uri (>= 0.13.1)
|
||||||
|
addressable (2.8.7)
|
||||||
|
public_suffix (>= 2.0.2, < 7.0)
|
||||||
|
ast (2.4.3)
|
||||||
|
base64 (0.3.0)
|
||||||
|
bcrypt_pbkdf (1.1.1)
|
||||||
|
benchmark (0.4.1)
|
||||||
|
bigdecimal (3.2.3)
|
||||||
|
bindex (0.8.1)
|
||||||
|
bootsnap (1.18.6)
|
||||||
|
msgpack (~> 1.2)
|
||||||
|
brakeman (7.1.0)
|
||||||
|
racc
|
||||||
|
builder (3.3.0)
|
||||||
|
capybara (3.40.0)
|
||||||
|
addressable
|
||||||
|
matrix
|
||||||
|
mini_mime (>= 0.1.3)
|
||||||
|
nokogiri (~> 1.11)
|
||||||
|
rack (>= 1.6.0)
|
||||||
|
rack-test (>= 0.6.3)
|
||||||
|
regexp_parser (>= 1.5, < 3.0)
|
||||||
|
xpath (~> 3.2)
|
||||||
|
concurrent-ruby (1.3.5)
|
||||||
|
connection_pool (2.5.4)
|
||||||
|
crass (1.0.6)
|
||||||
|
date (3.4.1)
|
||||||
|
debug (1.11.0)
|
||||||
|
irb (~> 1.10)
|
||||||
|
reline (>= 0.3.8)
|
||||||
|
dotenv (3.1.8)
|
||||||
|
drb (2.2.3)
|
||||||
|
ed25519 (1.4.0)
|
||||||
|
erb (5.0.2)
|
||||||
|
erubi (1.13.1)
|
||||||
|
et-orbi (1.4.0)
|
||||||
|
tzinfo
|
||||||
|
fugit (1.11.2)
|
||||||
|
et-orbi (~> 1, >= 1.2.11)
|
||||||
|
raabro (~> 1.4)
|
||||||
|
globalid (1.3.0)
|
||||||
|
activesupport (>= 6.1)
|
||||||
|
i18n (1.14.7)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
importmap-rails (2.2.2)
|
||||||
|
actionpack (>= 6.0.0)
|
||||||
|
activesupport (>= 6.0.0)
|
||||||
|
railties (>= 6.0.0)
|
||||||
|
io-console (0.8.1)
|
||||||
|
irb (1.15.2)
|
||||||
|
pp (>= 0.6.0)
|
||||||
|
rdoc (>= 4.0.0)
|
||||||
|
reline (>= 0.4.2)
|
||||||
|
jbuilder (2.14.1)
|
||||||
|
actionview (>= 7.0.0)
|
||||||
|
activesupport (>= 7.0.0)
|
||||||
|
json (2.15.0)
|
||||||
|
kamal (2.7.0)
|
||||||
|
activesupport (>= 7.0)
|
||||||
|
base64 (~> 0.2)
|
||||||
|
bcrypt_pbkdf (~> 1.0)
|
||||||
|
concurrent-ruby (~> 1.2)
|
||||||
|
dotenv (~> 3.1)
|
||||||
|
ed25519 (~> 1.4)
|
||||||
|
net-ssh (~> 7.3)
|
||||||
|
sshkit (>= 1.23.0, < 2.0)
|
||||||
|
thor (~> 1.3)
|
||||||
|
zeitwerk (>= 2.6.18, < 3.0)
|
||||||
|
language_server-protocol (3.17.0.5)
|
||||||
|
lint_roller (1.1.0)
|
||||||
|
logger (1.7.0)
|
||||||
|
loofah (2.24.1)
|
||||||
|
crass (~> 1.0.2)
|
||||||
|
nokogiri (>= 1.12.0)
|
||||||
|
mail (2.8.1)
|
||||||
|
mini_mime (>= 0.1.1)
|
||||||
|
net-imap
|
||||||
|
net-pop
|
||||||
|
net-smtp
|
||||||
|
marcel (1.1.0)
|
||||||
|
matrix (0.4.3)
|
||||||
|
mini_mime (1.1.5)
|
||||||
|
minitest (5.25.5)
|
||||||
|
msgpack (1.8.0)
|
||||||
|
net-imap (0.5.10)
|
||||||
|
date
|
||||||
|
net-protocol
|
||||||
|
net-pop (0.1.2)
|
||||||
|
net-protocol
|
||||||
|
net-protocol (0.2.2)
|
||||||
|
timeout
|
||||||
|
net-scp (4.1.0)
|
||||||
|
net-ssh (>= 2.6.5, < 8.0.0)
|
||||||
|
net-sftp (4.0.0)
|
||||||
|
net-ssh (>= 5.0.0, < 8.0.0)
|
||||||
|
net-smtp (0.5.1)
|
||||||
|
net-protocol
|
||||||
|
net-ssh (7.3.0)
|
||||||
|
nio4r (2.7.4)
|
||||||
|
nokogiri (1.18.10-x86_64-linux-gnu)
|
||||||
|
racc (~> 1.4)
|
||||||
|
ostruct (0.6.3)
|
||||||
|
parallel (1.27.0)
|
||||||
|
parser (3.3.9.0)
|
||||||
|
ast (~> 2.4.1)
|
||||||
|
racc
|
||||||
|
pp (0.6.2)
|
||||||
|
prettyprint
|
||||||
|
prettyprint (0.2.0)
|
||||||
|
prism (1.5.1)
|
||||||
|
propshaft (1.3.1)
|
||||||
|
actionpack (>= 7.0.0)
|
||||||
|
activesupport (>= 7.0.0)
|
||||||
|
rack
|
||||||
|
psych (5.2.6)
|
||||||
|
date
|
||||||
|
stringio
|
||||||
|
public_suffix (6.0.2)
|
||||||
|
puma (7.0.4)
|
||||||
|
nio4r (~> 2.0)
|
||||||
|
raabro (1.4.0)
|
||||||
|
racc (1.8.1)
|
||||||
|
rack (3.2.1)
|
||||||
|
rack-session (2.1.1)
|
||||||
|
base64 (>= 0.1.0)
|
||||||
|
rack (>= 3.0.0)
|
||||||
|
rack-test (2.2.0)
|
||||||
|
rack (>= 1.3)
|
||||||
|
rackup (2.2.1)
|
||||||
|
rack (>= 3)
|
||||||
|
rails (8.0.3)
|
||||||
|
actioncable (= 8.0.3)
|
||||||
|
actionmailbox (= 8.0.3)
|
||||||
|
actionmailer (= 8.0.3)
|
||||||
|
actionpack (= 8.0.3)
|
||||||
|
actiontext (= 8.0.3)
|
||||||
|
actionview (= 8.0.3)
|
||||||
|
activejob (= 8.0.3)
|
||||||
|
activemodel (= 8.0.3)
|
||||||
|
activerecord (= 8.0.3)
|
||||||
|
activestorage (= 8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
bundler (>= 1.15.0)
|
||||||
|
railties (= 8.0.3)
|
||||||
|
rails-dom-testing (2.3.0)
|
||||||
|
activesupport (>= 5.0.0)
|
||||||
|
minitest
|
||||||
|
nokogiri (>= 1.6)
|
||||||
|
rails-html-sanitizer (1.6.2)
|
||||||
|
loofah (~> 2.21)
|
||||||
|
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
||||||
|
railties (8.0.3)
|
||||||
|
actionpack (= 8.0.3)
|
||||||
|
activesupport (= 8.0.3)
|
||||||
|
irb (~> 1.13)
|
||||||
|
rackup (>= 1.0.0)
|
||||||
|
rake (>= 12.2)
|
||||||
|
thor (~> 1.0, >= 1.2.2)
|
||||||
|
tsort (>= 0.2)
|
||||||
|
zeitwerk (~> 2.6)
|
||||||
|
rainbow (3.1.1)
|
||||||
|
rake (13.3.0)
|
||||||
|
rdoc (6.14.2)
|
||||||
|
erb
|
||||||
|
psych (>= 4.0.0)
|
||||||
|
regexp_parser (2.11.3)
|
||||||
|
reline (0.6.2)
|
||||||
|
io-console (~> 0.5)
|
||||||
|
rexml (3.4.4)
|
||||||
|
rubocop (1.81.1)
|
||||||
|
json (~> 2.3)
|
||||||
|
language_server-protocol (~> 3.17.0.2)
|
||||||
|
lint_roller (~> 1.1.0)
|
||||||
|
parallel (~> 1.10)
|
||||||
|
parser (>= 3.3.0.2)
|
||||||
|
rainbow (>= 2.2.2, < 4.0)
|
||||||
|
regexp_parser (>= 2.9.3, < 3.0)
|
||||||
|
rubocop-ast (>= 1.47.1, < 2.0)
|
||||||
|
ruby-progressbar (~> 1.7)
|
||||||
|
unicode-display_width (>= 2.4.0, < 4.0)
|
||||||
|
rubocop-ast (1.47.1)
|
||||||
|
parser (>= 3.3.7.2)
|
||||||
|
prism (~> 1.4)
|
||||||
|
rubocop-performance (1.26.0)
|
||||||
|
lint_roller (~> 1.1)
|
||||||
|
rubocop (>= 1.75.0, < 2.0)
|
||||||
|
rubocop-ast (>= 1.44.0, < 2.0)
|
||||||
|
rubocop-rails (2.33.4)
|
||||||
|
activesupport (>= 4.2.0)
|
||||||
|
lint_roller (~> 1.1)
|
||||||
|
rack (>= 1.1)
|
||||||
|
rubocop (>= 1.75.0, < 2.0)
|
||||||
|
rubocop-ast (>= 1.44.0, < 2.0)
|
||||||
|
rubocop-rails-omakase (1.1.0)
|
||||||
|
rubocop (>= 1.72)
|
||||||
|
rubocop-performance (>= 1.24)
|
||||||
|
rubocop-rails (>= 2.30)
|
||||||
|
ruby-progressbar (1.13.0)
|
||||||
|
rubyzip (3.1.1)
|
||||||
|
securerandom (0.4.1)
|
||||||
|
selenium-webdriver (4.35.0)
|
||||||
|
base64 (~> 0.2)
|
||||||
|
logger (~> 1.4)
|
||||||
|
rexml (~> 3.2, >= 3.2.5)
|
||||||
|
rubyzip (>= 1.2.2, < 4.0)
|
||||||
|
websocket (~> 1.0)
|
||||||
|
solid_cable (3.0.12)
|
||||||
|
actioncable (>= 7.2)
|
||||||
|
activejob (>= 7.2)
|
||||||
|
activerecord (>= 7.2)
|
||||||
|
railties (>= 7.2)
|
||||||
|
solid_cache (1.0.7)
|
||||||
|
activejob (>= 7.2)
|
||||||
|
activerecord (>= 7.2)
|
||||||
|
railties (>= 7.2)
|
||||||
|
solid_queue (1.2.1)
|
||||||
|
activejob (>= 7.1)
|
||||||
|
activerecord (>= 7.1)
|
||||||
|
concurrent-ruby (>= 1.3.1)
|
||||||
|
fugit (~> 1.11.0)
|
||||||
|
railties (>= 7.1)
|
||||||
|
thor (>= 1.3.1)
|
||||||
|
sqlite3 (2.7.4-x86_64-linux-gnu)
|
||||||
|
sshkit (1.24.0)
|
||||||
|
base64
|
||||||
|
logger
|
||||||
|
net-scp (>= 1.1.2)
|
||||||
|
net-sftp (>= 2.1.2)
|
||||||
|
net-ssh (>= 2.8.0)
|
||||||
|
ostruct
|
||||||
|
stimulus-rails (1.3.4)
|
||||||
|
railties (>= 6.0.0)
|
||||||
|
stringio (3.1.7)
|
||||||
|
thor (1.4.0)
|
||||||
|
thruster (0.1.15-x86_64-linux)
|
||||||
|
timeout (0.4.3)
|
||||||
|
tsort (0.2.0)
|
||||||
|
turbo-rails (2.0.17)
|
||||||
|
actionpack (>= 7.1.0)
|
||||||
|
railties (>= 7.1.0)
|
||||||
|
tzinfo (2.0.6)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
unicode-display_width (3.2.0)
|
||||||
|
unicode-emoji (~> 4.1)
|
||||||
|
unicode-emoji (4.1.0)
|
||||||
|
uri (1.0.3)
|
||||||
|
useragent (0.16.11)
|
||||||
|
web-console (4.2.1)
|
||||||
|
actionview (>= 6.0.0)
|
||||||
|
activemodel (>= 6.0.0)
|
||||||
|
bindex (>= 0.4.0)
|
||||||
|
railties (>= 6.0.0)
|
||||||
|
websocket (1.2.11)
|
||||||
|
websocket-driver (0.8.0)
|
||||||
|
base64
|
||||||
|
websocket-extensions (>= 0.1.0)
|
||||||
|
websocket-extensions (0.1.5)
|
||||||
|
xpath (3.2.0)
|
||||||
|
nokogiri (~> 1.8)
|
||||||
|
zeitwerk (2.7.3)
|
||||||
|
|
||||||
|
PLATFORMS
|
||||||
|
x86_64-linux
|
||||||
|
|
||||||
|
DEPENDENCIES
|
||||||
|
bootsnap
|
||||||
|
brakeman
|
||||||
|
capybara
|
||||||
|
debug
|
||||||
|
importmap-rails
|
||||||
|
jbuilder
|
||||||
|
kamal
|
||||||
|
propshaft
|
||||||
|
puma (>= 5.0)
|
||||||
|
rails (~> 8.0.3)
|
||||||
|
rubocop-rails-omakase
|
||||||
|
selenium-webdriver
|
||||||
|
solid_cable
|
||||||
|
solid_cache
|
||||||
|
solid_queue
|
||||||
|
sqlite3 (>= 2.1)
|
||||||
|
stimulus-rails
|
||||||
|
thruster
|
||||||
|
turbo-rails
|
||||||
|
tzinfo-data
|
||||||
|
web-console
|
||||||
|
|
||||||
|
BUNDLED WITH
|
||||||
|
2.4.20
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
# README
|
||||||
|
|
||||||
|
This README would normally document whatever steps are necessary to get the
|
||||||
|
application up and running.
|
||||||
|
|
||||||
|
Things you may want to cover:
|
||||||
|
|
||||||
|
* Ruby version
|
||||||
|
|
||||||
|
* System dependencies
|
||||||
|
|
||||||
|
* Configuration
|
||||||
|
|
||||||
|
* Database creation
|
||||||
|
|
||||||
|
* Database initialization
|
||||||
|
|
||||||
|
* How to run the test suite
|
||||||
|
|
||||||
|
* Services (job queues, cache servers, search engines, etc.)
|
||||||
|
|
||||||
|
* Deployment instructions
|
||||||
|
|
||||||
|
* ...
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
||||||
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
||||||
|
|
||||||
|
require_relative "config/application"
|
||||||
|
|
||||||
|
Rails.application.load_tasks
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
|
|
@ -0,0 +1,10 @@
|
||||||
|
/*
|
||||||
|
* This is a manifest file that'll be compiled into application.css.
|
||||||
|
*
|
||||||
|
* With Propshaft, assets are served efficiently without preprocessing steps. You can still include
|
||||||
|
* application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
|
||||||
|
* cascading order, meaning styles declared later in the document or manifest will override earlier ones,
|
||||||
|
* depending on specificity.
|
||||||
|
*
|
||||||
|
* Consider organizing styles into separate files for maintainability.
|
||||||
|
*/
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
class ApplicationController < ActionController::Base
|
||||||
|
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
||||||
|
allow_browser versions: :modern
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
class InstitutionsController < ApplicationController
|
||||||
|
before_action :set_institution, only: %i[ show edit update destroy ]
|
||||||
|
|
||||||
|
|
||||||
|
# GET /institutions or /institutions.json
|
||||||
|
def index
|
||||||
|
@institutions = Institution.all
|
||||||
|
@programs = Program.all
|
||||||
|
@ziyaras = Ziyara.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /institutions/1 or /institutions/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /institutions/new
|
||||||
|
def new
|
||||||
|
@institution = Institution.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /institutions/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /institutions or /institutions.json
|
||||||
|
def create
|
||||||
|
@institution = Institution.new(institution_params)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @institution.save
|
||||||
|
format.html { redirect_to @institution, notice: "Institution was successfully created." }
|
||||||
|
format.json { render :show, status: :created, location: @institution }
|
||||||
|
else
|
||||||
|
format.html { render :new, status: :unprocessable_entity }
|
||||||
|
format.json { render json: @institution.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /institutions/1 or /institutions/1.json
|
||||||
|
def update
|
||||||
|
respond_to do |format|
|
||||||
|
if @institution.update(institution_params)
|
||||||
|
format.html { redirect_to @institution, notice: "Institution was successfully updated.", status: :see_other }
|
||||||
|
format.json { render :show, status: :ok, location: @institution }
|
||||||
|
else
|
||||||
|
format.html { render :edit, status: :unprocessable_entity }
|
||||||
|
format.json { render json: @institution.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /institutions/1 or /institutions/1.json
|
||||||
|
def destroy
|
||||||
|
@institution.destroy!
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to institutions_path, notice: "Institution was successfully destroyed.", status: :see_other }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_institution
|
||||||
|
@institution = Institution.find(params.expect(:id))
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only allow a list of trusted parameters through.
|
||||||
|
def institution_params
|
||||||
|
params.expect(institution: [ :name, :institution_type ])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
class ProgramsController < ApplicationController
|
||||||
|
before_action :set_program, only: %i[ show edit update destroy ]
|
||||||
|
|
||||||
|
# GET /programs or /programs.json
|
||||||
|
def index
|
||||||
|
@programs = Program.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /programs/1 or /programs/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /programs/new
|
||||||
|
def new
|
||||||
|
@program = Program.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /programs/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /programs or /programs.json
|
||||||
|
def create
|
||||||
|
@program = Program.new(program_params)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @program.save
|
||||||
|
format.html { redirect_to @program, notice: "Program was successfully created." }
|
||||||
|
format.json { render :show, status: :created, location: @program }
|
||||||
|
else
|
||||||
|
format.html { render :new, status: :unprocessable_entity }
|
||||||
|
format.json { render json: @program.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /programs/1 or /programs/1.json
|
||||||
|
def update
|
||||||
|
respond_to do |format|
|
||||||
|
if @program.update(program_params)
|
||||||
|
format.html { redirect_to @program, notice: "Program was successfully updated.", status: :see_other }
|
||||||
|
format.json { render :show, status: :ok, location: @program }
|
||||||
|
else
|
||||||
|
format.html { render :edit, status: :unprocessable_entity }
|
||||||
|
format.json { render json: @program.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /programs/1 or /programs/1.json
|
||||||
|
def destroy
|
||||||
|
@program.destroy!
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to programs_path, notice: "Program was successfully destroyed.", status: :see_other }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_program
|
||||||
|
@program = Program.find(params.expect(:id))
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only allow a list of trusted parameters through.
|
||||||
|
def program_params
|
||||||
|
params.expect(program: [ :name, :date, :leadingPerson ])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
class StudentsController < ApplicationController
|
||||||
|
before_action :set_institution
|
||||||
|
before_action :set_student, only: %i[ show edit update destroy ]
|
||||||
|
|
||||||
|
# GET /students or /students.json
|
||||||
|
def index
|
||||||
|
@students = @institution.students
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /students/1 or /students/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /students/new
|
||||||
|
def new
|
||||||
|
@student = @institution.students.build
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /students/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /students or /students.json
|
||||||
|
def create
|
||||||
|
@student = @institution.students.build(student_params)
|
||||||
|
if @student.save
|
||||||
|
redirect_to institution_students_path(@institution), notice: 'Student was successfully created.'
|
||||||
|
else
|
||||||
|
render :new, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /students/1 or /students/1.json
|
||||||
|
def update
|
||||||
|
if @student.update(student_params)
|
||||||
|
redirect_to institution_students_path(@institution), notice: 'Student was successfully updated.'
|
||||||
|
else
|
||||||
|
render :edit, status: :unprocessable_entity
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /students/1 or /students/1.json
|
||||||
|
def destroy
|
||||||
|
@student.destroy
|
||||||
|
redirect_to institution_students_path(@institution), notice: 'Student was successfully destroyed.'
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_institution
|
||||||
|
@institution = Institution.find(params[:institution_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_student
|
||||||
|
@student = @institution.students.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only allow a list of trusted parameters through.
|
||||||
|
def student_params
|
||||||
|
params.require(:student).permit(:first_name, :last_name, :email, :institution_id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
class ZiyarasController < ApplicationController
|
||||||
|
before_action :set_ziyara, only: %i[ show edit update destroy ]
|
||||||
|
|
||||||
|
# GET /ziyaras or /ziyaras.json
|
||||||
|
def index
|
||||||
|
@ziyaras = Ziyara.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /ziyaras/1 or /ziyaras/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /ziyaras/new
|
||||||
|
def new
|
||||||
|
@ziyara = Ziyara.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /ziyaras/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /ziyaras or /ziyaras.json
|
||||||
|
def create
|
||||||
|
@ziyara = Ziyara.new(ziyara_params)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @ziyara.save
|
||||||
|
format.html { redirect_to @ziyara, notice: "Ziyara was successfully created." }
|
||||||
|
format.json { render :show, status: :created, location: @ziyara }
|
||||||
|
else
|
||||||
|
format.html { render :new, status: :unprocessable_entity }
|
||||||
|
format.json { render json: @ziyara.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /ziyaras/1 or /ziyaras/1.json
|
||||||
|
def update
|
||||||
|
respond_to do |format|
|
||||||
|
if @ziyara.update(ziyara_params)
|
||||||
|
format.html { redirect_to @ziyara, notice: "Ziyara was successfully updated.", status: :see_other }
|
||||||
|
format.json { render :show, status: :ok, location: @ziyara }
|
||||||
|
else
|
||||||
|
format.html { render :edit, status: :unprocessable_entity }
|
||||||
|
format.json { render json: @ziyara.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /ziyaras/1 or /ziyaras/1.json
|
||||||
|
def destroy
|
||||||
|
@ziyara.destroy!
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to ziyaras_path, notice: "Ziyara was successfully destroyed.", status: :see_other }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_ziyara
|
||||||
|
@ziyara = Ziyara.find(params.expect(:id))
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only allow a list of trusted parameters through.
|
||||||
|
def ziyara_params
|
||||||
|
params.expect(ziyara: [ :name ])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ApplicationHelper
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
module InstitutionsHelper
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ProgramsHelper
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
module StudentsHelper
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ZiyarasHelper
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
||||||
|
import "@hotwired/turbo-rails"
|
||||||
|
import "controllers"
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
import { Application } from "@hotwired/stimulus"
|
||||||
|
|
||||||
|
const application = Application.start()
|
||||||
|
|
||||||
|
// Configure Stimulus development experience
|
||||||
|
application.debug = false
|
||||||
|
window.Stimulus = application
|
||||||
|
|
||||||
|
export { application }
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import { Controller } from "@hotwired/stimulus"
|
||||||
|
|
||||||
|
export default class extends Controller {
|
||||||
|
connect() {
|
||||||
|
this.element.textContent = "Hello World!"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
// Import and register all your controllers from the importmap via controllers/**/*_controller
|
||||||
|
import { application } from "controllers/application"
|
||||||
|
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
||||||
|
eagerLoadControllersFrom("controllers", application)
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
class ApplicationJob < ActiveJob::Base
|
||||||
|
# Automatically retry jobs that encountered a deadlock
|
||||||
|
# retry_on ActiveRecord::Deadlocked
|
||||||
|
|
||||||
|
# Most jobs are safe to ignore if the underlying records are no longer available
|
||||||
|
# discard_on ActiveJob::DeserializationError
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
class ApplicationMailer < ActionMailer::Base
|
||||||
|
default from: "from@example.com"
|
||||||
|
layout "mailer"
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class ApplicationRecord < ActiveRecord::Base
|
||||||
|
primary_abstract_class
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
class Institution < ApplicationRecord
|
||||||
|
has_many :students, dependent: :destroy
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class Program < ApplicationRecord
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
class Student < ApplicationRecord
|
||||||
|
belongs_to :institution
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
class Ziyara < ApplicationRecord
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<%= form_with(model: institution) do |form| %>
|
||||||
|
<% if institution.errors.any? %>
|
||||||
|
<div style="color: red">
|
||||||
|
<h2><%= pluralize(institution.errors.count, "error") %> prohibited this institution from being saved:</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% institution.errors.each do |error| %>
|
||||||
|
<li><%= error.full_message %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :name, style: "display: block" %>
|
||||||
|
<%= form.text_field :name %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :institution_type, style: "display: block" %>
|
||||||
|
<%= form.text_field :institution_type %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div id="<%= dom_id institution %>">
|
||||||
|
<h1><%= institution.name %></h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
json.extract! institution, :id, :name, :institution_type, :created_at, :updated_at
|
||||||
|
json.url institution_url(institution, format: :json)
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
|
||||||
|
<h1><%= program.name %></h1>
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<% content_for :title, "Editing institution" %>
|
||||||
|
|
||||||
|
<h1>Editing institution</h1>
|
||||||
|
|
||||||
|
<%= render "form", institution: @institution %>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Show this institution", @institution %> |
|
||||||
|
<%= link_to "Back to institutions", institutions_path %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,315 @@
|
||||||
|
<style>
|
||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: linear-gradient(135deg, #e3f2fd, #e8f5e9);
|
||||||
|
font-family: "Poppins", sans-serif;
|
||||||
|
color: #2c3e50;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-wrapper {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between; /* space out header and content */
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
padding: 0 20px;
|
||||||
|
max-width: 1900px;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center; /* center vertically */
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-center.my-5 {
|
||||||
|
margin-top: 0 !important;
|
||||||
|
margin-bottom: 1.5rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header Section */
|
||||||
|
.page-header {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-header h1 {
|
||||||
|
font-weight: 700;
|
||||||
|
color: #1e88e5;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
background: linear-gradient(90deg, #1e88e5, #43a047, #1e88e5);
|
||||||
|
background-size: 200% auto;
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
animation: gradient-move 3s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes gradient-move {
|
||||||
|
0% {
|
||||||
|
background-position: 0% center;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
background-position: 200% center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.logo-img {
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.divider {
|
||||||
|
width: 70px;
|
||||||
|
height: 4px;
|
||||||
|
background: linear-gradient(to right, #1e88e5, #43a047);
|
||||||
|
margin: 15px auto;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Card Styles */
|
||||||
|
.glass-card {
|
||||||
|
background: rgba(255, 255, 255, 0.9);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
border-radius: 18px;
|
||||||
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
||||||
|
transition: 0.3s ease;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.glass-card:hover {
|
||||||
|
transform: translateY(-3px);
|
||||||
|
box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
font-weight: 700;
|
||||||
|
text-align: center;
|
||||||
|
color: #1565c0;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-card {
|
||||||
|
border-radius: 15px;
|
||||||
|
background: #ffffff;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
border: 1px solid #e0e0e0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-card:hover {
|
||||||
|
background: #f9f9f9;
|
||||||
|
transform: scale(1.02);
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-title {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #0d47a1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-desc {
|
||||||
|
color: #37474f;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.item-footer {
|
||||||
|
border-top: 1px solid #e3f2fd;
|
||||||
|
padding-top: 10px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-custom {
|
||||||
|
border-radius: 25px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 7px 18px;
|
||||||
|
transition: 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary-custom {
|
||||||
|
background-color: #1e88e5;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary-custom:hover {
|
||||||
|
background-color: #1565c0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-success-custom {
|
||||||
|
background-color: #43a047;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-success-custom:hover {
|
||||||
|
background-color: #2e7d32;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
background: rgba(255, 255, 255, 0.7);
|
||||||
|
padding: 12px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #555;
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 992px) {
|
||||||
|
.container {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* --- Ziyara Section Styling --- */
|
||||||
|
.ziyara-card {
|
||||||
|
border-top: 5px solid #fbc02d;
|
||||||
|
background: rgba(255, 255, 240, 0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ziyara-title {
|
||||||
|
color: #f9a825;
|
||||||
|
background: linear-gradient(90deg, #fdd835, #fbc02d, #f57f17);
|
||||||
|
background-size: 200% auto;
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
animation: gradient-move 4s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ziyara-item {
|
||||||
|
border-left: 4px solid #fbc02d;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ziyara-item:hover {
|
||||||
|
background: #fff8e1;
|
||||||
|
box-shadow: 0 8px 20px rgba(251, 192, 45, 0.25);
|
||||||
|
transform: translateY(-4px);
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="page-wrapper">
|
||||||
|
<div class="container text-center">
|
||||||
|
<!-- Logo & Header -->
|
||||||
|
<div class="page-header mb-4 d-flex align-items-center justify-content-center flex-wrap">
|
||||||
|
<%= image_tag("unnamed.jpg", alt: "Logo", class: "logo-img me-3") %>
|
||||||
|
<h1>BADAR MADEENA CULTURAL CENTER
|
||||||
|
AND CHARITY TRUST</h1>
|
||||||
|
</div>
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Two Sections Side by Side -->
|
||||||
|
<div class="row g-4 justify-content-center align-items-stretch">
|
||||||
|
<!-- Institutions Section -->
|
||||||
|
<div class="col-lg-6 d-flex">
|
||||||
|
<div class="glass-card p-4 w-100">
|
||||||
|
<h3 class="section-title text-primary">🏫 Institutions</h3>
|
||||||
|
<% if @institutions.present? %>
|
||||||
|
<div class="row g-3">
|
||||||
|
<% @institutions.each do |institution| %>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="item-card p-3 shadow-sm">
|
||||||
|
<div class="item-title"><%= institution.name %></div>
|
||||||
|
<% if institution.respond_to?(:description) %>
|
||||||
|
<p class="item-desc mb-2"><%= institution.description.truncate(100) %></p>
|
||||||
|
<% end %>
|
||||||
|
<div class="item-footer">
|
||||||
|
<%= link_to "View", institution, class: "btn btn-primary-custom btn-sm btn-custom" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<p class="item-desc text-center">No institutions added yet.</p>
|
||||||
|
<% end %>
|
||||||
|
<div class="text-center mt-3">
|
||||||
|
<%= link_to "➕ New Institution", new_institution_path, class: "btn btn-success-custom btn-custom" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Programs Section -->
|
||||||
|
<div class="col-lg-6 d-flex">
|
||||||
|
<div class="glass-card p-4 w-100">
|
||||||
|
<h3 class="section-title text-success">🎓 Programs</h3>
|
||||||
|
<% if @programs.present? %>
|
||||||
|
<div class="row g-3">
|
||||||
|
<% @programs.each do |program| %>
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="item-card p-3 shadow-sm">
|
||||||
|
<div class="item-title"><%= program.name %></div>
|
||||||
|
<p class="item-desc mb-2">
|
||||||
|
<% if program.respond_to?(:date) %>
|
||||||
|
<strong>Date:</strong> <%= program.date %><br>
|
||||||
|
<% end %>
|
||||||
|
<% if program.respond_to?(:leadingPerson) %>
|
||||||
|
<strong>Lead:</strong> <%= program.leadingPerson %>
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
<div class="item-footer">
|
||||||
|
<%= link_to "View", program, class: "btn btn-success-custom btn-sm btn-custom" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<p class="item-desc text-center">No programs available yet.</p>
|
||||||
|
<% end %>
|
||||||
|
<div class="text-center mt-3">
|
||||||
|
<%= link_to "➕ New Program", new_program_path, class: "btn btn-success-custom btn-custom" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Ziyara Section -->
|
||||||
|
<div class="row mt-4 justify-content-center">
|
||||||
|
<div class="col-lg-10 d-flex">
|
||||||
|
<div class="glass-card ziyara-card p-4 w-100">
|
||||||
|
<h3 class="section-title ziyara-title">🕌 Ziyara</h3>
|
||||||
|
|
||||||
|
<% if @ziyaras.present? %>
|
||||||
|
<div class="row g-3">
|
||||||
|
<% @ziyaras.each do |ziyara| %>
|
||||||
|
<div class="col-md-6 col-lg-4">
|
||||||
|
<div class="item-card ziyara-item p-3 shadow-sm">
|
||||||
|
<div class="item-title"><%= ziyara.name %></div>
|
||||||
|
<% if ziyara.respond_to?(:location) %>
|
||||||
|
<p class="item-desc mb-1"><strong>📍 Location:</strong> <%= ziyara.location %></p>
|
||||||
|
<% end %>
|
||||||
|
<% if ziyara.respond_to?(:date) %>
|
||||||
|
<p class="item-desc mb-1"><strong>📅 Date:</strong> <%= ziyara.date %></p>
|
||||||
|
<% end %>
|
||||||
|
<div class="item-footer">
|
||||||
|
<%= link_to "View", ziyara, class: "btn btn-primary-custom btn-sm btn-custom" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<p class="item-desc text-center">No Ziyara records yet.</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="text-center mt-3">
|
||||||
|
<%= link_to "➕ New Ziyara", new_ziyara_path, class: "btn btn-success-custom btn-custom" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
json.array! @institutions, partial: "institutions/institution", as: :institution
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<% content_for :title, "New institution" %>
|
||||||
|
|
||||||
|
<h1>New institution</h1>
|
||||||
|
|
||||||
|
<%= render "form", institution: @institution %>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Back to institutions", institutions_path %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<% if notice %>
|
||||||
|
<div class="alert alert-success"><%= notice %></div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card bg-white shadow p-4 mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h2 class="card-title mb-3 text-primary"><%= @institution.name %></h2>
|
||||||
|
<p class="card-text mb-2"><strong>ID:</strong> <%= @institution.id %></p>
|
||||||
|
<%# Add more institution details here if needed %>
|
||||||
|
<div class="mb-3">
|
||||||
|
<%= link_to "Edit Institution", edit_institution_path(@institution), class: "btn btn-secondary me-2" %>
|
||||||
|
<%= link_to "Back to Institutions", institutions_path, class: "btn btn-outline-light me-2" %>
|
||||||
|
<%= button_to "Destroy Institution", @institution, method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h3 class="mt-4 mb-3 text-info">Students</h3>
|
||||||
|
<div class="mb-3">
|
||||||
|
<%= link_to "Add Student", new_institution_student_path(@institution), class: "btn btn-success" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row g-4">
|
||||||
|
<% @institution.students.each do |student| %>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card bg-white shadow-sm h-100 border-info">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title text-info"><%= student.first_name %> <%= student.last_name %></h5>
|
||||||
|
<p class="card-text mb-1"><strong>Email:</strong> <%= student.email %></p>
|
||||||
|
<p class="card-text mb-1"><strong>ID:</strong> <%= student.id %></p>
|
||||||
|
</div>
|
||||||
|
<div class="card-footer bg-transparent border-0 d-flex justify-content-end">
|
||||||
|
<%= link_to "Show", institution_student_path(@institution, student), class: "btn btn-primary btn-sm me-2" %>
|
||||||
|
<%= link_to "Edit", edit_institution_student_path(@institution, student), class: "btn btn-secondary btn-sm me-2" %>
|
||||||
|
<%= button_to "Delete", institution_student_path(@institution, student), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger btn-sm" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
json.partial! "institutions/institution", institution: @institution
|
||||||
|
|
@ -0,0 +1,192 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title><%= content_for(:title) || "Badar Madeena" %></title>
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="mobile-web-app-capable" content="yes">
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
<%= csp_meta_tag %>
|
||||||
|
|
||||||
|
<%= yield :head %>
|
||||||
|
|
||||||
|
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
||||||
|
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
||||||
|
|
||||||
|
<link rel="icon" href="/icon.png" type="image/png">
|
||||||
|
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
||||||
|
<link rel="apple-touch-icon" href="/icon.png">
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS for modern UI -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #181a1b !important;
|
||||||
|
color: #e0e0e0 !important;
|
||||||
|
}
|
||||||
|
.bg-white {
|
||||||
|
background-color: #23272b !important;
|
||||||
|
color: #e0e0e0 !important;
|
||||||
|
}
|
||||||
|
.navbar, .footer {
|
||||||
|
background-color: #23272b !important;
|
||||||
|
}
|
||||||
|
.navbar-brand, .footer, .text-muted {
|
||||||
|
color: #e0e0e0 !important;
|
||||||
|
}
|
||||||
|
.alert-success {
|
||||||
|
background-color: #1e2d24 !important;
|
||||||
|
color: #b8e994 !important;
|
||||||
|
border-color: #1e2d24 !important;
|
||||||
|
}
|
||||||
|
.alert-danger {
|
||||||
|
background-color: #2d1e1e !important;
|
||||||
|
color: #ff6f61 !important;
|
||||||
|
border-color: #2d1e1e !important;
|
||||||
|
}
|
||||||
|
.form-label, label {
|
||||||
|
color: #e0e0e0 !important;
|
||||||
|
}
|
||||||
|
input, textarea, select {
|
||||||
|
background-color: #181a1b !important;
|
||||||
|
color: #e0e0e0 !important;
|
||||||
|
border: 1px solid #444 !important;
|
||||||
|
}
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #007bff !important;
|
||||||
|
border-color: #007bff !important;
|
||||||
|
}
|
||||||
|
.btn {
|
||||||
|
color: #e0e0e0 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
||||||
|
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
|
||||||
|
<%= javascript_importmap_tags %>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<!-- Navigation Bar -->
|
||||||
|
<nav class="navbar navbar-expand-lg glass-navbar shadow-sm">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<!-- Logo & Brand -->
|
||||||
|
<%= link_to root_path, class: "navbar-brand d-flex align-items-center" do %>
|
||||||
|
<%= image_tag("unnamed.jpg", alt: "Logo", class: "nav-logo me-2") %>
|
||||||
|
<span>Badar Madeena Trust</span>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<!-- Toggler (for mobile) -->
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav"
|
||||||
|
aria-controls="mainNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Nav Links -->
|
||||||
|
<div class="collapse navbar-collapse" id="mainNav">
|
||||||
|
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||||
|
<li class="nav-item">
|
||||||
|
<%= link_to "🏠 Home", root_path, class: "nav-link active" %>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<%= link_to "🏫 Institutions", institutions_path, class: "nav-link" %>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<%= link_to "🎓 Programs", programs_path, class: "nav-link" %>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<%= link_to "🕌 Ziyara", ziyaras_path, class: "nav-link" %>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<%= link_to "📞 Contact", "#", class: "nav-link" %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
<style>
|
||||||
|
/* ====== NAVBAR STYLING ====== */
|
||||||
|
.glass-navbar {
|
||||||
|
background: rgba(255, 255, 255, 0.85);
|
||||||
|
backdrop-filter: blur(12px);
|
||||||
|
border-bottom: 2px solid rgba(30, 136, 229, 0.2);
|
||||||
|
font-family: "Poppins", sans-serif;
|
||||||
|
padding: 10px 30px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.glass-navbar .navbar-brand {
|
||||||
|
font-weight: 700;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
color: #1e88e5;
|
||||||
|
background: linear-gradient(90deg, #1e88e5, #43a047);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-logo {
|
||||||
|
width: 45px;
|
||||||
|
height: 45px;
|
||||||
|
border-radius: 50%;
|
||||||
|
object-fit: cover;
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-nav .nav-link {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #2c3e50 !important;
|
||||||
|
padding: 8px 18px;
|
||||||
|
border-radius: 25px;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-nav .nav-link:hover,
|
||||||
|
.navbar-nav .nav-link.active {
|
||||||
|
background: linear-gradient(90deg, #1e88e5, #43a047);
|
||||||
|
color: white !important;
|
||||||
|
box-shadow: 0 3px 10px rgba(30, 136, 229, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-toggler {
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-toggler-icon {
|
||||||
|
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(30,136,229, 0.8)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 992px) {
|
||||||
|
.glass-navbar {
|
||||||
|
padding: 8px 20px;
|
||||||
|
}
|
||||||
|
.navbar-nav .nav-link {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<p class="text-success text-center"><%= notice %></p>
|
||||||
|
|
||||||
|
<% content_for :title, "Institutions & Programs" %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="container shadow rounded p-4 bg-white mt-4">
|
||||||
|
<% if notice %>
|
||||||
|
<div class="alert alert-success"><%= notice %></div>
|
||||||
|
<% end %>
|
||||||
|
<% if alert %>
|
||||||
|
<div class="alert alert-danger"><%= alert %></div>
|
||||||
|
<% end %>
|
||||||
|
<%= yield %>
|
||||||
|
</div>
|
||||||
|
<footer class="footer text-center mt-5 mb-3 text-muted">
|
||||||
|
© <%= Time.current.year %> Badar Madeena
|
||||||
|
</footer>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<style>
|
||||||
|
/* Email styles need to be inline */
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<%= yield %>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<%= yield %>
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<%= form_with(model: program) do |form| %>
|
||||||
|
<% if program.errors.any? %>
|
||||||
|
<div style="color: red">
|
||||||
|
<h2><%= pluralize(program.errors.count, "error") %> prohibited this program from being saved:</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% program.errors.each do |error| %>
|
||||||
|
<li><%= error.full_message %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :name, style: "display: block" %>
|
||||||
|
<%= form.text_field :name %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :date, style: "display: block" %>
|
||||||
|
<%= form.date_field :date %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :leadingPerson, style: "display: block" %>
|
||||||
|
<%= form.text_field :leadingPerson %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<div id="<%= dom_id program %>">
|
||||||
|
|
||||||
|
<strong>Name:</strong><h5><%= program.name %></h5>
|
||||||
|
|
||||||
|
<strong>Date:</strong><p><%= program.date %></p>
|
||||||
|
<strong>Leadingperson:</strong><p><%= program.leadingPerson %></p>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
json.extract! program, :id, :name, :date, :leadingPerson, :created_at, :updated_at
|
||||||
|
json.url program_url(program, format: :json)
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<% content_for :title, "Editing program" %>
|
||||||
|
|
||||||
|
<h1>Editing program</h1>
|
||||||
|
|
||||||
|
<%= render "form", program: @program %>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Show this program", @program %> |
|
||||||
|
<%= link_to "Back to programs", programs_path %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<p style="color: green"><%= notice %></p>
|
||||||
|
|
||||||
|
<% content_for :title, "Programs" %>
|
||||||
|
|
||||||
|
<h1>Programs</h1>
|
||||||
|
|
||||||
|
<div id="programs">
|
||||||
|
<% @programs.each do |program| %>
|
||||||
|
<%= render program %>
|
||||||
|
<p>
|
||||||
|
<%= link_to "Show this program", program %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= link_to "New program", new_program_path %>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
json.array! @programs, partial: "programs/program", as: :program
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<% content_for :title, "New program" %>
|
||||||
|
|
||||||
|
<h1>New program</h1>
|
||||||
|
|
||||||
|
<%= render "form", program: @program %>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Back to programs", programs_path %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
<p class="text-success"><%= notice %></p>
|
||||||
|
|
||||||
|
<div class="container mt-4">
|
||||||
|
<div class="card shadow-lg border-0 rounded-4 overflow-hidden">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="card-header bg-gradient bg-primary text-white text-center py-4">
|
||||||
|
<h2 class="fw-bold mb-0"><%= @program.name.titleize %></h2>
|
||||||
|
<small class="text-light fst-italic">Program Details</small>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Body -->
|
||||||
|
<div class="card-body bg-light">
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card border-0 shadow-sm rounded-3 p-3 h-100">
|
||||||
|
<h6 class="text-secondary mb-1">📅 Date</h6>
|
||||||
|
<p class="fs-5 fw-semibold text-dark"><%= @program.date.strftime("%B %d, %Y") rescue @program.date %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if @program.respond_to?(:leadingPerson) && @program.leadingPerson.present? %>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card border-0 shadow-sm rounded-3 p-3 h-100">
|
||||||
|
<h6 class="text-secondary mb-1">👤 Leading Person</h6>
|
||||||
|
<p class="fs-5 fw-semibold text-dark"><%= @program.leadingPerson.titleize %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Footer -->
|
||||||
|
<div class="card-footer bg-white border-top d-flex justify-content-between align-items-center py-3">
|
||||||
|
<div>
|
||||||
|
<%= link_to "← Back to Programs", programs_path, class: "btn btn-outline-secondary btn-sm" %>
|
||||||
|
<%= link_to "✏️ Edit Program", edit_program_path(@program), class: "btn btn-outline-primary btn-sm ms-2" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= button_to "🗑️ Delete", @program, method: :delete, data: { confirm: "Are you sure you want to delete this program?" }, class: "btn btn-danger btn-sm" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
json.partial! "programs/program", program: @program
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"name": "BadarMadeena",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "/icon.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "512x512"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/icon.png",
|
||||||
|
"type": "image/png",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"purpose": "maskable"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"start_url": "/",
|
||||||
|
"display": "standalone",
|
||||||
|
"scope": "/",
|
||||||
|
"description": "BadarMadeena.",
|
||||||
|
"theme_color": "red",
|
||||||
|
"background_color": "red"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Add a service worker for processing Web Push notifications:
|
||||||
|
//
|
||||||
|
// self.addEventListener("push", async (event) => {
|
||||||
|
// const { title, options } = await event.data.json()
|
||||||
|
// event.waitUntil(self.registration.showNotification(title, options))
|
||||||
|
// })
|
||||||
|
//
|
||||||
|
// self.addEventListener("notificationclick", function(event) {
|
||||||
|
// event.notification.close()
|
||||||
|
// event.waitUntil(
|
||||||
|
// clients.matchAll({ type: "window" }).then((clientList) => {
|
||||||
|
// for (let i = 0; i < clientList.length; i++) {
|
||||||
|
// let client = clientList[i]
|
||||||
|
// let clientPath = (new URL(client.url)).pathname
|
||||||
|
//
|
||||||
|
// if (clientPath == event.notification.data.path && "focus" in client) {
|
||||||
|
// return client.focus()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (clients.openWindow) {
|
||||||
|
// return clients.openWindow(event.notification.data.path)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// )
|
||||||
|
// })
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
<% institution = @institution || student.institution %>
|
||||||
|
<% form_url = student.persisted? ? institution_student_path(institution, student) : institution_students_path(institution) %>
|
||||||
|
<%= form_with(model: student, url: form_url) do |form| %>
|
||||||
|
<% if student.errors.any? %>
|
||||||
|
<div style="color: red">
|
||||||
|
<h2><%= pluralize(student.errors.count, "error") %> prohibited this student from being saved:</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% student.errors.each do |error| %>
|
||||||
|
<li><%= error.full_message %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :first_name, style: "display: block" %>
|
||||||
|
<%= form.text_field :first_name %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :last_name, style: "display: block" %>
|
||||||
|
<%= form.text_field :last_name %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :email, style: "display: block" %>
|
||||||
|
<%= form.text_field :email %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= form.label :phone_number, style: "display: block" %>
|
||||||
|
<%= form.text_field :phone_number %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= form.label :place, style: "display: block" %>
|
||||||
|
<%= form.text_field :place %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= form.label :age, style: "display: block" %>
|
||||||
|
<%= form.number_field :age %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :institution_id, style: "display: block" %>
|
||||||
|
<%= form.text_field :institution_id %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
<div id="<%= dom_id student %>">
|
||||||
|
<p>
|
||||||
|
<strong>First name:</strong>
|
||||||
|
<%= student.first_name %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Last name:</strong>
|
||||||
|
<%= student.last_name %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Email:</strong>
|
||||||
|
<%= student.email %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Institution:</strong>
|
||||||
|
<%= student.institution_id %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>phone_number:</strong>
|
||||||
|
<%= student.phone_number %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Place:</strong>
|
||||||
|
<%= student.place %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Age:</strong>
|
||||||
|
<%= student.age %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
json.extract! student, :id, :first_name, :last_name, :email, :institution_id, :created_at, :updated_at
|
||||||
|
json.url student_url(student, format: :json)
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
<% content_for :title, "Editing student" %>
|
||||||
|
|
||||||
|
<h1>Editing student</h1>
|
||||||
|
|
||||||
|
<%= render "form", student: @student %>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Show this student", institution_student_path(@institution, @student) %> |
|
||||||
|
<%= link_to "Back to students", institution_students_path(@institution) %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<p style="color: green"><%= notice %></p>
|
||||||
|
|
||||||
|
<% content_for :title, "Students" %>
|
||||||
|
|
||||||
|
<h1>Students</h1>
|
||||||
|
|
||||||
|
<div id="students">
|
||||||
|
<% @students.each do |student| %>
|
||||||
|
<%= render student %>
|
||||||
|
<p>
|
||||||
|
<%= link_to "Show this student", institution_student_path(@institution, student) %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= link_to "New student", new_institution_student_path(@institution) %>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
json.array! @students, partial: "students/student", as: :student
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<% content_for :title, "New student" %>
|
||||||
|
|
||||||
|
<h1>New student</h1>
|
||||||
|
|
||||||
|
<%= render "form", student: @student %>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Back to students", institution_students_path(@institution) %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<p style="color: green"><%= notice %></p>
|
||||||
|
|
||||||
|
<%= render @student %>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Edit this student", edit_institution_student_path(@student.institution, @student) %> |
|
||||||
|
<%= link_to "Back to students", institution_students_path(@student.institution) %>
|
||||||
|
|
||||||
|
<%= button_to "Destroy this student", institution_student_path(@student.institution, @student), method: :delete %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
json.partial! "students/student", student: @student
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<%= form_with(model: ziyara) do |form| %>
|
||||||
|
<% if ziyara.errors.any? %>
|
||||||
|
<div style="color: red">
|
||||||
|
<h2><%= pluralize(ziyara.errors.count, "error") %> prohibited this ziyara from being saved:</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% ziyara.errors.each do |error| %>
|
||||||
|
<li><%= error.full_message %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.label :name, style: "display: block" %>
|
||||||
|
<%= form.text_field :name %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= form.submit %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,92 @@
|
||||||
|
<div id="<%= dom_id(ziyara) %>" class="dashboard-card">
|
||||||
|
<div class="icon-wrapper">
|
||||||
|
<i class="bi bi-mosque"></i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title"><%= ziyara.name %></h5>
|
||||||
|
|
||||||
|
<% if ziyara.respond_to?(:location) %>
|
||||||
|
<p class="card-text"><strong>Location:</strong> <%= ziyara.location %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% if ziyara.respond_to?(:date) %>
|
||||||
|
<p class="card-text"><strong>Date:</strong> <%= ziyara.date.strftime('%B %d, %Y') %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= link_to "View Details →", ziyara, class: "view-link" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* === Modern Dashboard Card === */
|
||||||
|
.dashboard-card {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 16px;
|
||||||
|
box-shadow: 0 4px 10px rgba(0,0,0,0.08);
|
||||||
|
padding: 18px 20px;
|
||||||
|
width: 280px;
|
||||||
|
height: 180px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
text-align: left;
|
||||||
|
margin: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard-card:hover {
|
||||||
|
transform: translateY(-6px);
|
||||||
|
box-shadow: 0 12px 25px rgba(0,0,0,0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Icon Circle === */
|
||||||
|
.icon-wrapper {
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
background: linear-gradient(135deg, #e3f2fd, #bbdefb);
|
||||||
|
color: #1e88e5;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Card Text === */
|
||||||
|
.card-title {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #2c3e50;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-text {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: #555;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === View Link === */
|
||||||
|
.view-link {
|
||||||
|
display: inline-block;
|
||||||
|
color: #1e88e5;
|
||||||
|
font-weight: 500;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-link:hover {
|
||||||
|
color: #1565c0;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* === Optional Grid for multiple cards === */
|
||||||
|
.dashboard-grid {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
json.extract! ziyara, :id, :name, :created_at, :updated_at
|
||||||
|
json.url ziyara_url(ziyara, format: :json)
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
<% content_for :title, "Editing ziyara" %>
|
||||||
|
|
||||||
|
<h1>Editing ziyara</h1>
|
||||||
|
|
||||||
|
<%= render "form", ziyara: @ziyara %>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Show this ziyara", @ziyara %> |
|
||||||
|
<%= link_to "Back to ziyaras", ziyaras_path %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<p style="color: green"><%= notice %></p>
|
||||||
|
|
||||||
|
<% content_for :title, "Ziyaras" %>
|
||||||
|
|
||||||
|
<h1>Ziyaras</h1>
|
||||||
|
|
||||||
|
<div id="ziyaras">
|
||||||
|
<% @ziyaras.each do |ziyara| %>
|
||||||
|
<%= render ziyara %>
|
||||||
|
<p>
|
||||||
|
<%= link_to "Show this ziyara", ziyara %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= link_to "New ziyara", new_ziyara_path %>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
json.array! @ziyaras, partial: "ziyaras/ziyara", as: :ziyara
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<% content_for :title, "New ziyara" %>
|
||||||
|
|
||||||
|
<h1>New ziyara</h1>
|
||||||
|
|
||||||
|
<%= render "form", ziyara: @ziyara %>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Back to ziyaras", ziyaras_path %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<p style="color: green"><%= notice %></p>
|
||||||
|
|
||||||
|
<%= render @ziyara %>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<%= link_to "Edit this ziyara", edit_ziyara_path(@ziyara) %> |
|
||||||
|
<%= link_to "Back to ziyaras", ziyaras_path %>
|
||||||
|
|
||||||
|
<%= button_to "Destroy this ziyara", @ziyara, method: :delete %>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
json.partial! "ziyaras/ziyara", ziyara: @ziyara
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
ARGV.unshift("--ensure-latest")
|
||||||
|
|
||||||
|
load Gem.bin_path("brakeman", "brakeman")
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'bundle' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require "rubygems"
|
||||||
|
|
||||||
|
m = Module.new do
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def invoked_as_script?
|
||||||
|
File.expand_path($0) == File.expand_path(__FILE__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def env_var_version
|
||||||
|
ENV["BUNDLER_VERSION"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def cli_arg_version
|
||||||
|
return unless invoked_as_script? # don't want to hijack other binstubs
|
||||||
|
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
||||||
|
bundler_version = nil
|
||||||
|
update_index = nil
|
||||||
|
ARGV.each_with_index do |a, i|
|
||||||
|
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
||||||
|
bundler_version = a
|
||||||
|
end
|
||||||
|
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
||||||
|
bundler_version = $1
|
||||||
|
update_index = i
|
||||||
|
end
|
||||||
|
bundler_version
|
||||||
|
end
|
||||||
|
|
||||||
|
def gemfile
|
||||||
|
gemfile = ENV["BUNDLE_GEMFILE"]
|
||||||
|
return gemfile if gemfile && !gemfile.empty?
|
||||||
|
|
||||||
|
File.expand_path("../Gemfile", __dir__)
|
||||||
|
end
|
||||||
|
|
||||||
|
def lockfile
|
||||||
|
lockfile =
|
||||||
|
case File.basename(gemfile)
|
||||||
|
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
||||||
|
else "#{gemfile}.lock"
|
||||||
|
end
|
||||||
|
File.expand_path(lockfile)
|
||||||
|
end
|
||||||
|
|
||||||
|
def lockfile_version
|
||||||
|
return unless File.file?(lockfile)
|
||||||
|
lockfile_contents = File.read(lockfile)
|
||||||
|
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
||||||
|
Regexp.last_match(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
def bundler_requirement
|
||||||
|
@bundler_requirement ||=
|
||||||
|
env_var_version ||
|
||||||
|
cli_arg_version ||
|
||||||
|
bundler_requirement_for(lockfile_version)
|
||||||
|
end
|
||||||
|
|
||||||
|
def bundler_requirement_for(version)
|
||||||
|
return "#{Gem::Requirement.default}.a" unless version
|
||||||
|
|
||||||
|
bundler_gem_version = Gem::Version.new(version)
|
||||||
|
|
||||||
|
bundler_gem_version.approximate_recommendation
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_bundler!
|
||||||
|
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
||||||
|
|
||||||
|
activate_bundler
|
||||||
|
end
|
||||||
|
|
||||||
|
def activate_bundler
|
||||||
|
gem_error = activation_error_handling do
|
||||||
|
gem "bundler", bundler_requirement
|
||||||
|
end
|
||||||
|
return if gem_error.nil?
|
||||||
|
require_error = activation_error_handling do
|
||||||
|
require "bundler/version"
|
||||||
|
end
|
||||||
|
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
||||||
|
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
||||||
|
exit 42
|
||||||
|
end
|
||||||
|
|
||||||
|
def activation_error_handling
|
||||||
|
yield
|
||||||
|
nil
|
||||||
|
rescue StandardError, LoadError => e
|
||||||
|
e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
m.load_bundler!
|
||||||
|
|
||||||
|
if m.invoked_as_script?
|
||||||
|
load Gem.bin_path("bundler", "bundle")
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
exec "./bin/rails", "server", *ARGV
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# Enable jemalloc for reduced memory usage and latency.
|
||||||
|
if [ -z "${LD_PRELOAD+x}" ]; then
|
||||||
|
LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
|
||||||
|
export LD_PRELOAD
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If running the rails server then create or migrate existing database
|
||||||
|
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
|
||||||
|
./bin/rails db:prepare
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "${@}"
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require_relative "../config/application"
|
||||||
|
require "importmap/commands"
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require_relative "../config/environment"
|
||||||
|
require "solid_queue/cli"
|
||||||
|
|
||||||
|
SolidQueue::Cli.start(ARGV)
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'kamal' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||||
|
|
||||||
|
bundle_binstub = File.expand_path("bundle", __dir__)
|
||||||
|
|
||||||
|
if File.file?(bundle_binstub)
|
||||||
|
if File.read(bundle_binstub, 300).include?("This file was generated by Bundler")
|
||||||
|
load(bundle_binstub)
|
||||||
|
else
|
||||||
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||||
|
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
load Gem.bin_path("kamal", "kamal")
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
APP_PATH = File.expand_path("../config/application", __dir__)
|
||||||
|
require_relative "../config/boot"
|
||||||
|
require "rails/commands"
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
require_relative "../config/boot"
|
||||||
|
require "rake"
|
||||||
|
Rake.application.run
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue