Compare commits
2 Commits
103d79a472
...
1992e967b5
| Author | SHA1 | Date |
|---|---|---|
|
|
1992e967b5 | |
|
|
34dbca20d9 |
5
Gemfile
5
Gemfile
|
|
@ -67,8 +67,3 @@ gem 'devise'
|
|||
gem "sprockets-rails"
|
||||
gem "sassc-rails"
|
||||
gem "font-awesome-sass", '~> 5.15.1'
|
||||
|
||||
|
||||
|
||||
|
||||
gem "shop_now", path: "vendor/plugins/shop_now"
|
||||
|
|
@ -1,9 +1,3 @@
|
|||
PATH
|
||||
remote: vendor/plugins/shop_now
|
||||
specs:
|
||||
shop_now (0.1.0)
|
||||
rails (>= 8.0.3)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
|
|
@ -399,7 +393,6 @@ DEPENDENCIES
|
|||
rubocop-rails-omakase
|
||||
sassc-rails
|
||||
selenium-webdriver
|
||||
shop_now!
|
||||
solid_cable
|
||||
solid_cache
|
||||
solid_queue
|
||||
|
|
|
|||
|
|
@ -1,2 +1,4 @@
|
|||
//= link_tree ../images
|
||||
//= link_directory ../stylesheets .css
|
||||
//= link_tree ../video .mp4
|
||||
//= link just.mp4
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -5,6 +5,6 @@ class ApplicationController < ActionController::Base
|
|||
allow_browser versions: :modern
|
||||
before_action :set_assets_url
|
||||
def set_assets_url
|
||||
Rails.application.routes.default_url_options[:host] = "10.159.208.233:3000"
|
||||
Rails.application.routes.default_url_options[:host] = "192.168.1.77:3000"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,17 +26,28 @@ class IncomesController < ApplicationController
|
|||
# @chart_data = grouped.values.map { |items| items.sum(&:amount) }
|
||||
@incomes = Income.all
|
||||
|
||||
# Daily / Weekly / Monthly totals using scopes
|
||||
@daily_income = Income.today.total_amount
|
||||
@weekly_income = Income.this_week.total_amount
|
||||
@monthly_income = Income.this_month.total_amount
|
||||
# Daily incomes
|
||||
@daily_income_items = Income.where(date: Date.today)
|
||||
@daily_income = @daily_income_items.sum(:amount)
|
||||
|
||||
# For charts
|
||||
# Weekly incomes
|
||||
@weekly_income_items = Income.where(date: Date.today.beginning_of_week..Date.today.end_of_week)
|
||||
@weekly_income = @weekly_income_items.sum(:amount)
|
||||
|
||||
# Monthly incomes
|
||||
@monthly_income_items = Income.where(date: Date.today.beginning_of_month..Date.today.end_of_month)
|
||||
@monthly_income = @monthly_income_items.sum(:amount)
|
||||
|
||||
# For charts - last 7 days
|
||||
@chart_labels = (0..6).map { |i| (Date.today - i).strftime("%d %b") }.reverse
|
||||
@chart_data = @chart_labels.map { |d| Income.where(created_at: d.to_date.all_day).sum(:amount) }
|
||||
@chart_data = @chart_labels.map { |date_str|
|
||||
date = Date.parse(date_str)
|
||||
Income.where(date: date).sum(:amount)
|
||||
}
|
||||
end
|
||||
|
||||
def show; end
|
||||
def show
|
||||
end
|
||||
|
||||
def new
|
||||
@income = Income.new
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
class ProductsController < ApplicationController
|
||||
before_action :set_product, only: %i[ show edit update destroy ]
|
||||
|
||||
# GET /products or /products.json
|
||||
def index
|
||||
@products = Product.all
|
||||
end
|
||||
|
||||
# GET /products/1 or /products/1.json
|
||||
def show
|
||||
end
|
||||
|
||||
# GET /products/new
|
||||
def new
|
||||
@product = Product.new
|
||||
end
|
||||
|
||||
# GET /products/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# POST /products or /products.json
|
||||
def create
|
||||
@product = Product.new(product_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @product.save
|
||||
format.html { redirect_to @product, notice: "Product was successfully created." }
|
||||
format.json { render :show, status: :created, location: @product }
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.json { render json: @product.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /products/1 or /products/1.json
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @product.update(product_params)
|
||||
format.html { redirect_to @product, notice: "Product was successfully updated.", status: :see_other }
|
||||
format.json { render :show, status: :ok, location: @product }
|
||||
else
|
||||
format.html { render :edit, status: :unprocessable_entity }
|
||||
format.json { render json: @product.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /products/1 or /products/1.json
|
||||
def destroy
|
||||
@product.destroy!
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to products_path, notice: "Product 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_product
|
||||
@product = Product.find(params.expect(:id))
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def product_params
|
||||
params.expect(product: [ :name, :description, :price, images: [] ])
|
||||
end
|
||||
end
|
||||
|
|
@ -39,17 +39,17 @@ class StudentsController < ApplicationController
|
|||
# end
|
||||
# end
|
||||
def create
|
||||
@student = @institution.students.new(student_params)
|
||||
@student = @institution.students.new(student_params)
|
||||
|
||||
if @student.save
|
||||
respond_to do |format|
|
||||
format.js # creates -> create.js.erb
|
||||
if @student.save
|
||||
format.html { redirect_to institution_students_path(@institution), notice: 'Student was successfully created.' }
|
||||
format.js # renders create.js.erb
|
||||
else
|
||||
format.html { render :new, status: :unprocessable_entity }
|
||||
format.js { render :error }
|
||||
end
|
||||
end
|
||||
else
|
||||
respond_to do |format|
|
||||
format.js { render :error }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,3 @@
|
|||
class Admin < ApplicationRecord
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
devise :database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :validatable
|
||||
end
|
||||
class Admin < User
|
||||
|
||||
end
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
class AdminUser < ApplicationRecord
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
devise :database_authenticatable,
|
||||
:recoverable, :rememberable, :validatable
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
devise :database_authenticatable,
|
||||
:recoverable, :rememberable, :validatable
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
devise :database_authenticatable,
|
||||
:recoverable, :rememberable, :validatable
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
devise :database_authenticatable,
|
||||
:recoverable, :rememberable, :validatable
|
||||
end
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
class Product < ApplicationRecord
|
||||
has_rich_text :description
|
||||
has_many_attached :images
|
||||
end
|
||||
|
|
@ -1,4 +1,10 @@
|
|||
<div id="<%= dom_id expense %>">
|
||||
|
||||
<p>
|
||||
<strong>Title:</strong>
|
||||
<%= expense.title %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Amount:</strong>
|
||||
<%= expense.amount %>
|
||||
|
|
@ -9,4 +15,14 @@
|
|||
<%= expense.date %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Category:</strong>
|
||||
<%= expense.category %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= expense.description %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div>
|
||||
<%= form.label :title, style: "display: block" %>
|
||||
<%= form.text_field :title %>
|
||||
</div>
|
||||
<div>
|
||||
<%= form.label :amount, style: "display: block" %>
|
||||
<%= form.text_field :amount %>
|
||||
|
|
@ -21,6 +24,16 @@
|
|||
<%= form.date_field :date %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :category, style: "display: block" %>
|
||||
<%= form.text_field :category %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :description, style: "display: block" %>
|
||||
<%= form.textarea :description %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,14 @@
|
|||
<% content_for :title, "Expense Report" %>
|
||||
|
||||
<!-- Minimal & Clean CSS (small and tidy) -->
|
||||
<style>
|
||||
:root{
|
||||
--card-bg: #ffffff;
|
||||
--muted: #6b7280;
|
||||
--accent: #2563eb; /* blue */
|
||||
--accent: #f59e0b; /* Orange for expenses */
|
||||
--radius: 10px;
|
||||
--shadow: 0 6px 20px rgba(16,24,40,0.06);
|
||||
--gap: 18px;
|
||||
font-family: "Inter", "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
|
||||
font-family: "Inter", "Poppins", system-ui;
|
||||
}
|
||||
|
||||
.er-container {
|
||||
|
|
@ -44,46 +43,44 @@
|
|||
text-decoration:none;
|
||||
font-weight:600;
|
||||
font-size:0.95rem;
|
||||
box-shadow: 0 6px 16px rgba(37,99,235,0.12);
|
||||
box-shadow: 0 6px 16px rgba(249, 94, 11, 0.12);
|
||||
transition: transform .12s ease, box-shadow .12s ease;
|
||||
}
|
||||
.btn-simple:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(37,99,235,0.16); }
|
||||
.btn-simple:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(249, 94, 11, 0.16); }
|
||||
|
||||
/* summary cards row */
|
||||
.summary-row {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
.summary-row {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
|
||||
.card {
|
||||
flex: 1;
|
||||
padding: 16px;
|
||||
border-radius: var(--radius);
|
||||
background: #87ceeb; /* 🌤️ Sky Blue */
|
||||
border: 1px solid var(--border);
|
||||
backdrop-filter: blur(12px);
|
||||
box-shadow: var(--shadowG3);
|
||||
transition: .25s;
|
||||
}
|
||||
.card {
|
||||
flex: 1;
|
||||
padding: 16px;
|
||||
border-radius: var(--radius);
|
||||
background: #f3f4f6;
|
||||
border: 1px solid var(--border);
|
||||
backdrop-filter: blur(12px);
|
||||
box-shadow: var(--shadow);
|
||||
transition: .25s;
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
transform: translateY(-6px) scale(1.02);
|
||||
box-shadow: 0 12px 36px rgba(168,85,247,0.75);
|
||||
}
|
||||
.card:hover {
|
||||
transform: translateY(-6px) scale(1.02);
|
||||
box-shadow: 0 12px 36px rgba(249, 94, 11, 0.75);
|
||||
}
|
||||
|
||||
.card small {
|
||||
color: var(--muted);
|
||||
font-weight: 500;
|
||||
}
|
||||
.card small {
|
||||
color: var(--muted);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.card .value {
|
||||
font-size: 1.4rem;
|
||||
font-weight: 700;
|
||||
margin-top: 6px;
|
||||
}
|
||||
.card .value {
|
||||
font-size: 1.4rem;
|
||||
font-weight: 700;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
/* chart wrapper */
|
||||
.chart-wrap {
|
||||
background: var(--card-bg);
|
||||
border-radius: var(--radius);
|
||||
|
|
@ -93,29 +90,68 @@
|
|||
border: 1px solid rgba(15,23,42,0.04);
|
||||
}
|
||||
|
||||
/* tables */
|
||||
.table {
|
||||
width:100%;
|
||||
border-collapse:collapse;
|
||||
margin-bottom:20px;
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
margin-bottom: 20px;
|
||||
background: transparent;
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table thead {
|
||||
background: rgba(35, 39, 43, 0.98);
|
||||
}
|
||||
|
||||
.table thead th {
|
||||
text-align: left;
|
||||
font-size: 0.9rem;
|
||||
color: #562929;
|
||||
padding: 12px 16px;
|
||||
font-weight: 600;
|
||||
border-bottom: 2px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.table tbody tr {
|
||||
background: rgba(35, 39, 43, 0.95);
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.table tbody tr:hover {
|
||||
background: rgba(45, 49, 53, 0.98);
|
||||
}
|
||||
|
||||
.table td {
|
||||
padding: 12px 16px;
|
||||
font-size: 0.95rem;
|
||||
color: #562929;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.table tbody tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.table tfoot {
|
||||
background: rgba(35, 39, 43, 0.98);
|
||||
}
|
||||
|
||||
.table tfoot th {
|
||||
padding: 12px 16px;
|
||||
text-align: left;
|
||||
font-weight: 700;
|
||||
color: #562929;
|
||||
border-top: 2px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
/* Fix the "No expense" message color */
|
||||
.table tbody tr td[colspan] {
|
||||
color: #e0e0e0 !important;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
.table thead th {
|
||||
text-align:left; font-size:0.9rem; color:var(--muted); padding:10px 12px;
|
||||
border-bottom: 1px solid rgba(15,23,42,0.06);
|
||||
}
|
||||
.table tbody tr {
|
||||
background: #fff; border-radius:8px;
|
||||
}
|
||||
.table td {
|
||||
padding:11px 12px;
|
||||
font-size:0.95rem;
|
||||
vertical-align:middle;
|
||||
border-bottom: 1px solid rgba(15,23,42,0.03);
|
||||
}
|
||||
.table tfoot th { padding:10px 12px; text-align:left; font-weight:700; border-top:1px solid rgba(15,23,42,0.06); }
|
||||
|
||||
/* responsive: stack cards on small screens */
|
||||
@media (max-width:720px){
|
||||
.summary-row { flex-direction:column; }
|
||||
.er-header { flex-direction:column; align-items:flex-start; gap:10px; }
|
||||
|
|
@ -134,46 +170,53 @@
|
|||
<!-- Summary -->
|
||||
<div class="summary-row">
|
||||
<div class="card">
|
||||
<small>Today's Expenses</small>
|
||||
<div class="value"><%= number_to_currency(@daily_expenses || 0, unit: "₹") %></div>
|
||||
<small>Today's Expense</small>
|
||||
<div class="value"><%= number_to_currency(@daily_expense || 0, unit: "₹") %></div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<small>This Week</small>
|
||||
<div class="value"><%= number_to_currency(@weekly_expenses || 0, unit: "₹") %></div>
|
||||
<div class="value"><%= number_to_currency(@weekly_expense || 0, unit: "₹") %></div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<small>This Month</small>
|
||||
<div class="value"><%= number_to_currency(@monthly_expenses || 0, unit: "₹") %></div>
|
||||
<div class="value"><%= number_to_currency(@monthly_expense || 0, unit: "₹") %></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Chart -->
|
||||
<div class="chart-wrap">
|
||||
<canvas id="expensesChart" height="120"></canvas>
|
||||
<canvas id="expenseChart" height="120"></canvas>
|
||||
</div>
|
||||
|
||||
<!-- Today's table -->
|
||||
<section>
|
||||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#fff;">Today's Expenses</h3>
|
||||
<table class="table" aria-describedby="today-expenses">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>Amount</th><th>Date</th></tr>
|
||||
<tr><th>Title</th><th>Amount</th><th>Date</th><th>Description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% (@daily_expense_items || []).each do |expense| %>
|
||||
<tr>
|
||||
<td><%= expense.title %></td>
|
||||
<td><%= number_to_currency(expense.amount, unit: "₹") %></td>
|
||||
<td><%= expense.created_at.strftime("%d %b %Y") %></td>
|
||||
<td><%= expense.description %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if (@daily_expense_items || []).empty? %>
|
||||
<tr><td colspan="2" style="padding:12px;color:var(--muted)">No expenses for today.</td></tr>
|
||||
<tr><td colspan="4" class="text-center">No expense for today.</td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><th>Total</th><th><%= number_to_currency(@daily_expenses || 0, unit: "₹") %></th></tr>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><%= number_to_currency(@daily_expense || 0, unit: "₹") %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</section>
|
||||
|
|
@ -181,23 +224,30 @@
|
|||
<!-- Week table -->
|
||||
<section>
|
||||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#fff;">This Week's Expenses</h3>
|
||||
<table class="table" aria-describedby="week-expenses">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>Amount</th><th>Date</th></tr>
|
||||
<tr><th>Title</th><th>Amount</th><th>Date</th><th>Description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% (@weekly_expense_items || []).each do |expense| %>
|
||||
<tr>
|
||||
<td><%= expense.title %></td>
|
||||
<td><%= number_to_currency(expense.amount, unit: "₹") %></td>
|
||||
<td><%= expense.created_at.strftime("%d %b %Y") %></td>
|
||||
<td><%= expense.description %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if (@weekly_expense_items || []).empty? %>
|
||||
<tr><td colspan="2" style="padding:12px;color:var(--muted)">No expenses for this week.</td></tr>
|
||||
<tr><td colspan="4" class="text-center">No expense for this week.</td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><th>Total</th><th><%= number_to_currency(@weekly_expenses || 0, unit: "₹") %></th></tr>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><%= number_to_currency(@weekly_expense || 0, unit: "₹") %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</section>
|
||||
|
|
@ -205,39 +255,46 @@
|
|||
<!-- Month table -->
|
||||
<section>
|
||||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#fff;">This Month's Expenses</h3>
|
||||
<table class="table" aria-describedby="month-expenses">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>Amount</th><th>Date</th></tr>
|
||||
<tr><th>Title</th><th>Amount</th><th>Date</th><th>Description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% (@monthly_expense_items || []).each do |expense| %>
|
||||
<tr>
|
||||
<td><%= expense.title %></td>
|
||||
<td><%= number_to_currency(expense.amount, unit: "₹") %></td>
|
||||
<td><%= expense.created_at.strftime("%d %b %Y") %></td>
|
||||
<td><%= expense.description %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if (@monthly_expense_items || []).empty? %>
|
||||
<tr><td colspan="2" style="padding:12px;color:var(--muted)">No expenses for this month.</td></tr>
|
||||
<tr><td colspan="4" class="text-center">No expense for this month.</td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><th>Total</th><th><%= number_to_currency(@monthly_expenses || 0, unit: "₹") %></th></tr>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><%= number_to_currency(@monthly_expense || 0, unit: "₹") %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<!-- Chart.js (rounded line + subtle gradient) -->
|
||||
<!-- Chart.js -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<script>
|
||||
(function(){
|
||||
const labels = <%= raw((@chart_labels || []).to_json) %>;
|
||||
const data = <%= raw((@chart_data || []).to_json) %>;
|
||||
|
||||
const ctx = document.getElementById('expensesChart').getContext('2d');
|
||||
const ctx = document.getElementById('expenseChart').getContext('2d');
|
||||
const gradient = ctx.createLinearGradient(0,0,0,120);
|
||||
gradient.addColorStop(0, 'rgba(37,99,235,0.18)');
|
||||
gradient.addColorStop(1, 'rgba(37,99,235,0)');
|
||||
gradient.addColorStop(0, 'rgba(249,94,11,0.18)');
|
||||
gradient.addColorStop(1, 'rgba(249,94,11,0)');
|
||||
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
|
|
@ -248,11 +305,11 @@
|
|||
data: data,
|
||||
fill: true,
|
||||
backgroundColor: gradient,
|
||||
borderColor: 'rgba(37,99,235,1)',
|
||||
borderColor: 'rgba(249,94,11,1)',
|
||||
tension: 0.42,
|
||||
borderWidth: 2,
|
||||
pointRadius: 3,
|
||||
pointBackgroundColor: 'rgba(37,99,235,1)'
|
||||
pointBackgroundColor: 'rgba(249,94,11,1)'
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
|
|
@ -261,24 +318,15 @@
|
|||
x: { ticks: { color: '#374151' } },
|
||||
y: {
|
||||
beginAtZero: true,
|
||||
ticks: {
|
||||
callback: function(v){ return '₹' + v; },
|
||||
color: '#374151'
|
||||
},
|
||||
ticks: { callback: v => '₹' + v, color: '#374151' },
|
||||
grid: { color: 'rgba(15,23,42,0.04)' }
|
||||
}
|
||||
},
|
||||
plugins: {
|
||||
legend: { display: false },
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
label: function(ctx){ return '₹' + ctx.formattedValue; }
|
||||
}
|
||||
}
|
||||
tooltip: { callbacks: { label: ctx => '₹' + ctx.formattedValue } }
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<% content_for :title, "Expense Report" %>
|
||||
|
||||
|
|
|
|||
|
|
@ -40,3 +40,4 @@
|
|||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@
|
|||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@
|
|||
<%= link_to "📊 Income Report", income_report_path, class: "btn btn-outline-primary" %>
|
||||
</div>
|
||||
|
||||
<%= link_to "New income", new_income_path, class:"btn-income" %>
|
||||
<% if ["Admin"].include?current_user.type %>
|
||||
<%= link_to "New income", new_income_path, class:"btn-income" %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<div id="income">
|
||||
|
|
|
|||
|
|
@ -91,27 +91,65 @@
|
|||
}
|
||||
|
||||
.table {
|
||||
width:100%;
|
||||
border-collapse:collapse;
|
||||
margin-bottom:20px;
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
margin-bottom: 20px;
|
||||
background: transparent;
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.table thead {
|
||||
background: rgba(35, 39, 43, 0.98);
|
||||
}
|
||||
|
||||
.table thead th {
|
||||
text-align:left; font-size:0.9rem; color:var(--muted); padding:10px 12px;
|
||||
border-bottom: 1px solid rgba(15,23,42,0.06);
|
||||
text-align: left;
|
||||
font-size: 0.9rem;
|
||||
color: #562929;
|
||||
padding: 12px 16px;
|
||||
font-weight: 600;
|
||||
border-bottom: 2px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.table tbody tr { background: #fff; border-radius:8px; }
|
||||
|
||||
.table tbody tr {
|
||||
background: rgba(35, 39, 43, 0.95);
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.table tbody tr:hover {
|
||||
background: rgba(45, 49, 53, 0.98);
|
||||
}
|
||||
|
||||
.table td {
|
||||
padding:11px 12px;
|
||||
font-size:0.95rem;
|
||||
vertical-align:middle;
|
||||
border-bottom: 1px solid rgba(15,23,42,0.03);
|
||||
padding: 12px 16px;
|
||||
font-size: 0.95rem;
|
||||
color: #562929;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.table tbody tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.table tfoot {
|
||||
background: rgba(35, 39, 43, 0.98);
|
||||
}
|
||||
|
||||
.table tfoot th {
|
||||
padding:10px 12px;
|
||||
text-align:left;
|
||||
font-weight:700;
|
||||
border-top:1px solid rgba(15,23,42,0.06);
|
||||
padding: 12px 16px;
|
||||
text-align: left;
|
||||
font-weight: 700;
|
||||
color: #562929;
|
||||
border-top: 2px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
/* Fix the "No income" message color */
|
||||
.table tbody tr td[colspan] {
|
||||
color: #e0e0e0 !important;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
@media (max-width:720px){
|
||||
|
|
@ -157,21 +195,28 @@
|
|||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#fff;">Today's Income</h3>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>Amount</th><th>Date</th></tr>
|
||||
<tr><th>title</th><th>Amount</th><th>Date</th><th>description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% (@daily_income_items || []).each do |income| %>
|
||||
<tr>
|
||||
<td><%= income.title %></td>
|
||||
<td><%= number_to_currency(income.amount, unit: "₹") %></td>
|
||||
<td><%= income.created_at.strftime("%d %b %Y") %></td>
|
||||
<td><%= income.description %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if (@daily_income_items || []).empty? %>
|
||||
<tr><td colspan="2" style="padding:12px;color:var(--muted)">No income for today.</td></tr>
|
||||
<tr><td colspan="4" class="text-center">No income for today.</td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><th>Total</th><th><%= number_to_currency(@daily_income || 0, unit: "₹") %></th></tr>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><%= number_to_currency(@daily_income || 0, unit: "₹") %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</section>
|
||||
|
|
@ -181,21 +226,28 @@
|
|||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#fff;">This Week's Income</h3>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>Amount</th><th>Date</th></tr>
|
||||
<tr><th>title</th><th>Amount</th><th>Date</th><th>description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% (@weekly_income_items || []).each do |income| %>
|
||||
<tr>
|
||||
<td><%= income.title %></td>
|
||||
<td><%= number_to_currency(income.amount, unit: "₹") %></td>
|
||||
<td><%= income.created_at.strftime("%d %b %Y") %></td>
|
||||
<td><%= income.description %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if (@weekly_income_items || []).empty? %>
|
||||
<tr><td colspan="2" style="padding:12px;color:var(--muted)">No income for this week.</td></tr>
|
||||
<tr><td colspan="4" class="text-center">No income for this week.</td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><th>Total</th><th><%= number_to_currency(@weekly_income || 0, unit: "₹") %></th></tr>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><%= number_to_currency(@weekly_income || 0, unit: "₹") %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</section>
|
||||
|
|
@ -205,21 +257,28 @@
|
|||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#fff;">This Month's Income</h3>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>Amount</th><th>Date</th></tr>
|
||||
<tr><th>title</th><th>Amount</th><th>Date</th><th>description</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% (@monthly_income_items || []).each do |income| %>
|
||||
<tr>
|
||||
<td><%= income.title %></td>
|
||||
<td><%= number_to_currency(income.amount, unit: "₹") %></td>
|
||||
<td><%= income.created_at.strftime("%d %b %Y") %></td>
|
||||
<td><%= income.description %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if (@monthly_income_items || []).empty? %>
|
||||
<tr><td colspan="2" style="padding:12px;color:var(--muted)">No income for this month.</td></tr>
|
||||
<tr><td colspan="4" class="text-center">No income for this month.</td></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><th>Total</th><th><%= number_to_currency(@monthly_income || 0, unit: "₹") %></th></tr>
|
||||
<tr>
|
||||
<th>Total</th>
|
||||
<th><%= number_to_currency(@monthly_income || 0, unit: "₹") %></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,52 @@
|
|||
<style>
|
||||
/* ---------------- Video Header ---------------- */
|
||||
.video-header {
|
||||
position: relative;
|
||||
height: 80vh;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.bg-video {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.video-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.video-content {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 2rem;
|
||||
color: white;
|
||||
text-align: center;
|
||||
padding-top: 30vh;
|
||||
}
|
||||
|
||||
.video-content h1 {
|
||||
font-size: 3rem;
|
||||
margin-bottom: 1rem;
|
||||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.video-content h2 {
|
||||
font-size: 2rem;
|
||||
margin-bottom: 0.5rem;
|
||||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
/* ---------------- Body & Layout ---------------- */
|
||||
html, body {
|
||||
height: 100%;
|
||||
|
|
@ -13,12 +61,13 @@ html, body {
|
|||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-top: 60px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1900px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
padding-top: 20px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +77,7 @@ html, body {
|
|||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
.page-header h2 {
|
||||
font-weight: 700;
|
||||
font-size: 2.9rem;
|
||||
background: linear-gradient(90deg, #1e88e5, #43a047, #fdd835, #fb8c00, #e53935);
|
||||
|
|
@ -98,8 +147,8 @@ html, body {
|
|||
|
||||
/* ---------------- Glass Cards ---------------- */
|
||||
.glass-card {
|
||||
background: rgba(255,255,255,0.1);
|
||||
backdrop-filter: blur(12px);
|
||||
background: rgba(255, 255, 255, 0.05); /* Lowered opacity for more transparency */
|
||||
backdrop-filter: blur(1px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
border-radius: 18px;
|
||||
padding: 25px;
|
||||
|
|
@ -108,8 +157,8 @@ html, body {
|
|||
}
|
||||
|
||||
.glass-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 12px 40px rgba(0,0,0,0.25);
|
||||
transform: translateY(-15px);
|
||||
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
/* ---------------- Section Titles ---------------- */
|
||||
|
|
@ -226,19 +275,67 @@ html, body {
|
|||
margin: 10px 0;
|
||||
text-align: center;
|
||||
}
|
||||
.just {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 70%;
|
||||
margin-left: 250px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="page-wrapper">
|
||||
<div class="container">
|
||||
|
||||
<!-- Header -->
|
||||
|
||||
<!-- Header -->
|
||||
<div class="page-header d-flex flex-column align-items-center">
|
||||
<%= image_tag("unnamed.jpg", alt: "Logo", class: "logo-img") %>
|
||||
<h1>BADAR MADEENA CULTURAL CENTER AND CHARITY TRUST</h1>
|
||||
<h2>BADAR MADEENA CULTURAL CENTER AND CHARITY TRUST</h2>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="video-header">
|
||||
<video autoplay muted loop playsinline class="bg-video">
|
||||
<source src="<%= asset_path('just.mp4') %>" type="video/mp4">
|
||||
Your browser does not support the video tag.
|
||||
</video>
|
||||
|
||||
<div class="video-overlay"></div>
|
||||
|
||||
<div class="video-content text-center">
|
||||
<h2 class="text-primary">From Him To Him</h2>
|
||||
<h1 class="text-white fw-bold">A Shelter for the destitute</h1>
|
||||
<h1 class="text-white fw-bold">EDUCATIONAL INSTITUTIONS</h1>
|
||||
<h1 class="text-white fw-bold">AND CHARITY TRUST</h1>
|
||||
<h1 class="text-white fw-bold">MANAGEMENT SYSTEM</h1>
|
||||
<h1 class="text-white fw-bold">GENERATION OF THOUGHTS</h1>
|
||||
|
||||
<div class="just">
|
||||
<div class="glass-card p-4 w-50">
|
||||
<% if @institutions.present? %>
|
||||
<div class="mb-4">
|
||||
<label for="institution_select" class="form-label fw-bold">Study With Our College</label>
|
||||
<select id="institution_select" class="form-select" onchange="if(this.value){ window.location = '/institutions/' + this.value }">
|
||||
<option value="">-- Choose an institution --</option>
|
||||
<% @institutions.each do |institution| %>
|
||||
<option value="<%= institution.id %>"><%= institution.name %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
<% else %>
|
||||
<p class="item-desc text-center text-muted">No institutions added yet.</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Stats Row -->
|
||||
<div class="stats-row">
|
||||
<div class="stat-card">
|
||||
|
|
@ -414,3 +511,25 @@ html, body {
|
|||
|
||||
</div> <!-- container -->
|
||||
</div> <!-- page-wrapper -->
|
||||
<!-- JavaScript to handle the text change effect -->
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
let h1Elements = document.querySelectorAll('h1');
|
||||
let currentIndex = 0;
|
||||
|
||||
// Initially hide all h1 elements
|
||||
h1Elements.forEach((el, index) => {
|
||||
el.style.display = 'none';
|
||||
});
|
||||
|
||||
// Show the first h1 element
|
||||
h1Elements[currentIndex].style.display = 'block';
|
||||
|
||||
// Change text every 3 seconds
|
||||
setInterval(function() {
|
||||
h1Elements[currentIndex].style.display = 'none'; // Hide current
|
||||
currentIndex = (currentIndex + 1) % h1Elements.length; // Move to next h1
|
||||
h1Elements[currentIndex].style.display = 'block'; // Show next
|
||||
}, 3000); // 3 seconds
|
||||
});
|
||||
</script>
|
||||
|
|
@ -23,6 +23,20 @@
|
|||
<!-- Bootstrap CSS for modern UI -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
|
||||
<!-- Add scroll effect to navbar -->
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const navbar = document.querySelector('.navbar');
|
||||
window.addEventListener('scroll', function() {
|
||||
if (window.scrollY > 50) {
|
||||
navbar.classList.add('scrolled');
|
||||
} else {
|
||||
navbar.classList.remove('scrolled');
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body {
|
||||
|
|
@ -41,15 +55,41 @@ background: linear-gradient(-45deg, #1e88e5, #43a047, #6a1b9a, #d81b60);
|
|||
|
||||
|
||||
.bg-white {
|
||||
background-color: #181a1b !important;
|
||||
background-color: #181a1b !important;
|
||||
color: #e0e0e0 !important;
|
||||
}
|
||||
.navbar, .footer {
|
||||
.navbar {
|
||||
background-color: rgba(35, 39, 43, 0.95) !important;
|
||||
backdrop-filter: blur(10px);
|
||||
-webkit-backdrop-filter: blur(10px);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 1030;
|
||||
box-shadow: 0 2px 10px rgba(0,0,0,0.3);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.footer {
|
||||
background-color: #23272b !important;
|
||||
}
|
||||
|
||||
.navbar-brand, .footer, .text-muted {
|
||||
color: #e0e0e0 !important;
|
||||
}
|
||||
|
||||
/* Add padding to body to prevent content from going under navbar */
|
||||
body {
|
||||
padding-top: 76px; /* Adjust this value based on your navbar height */
|
||||
}
|
||||
|
||||
/* Make navbar more compact on scroll */
|
||||
.navbar.scrolled {
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
background-color: rgba(35, 39, 43, 0.98) !important;
|
||||
}
|
||||
.alert-success {
|
||||
background-color: #1e2d24 !important;
|
||||
color: #b8e994 !important;
|
||||
|
|
@ -104,6 +144,11 @@ background-color: #181a1b !important;
|
|||
margin-top: 0.5rem;
|
||||
min-width: 200px;
|
||||
}
|
||||
.navbar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
|
@ -133,9 +178,6 @@ background-color: #181a1b !important;
|
|||
<li class="nav-item">
|
||||
<%= link_to "🏠 Home", root_path, class: "nav-link active" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "🏫 MARKET", shop_now.products_path, class: "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "🎓 Programs", programs_path, class: "nav-link" %>
|
||||
</li>
|
||||
|
|
@ -145,9 +187,15 @@ background-color: #181a1b !important;
|
|||
<li class="nav-item">
|
||||
<%= link_to "📚 All Students", students_path, class: "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "💰 Income", incomes_path, class: "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "📊 Expenses", expenses_path, class: "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "🏫 Records", exclusive_traditional_records_path, class: "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "📞 Contact", contact_path, class: "nav-link" %>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
<%= form_with(model: product) do |form| %>
|
||||
<% if product.errors.any? %>
|
||||
<div style="color: red">
|
||||
<h2><%= pluralize(product.errors.count, "error") %> prohibited this product from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% product.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 :description, style: "display: block" %>
|
||||
<%= form.rich_textarea :description %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :images, style: "display: block" %>
|
||||
<%= form.file_field :images, multiple: true %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.label :price, style: "display: block" %>
|
||||
<%= form.text_field :price %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<%= form.submit %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<div id="<%= dom_id product %>">
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= product.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= product.description %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Images:</strong>
|
||||
<% product.images.each do |image| %>
|
||||
<div><%= link_to image.filename, image %></div>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Price:</strong>
|
||||
<%= product.price %>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<% content_for :title, "Products" %>
|
||||
|
||||
<h1>Products</h1>
|
||||
|
||||
<div id="products">
|
||||
<% @products.each do |product| %>
|
||||
<%= render product %>
|
||||
<p>
|
||||
<%= link_to "Show this product", product %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= link_to "New product", new_product_path %>
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @product %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Edit this product", edit_product_path(@product) %> |
|
||||
<%= link_to "Back to products", products_path %>
|
||||
|
||||
<%= button_to "Destroy this product", @product, method: :delete %>
|
||||
</div>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
// Close any existing modal
|
||||
var modal = document.querySelector('.modal');
|
||||
if (modal) {
|
||||
var modalInstance = bootstrap.Modal.getInstance(modal);
|
||||
modalInstance.hide();
|
||||
}
|
||||
|
||||
// Show success message
|
||||
var flashMessage = document.createElement('div');
|
||||
flashMessage.className = 'alert alert-success alert-dismissible fade show';
|
||||
flashMessage.setAttribute('role', 'alert');
|
||||
flashMessage.innerHTML = `
|
||||
Student was successfully created.
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
`;
|
||||
|
||||
// Add the flash message to the page
|
||||
var flashContainer = document.querySelector('.flash-messages') || document.querySelector('main');
|
||||
flashContainer.insertBefore(flashMessage, flashContainer.firstChild);
|
||||
|
||||
// Redirect to the students list
|
||||
window.location.href = '<%= institution_students_path(@institution) %>';
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
// Replace the form with the updated one containing errors
|
||||
document.querySelector('#new_student, .edit_student').innerHTML = '<%= j render "form", student: @student %>';
|
||||
|
|
@ -5,3 +5,5 @@ Rails.application.config.assets.version = "1.0"
|
|||
|
||||
# Add additional assets to the asset load path.
|
||||
# Rails.application.config.assets.paths << Emoji.images_path
|
||||
Rails.application.config.assets.paths << Rails.root.join("app", "assets", "video")
|
||||
Rails.application.config.assets.precompile += %w( *.mp4 video/*.mp4 )
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
Rails.application.routes.draw do
|
||||
resources :products
|
||||
devise_for :users
|
||||
|
||||
resources :students
|
||||
|
|
@ -28,6 +29,4 @@ Rails.application.routes.draw do
|
|||
root "institutions#index"
|
||||
|
||||
|
||||
mount ShopNow::Engine, at: "/shop_now"
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ class DeviseCreateUsers < ActiveRecord::Migration[8.0]
|
|||
## Database authenticatable
|
||||
t.string :email, null: false, default: ""
|
||||
t.string :encrypted_password, null: false, default: ""
|
||||
|
||||
|
||||
## Recoverable
|
||||
t.string :reset_password_token
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
# This migration comes from action_mailbox (originally 20180917164000)
|
||||
class CreateActionMailboxTables < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
create_table :action_mailbox_inbound_emails, id: primary_key_type do |t|
|
||||
t.integer :status, default: 0, null: false
|
||||
t.string :message_id, null: false
|
||||
t.string :message_checksum, null: false
|
||||
|
||||
t.timestamps
|
||||
|
||||
t.index [ :message_id, :message_checksum ], name: "index_action_mailbox_inbound_emails_uniqueness", unique: true
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def primary_key_type
|
||||
config = Rails.configuration.generators
|
||||
config.options[config.orm][:primary_key_type] || :primary_key
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
# This migration comes from shop_now (originally 20251103064039)
|
||||
class CreateShopNowCartItems < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :shop_now_cart_items do |t|
|
||||
t.references :product, null: false, foreign_key: true
|
||||
t.integer :quantity
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddUser < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :users, :type, :string
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
class DropCartItemsTable < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
drop_table :cart_items
|
||||
drop_table :carts
|
||||
drop_table :shop_now_cart_items
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
class DropShopNowProductTable < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
drop_table :shop_now_products
|
||||
drop_table :admins
|
||||
drop_table :admin_users
|
||||
drop_table :active_admin_comments
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
class AddToExpense < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
class AddTitleCategoryDescriptionToExpenses < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
class AddTitleCategoryDescriptionToExpense < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :expenses, :title, :string
|
||||
add_column :expenses, :category, :string
|
||||
add_column :expenses, :description, :text
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,16 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_11_02_124707) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_11_05_180728) do
|
||||
create_table "action_mailbox_inbound_emails", force: :cascade do |t|
|
||||
t.integer "status", default: 0, null: false
|
||||
t.string "message_id", null: false
|
||||
t.string "message_checksum", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["message_id", "message_checksum"], name: "index_action_mailbox_inbound_emails_uniqueness", unique: true
|
||||
end
|
||||
|
||||
create_table "action_text_rich_texts", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.text "body"
|
||||
|
|
@ -21,20 +30,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_02_124707) do
|
|||
t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true
|
||||
end
|
||||
|
||||
create_table "active_admin_comments", force: :cascade do |t|
|
||||
t.string "namespace"
|
||||
t.text "body"
|
||||
t.string "resource_type"
|
||||
t.integer "resource_id"
|
||||
t.string "author_type"
|
||||
t.integer "author_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author"
|
||||
t.index ["namespace"], name: "index_active_admin_comments_on_namespace"
|
||||
t.index ["resource_type", "resource_id"], name: "index_active_admin_comments_on_resource"
|
||||
end
|
||||
|
||||
create_table "active_storage_attachments", force: :cascade do |t|
|
||||
t.string "name", null: false
|
||||
t.string "record_type", null: false
|
||||
|
|
@ -63,45 +58,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_02_124707) do
|
|||
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
||||
end
|
||||
|
||||
create_table "admin_users", force: :cascade do |t|
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["email"], name: "index_admin_users_on_email", unique: true
|
||||
t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
|
||||
end
|
||||
|
||||
create_table "admins", force: :cascade do |t|
|
||||
t.string "email", default: "", null: false
|
||||
t.string "encrypted_password", default: "", null: false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["email"], name: "index_admins_on_email", unique: true
|
||||
t.index ["reset_password_token"], name: "index_admins_on_reset_password_token", unique: true
|
||||
end
|
||||
|
||||
create_table "cart_items", force: :cascade do |t|
|
||||
t.integer "cart_id", null: false
|
||||
t.integer "product_id", null: false
|
||||
t.integer "quantity"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["cart_id"], name: "index_cart_items_on_cart_id"
|
||||
t.index ["product_id"], name: "index_cart_items_on_product_id"
|
||||
end
|
||||
|
||||
create_table "carts", force: :cascade do |t|
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "exclusive_traditional_records", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "author"
|
||||
|
|
@ -115,6 +71,9 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_02_124707) do
|
|||
t.date "date"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "title"
|
||||
t.string "category"
|
||||
t.text "description"
|
||||
end
|
||||
|
||||
create_table "incomes", force: :cascade do |t|
|
||||
|
|
@ -160,14 +119,6 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_02_124707) do
|
|||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "shop_now_products", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.decimal "price"
|
||||
t.text "description"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "students", force: :cascade do |t|
|
||||
t.string "first_name"
|
||||
t.string "last_name"
|
||||
|
|
@ -189,6 +140,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_02_124707) do
|
|||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "type"
|
||||
t.index ["email"], name: "index_users_on_email", unique: true
|
||||
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||
end
|
||||
|
|
@ -201,7 +153,5 @@ ActiveRecord::Schema[8.0].define(version: 2025_11_02_124707) do
|
|||
|
||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "active_storage_variant_records", "active_storage_blobs", column: "blob_id"
|
||||
add_foreign_key "cart_items", "carts"
|
||||
add_foreign_key "cart_items", "products"
|
||||
add_foreign_key "students", "institutions"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
# 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
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
# Specify your gem's dependencies in shop_now.gemspec.
|
||||
gemspec
|
||||
|
||||
gem "puma"
|
||||
|
||||
gem "sqlite3"
|
||||
|
||||
gem "propshaft"
|
||||
|
||||
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
|
||||
gem "rubocop-rails-omakase", require: false
|
||||
|
||||
# Start debugger with binding.b [https://github.com/ruby/debug]
|
||||
# gem "debug", ">= 1.0.0"
|
||||
|
|
@ -1,254 +0,0 @@
|
|||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
shop_now (0.1.0)
|
||||
rails (>= 8.0.3)
|
||||
|
||||
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)
|
||||
ast (2.4.3)
|
||||
base64 (0.3.0)
|
||||
benchmark (0.5.0)
|
||||
bigdecimal (3.3.1)
|
||||
builder (3.3.0)
|
||||
concurrent-ruby (1.3.5)
|
||||
connection_pool (2.5.4)
|
||||
crass (1.0.6)
|
||||
date (3.4.1)
|
||||
drb (2.2.3)
|
||||
erb (5.1.1)
|
||||
erubi (1.13.1)
|
||||
globalid (1.3.0)
|
||||
activesupport (>= 6.1)
|
||||
i18n (1.14.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
io-console (0.8.1)
|
||||
irb (1.15.2)
|
||||
pp (>= 0.6.0)
|
||||
rdoc (>= 4.0.0)
|
||||
reline (>= 0.4.2)
|
||||
json (2.15.2)
|
||||
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.9.0)
|
||||
logger
|
||||
mini_mime (>= 0.1.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
marcel (1.1.0)
|
||||
mini_mime (1.1.5)
|
||||
minitest (5.26.0)
|
||||
net-imap (0.5.12)
|
||||
date
|
||||
net-protocol
|
||||
net-pop (0.1.2)
|
||||
net-protocol
|
||||
net-protocol (0.2.2)
|
||||
timeout
|
||||
net-smtp (0.5.1)
|
||||
net-protocol
|
||||
nio4r (2.7.4)
|
||||
nokogiri (1.18.10-x86_64-linux-gnu)
|
||||
racc (~> 1.4)
|
||||
parallel (1.27.0)
|
||||
parser (3.3.10.0)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
pp (0.6.3)
|
||||
prettyprint
|
||||
prettyprint (0.2.0)
|
||||
prism (1.6.0)
|
||||
propshaft (1.3.1)
|
||||
actionpack (>= 7.0.0)
|
||||
activesupport (>= 7.0.0)
|
||||
rack
|
||||
psych (5.2.6)
|
||||
date
|
||||
stringio
|
||||
puma (7.1.0)
|
||||
nio4r (~> 2.0)
|
||||
racc (1.8.1)
|
||||
rack (3.2.3)
|
||||
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.15.0)
|
||||
erb
|
||||
psych (>= 4.0.0)
|
||||
tsort
|
||||
regexp_parser (2.11.3)
|
||||
reline (0.6.2)
|
||||
io-console (~> 0.5)
|
||||
rubocop (1.81.6)
|
||||
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.1)
|
||||
lint_roller (~> 1.1)
|
||||
rubocop (>= 1.75.0, < 2.0)
|
||||
rubocop-ast (>= 1.47.1, < 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)
|
||||
securerandom (0.4.1)
|
||||
sqlite3 (2.7.4-x86_64-linux-gnu)
|
||||
stringio (3.1.7)
|
||||
thor (1.4.0)
|
||||
timeout (0.4.3)
|
||||
tsort (0.2.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.1.0)
|
||||
useragent (0.16.11)
|
||||
websocket-driver (0.8.0)
|
||||
base64
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
zeitwerk (2.7.3)
|
||||
|
||||
PLATFORMS
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
propshaft
|
||||
puma
|
||||
rubocop-rails-omakase
|
||||
shop_now!
|
||||
sqlite3
|
||||
|
||||
BUNDLED WITH
|
||||
2.4.20
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
# ShopNow
|
||||
Short description and motivation.
|
||||
|
||||
## Usage
|
||||
How to use my plugin.
|
||||
|
||||
## Installation
|
||||
Add this line to your application's Gemfile:
|
||||
|
||||
```ruby
|
||||
gem "shop_now"
|
||||
```
|
||||
|
||||
And then execute:
|
||||
```bash
|
||||
$ bundle
|
||||
```
|
||||
|
||||
Or install it yourself as:
|
||||
```bash
|
||||
$ gem install shop_now
|
||||
```
|
||||
|
||||
## Contributing
|
||||
Contribution directions go here.
|
||||
|
||||
## License
|
||||
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
require "bundler/setup"
|
||||
|
||||
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
||||
load "rails/tasks/engine.rake"
|
||||
|
||||
load "rails/tasks/statistics.rake"
|
||||
|
||||
require "bundler/gem_tasks"
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
module ShopNow
|
||||
|
||||
class ProductsController < ApplicationController
|
||||
before_action :set_product, only: %i[ show edit update destroy ]
|
||||
layout "shop_now/application"
|
||||
|
||||
|
||||
# GET /products
|
||||
def index
|
||||
@products = Product.all
|
||||
end
|
||||
|
||||
# GET /products/1
|
||||
def show
|
||||
@product = Product.find(params[:id])
|
||||
end
|
||||
|
||||
# GET /products/new
|
||||
def new
|
||||
@product = Product.new
|
||||
end
|
||||
|
||||
# GET /products/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# GET /products/1/contact
|
||||
def contact
|
||||
end
|
||||
|
||||
# POST /products
|
||||
def create
|
||||
@product = Product.new(product_params)
|
||||
|
||||
if @product.save
|
||||
redirect_to shop_now.product_path(@product), notice: "Product was successfully created."
|
||||
else
|
||||
render :new, status: :unprocessable_content
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH/PUT /products/1
|
||||
def update
|
||||
if @product.update(product_params)
|
||||
redirect_to shop_now.product_path(@product), notice: "Product was successfully updated.", status: :see_other
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /products/1
|
||||
def destroy
|
||||
@product.destroy!
|
||||
redirect_to shop_now.products_path, notice: "Product was successfully destroyed.", status: :see_other
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_product
|
||||
@product = Product.find(params[:id])
|
||||
end
|
||||
|
||||
# Only allow a list of trusted parameters through.
|
||||
def product_params
|
||||
params.require(:product).permit(:name, :description, :price, images: [])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
module ProductsHelper
|
||||
end
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
module ShopNow
|
||||
class Product < ApplicationRecord
|
||||
self.table_name = 'shop_now_products'
|
||||
has_rich_text :description
|
||||
has_many_attached :images
|
||||
has_one_attached :image
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
# class ShopNow::Product < ApplicationRecord
|
||||
|
||||
# end
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ShopNow</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
|
||||
|
||||
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
||||
|
||||
|
||||
<!-- Bootstrap -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Google Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Poppins', sans-serif;
|
||||
background-color: #f9fafc;
|
||||
}
|
||||
|
||||
/* Navbar Styling */
|
||||
.navbar {
|
||||
background: linear-gradient(90deg, #007bff, #00c6ff);
|
||||
box-shadow: 0 3px 6px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.navbar-brand {
|
||||
font-weight: 700;
|
||||
font-size: 1.5rem;
|
||||
color: #fff !important;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.navbar-nav .nav-link {
|
||||
color: #f1f1f1 !important;
|
||||
margin: 0 10px;
|
||||
font-weight: 500;
|
||||
transition: all 0.3s ease;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.navbar-nav .nav-link::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 0%;
|
||||
height: 2px;
|
||||
bottom: -4px;
|
||||
left: 0;
|
||||
background-color: #fff;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.navbar-nav .nav-link:hover::after {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.navbar-nav .nav-link:hover {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.btn-shop {
|
||||
background-color: #fff;
|
||||
color: #007bff;
|
||||
border-radius: 30px;
|
||||
font-weight: 600;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.btn-shop:hover {
|
||||
background-color: #f1f1f1;
|
||||
color: #0056b3;
|
||||
}
|
||||
|
||||
.content-container {
|
||||
padding-top: 90px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Beautiful Navbar -->
|
||||
<nav class="navbar navbar-expand-lg fixed-top">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="<%= shop_now.products_path %>">🛍️ BADAR MADEENA ShopNow</a>
|
||||
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
|
||||
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon text-light"></span>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav ms-auto align-items-center">
|
||||
<li class="nav-item">
|
||||
<%= link_to "🏠BADAR MADEENA Home", main_app.institutions_path, class: "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "🛒 Products", shop_now.products_path, class: "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "⭐ Featured", "#", class: "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to "📞 Contact", shop_now.contact_path, class: "nav-link" %>
|
||||
</li>
|
||||
<li class="nav-item ms-3">
|
||||
<%= link_to "Shop Now", shop_now.products_path, class: "btn btn-shop px-3 py-1" %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Page Content -->
|
||||
<div class="container content-container">
|
||||
<%= yield %>
|
||||
</div>
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<%# Use explicit engine route helpers to avoid polymorphic helper resolution issues inside isolated engine views %>
|
||||
<% form_url = product.persisted? ? shop_now.product_path(product) : shop_now.products_path %>
|
||||
<% form_method = product.persisted? ? :patch : :post %>
|
||||
<%= form_with(model: product, url: form_url, method: form_method, local: true) do |form| %>
|
||||
<% if product.errors.any? %>
|
||||
<div style="color: red">
|
||||
<h2><%= pluralize(product.errors.count, "error") %> prohibited this product from being saved:</h2>
|
||||
<ul>
|
||||
<% product.errors.each do |error| %>
|
||||
<li><%= error.full_message %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= form.label :name, class: "form-label" %>
|
||||
<%= form.text_field :name, class: "form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= form.label :price, class: "form-label" %>
|
||||
<%= form.number_field :price, class: "form-control", step: :any %>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= form.label :description, class: "form-label" %>
|
||||
<%= form.text_field :description, class: "form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= form.label :images, class: "form-label" %>
|
||||
<%= form.file_field :images, multiple: true, class: "form-control" %>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<%= form.submit class: "btn btn-primary" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<div id="<%= dom_id product %>">
|
||||
<p>
|
||||
<strong>Name:</strong>
|
||||
<%= product.name %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Description:</strong>
|
||||
<%= product.description %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Images:</strong>
|
||||
<% if product.images.attached? %>
|
||||
<div class="d-flex flex-wrap gap-3 my-3">
|
||||
<% product.images.each do |image| %>
|
||||
<div>
|
||||
<%= image_tag main_app.rails_blob_path(image, only_path: true), class: "img-thumbnail rounded shadow-sm", style: "max-width: 200px; height: auto;" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Price:</strong>
|
||||
<%= product.price %>
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<h2>Contact Us</h2>
|
||||
<p>If you have any questions or need assistance, please feel free to reach out to us:</p>
|
||||
<ul>
|
||||
<li>Email: <a href="mailto:info@badarmadeena.org">info@badarmadeena.org</a></li>
|
||||
<li>Phone: +91 9747111705</li>
|
||||
<li>Phone: +91 8592080609</li>
|
||||
<li>Website: <a href="https://badarmadeena.org">badarmadeena.org</a></li>
|
||||
<li>Address: Badar Madeena Educational Trust, Kerala, India</li>
|
||||
|
||||
</ul>
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
<% content_for :title, "Products" %>
|
||||
|
||||
<!-- Navbar with Filters & Sort -->
|
||||
<nav class="navbar">
|
||||
<div class="navbar-links">
|
||||
<%= link_to 'Relevance', '#', class: 'navbar-item' %>
|
||||
<%= link_to 'Price: Low to High', '#', class: 'navbar-item' %>
|
||||
<%= link_to 'Price: High to Low', '#', class: 'navbar-item' %>
|
||||
<%= link_to 'New', '#', class: 'navbar-item' %>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Products Grid -->
|
||||
<div class="products-container">
|
||||
<% @products.each do |product| %>
|
||||
<div class="product-card">
|
||||
<div class="product-image-carousel">
|
||||
<% product.images.each_with_index do |image, index| %>
|
||||
<%= image_tag main_app.rails_representation_url(image.variant(resize_to_limit: [250, 250])), class: "product-image", data: { index: index } %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<h3 class="product-title"><%= product.name %></h3>
|
||||
<p class="product-price"><%= product.price %></p>
|
||||
<%= link_to "View Product", product_path(product), class: "product-link" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<!-- New Product Button -->
|
||||
<%= link_to "Add New Product", new_product_path, class: 'new-product-button' %>
|
||||
|
||||
<!-- Styles and Scripts -->
|
||||
<style>
|
||||
/* Global Styles */
|
||||
body {
|
||||
font-family: 'Arial', sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Navbar Styling */
|
||||
.navbar {
|
||||
background-color: #333;
|
||||
padding: 10px 20px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.navbar-links {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.navbar-item {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
padding: 5px 10px;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.navbar-item:hover {
|
||||
background-color: #555;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
/* Products Grid */
|
||||
.products-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||
gap: 20px;
|
||||
margin: 20px auto;
|
||||
max-width: 1200px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.product-card {
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.product-card:hover {
|
||||
transform: translateY(-8px);
|
||||
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.product-title {
|
||||
font-size: 1.2rem;
|
||||
color: #333;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.product-price {
|
||||
font-size: 1.1rem;
|
||||
color: #ff5722;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.product-link {
|
||||
font-size: 1rem;
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.product-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Image Carousel Styling */
|
||||
.product-image-carousel {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 250px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: #f9f9f9; /* optional nice background */
|
||||
}
|
||||
|
||||
.product-image {
|
||||
position: absolute;
|
||||
width: auto;
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
object-fit: contain; /* keep full image visible */
|
||||
opacity: 0;
|
||||
transition: opacity 0.8s ease;
|
||||
}
|
||||
|
||||
.product-image.show {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* New Product Button */
|
||||
.new-product-button {
|
||||
display: block;
|
||||
text-align: center;
|
||||
margin-top: 40px;
|
||||
padding: 12px 25px;
|
||||
background-color: #28a745;
|
||||
color: white;
|
||||
border-radius: 30px;
|
||||
font-size: 16px;
|
||||
text-decoration: none;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.new-product-button:hover {
|
||||
background-color: #218838;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// Get all the product image carousels
|
||||
const carousels = document.querySelectorAll('.product-image-carousel');
|
||||
|
||||
carousels.forEach(function (carousel) {
|
||||
const images = carousel.querySelectorAll('.product-image');
|
||||
let currentIndex = 0;
|
||||
|
||||
// Show the first image initially
|
||||
images[currentIndex].classList.add('show');
|
||||
|
||||
// Change the image every 3 seconds
|
||||
setInterval(function () {
|
||||
images[currentIndex].classList.remove('show');
|
||||
currentIndex = (currentIndex + 1) % images.length;
|
||||
images[currentIndex].classList.add('show');
|
||||
}, 3000); // Change image every 3 seconds
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<p style="color: green"><%= notice %></p>
|
||||
|
||||
<%= render @product %>
|
||||
|
||||
<div>
|
||||
<%= link_to "Edit this product", shop_now.edit_product_path(@product) %> |
|
||||
<%= link_to "Back to products", shop_now.products_path %>
|
||||
|
||||
<%= button_to "Destroy this product", shop_now.product_path(@product), method: :delete %>
|
||||
</div>
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
# This command will automatically be run when you run "rails" with Rails gems
|
||||
# installed from the root of your application.
|
||||
|
||||
ENGINE_ROOT = File.expand_path("..", __dir__)
|
||||
ENGINE_PATH = File.expand_path("../lib/shop_now/engine", __dir__)
|
||||
APP_PATH = File.expand_path("../test/dummy/config/application", __dir__)
|
||||
|
||||
# Set up gems listed in the Gemfile.
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
||||
|
||||
require "rails/all"
|
||||
require "rails/engine/commands"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
require "rubygems"
|
||||
require "bundler/setup"
|
||||
|
||||
# explicit rubocop config increases performance slightly while avoiding config confusion.
|
||||
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
|
||||
|
||||
load Gem.bin_path("rubocop", "rubocop")
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
ShopNow::Engine.routes.draw do
|
||||
resources :products
|
||||
# Within the engine, controllers are namespaced automatically (ShopNow::ProductsController)
|
||||
root to: "shop_now/products#index"
|
||||
get "contact", to: "products#contact"
|
||||
end
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
class CreateProducts < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :products do |t|
|
||||
t.string :name
|
||||
t.text :description
|
||||
t.decimal :price
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
require "shop_now/version"
|
||||
require "shop_now/engine"
|
||||
|
||||
module ShopNow
|
||||
# Your code goes here...
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
module ShopNow
|
||||
class Engine < ::Rails::Engine
|
||||
isolate_namespace ShopNow
|
||||
end
|
||||
end
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
module ShopNow
|
||||
VERSION = "0.1.0"
|
||||
end
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
# desc "Explaining what the task does"
|
||||
# task :shop_now do
|
||||
# # Task goes here
|
||||
# end
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
require_relative "lib/shop_now/version"
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "shop_now"
|
||||
spec.version = ShopNow::VERSION
|
||||
spec.authors = [ "niyas301" ]
|
||||
spec.email = [ "niyumon301@gmail.com" ]
|
||||
spec.homepage = "https://example.com/shop_now"
|
||||
spec.summary = "ShopNow plugin for Badar Madeena (local)"
|
||||
spec.description = "Local ShopNow plugin used by the application. Replace with your project's description."
|
||||
|
||||
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the "allowed_push_host"
|
||||
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
||||
# If you publish this gem, set allowed_push_host appropriately. Left unset for local use.
|
||||
# spec.metadata["allowed_push_host"] = "http://mygemserver.com"
|
||||
|
||||
spec.metadata["homepage_uri"] = spec.homepage
|
||||
spec.metadata["source_code_uri"] = "https://example.com/shop_now/source"
|
||||
spec.metadata["changelog_uri"] = "https://example.com/shop_now/CHANGELOG.md"
|
||||
|
||||
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
||||
Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
|
||||
end
|
||||
|
||||
spec.add_dependency "rails", ">= 8.0.3"
|
||||
end
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
require "test_helper"
|
||||
|
||||
class ProductsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@product = products(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get products_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get new_product_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create product" do
|
||||
assert_difference("Product.count") do
|
||||
post products_url, params: { product: { name: @product.name, price: @product.price } }
|
||||
end
|
||||
|
||||
assert_redirected_to product_url(Product.last)
|
||||
end
|
||||
|
||||
test "should show product" do
|
||||
get product_url(@product)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get edit" do
|
||||
get edit_product_url(@product)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update product" do
|
||||
patch product_url(@product), params: { product: { name: @product.name, price: @product.price } }
|
||||
assert_redirected_to product_url(@product)
|
||||
end
|
||||
|
||||
test "should destroy product" do
|
||||
assert_difference("Product.count", -1) do
|
||||
delete product_url(@product)
|
||||
end
|
||||
|
||||
assert_redirected_to products_url
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# 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
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
||||
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
||||
* It is generally better to create a new file per style scope.
|
||||
*
|
||||
*= require_tree .
|
||||
*= require_self
|
||||
*/
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
module ApplicationHelper
|
||||
end
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: "from@example.com"
|
||||
layout "mailer"
|
||||
end
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
class ApplicationRecord < ActiveRecord::Base
|
||||
primary_abstract_class
|
||||
end
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= content_for(:title) || "Dummy" %></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">
|
||||
|
||||
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
||||
<%= stylesheet_link_tag :app %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
<!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>
|
||||
|
|
@ -1 +0,0 @@
|
|||
<%= yield %>
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
{
|
||||
"name": "Dummy",
|
||||
"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": "Dummy.",
|
||||
"theme_color": "red",
|
||||
"background_color": "red"
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
// 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)
|
||||
// }
|
||||
// })
|
||||
// )
|
||||
// })
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
exec "./bin/rails", "server", *ARGV
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
APP_PATH = File.expand_path("../config/application", __dir__)
|
||||
require_relative "../config/boot"
|
||||
require "rails/commands"
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
require_relative "../config/boot"
|
||||
require "rake"
|
||||
Rake.application.run
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
require "fileutils"
|
||||
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
|
||||
def system!(*args)
|
||||
system(*args, exception: true)
|
||||
end
|
||||
|
||||
FileUtils.chdir APP_ROOT do
|
||||
# This script is a way to set up or update your development environment automatically.
|
||||
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
||||
# Add necessary setup steps to this file.
|
||||
|
||||
puts "== Installing dependencies =="
|
||||
system("bundle check") || system!("bundle install")
|
||||
|
||||
# puts "\n== Copying sample files =="
|
||||
# unless File.exist?("config/database.yml")
|
||||
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
||||
# end
|
||||
|
||||
puts "\n== Preparing database =="
|
||||
system! "bin/rails db:prepare"
|
||||
|
||||
puts "\n== Removing old logs and tempfiles =="
|
||||
system! "bin/rails log:clear tmp:clear"
|
||||
|
||||
unless ARGV.include?("--skip-server")
|
||||
puts "\n== Starting development server =="
|
||||
STDOUT.flush # flush the output before exec(2) so that it displays
|
||||
exec "bin/dev"
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
# This file is used by Rack-based servers to start the application.
|
||||
|
||||
require_relative "config/environment"
|
||||
|
||||
run Rails.application
|
||||
Rails.application.load_server
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
require_relative "boot"
|
||||
|
||||
require "rails/all"
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
Bundler.require(*Rails.groups)
|
||||
|
||||
module Dummy
|
||||
class Application < Rails::Application
|
||||
config.load_defaults Rails::VERSION::STRING.to_f
|
||||
|
||||
# For compatibility with applications that use this config
|
||||
config.action_controller.include_all_helpers = false
|
||||
|
||||
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
||||
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
||||
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
||||
config.autoload_lib(ignore: %w[assets tasks])
|
||||
|
||||
# Configuration for the application, engines, and railties goes here.
|
||||
#
|
||||
# These settings can be overridden in specific environments using the files
|
||||
# in config/environments, which are processed later.
|
||||
#
|
||||
# config.time_zone = "Central Time (US & Canada)"
|
||||
# config.eager_load_paths << Rails.root.join("extras")
|
||||
end
|
||||
end
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# Set up gems listed in the Gemfile.
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
|
||||
|
||||
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
||||
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: test
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
||||
channel_prefix: dummy_production
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
# SQLite. Versions 3.8.0 and up are supported.
|
||||
# gem install sqlite3
|
||||
#
|
||||
# Ensure the SQLite 3 gem is defined in your Gemfile
|
||||
# gem "sqlite3"
|
||||
#
|
||||
default: &default
|
||||
adapter: sqlite3
|
||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||
timeout: 5000
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
database: storage/development.sqlite3
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
<<: *default
|
||||
database: storage/test.sqlite3
|
||||
|
||||
|
||||
# SQLite3 write its data on the local filesystem, as such it requires
|
||||
# persistent disks. If you are deploying to a managed service, you should
|
||||
# make sure it provides disk persistence, as many don't.
|
||||
#
|
||||
# Similarly, if you deploy your application as a Docker container, you must
|
||||
# ensure the database is located in a persisted volume.
|
||||
production:
|
||||
<<: *default
|
||||
# database: path/to/persistent/storage/production.sqlite3
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# Load the Rails application.
|
||||
require_relative "application"
|
||||
|
||||
# Initialize the Rails application.
|
||||
Rails.application.initialize!
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue