course #3
11
Gemfile
11
Gemfile
|
|
@ -61,3 +61,14 @@ group :test do
|
||||||
gem "capybara"
|
gem "capybara"
|
||||||
gem "selenium-webdriver"
|
gem "selenium-webdriver"
|
||||||
end
|
end
|
||||||
|
# admin
|
||||||
|
gem 'devise'
|
||||||
|
|
||||||
|
gem "sprockets-rails"
|
||||||
|
gem "sassc-rails"
|
||||||
|
gem "font-awesome-sass", '~> 5.15.1'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
gem "shop_now", path: "vendor/plugins/shop_now"
|
||||||
45
Gemfile.lock
45
Gemfile.lock
|
|
@ -1,3 +1,9 @@
|
||||||
|
PATH
|
||||||
|
remote: vendor/plugins/shop_now
|
||||||
|
specs:
|
||||||
|
shop_now (0.1.0)
|
||||||
|
rails (>= 8.0.3)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
|
|
@ -76,6 +82,7 @@ GEM
|
||||||
public_suffix (>= 2.0.2, < 7.0)
|
public_suffix (>= 2.0.2, < 7.0)
|
||||||
ast (2.4.3)
|
ast (2.4.3)
|
||||||
base64 (0.3.0)
|
base64 (0.3.0)
|
||||||
|
bcrypt (3.1.20)
|
||||||
bcrypt_pbkdf (1.1.1)
|
bcrypt_pbkdf (1.1.1)
|
||||||
benchmark (0.4.1)
|
benchmark (0.4.1)
|
||||||
bigdecimal (3.2.3)
|
bigdecimal (3.2.3)
|
||||||
|
|
@ -101,6 +108,12 @@ GEM
|
||||||
debug (1.11.0)
|
debug (1.11.0)
|
||||||
irb (~> 1.10)
|
irb (~> 1.10)
|
||||||
reline (>= 0.3.8)
|
reline (>= 0.3.8)
|
||||||
|
devise (4.9.4)
|
||||||
|
bcrypt (~> 3.0)
|
||||||
|
orm_adapter (~> 0.1)
|
||||||
|
railties (>= 4.1.0)
|
||||||
|
responders
|
||||||
|
warden (~> 1.2.3)
|
||||||
dotenv (3.1.8)
|
dotenv (3.1.8)
|
||||||
drb (2.2.3)
|
drb (2.2.3)
|
||||||
ed25519 (1.4.0)
|
ed25519 (1.4.0)
|
||||||
|
|
@ -109,6 +122,8 @@ GEM
|
||||||
et-orbi (1.4.0)
|
et-orbi (1.4.0)
|
||||||
tzinfo
|
tzinfo
|
||||||
ffi (1.17.2-x86_64-linux-gnu)
|
ffi (1.17.2-x86_64-linux-gnu)
|
||||||
|
font-awesome-sass (5.15.1)
|
||||||
|
sassc (>= 1.11)
|
||||||
fugit (1.11.2)
|
fugit (1.11.2)
|
||||||
et-orbi (~> 1, >= 1.2.11)
|
et-orbi (~> 1, >= 1.2.11)
|
||||||
raabro (~> 1.4)
|
raabro (~> 1.4)
|
||||||
|
|
@ -178,6 +193,7 @@ GEM
|
||||||
nio4r (2.7.4)
|
nio4r (2.7.4)
|
||||||
nokogiri (1.18.10-x86_64-linux-gnu)
|
nokogiri (1.18.10-x86_64-linux-gnu)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
|
orm_adapter (0.5.0)
|
||||||
ostruct (0.6.3)
|
ostruct (0.6.3)
|
||||||
parallel (1.27.0)
|
parallel (1.27.0)
|
||||||
parser (3.3.9.0)
|
parser (3.3.9.0)
|
||||||
|
|
@ -245,6 +261,9 @@ GEM
|
||||||
regexp_parser (2.11.3)
|
regexp_parser (2.11.3)
|
||||||
reline (0.6.2)
|
reline (0.6.2)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
|
responders (3.2.0)
|
||||||
|
actionpack (>= 7.0)
|
||||||
|
railties (>= 7.0)
|
||||||
rexml (3.4.4)
|
rexml (3.4.4)
|
||||||
rubocop (1.81.1)
|
rubocop (1.81.1)
|
||||||
json (~> 2.3)
|
json (~> 2.3)
|
||||||
|
|
@ -279,6 +298,14 @@ GEM
|
||||||
ffi (~> 1.12)
|
ffi (~> 1.12)
|
||||||
logger
|
logger
|
||||||
rubyzip (3.1.1)
|
rubyzip (3.1.1)
|
||||||
|
sassc (2.4.0)
|
||||||
|
ffi (~> 1.9)
|
||||||
|
sassc-rails (2.1.2)
|
||||||
|
railties (>= 4.0.0)
|
||||||
|
sassc (>= 2.0)
|
||||||
|
sprockets (> 3.0)
|
||||||
|
sprockets-rails
|
||||||
|
tilt
|
||||||
securerandom (0.4.1)
|
securerandom (0.4.1)
|
||||||
selenium-webdriver (4.35.0)
|
selenium-webdriver (4.35.0)
|
||||||
base64 (~> 0.2)
|
base64 (~> 0.2)
|
||||||
|
|
@ -302,6 +329,14 @@ GEM
|
||||||
fugit (~> 1.11.0)
|
fugit (~> 1.11.0)
|
||||||
railties (>= 7.1)
|
railties (>= 7.1)
|
||||||
thor (>= 1.3.1)
|
thor (>= 1.3.1)
|
||||||
|
sprockets (4.2.2)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
logger
|
||||||
|
rack (>= 2.2.4, < 4)
|
||||||
|
sprockets-rails (3.5.2)
|
||||||
|
actionpack (>= 6.1)
|
||||||
|
activesupport (>= 6.1)
|
||||||
|
sprockets (>= 3.0.0)
|
||||||
sqlite3 (2.7.4-x86_64-linux-gnu)
|
sqlite3 (2.7.4-x86_64-linux-gnu)
|
||||||
sshkit (1.24.0)
|
sshkit (1.24.0)
|
||||||
base64
|
base64
|
||||||
|
|
@ -315,6 +350,7 @@ GEM
|
||||||
stringio (3.1.7)
|
stringio (3.1.7)
|
||||||
thor (1.4.0)
|
thor (1.4.0)
|
||||||
thruster (0.1.15-x86_64-linux)
|
thruster (0.1.15-x86_64-linux)
|
||||||
|
tilt (2.6.1)
|
||||||
timeout (0.4.3)
|
timeout (0.4.3)
|
||||||
tsort (0.2.0)
|
tsort (0.2.0)
|
||||||
turbo-rails (2.0.17)
|
turbo-rails (2.0.17)
|
||||||
|
|
@ -325,8 +361,10 @@ GEM
|
||||||
unicode-display_width (3.2.0)
|
unicode-display_width (3.2.0)
|
||||||
unicode-emoji (~> 4.1)
|
unicode-emoji (~> 4.1)
|
||||||
unicode-emoji (4.1.0)
|
unicode-emoji (4.1.0)
|
||||||
uri (1.0.3)
|
uri (1.1.0)
|
||||||
useragent (0.16.11)
|
useragent (0.16.11)
|
||||||
|
warden (1.2.9)
|
||||||
|
rack (>= 2.0.9)
|
||||||
web-console (4.2.1)
|
web-console (4.2.1)
|
||||||
actionview (>= 6.0.0)
|
actionview (>= 6.0.0)
|
||||||
activemodel (>= 6.0.0)
|
activemodel (>= 6.0.0)
|
||||||
|
|
@ -349,6 +387,8 @@ DEPENDENCIES
|
||||||
brakeman
|
brakeman
|
||||||
capybara
|
capybara
|
||||||
debug
|
debug
|
||||||
|
devise
|
||||||
|
font-awesome-sass (~> 5.15.1)
|
||||||
image_processing (~> 1.12)
|
image_processing (~> 1.12)
|
||||||
importmap-rails
|
importmap-rails
|
||||||
jbuilder
|
jbuilder
|
||||||
|
|
@ -357,10 +397,13 @@ DEPENDENCIES
|
||||||
puma (>= 5.0)
|
puma (>= 5.0)
|
||||||
rails (~> 8.0.3)
|
rails (~> 8.0.3)
|
||||||
rubocop-rails-omakase
|
rubocop-rails-omakase
|
||||||
|
sassc-rails
|
||||||
selenium-webdriver
|
selenium-webdriver
|
||||||
|
shop_now!
|
||||||
solid_cable
|
solid_cable
|
||||||
solid_cache
|
solid_cache
|
||||||
solid_queue
|
solid_queue
|
||||||
|
sprockets-rails
|
||||||
sqlite3 (>= 2.1)
|
sqlite3 (>= 2.1)
|
||||||
stimulus-rails
|
stimulus-rails
|
||||||
thruster
|
thruster
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
//= link_tree ../images
|
||||||
|
//= link_directory ../stylesheets .css
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
// app/javascript/application.js or app/assets/javascripts/application.js
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
const flash = document.getElementById("flash-message");
|
||||||
|
if (flash) {
|
||||||
|
setTimeout(() => {
|
||||||
|
flash.style.transition = "opacity 0.5s ease";
|
||||||
|
flash.style.opacity = "0";
|
||||||
|
setTimeout(() => flash.remove(), 500); // remove from DOM after fade
|
||||||
|
}, 3000); // 3 seconds
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,440 @@
|
||||||
|
/*
|
||||||
|
* Default Trix editor styles. See Action Text overwrites below.
|
||||||
|
*/
|
||||||
|
|
||||||
|
trix-editor {
|
||||||
|
border: 1px solid #bbb;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.4em 0.6em;
|
||||||
|
min-height: 5em;
|
||||||
|
outline: none; }
|
||||||
|
|
||||||
|
trix-toolbar * {
|
||||||
|
box-sizing: border-box; }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button-row {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
overflow-x: auto; }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button-group {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border: 1px solid #bbb;
|
||||||
|
border-top-color: #ccc;
|
||||||
|
border-bottom-color: #888;
|
||||||
|
border-radius: 3px; }
|
||||||
|
trix-toolbar .trix-button-group:not(:first-child) {
|
||||||
|
margin-left: 1.5vw; }
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
trix-toolbar .trix-button-group:not(:first-child) {
|
||||||
|
margin-left: 0; } }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button-group-spacer {
|
||||||
|
flex-grow: 1; }
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
trix-toolbar .trix-button-group-spacer {
|
||||||
|
display: none; } }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
color: rgba(0, 0, 0, 0.6);
|
||||||
|
font-size: 0.75em;
|
||||||
|
font-weight: 600;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
margin: 0;
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid #ddd;
|
||||||
|
border-radius: 0;
|
||||||
|
background: transparent; }
|
||||||
|
trix-toolbar .trix-button:not(:first-child) {
|
||||||
|
border-left: 1px solid #ccc; }
|
||||||
|
trix-toolbar .trix-button.trix-active {
|
||||||
|
background: #cbeefa;
|
||||||
|
color: black; }
|
||||||
|
trix-toolbar .trix-button:not(:disabled) {
|
||||||
|
cursor: pointer; }
|
||||||
|
trix-toolbar .trix-button:disabled {
|
||||||
|
color: rgba(0, 0, 0, 0.125); }
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
trix-toolbar .trix-button {
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
padding: 0 0.3em; } }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon {
|
||||||
|
font-size: inherit;
|
||||||
|
width: 2.6em;
|
||||||
|
height: 1.6em;
|
||||||
|
max-width: calc(0.8em + 4vw);
|
||||||
|
text-indent: -9999px; }
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
trix-toolbar .trix-button--icon {
|
||||||
|
height: 2em;
|
||||||
|
max-width: calc(0.8em + 3.5vw); } }
|
||||||
|
trix-toolbar .trix-button--icon::before {
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
opacity: 0.6;
|
||||||
|
content: "";
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: contain; }
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
trix-toolbar .trix-button--icon::before {
|
||||||
|
right: 6%;
|
||||||
|
left: 6%; } }
|
||||||
|
trix-toolbar .trix-button--icon.trix-active::before {
|
||||||
|
opacity: 1; }
|
||||||
|
trix-toolbar .trix-button--icon:disabled::before {
|
||||||
|
opacity: 0.125; }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-attach::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10.5%2018V7.5c0-2.25%203-2.25%203%200V18c0%204.125-6%204.125-6%200V7.5c0-6.375%209-6.375%209%200V18%22%20stroke%3D%22%23000%22%20stroke-width%3D%222%22%20stroke-miterlimit%3D%2210%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");
|
||||||
|
top: 8%;
|
||||||
|
bottom: 4%; }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-bold::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.522%2019.242a.5.5%200%200%201-.5-.5V5.35a.5.5%200%200%201%20.5-.5h5.783c1.347%200%202.46.345%203.24.982.783.64%201.216%201.562%201.216%202.683%200%201.13-.587%202.129-1.476%202.71a.35.35%200%200%200%20.049.613c1.259.56%202.101%201.742%202.101%203.22%200%201.282-.483%202.334-1.363%203.063-.876.726-2.132%201.12-3.66%201.12h-5.89ZM9.27%207.347v3.362h1.97c.766%200%201.347-.17%201.733-.464.38-.291.587-.716.587-1.27%200-.53-.183-.928-.513-1.198-.334-.273-.838-.43-1.505-.43H9.27Zm0%205.606v3.791h2.389c.832%200%201.448-.177%201.853-.497.399-.315.614-.786.614-1.423%200-.62-.22-1.077-.63-1.385-.418-.313-1.053-.486-1.905-.486H9.27Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-italic::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M9%205h6.5v2h-2.23l-2.31%2010H13v2H6v-2h2.461l2.306-10H9V5Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-link::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M18.948%205.258a4.337%204.337%200%200%200-6.108%200L11.217%206.87a.993.993%200%200%200%200%201.41c.392.39%201.027.39%201.418%200l1.623-1.613a2.323%202.323%200%200%201%203.271%200%202.29%202.29%200%200%201%200%203.251l-2.393%202.38a3.021%203.021%200%200%201-4.255%200l-.05-.049a1.007%201.007%200%200%200-1.418%200%20.993.993%200%200%200%200%201.41l.05.049a5.036%205.036%200%200%200%207.091%200l2.394-2.38a4.275%204.275%200%200%200%200-6.072Zm-13.683%2013.6a4.337%204.337%200%200%200%206.108%200l1.262-1.255a.993.993%200%200%200%200-1.41%201.007%201.007%200%200%200-1.418%200L9.954%2017.45a2.323%202.323%200%200%201-3.27%200%202.29%202.29%200%200%201%200-3.251l2.344-2.331a2.579%202.579%200%200%201%203.631%200c.392.39%201.027.39%201.419%200a.993.993%200%200%200%200-1.41%204.593%204.593%200%200%200-6.468%200l-2.345%202.33a4.275%204.275%200%200%200%200%206.072Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-strike::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6%2014.986c.088%202.647%202.246%204.258%205.635%204.258%203.496%200%205.713-1.728%205.713-4.463%200-.275-.02-.536-.062-.781h-3.461c.398.293.573.654.573%201.123%200%201.035-1.074%201.787-2.646%201.787-1.563%200-2.773-.762-2.91-1.924H6ZM6.432%2010h3.763c-.632-.314-.914-.715-.914-1.273%200-1.045.977-1.739%202.432-1.739%201.475%200%202.52.723%202.617%201.914h2.764c-.05-2.548-2.11-4.238-5.39-4.238-3.145%200-5.392%201.719-5.392%204.316%200%20.363.04.703.12%201.02ZM4%2011a1%201%200%201%200%200%202h15a1%201%200%201%200%200-2H4Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-quote::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M4.581%208.471c.44-.5%201.056-.834%201.758-.995C8.074%207.17%209.201%207.822%2010%208.752c1.354%201.578%201.33%203.555.394%205.277-.941%201.731-2.788%203.163-4.988%203.56a.622.622%200%200%201-.653-.317c-.113-.205-.121-.49.16-.764.294-.286.567-.566.791-.835.222-.266.413-.54.524-.815.113-.28.156-.597.026-.908-.128-.303-.39-.524-.72-.69a3.02%203.02%200%200%201-1.674-2.7c0-.905.283-1.59.72-2.088Zm9.419%200c.44-.5%201.055-.834%201.758-.995%201.734-.306%202.862.346%203.66%201.276%201.355%201.578%201.33%203.555.395%205.277-.941%201.731-2.789%203.163-4.988%203.56a.622.622%200%200%201-.653-.317c-.113-.205-.122-.49.16-.764.294-.286.567-.566.791-.835.222-.266.412-.54.523-.815.114-.28.157-.597.026-.908-.127-.303-.39-.524-.72-.69a3.02%203.02%200%200%201-1.672-2.701c0-.905.283-1.59.72-2.088Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-heading-1::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M21.5%207.5v-3h-12v3H14v13h3v-13h4.5ZM9%2013.5h3.5v-3h-10v3H6v7h3v-7Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-code::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.293%2011.293a1%201%200%200%200%200%201.414l4%204a1%201%200%201%200%201.414-1.414L5.414%2012l3.293-3.293a1%201%200%200%200-1.414-1.414l-4%204Zm13.414%205.414%204-4a1%201%200%200%200%200-1.414l-4-4a1%201%200%201%200-1.414%201.414L18.586%2012l-3.293%203.293a1%201%200%200%200%201.414%201.414Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-bullet-list::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M5%207.5a1.5%201.5%200%201%200%200-3%201.5%201.5%200%200%200%200%203ZM8%206a1%201%200%200%201%201-1h11a1%201%200%201%201%200%202H9a1%201%200%200%201-1-1Zm1%205a1%201%200%201%200%200%202h11a1%201%200%201%200%200-2H9Zm0%206a1%201%200%201%200%200%202h11a1%201%200%201%200%200-2H9Zm-2.5-5a1.5%201.5%200%201%201-3%200%201.5%201.5%200%200%201%203%200ZM5%2019.5a1.5%201.5%200%201%200%200-3%201.5%201.5%200%200%200%200%203Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-number-list::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3%204h2v4H4V5H3V4Zm5%202a1%201%200%200%201%201-1h11a1%201%200%201%201%200%202H9a1%201%200%200%201-1-1Zm1%205a1%201%200%201%200%200%202h11a1%201%200%201%200%200-2H9Zm0%206a1%201%200%201%200%200%202h11a1%201%200%201%200%200-2H9Zm-3.5-7H6v1l-1.5%202H6v1H3v-1l1.667-2H3v-1h2.5ZM3%2017v-1h3v4H3v-1h2v-.5H4v-1h1V17H3Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-undo::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3%2014a1%201%200%200%200%201%201h6a1%201%200%201%200%200-2H6.257c2.247-2.764%205.151-3.668%207.579-3.264%202.589.432%204.739%202.356%205.174%205.405a1%201%200%200%200%201.98-.283c-.564-3.95-3.415-6.526-6.825-7.095C11.084%207.25%207.63%208.377%205%2011.39V8a1%201%200%200%200-2%200v6Zm2-1Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-redo::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M21%2014a1%201%200%200%201-1%201h-6a1%201%200%201%201%200-2h3.743c-2.247-2.764-5.151-3.668-7.579-3.264-2.589.432-4.739%202.356-5.174%205.405a1%201%200%200%201-1.98-.283c.564-3.95%203.415-6.526%206.826-7.095%203.08-.513%206.534.614%209.164%203.626V8a1%201%200%201%201%202%200v6Zm-2-1Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-decrease-nesting-level::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M5%206a1%201%200%200%201%201-1h12a1%201%200%201%201%200%202H6a1%201%200%200%201-1-1Zm4%205a1%201%200%201%200%200%202h9a1%201%200%201%200%200-2H9Zm-3%206a1%201%200%201%200%200%202h12a1%201%200%201%200%200-2H6Zm-3.707-5.707a1%201%200%200%200%200%201.414l2%202a1%201%200%201%200%201.414-1.414L4.414%2012l1.293-1.293a1%201%200%200%200-1.414-1.414l-2%202Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--icon-increase-nesting-level::before {
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M5%206a1%201%200%200%201%201-1h12a1%201%200%201%201%200%202H6a1%201%200%200%201-1-1Zm4%205a1%201%200%201%200%200%202h9a1%201%200%201%200%200-2H9Zm-3%206a1%201%200%201%200%200%202h12a1%201%200%201%200%200-2H6Zm-2.293-2.293%202-2a1%201%200%200%200%200-1.414l-2-2a1%201%200%201%200-1.414%201.414L3.586%2012l-1.293%201.293a1%201%200%201%200%201.414%201.414Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); }
|
||||||
|
|
||||||
|
trix-toolbar .trix-dialogs {
|
||||||
|
position: relative; }
|
||||||
|
|
||||||
|
trix-toolbar .trix-dialog {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
font-size: 0.75em;
|
||||||
|
padding: 15px 10px;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 0.3em 1em #ccc;
|
||||||
|
border-top: 2px solid #888;
|
||||||
|
border-radius: 5px;
|
||||||
|
z-index: 5; }
|
||||||
|
|
||||||
|
trix-toolbar .trix-input--dialog {
|
||||||
|
font-size: inherit;
|
||||||
|
font-weight: normal;
|
||||||
|
padding: 0.5em 0.8em;
|
||||||
|
margin: 0 10px 0 0;
|
||||||
|
border-radius: 3px;
|
||||||
|
border: 1px solid #bbb;
|
||||||
|
background-color: #fff;
|
||||||
|
box-shadow: none;
|
||||||
|
outline: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none; }
|
||||||
|
trix-toolbar .trix-input--dialog.validate:invalid {
|
||||||
|
box-shadow: #F00 0px 0px 1.5px 1px; }
|
||||||
|
|
||||||
|
trix-toolbar .trix-button--dialog {
|
||||||
|
font-size: inherit;
|
||||||
|
padding: 0.5em;
|
||||||
|
border-bottom: none; }
|
||||||
|
|
||||||
|
trix-toolbar .trix-dialog--link {
|
||||||
|
max-width: 600px; }
|
||||||
|
|
||||||
|
trix-toolbar .trix-dialog__link-fields {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline; }
|
||||||
|
trix-toolbar .trix-dialog__link-fields .trix-input {
|
||||||
|
flex: 1; }
|
||||||
|
trix-toolbar .trix-dialog__link-fields .trix-button-group {
|
||||||
|
flex: 0 0 content;
|
||||||
|
margin: 0; }
|
||||||
|
|
||||||
|
trix-editor [data-trix-mutable]:not(.attachment__caption-editor) {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none; }
|
||||||
|
|
||||||
|
trix-editor [data-trix-mutable]::-moz-selection,
|
||||||
|
trix-editor [data-trix-cursor-target]::-moz-selection, trix-editor [data-trix-mutable] ::-moz-selection {
|
||||||
|
background: none; }
|
||||||
|
|
||||||
|
trix-editor [data-trix-mutable]::selection,
|
||||||
|
trix-editor [data-trix-cursor-target]::selection, trix-editor [data-trix-mutable] ::selection {
|
||||||
|
background: none; }
|
||||||
|
|
||||||
|
trix-editor .attachment__caption-editor:focus[data-trix-mutable]::-moz-selection {
|
||||||
|
background: highlight; }
|
||||||
|
|
||||||
|
trix-editor .attachment__caption-editor:focus[data-trix-mutable]::selection {
|
||||||
|
background: highlight; }
|
||||||
|
|
||||||
|
trix-editor [data-trix-mutable].attachment.attachment--file {
|
||||||
|
box-shadow: 0 0 0 2px highlight;
|
||||||
|
border-color: transparent; }
|
||||||
|
|
||||||
|
trix-editor [data-trix-mutable].attachment img {
|
||||||
|
box-shadow: 0 0 0 2px highlight; }
|
||||||
|
|
||||||
|
trix-editor .attachment {
|
||||||
|
position: relative; }
|
||||||
|
trix-editor .attachment:hover {
|
||||||
|
cursor: default; }
|
||||||
|
|
||||||
|
trix-editor .attachment--preview .attachment__caption:hover {
|
||||||
|
cursor: text; }
|
||||||
|
|
||||||
|
trix-editor .attachment__progress {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
height: 20px;
|
||||||
|
top: calc(50% - 10px);
|
||||||
|
left: 5%;
|
||||||
|
width: 90%;
|
||||||
|
opacity: 0.9;
|
||||||
|
transition: opacity 200ms ease-in; }
|
||||||
|
trix-editor .attachment__progress[value="100"] {
|
||||||
|
opacity: 0; }
|
||||||
|
|
||||||
|
trix-editor .attachment__caption-editor {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-size: inherit;
|
||||||
|
font-family: inherit;
|
||||||
|
line-height: inherit;
|
||||||
|
color: inherit;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: top;
|
||||||
|
border: none;
|
||||||
|
outline: none;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none; }
|
||||||
|
|
||||||
|
trix-editor .attachment__toolbar {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
top: -0.9em;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center; }
|
||||||
|
|
||||||
|
trix-editor .trix-button-group {
|
||||||
|
display: inline-flex; }
|
||||||
|
|
||||||
|
trix-editor .trix-button {
|
||||||
|
position: relative;
|
||||||
|
float: left;
|
||||||
|
color: #666;
|
||||||
|
white-space: nowrap;
|
||||||
|
font-size: 80%;
|
||||||
|
padding: 0 0.8em;
|
||||||
|
margin: 0;
|
||||||
|
outline: none;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0;
|
||||||
|
background: transparent; }
|
||||||
|
trix-editor .trix-button:not(:first-child) {
|
||||||
|
border-left: 1px solid #ccc; }
|
||||||
|
trix-editor .trix-button.trix-active {
|
||||||
|
background: #cbeefa; }
|
||||||
|
trix-editor .trix-button:not(:disabled) {
|
||||||
|
cursor: pointer; }
|
||||||
|
|
||||||
|
trix-editor .trix-button--remove {
|
||||||
|
text-indent: -9999px;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0;
|
||||||
|
outline: none;
|
||||||
|
width: 1.8em;
|
||||||
|
height: 1.8em;
|
||||||
|
line-height: 1.8em;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 2px solid highlight;
|
||||||
|
box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.25); }
|
||||||
|
trix-editor .trix-button--remove::before {
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
opacity: 0.7;
|
||||||
|
content: "";
|
||||||
|
background-image: url("data:image/svg+xml,%3Csvg%20height%3D%2224%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M19%206.41%2017.59%205%2012%2010.59%206.41%205%205%206.41%2010.59%2012%205%2017.59%206.41%2019%2012%2013.41%2017.59%2019%2019%2017.59%2013.41%2012z%22%2F%3E%3Cpath%20d%3D%22M0%200h24v24H0z%22%20fill%3D%22none%22%2F%3E%3C%2Fsvg%3E");
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 90%; }
|
||||||
|
trix-editor .trix-button--remove:hover {
|
||||||
|
border-color: #333; }
|
||||||
|
trix-editor .trix-button--remove:hover::before {
|
||||||
|
opacity: 1; }
|
||||||
|
|
||||||
|
trix-editor .attachment__metadata-container {
|
||||||
|
position: relative; }
|
||||||
|
|
||||||
|
trix-editor .attachment__metadata {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
top: 2em;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
max-width: 90%;
|
||||||
|
padding: 0.1em 0.6em;
|
||||||
|
font-size: 0.8em;
|
||||||
|
color: #fff;
|
||||||
|
background-color: rgba(0, 0, 0, 0.7);
|
||||||
|
border-radius: 3px; }
|
||||||
|
trix-editor .attachment__metadata .attachment__name {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 100%;
|
||||||
|
vertical-align: bottom;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap; }
|
||||||
|
trix-editor .attachment__metadata .attachment__size {
|
||||||
|
margin-left: 0.2em;
|
||||||
|
white-space: nowrap; }
|
||||||
|
|
||||||
|
.trix-content {
|
||||||
|
line-height: 1.5;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-break: break-word; }
|
||||||
|
.trix-content * {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0; }
|
||||||
|
.trix-content h1 {
|
||||||
|
font-size: 1.2em;
|
||||||
|
line-height: 1.2; }
|
||||||
|
.trix-content blockquote {
|
||||||
|
border: 0 solid #ccc;
|
||||||
|
border-left-width: 0.3em;
|
||||||
|
margin-left: 0.3em;
|
||||||
|
padding-left: 0.6em; }
|
||||||
|
.trix-content [dir=rtl] blockquote,
|
||||||
|
.trix-content blockquote[dir=rtl] {
|
||||||
|
border-width: 0;
|
||||||
|
border-right-width: 0.3em;
|
||||||
|
margin-right: 0.3em;
|
||||||
|
padding-right: 0.6em; }
|
||||||
|
.trix-content li {
|
||||||
|
margin-left: 1em; }
|
||||||
|
.trix-content [dir=rtl] li {
|
||||||
|
margin-right: 1em; }
|
||||||
|
.trix-content pre {
|
||||||
|
display: inline-block;
|
||||||
|
width: 100%;
|
||||||
|
vertical-align: top;
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 0.9em;
|
||||||
|
padding: 0.5em;
|
||||||
|
white-space: pre;
|
||||||
|
background-color: #eee;
|
||||||
|
overflow-x: auto; }
|
||||||
|
.trix-content img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto; }
|
||||||
|
.trix-content .attachment {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
max-width: 100%; }
|
||||||
|
.trix-content .attachment a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none; }
|
||||||
|
.trix-content .attachment a:hover, .trix-content .attachment a:visited:hover {
|
||||||
|
color: inherit; }
|
||||||
|
.trix-content .attachment__caption {
|
||||||
|
text-align: center; }
|
||||||
|
.trix-content .attachment__caption .attachment__name + .attachment__size::before {
|
||||||
|
content: ' \2022 '; }
|
||||||
|
.trix-content .attachment--preview {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center; }
|
||||||
|
.trix-content .attachment--preview .attachment__caption {
|
||||||
|
color: #666;
|
||||||
|
font-size: 0.9em;
|
||||||
|
line-height: 1.2; }
|
||||||
|
.trix-content .attachment--file {
|
||||||
|
color: #333;
|
||||||
|
line-height: 1;
|
||||||
|
margin: 0 2px 2px 2px;
|
||||||
|
padding: 0.4em 1em;
|
||||||
|
border: 1px solid #bbb;
|
||||||
|
border-radius: 5px; }
|
||||||
|
.trix-content .attachment-gallery {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
position: relative; }
|
||||||
|
.trix-content .attachment-gallery .attachment {
|
||||||
|
flex: 1 0 33%;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
max-width: 33%; }
|
||||||
|
.trix-content .attachment-gallery.attachment-gallery--2 .attachment, .trix-content .attachment-gallery.attachment-gallery--4 .attachment {
|
||||||
|
flex-basis: 50%;
|
||||||
|
max-width: 50%; }
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to override trix.css’s image gallery styles to accommodate the
|
||||||
|
* <action-text-attachment> element we wrap around attachments. Otherwise,
|
||||||
|
* images in galleries will be squished by the max-width: 33%; rule.
|
||||||
|
*/
|
||||||
|
.trix-content .attachment-gallery > action-text-attachment,
|
||||||
|
.trix-content .attachment-gallery > .attachment {
|
||||||
|
flex: 1 0 33%;
|
||||||
|
padding: 0 0.5em;
|
||||||
|
max-width: 33%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment,
|
||||||
|
.trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment,
|
||||||
|
.trix-content .attachment-gallery.attachment-gallery--4 > .attachment {
|
||||||
|
flex-basis: 50%;
|
||||||
|
max-width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trix-content action-text-attachment .attachment {
|
||||||
|
padding: 0 !important;
|
||||||
|
max-width: 100% !important;
|
||||||
|
}
|
||||||
|
|
@ -8,3 +8,13 @@
|
||||||
*
|
*
|
||||||
* Consider organizing styles into separate files for maintainability.
|
* Consider organizing styles into separate files for maintainability.
|
||||||
*/
|
*/
|
||||||
|
@import "font-awesome";
|
||||||
|
|
||||||
|
#flash-message {
|
||||||
|
position: fixed;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
padding: 12px 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
.alert {
|
||||||
|
position: fixed;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
z-index: 1050;
|
||||||
|
min-width: 300px;
|
||||||
|
padding: 15px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
transition: opacity 0.3s ease-in-out;
|
||||||
|
|
||||||
|
&.alert-success {
|
||||||
|
background: rgba(40, 167, 69, 0.95);
|
||||||
|
border-color: #28a745;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.alert-danger {
|
||||||
|
background: rgba(220, 53, 69, 0.95);
|
||||||
|
border-color: #dc3545;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
.alert {
|
||||||
|
position: fixed;
|
||||||
|
top: 20px;
|
||||||
|
right: 20px;
|
||||||
|
z-index: 1050;
|
||||||
|
min-width: 300px;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||||
|
transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateX(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert.fade-out {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateX(100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-success {
|
||||||
|
background: rgba(40, 167, 69, 0.95);
|
||||||
|
border: 1px solid #28a745;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-danger {
|
||||||
|
background: rgba(220, 53, 69, 0.95);
|
||||||
|
border: 1px solid #dc3545;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
||||||
|
before_action :authenticate_user!
|
||||||
|
|
||||||
allow_browser versions: :modern
|
allow_browser versions: :modern
|
||||||
before_action :set_assets_url
|
before_action :set_assets_url
|
||||||
def set_assets_url
|
def set_assets_url
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,8 @@ class ExpensesController < ApplicationController
|
||||||
|
|
||||||
# GET /expenses/1 or /expenses/1.json
|
# GET /expenses/1 or /expenses/1.json
|
||||||
def show
|
def show
|
||||||
@expense = Expense.find(params[:id])
|
@expense = Expense.find_by(id: params[:id])
|
||||||
|
redirect_to expenses_path, alert: "Expense not found" unless @expense
|
||||||
|
|
||||||
# Totals
|
# Totals
|
||||||
@total_expenses = Expense.sum(:amount)
|
@total_expenses = Expense.sum(:amount)
|
||||||
|
|
@ -97,7 +98,10 @@ class ExpensesController < ApplicationController
|
||||||
private
|
private
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_expense
|
def set_expense
|
||||||
@expense = Expense.find(params[:id])
|
@expense = Expense.find_by(id: params[:id])
|
||||||
|
unless @expense
|
||||||
|
redirect_to expenses_path, alert: "Expense not found"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Only allow a list of trusted parameters through.
|
# Only allow a list of trusted parameters through.
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,10 @@ class InstitutionsController < ApplicationController
|
||||||
@weekly_expense_items = Expense.where(created_at: Time.current.all_week)
|
@weekly_expense_items = Expense.where(created_at: Time.current.all_week)
|
||||||
@monthly_expense_items = Expense.where(created_at: Time.current.all_month)
|
@monthly_expense_items = Expense.where(created_at: Time.current.all_month)
|
||||||
|
|
||||||
|
# Financial Summary
|
||||||
|
@total_income = Income.sum(:amount)
|
||||||
|
@total_expense = Expense.sum(:amount)
|
||||||
|
@profit = Finance.profit
|
||||||
# index is a collection action — do not attempt to load a single institution here
|
# index is a collection action — do not attempt to load a single institution here
|
||||||
@students = Student.all
|
@students = Student.all
|
||||||
|
|
||||||
|
|
@ -48,6 +51,8 @@ class InstitutionsController < ApplicationController
|
||||||
|
|
||||||
# GET /institutions/1 or /institutions/1.json
|
# GET /institutions/1 or /institutions/1.json
|
||||||
def show
|
def show
|
||||||
|
@institution = Institution.find(params[:id])
|
||||||
|
@students = @institution.students
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /institutions/contact
|
# GET /institutions/contact
|
||||||
|
|
@ -78,6 +83,7 @@ class InstitutionsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# PATCH/PUT /institutions/1 or /institutions/1.json
|
# PATCH/PUT /institutions/1 or /institutions/1.json
|
||||||
def update
|
def update
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
class LayoutsController < ApplicationController
|
||||||
|
def index
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -3,8 +3,8 @@ class StudentsController < ApplicationController
|
||||||
before_action :set_institution
|
before_action :set_institution
|
||||||
# set_student will safely find a student either scoped to @institution or globally
|
# set_student will safely find a student either scoped to @institution or globally
|
||||||
before_action :set_student, only: %i[ show edit update destroy ]
|
before_action :set_student, only: %i[ show edit update destroy ]
|
||||||
# ensure nested behaviour for index/new/create (these expect an institution)
|
# ensure nested behaviour for new/create (these expect an institution). Allow index to show all students.
|
||||||
before_action :ensure_institution_for_nested_actions, only: %i[index new create]
|
before_action :ensure_institution_for_nested_actions, only: %i[new create]
|
||||||
|
|
||||||
# GET /students or /students.json
|
# GET /students or /students.json
|
||||||
def index
|
def index
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
module CartItemsHelper
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
module CartsHelper
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
module ProductsHelper
|
||||||
|
end
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
||||||
import "@hotwired/turbo-rails"
|
import "@hotwired/turbo-rails"
|
||||||
|
import * as bootstrap from "bootstrap"
|
||||||
import "controllers"
|
import "controllers"
|
||||||
|
import "flash_messages"
|
||||||
|
|
||||||
|
import "trix"
|
||||||
|
import "@rails/actiontext"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
import { Application } from "@hotwired/stimulus"
|
import { Application } from "@hotwired/stimulus"
|
||||||
|
import DropdownController from "./dropdown_controller"
|
||||||
|
import HelloController from "./hello_controller"
|
||||||
|
import { definitionsFromContext } from "@hotwired/stimulus-loading"
|
||||||
|
|
||||||
const application = Application.start()
|
const application = Application.start()
|
||||||
|
const context = require.context("./", true, /\.js$/)
|
||||||
|
application.load(definitionsFromContext(context))
|
||||||
|
|
||||||
|
// Register custom controllers
|
||||||
|
application.register("dropdown", DropdownController)
|
||||||
|
application.register("hello", HelloController)
|
||||||
|
|
||||||
// Configure Stimulus development experience
|
// Configure Stimulus development experience
|
||||||
application.debug = false
|
application.debug = false
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
import { Controller } from "@hotwired/stimulus"
|
||||||
|
import { Dropdown } from "bootstrap"
|
||||||
|
|
||||||
|
export default class extends Controller {
|
||||||
|
connect() {
|
||||||
|
// Initialize all dropdowns on the page
|
||||||
|
const dropdownElementList = [].slice.call(document.querySelectorAll('.dropdown-toggle'))
|
||||||
|
dropdownElementList.map(function (dropdownToggleEl) {
|
||||||
|
return new Dropdown(dropdownToggleEl)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { Controller } from "@hotwired/stimulus"
|
||||||
|
|
||||||
|
export default class extends Controller {
|
||||||
|
connect() {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (this.element) {
|
||||||
|
this.element.style.opacity = '0'
|
||||||
|
setTimeout(() => {
|
||||||
|
this.element.remove()
|
||||||
|
}, 300) // Remove after fade animation
|
||||||
|
}
|
||||||
|
}, 3000) // Start fading after 3 seconds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
document.addEventListener('turbo:load', function() {
|
||||||
|
// Initialize all dropdowns
|
||||||
|
var dropdownElementList = [].slice.call(document.querySelectorAll('.dropdown-toggle'))
|
||||||
|
var dropdownList = dropdownElementList.map(function (dropdownToggleEl) {
|
||||||
|
return new bootstrap.Dropdown(dropdownToggleEl)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
document.addEventListener('turbo:load', () => {
|
||||||
|
const flashMessages = document.querySelectorAll('.alert');
|
||||||
|
flashMessages.forEach(flash => {
|
||||||
|
// Add fade-out class after 3 seconds
|
||||||
|
setTimeout(() => {
|
||||||
|
flash.classList.add('fade-out');
|
||||||
|
// Remove element after animation completes
|
||||||
|
setTimeout(() => {
|
||||||
|
flash.remove();
|
||||||
|
}, 500); // matches the CSS transition duration
|
||||||
|
}, 3000);
|
||||||
|
|
||||||
|
// Optional: Allow clicking to dismiss
|
||||||
|
flash.addEventListener('click', () => {
|
||||||
|
flash.classList.add('fade-out');
|
||||||
|
setTimeout(() => {
|
||||||
|
flash.remove();
|
||||||
|
}, 500);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
import "rails_admin/src/rails_admin/base";
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
class Admin < ApplicationRecord
|
||||||
|
# Include default devise modules. Others available are:
|
||||||
|
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||||
|
devise :database_authenticatable, :registerable,
|
||||||
|
:recoverable, :rememberable, :validatable
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
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,6 @@
|
||||||
|
|
||||||
|
class Finance
|
||||||
|
def self.profit
|
||||||
|
Income.sum(:amount) - Expense.sum(:amount)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
class Student < ApplicationRecord
|
class Student < ApplicationRecord
|
||||||
belongs_to :institution
|
belongs_to :institution
|
||||||
has_one_attached :photo
|
has_one_attached :photo
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
class User < ApplicationRecord
|
||||||
|
# Include default devise modules. Others available are:
|
||||||
|
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||||
|
devise :database_authenticatable, :registerable,
|
||||||
|
:recoverable, :rememberable, :validatable
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
|
||||||
|
<% if blob.representable? %>
|
||||||
|
<%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<figcaption class="attachment__caption">
|
||||||
|
<% if caption = blob.try(:caption) %>
|
||||||
|
<%= caption %>
|
||||||
|
<% else %>
|
||||||
|
<span class="attachment__name"><%= blob.filename %></span>
|
||||||
|
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
|
||||||
|
<% end %>
|
||||||
|
</figcaption>
|
||||||
|
</figure>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<h2>Resend confirmation instructions</h2>
|
||||||
|
|
||||||
|
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
||||||
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :email %><br />
|
||||||
|
<%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit "Resend confirmation instructions" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render "devise/shared/links" %>
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
<p>Welcome <%= @email %>!</p>
|
||||||
|
|
||||||
|
<p>You can confirm your account email through the link below:</p>
|
||||||
|
|
||||||
|
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<p>Hello <%= @email %>!</p>
|
||||||
|
|
||||||
|
<% if @resource.try(:unconfirmed_email?) %>
|
||||||
|
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
|
||||||
|
<% else %>
|
||||||
|
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<p>Hello <%= @resource.email %>!</p>
|
||||||
|
|
||||||
|
<p>We're contacting you to notify you that your password has been changed.</p>
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<p>Hello <%= @resource.email %>!</p>
|
||||||
|
|
||||||
|
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
||||||
|
|
||||||
|
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
|
||||||
|
|
||||||
|
<p>If you didn't request this, please ignore this email.</p>
|
||||||
|
<p>Your password won't change until you access the link above and create a new one.</p>
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<p>Hello <%= @resource.email %>!</p>
|
||||||
|
|
||||||
|
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
||||||
|
|
||||||
|
<p>Click the link below to unlock your account:</p>
|
||||||
|
|
||||||
|
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<h2>Change your password</h2>
|
||||||
|
|
||||||
|
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
||||||
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
<%= f.hidden_field :reset_password_token %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :password, "New password" %><br />
|
||||||
|
<% if @minimum_password_length %>
|
||||||
|
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
||||||
|
<% end %>
|
||||||
|
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
||||||
|
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit "Change my password" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render "devise/shared/links" %>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<h2>Forgot your password?</h2>
|
||||||
|
|
||||||
|
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
||||||
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :email %><br />
|
||||||
|
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit "Send me reset password instructions" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render "devise/shared/links" %>
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
||||||
|
|
||||||
|
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
||||||
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :email %><br />
|
||||||
|
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
||||||
|
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
||||||
|
<%= f.password_field :password, autocomplete: "new-password" %>
|
||||||
|
<% if @minimum_password_length %>
|
||||||
|
<br />
|
||||||
|
<em><%= @minimum_password_length %> characters minimum</em>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :password_confirmation %><br />
|
||||||
|
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
||||||
|
<%= f.password_field :current_password, autocomplete: "current-password" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit "Update" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<h3>Cancel my account</h3>
|
||||||
|
|
||||||
|
<div>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete %></div>
|
||||||
|
|
||||||
|
<%= link_to "Back", :back %>
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
<h2>Sign up</h2>
|
||||||
|
|
||||||
|
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||||
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :email %><br />
|
||||||
|
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :password %>
|
||||||
|
<% if @minimum_password_length %>
|
||||||
|
<em>(<%= @minimum_password_length %> characters minimum)</em>
|
||||||
|
<% end %><br />
|
||||||
|
<%= f.password_field :password, autocomplete: "new-password" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :password_confirmation %><br />
|
||||||
|
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit "Sign up" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render "devise/shared/links" %>
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
<h2>Log in</h2>
|
||||||
|
|
||||||
|
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :email %><br />
|
||||||
|
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :password %><br />
|
||||||
|
<%= f.password_field :password, autocomplete: "current-password" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if devise_mapping.rememberable? %>
|
||||||
|
<div class="field">
|
||||||
|
<%= f.check_box :remember_me %>
|
||||||
|
<%= f.label :remember_me %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit "Log in" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render "devise/shared/links" %>
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<% if resource.errors.any? %>
|
||||||
|
<div id="error_explanation" data-turbo-cache="false">
|
||||||
|
<h2>
|
||||||
|
<%= I18n.t("errors.messages.not_saved",
|
||||||
|
count: resource.errors.count,
|
||||||
|
resource: resource.class.model_name.human.downcase)
|
||||||
|
%>
|
||||||
|
</h2>
|
||||||
|
<ul>
|
||||||
|
<% resource.errors.full_messages.each do |message| %>
|
||||||
|
<li><%= message %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<%- if controller_name != 'sessions' %>
|
||||||
|
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
||||||
|
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||||
|
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||||
|
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||||
|
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%- if devise_mapping.omniauthable? %>
|
||||||
|
<%- resource_class.omniauth_providers.each do |provider| %>
|
||||||
|
<%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false } %><br />
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
<h2>Resend unlock instructions</h2>
|
||||||
|
|
||||||
|
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
||||||
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<%= f.label :email %><br />
|
||||||
|
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<%= f.submit "Resend unlock instructions" %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= render "devise/shared/links" %>
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<em>No PDF file uploaded.</em>
|
<em>No PDF file uploaded.</em>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<iframe src="<%= url_for(exclusive_traditional_record.pdf_file) %>" width="100%" height="600px"></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@
|
||||||
|
|
||||||
<!-- Today's table -->
|
<!-- Today's table -->
|
||||||
<section>
|
<section>
|
||||||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#374151;">Today's Expenses</h3>
|
<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" aria-describedby="today-expenses">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Amount</th><th>Date</th></tr>
|
<tr><th>Amount</th><th>Date</th></tr>
|
||||||
|
|
@ -180,7 +180,7 @@
|
||||||
|
|
||||||
<!-- Week table -->
|
<!-- Week table -->
|
||||||
<section>
|
<section>
|
||||||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#374151;">This Week's Expenses</h3>
|
<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" aria-describedby="week-expenses">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Amount</th><th>Date</th></tr>
|
<tr><th>Amount</th><th>Date</th></tr>
|
||||||
|
|
@ -204,7 +204,7 @@
|
||||||
|
|
||||||
<!-- Month table -->
|
<!-- Month table -->
|
||||||
<section>
|
<section>
|
||||||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#374151;">This Month's Expenses</h3>
|
<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" aria-describedby="month-expenses">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Amount</th><th>Date</th></tr>
|
<tr><th>Amount</th><th>Date</th></tr>
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@
|
||||||
|
|
||||||
<!-- Today's table -->
|
<!-- Today's table -->
|
||||||
<section>
|
<section>
|
||||||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#374151;">Today's Income</h3>
|
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#fff;">Today's Income</h3>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Amount</th><th>Date</th></tr>
|
<tr><th>Amount</th><th>Date</th></tr>
|
||||||
|
|
@ -178,7 +178,7 @@
|
||||||
|
|
||||||
<!-- Week table -->
|
<!-- Week table -->
|
||||||
<section>
|
<section>
|
||||||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#374151;">This Week's Income</h3>
|
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#fff;">This Week's Income</h3>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Amount</th><th>Date</th></tr>
|
<tr><th>Amount</th><th>Date</th></tr>
|
||||||
|
|
@ -202,7 +202,7 @@
|
||||||
|
|
||||||
<!-- Month table -->
|
<!-- Month table -->
|
||||||
<section>
|
<section>
|
||||||
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#374151;">This Month's Income</h3>
|
<h3 style="margin:0 0 8px 0; font-size:1rem; color:#fff;">This Month's Income</h3>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Amount</th><th>Date</th></tr>
|
<tr><th>Amount</th><th>Date</th></tr>
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<%= form.label :institution_type, style: "display: block" %>
|
<%= form.label :manager_name, style: "display: block" %>
|
||||||
<%= form.text_field :institution_type %>
|
<%= form.text_field :manager_name %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ html, body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: "Poppins", sans-serif;
|
font-family: "Poppins", sans-serif;
|
||||||
/* Dark gradient background */
|
background: linear-gradient(135deg, #0f1724, #1e293b);
|
||||||
background: linear-gradient(135deg, #0f1724, #1e293b); /* deep navy/charcoal */
|
|
||||||
color: #e6eef6;
|
color: #e6eef6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -14,7 +13,6 @@ html, body {
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-start;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
|
|
@ -27,18 +25,17 @@ html, body {
|
||||||
/* ---------------- Header ---------------- */
|
/* ---------------- Header ---------------- */
|
||||||
.page-header {
|
.page-header {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-header h1 {
|
.page-header h1 {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 3rem;
|
font-size: 2.9rem;
|
||||||
background: linear-gradient(90deg, #1e88e5, #43a047, #1e88e5);
|
background: linear-gradient(90deg, #1e88e5, #43a047, #fdd835, #fb8c00, #e53935);
|
||||||
background-size: 200% auto;
|
background-size: 200% auto;
|
||||||
-webkit-background-clip: text;
|
-webkit-background-clip: text;
|
||||||
-webkit-text-fill-color: transparent;
|
-webkit-text-fill-color: transparent;
|
||||||
animation: gradient-move 3s linear infinite;
|
animation: gradient-move 3s linear infinite;
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes gradient-move {
|
@keyframes gradient-move {
|
||||||
|
|
@ -47,156 +44,194 @@ html, body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo-img {
|
.logo-img {
|
||||||
width: 100px;
|
width: 120px;
|
||||||
height: 100px;
|
height: 120px;
|
||||||
object-fit: cover;
|
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
box-shadow: 0 4px 10px rgba(0,0,0,0.15);
|
box-shadow: 0 6px 16px rgba(0,0,0,0.3);
|
||||||
margin-bottom: 10px;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider {
|
.divider {
|
||||||
width: 80px;
|
width: 100px;
|
||||||
height: 4px;
|
height: 4px;
|
||||||
background: linear-gradient(to right, #1e88e5, #43a047);
|
background: linear-gradient(to right, #1e88e5, #43a047);
|
||||||
margin: 15px auto;
|
margin: 15px auto;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------- Stats Cards ---------------- */
|
/* ---------------- Stats Row ---------------- */
|
||||||
.stats-row {
|
.stats-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 12px;
|
gap: 15px;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-card {
|
.stat-card {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
width: 140px; /* compact cards */
|
width: 140px;
|
||||||
margin: 6px;
|
|
||||||
padding: 12px 16px;
|
padding: 12px 16px;
|
||||||
background: rgba(255,255,255,0.03);
|
background: rgba(255,255,255,0.05);
|
||||||
border: 1px solid rgba(255,255,255,0.06);
|
border-radius: 15px;
|
||||||
border-radius: 12px;
|
|
||||||
box-shadow: 0 6px 18px rgba(2,6,23,0.6);
|
|
||||||
transition: transform 0.18s ease, box-shadow 0.18s ease;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
box-shadow: 0 6px 20px rgba(0,0,0,0.3);
|
||||||
|
transition: 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-card:hover {
|
.stat-card:hover {
|
||||||
transform: translateY(-3px);
|
transform: translateY(-4px);
|
||||||
box-shadow: 0 10px 22px rgba(2,6,23,0.7);
|
box-shadow: 0 10px 25px rgba(0,0,0,0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-label {
|
.stat-label {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: rgba(230,238,246,0.8);
|
font-size: 0.85rem;
|
||||||
margin-bottom: 6px;
|
color: #cfd8dc;
|
||||||
font-size: 0.8rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-value {
|
.stat-value {
|
||||||
font-size: 1.4rem; /* smaller count */
|
font-size: 1.5rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #7dd3fc; /* soft cyan */
|
color: #7dd3fc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------- Glass Cards ---------------- */
|
/* ---------------- Glass Cards ---------------- */
|
||||||
.glass-card {
|
.glass-card {
|
||||||
background: rgba(255,255,255,0.9);
|
background: rgba(255,255,255,0.1);
|
||||||
backdrop-filter: blur(12px);
|
backdrop-filter: blur(12px);
|
||||||
|
-webkit-backdrop-filter: blur(12px);
|
||||||
border-radius: 18px;
|
border-radius: 18px;
|
||||||
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
|
|
||||||
padding: 25px;
|
padding: 25px;
|
||||||
transition: 0.3s ease;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
transition: 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.glass-card:hover {
|
.glass-card:hover {
|
||||||
transform: translateY(-3px);
|
transform: translateY(-5px);
|
||||||
box-shadow: 0 12px 30px rgba(0,0,0,0.15);
|
box-shadow: 0 12px 40px rgba(0,0,0,0.25);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------- Section Titles ---------------- */
|
/* ---------------- Section Titles ---------------- */
|
||||||
.section-title {
|
.section-title {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
font-size: 1.5rem;
|
font-size: 1.4rem;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------- Item Cards ---------------- */
|
/* ---------------- Item Cards ---------------- */
|
||||||
.item-card {
|
.item-card {
|
||||||
border-radius: 15px;
|
border-radius: 12px;
|
||||||
background: #ffffff;
|
background: rgba(255,255,255,0.95);
|
||||||
border: 1px solid #e0e0e0;
|
border: 1px solid rgba(0,0,0,0.1);
|
||||||
padding: 15px;
|
padding: 12px 15px;
|
||||||
|
margin-bottom: 10px;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-card:hover {
|
.item-card:hover {
|
||||||
transform: scale(1.03);
|
transform: scale(1.03);
|
||||||
background: #f9f9f9;
|
box-shadow: 0 6px 20px rgba(0,0,0,0.15);
|
||||||
box-shadow: 0 8px 20px rgba(0,0,0,0.1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-title {
|
.item-title {
|
||||||
font-size: 1.1rem;
|
font-size: 1.05rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #0d47a1;
|
color: #1e88e5;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-desc {
|
.item-desc {
|
||||||
font-size: 0.95rem;
|
font-size: 0.9rem;
|
||||||
color: #37474f;
|
color: #37474f;
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-footer {
|
.item-footer {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------- Buttons ---------------- */
|
/* ---------------- Buttons ---------------- */
|
||||||
.btn-custom {
|
.btn-custom {
|
||||||
border-radius: 25px;
|
padding: 10px 18px;
|
||||||
|
border-radius: 12px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
padding: 7px 18px;
|
|
||||||
transition: 0.3s ease;
|
transition: 0.3s ease;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-primary-custom { background-color: #1e88e5; color: #fff; }
|
.btn-primary-custom { background: #1e88e5; color: #fff; }
|
||||||
.btn-primary-custom:hover { background-color: #1565c0; }
|
.btn-primary-custom:hover { background: #1565c0; transform: translateY(-2px); }
|
||||||
|
|
||||||
.btn-success-custom { background-color: #43a047; color: #fff; }
|
.btn-success-custom { background: #43a047; color: #fff; }
|
||||||
.btn-success-custom:hover { background-color: #2e7d32; }
|
.btn-success-custom:hover { background: #2e7d32; transform: translateY(-2px); }
|
||||||
|
|
||||||
/* ---------------- Ziyara Section ---------------- */
|
/* ---------------- Expense & Income Cards ---------------- */
|
||||||
.ziyara-card {
|
.expense-card, .income-card {
|
||||||
border-top: 5px solid #fbc02d;
|
background: rgba(255,255,255,0.1);
|
||||||
background: rgba(255,255,240,0.95);
|
backdrop-filter: blur(12px);
|
||||||
|
border-radius: 18px;
|
||||||
|
padding: 25px;
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ziyara-title {
|
.expense-card:hover, .income-card:hover {
|
||||||
background: linear-gradient(90deg, #fdd835, #fbc02d, #f57f17);
|
transform: translateY(-5px);
|
||||||
-webkit-background-clip: text;
|
box-shadow: 0 12px 40px rgba(0,0,0,0.25);
|
||||||
-webkit-text-fill-color: transparent;
|
}
|
||||||
animation: gradient-move 4s linear infinite;
|
|
||||||
|
.expense-card h1, .income-card h1 {
|
||||||
|
font-size: 1.6rem;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expense-card .btn, .income-card .btn {
|
||||||
|
width: 80%;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 10px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------- Responsive ---------------- */
|
/* ---------------- Responsive ---------------- */
|
||||||
@media (max-width: 992px) {
|
@media (max-width: 992px) {
|
||||||
.stats-row { flex-direction: column; align-items: center; }
|
.stats-row { flex-direction: column; align-items: center; }
|
||||||
|
.row.g-4 { flex-direction: column; }
|
||||||
|
.col-lg-6, .col-lg-5 { max-width: 95%; margin: 0 auto; }
|
||||||
}
|
}
|
||||||
|
.finance-card {
|
||||||
|
background: rgba(255,255,255,0.08);
|
||||||
|
backdrop-filter: blur(14px);
|
||||||
|
-webkit-backdrop-filter: blur(14px);
|
||||||
|
border-radius: 20px;
|
||||||
|
border: 1px solid rgba(255,255,255,0.2);
|
||||||
|
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
||||||
|
padding: 30px;
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.finance-card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 15px 40px rgba(0,0,0,0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-value {
|
||||||
|
font-size: 1.6rem;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #facc15; /* golden color for finance numbers */
|
||||||
|
margin: 10px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="page-wrapper">
|
<div class="page-wrapper">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="page-header d-flex flex-column align-items-center">
|
<div class="page-header d-flex flex-column align-items-center">
|
||||||
<%= image_tag("unnamed.jpg", alt: "Logo", class: "logo-img") %>
|
<%= image_tag("unnamed.jpg", alt: "Logo", class: "logo-img") %>
|
||||||
|
|
@ -207,7 +242,7 @@ html, body {
|
||||||
<!-- Stats Row -->
|
<!-- Stats Row -->
|
||||||
<div class="stats-row">
|
<div class="stats-row">
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-label">INSTITUTION</div>
|
<div class="stat-label">INSTITUTIONS</div>
|
||||||
<div class="stat-value"><%= @institution_count || 0 %></div>
|
<div class="stat-value"><%= @institution_count || 0 %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
|
|
@ -219,7 +254,7 @@ html, body {
|
||||||
<div class="stat-value"><%= @student_count || 0 %></div>
|
<div class="stat-value"><%= @student_count || 0 %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
<div class="stat-label">ZIYARA</div>
|
<div class="stat-label">ZIYARAS</div>
|
||||||
<div class="stat-value"><%= @ziyara_count || 0 %></div>
|
<div class="stat-value"><%= @ziyara_count || 0 %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="stat-card">
|
<div class="stat-card">
|
||||||
|
|
@ -228,292 +263,153 @@ html, body {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Two-column sections -->
|
||||||
|
|
||||||
<!-- Two Column Sections -->
|
|
||||||
<div class="row g-4">
|
<div class="row g-4">
|
||||||
|
|
||||||
<!-- Institutions -->
|
<!-- Institutions -->
|
||||||
<div class="col-lg-6 d-flex">
|
<div class="col-lg-6 d-flex justify-content-center">
|
||||||
<div class="glass-card">
|
<div class="glass-card p-4 w-100">
|
||||||
<h3 class="section-title text-primary">🏫 Institutions</h3>
|
<h3 class="section-title text-primary mb-3">🏫 Institutions</h3>
|
||||||
<% if @institutions.present? %>
|
<% if @institutions.present? %>
|
||||||
<div class="row g-3">
|
<div class="mb-4">
|
||||||
|
<label for="institution_select" class="form-label fw-bold">Select Institution</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| %>
|
<% @institutions.each do |institution| %>
|
||||||
<div class="col-12">
|
<option value="<%= institution.id %>"><%= institution.name %></option>
|
||||||
<div class="item-card">
|
|
||||||
<div class="item-title"><%= institution.name %></div>
|
|
||||||
<% if institution.respond_to?(:description) %>
|
|
||||||
<p class="item-desc"><%= institution.description.truncate(100) %></p>
|
|
||||||
<% end %>
|
|
||||||
<div class="item-footer d-flex justify-content-end gap-2">
|
|
||||||
<%= link_to "Students", institution_students_path(institution), class: "btn btn-success-custom btn-sm btn-custom" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="item-desc text-center">No institutions added yet.</p>
|
<p class="item-desc text-center text-muted">No institutions added yet.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="text-center mt-3">
|
<div class="text-center mt-3">
|
||||||
<%= link_to "➕ New Institution", new_institution_path, class: "btn btn-success-custom btn-custom me-2" %>
|
<%= link_to "➕ New Institution", new_institution_path, class: "btn btn-success-custom me-2" %>
|
||||||
<%= link_to "📚 All Students", students_path, class: "btn btn-primary-custom btn-custom" %>
|
<%= link_to "📚 All Students", students_path, class: "btn btn-primary-custom" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Programs -->
|
<!-- Programs -->
|
||||||
<div class="col-lg-6 d-flex">
|
<div class="col-lg-6 d-flex justify-content-center">
|
||||||
<div class="glass-card">
|
<div class="glass-card p-4 w-100">
|
||||||
<h3 class="section-title text-success">🎓 Programs</h3>
|
<h3 class="section-title text-success mb-3">🎓 Programs</h3>
|
||||||
<% if @programs.present? %>
|
<% if @programs.present? %>
|
||||||
<div class="row g-3">
|
<div class="mb-4">
|
||||||
|
<label for="program_select" class="form-label fw-bold">Select Program</label>
|
||||||
|
<select id="program_select" class="form-select" onchange="if(this.value){ window.location = '/programs/' + this.value }">
|
||||||
|
<option value="">-- Choose a program --</option>
|
||||||
<% @programs.each do |program| %>
|
<% @programs.each do |program| %>
|
||||||
<div class="col-12">
|
<option value="<%= program.id %>"><%= program.name %></option>
|
||||||
<div class="item-card">
|
|
||||||
<div class="item-title"><%= program.name %></div>
|
|
||||||
<% if program.respond_to?(:date) %>
|
|
||||||
<p class="item-desc"><strong>Date:</strong> <%= program.date %></p>
|
|
||||||
<% end %>
|
|
||||||
<% if program.respond_to?(:leadingPerson) %>
|
|
||||||
<p class="item-desc"><strong>Lead:</strong> <%= program.leadingPerson %></p>
|
|
||||||
<% end %>
|
|
||||||
<div class="item-footer">
|
|
||||||
<%= link_to "View", program, class: "btn btn-success-custom btn-sm btn-custom" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="item-desc text-center">No programs available yet.</p>
|
<p class="item-desc text-center text-muted">No programs available yet.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="text-center mt-3">
|
<div class="text-center mt-3">
|
||||||
<%= link_to "➕ New Program", new_program_path, class: "btn btn-success-custom btn-custom" %>
|
<%= link_to "➕ New Program", new_program_path, class: "btn btn-success-custom me-2" %>
|
||||||
|
<%= link_to "📚 All Programs", programs_path, class: "btn btn-primary-custom" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Ziyara & Exclusive Traditional Records Side-by-side -->
|
<!-- Ziyara & Traditional Records -->
|
||||||
<div class="row mt-4 g-4 justify-content-center">
|
<div class="row g-4 mt-4 justify-content-center">
|
||||||
<div class="col-lg-5 d-flex">
|
|
||||||
<div class="glass-card ziyara-card w-100">
|
<!-- Ziyara -->
|
||||||
<h3 class="section-title ziyara-title">🕌 Ziyara</h3>
|
<div class="col-lg-5 d-flex justify-content-center">
|
||||||
|
<div class="glass-card p-4 w-100">
|
||||||
|
<h3 class="section-title text-primary mb-3">🕌 Ziyara</h3>
|
||||||
<% if @ziyaras.present? %>
|
<% if @ziyaras.present? %>
|
||||||
<div class="row g-3">
|
<div class="mb-4">
|
||||||
|
<label for="ziyara_select" class="form-label fw-bold">Select Ziyara</label>
|
||||||
|
<select id="ziyara_select" class="form-select" onchange="if(this.value){ window.location = '/ziyaras/' + this.value }">
|
||||||
|
<option value="">-- Choose a Ziyara --</option>
|
||||||
<% @ziyaras.each do |ziyara| %>
|
<% @ziyaras.each do |ziyara| %>
|
||||||
<div class="col-12">
|
<option value="<%= ziyara.id %>"><%= ziyara.name %></option>
|
||||||
<div class="item-card">
|
|
||||||
<div class="item-title"><%= ziyara.name %></div>
|
|
||||||
<% if ziyara.respond_to?(:location) %>
|
|
||||||
<p class="item-desc"><strong>📍 Location:</strong> <%= ziyara.location %></p>
|
|
||||||
<% end %>
|
|
||||||
<% if ziyara.respond_to?(:date) %>
|
|
||||||
<p class="item-desc"><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 %>
|
<% end %>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="item-desc text-center">No Ziyara records yet.</p>
|
<p class="item-desc text-center text-muted">No Ziyara records yet.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="text-center mt-3">
|
<div class="text-center mt-3">
|
||||||
<%= link_to "➕ New Ziyara", new_ziyara_path, class: "btn btn-success-custom btn-custom" %>
|
<%= link_to "➕ New Ziyara", new_ziyara_path, class: "btn btn-success-custom me-2" %>
|
||||||
|
<%= link_to "📚 All Ziyara", ziyaras_path, class: "btn btn-primary-custom" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-lg-5 d-flex">
|
<!-- Exclusive Traditional Records -->
|
||||||
<div class="glass-card w-100">
|
<div class="col-lg-5 d-flex justify-content-center">
|
||||||
<h3 class="section-title text-secondary">📜 Exclusive Traditional Records</h3>
|
<div class="glass-card p-4 w-100">
|
||||||
|
<h3 class="section-title text-secondary mb-3">📜 Exclusive Traditional Records</h3>
|
||||||
<% if @exclusive_traditional_records.present? %>
|
<% if @exclusive_traditional_records.present? %>
|
||||||
<div class="row g-3">
|
<div class="mb-4">
|
||||||
|
<label for="record_select" class="form-label fw-bold">Select Record</label>
|
||||||
|
<select id="record_select" class="form-select" onchange="if(this.value){ window.location = '/exclusive_traditional_records/' + this.value }">
|
||||||
|
<option value="">-- Choose a Record --</option>
|
||||||
<% @exclusive_traditional_records.each do |record| %>
|
<% @exclusive_traditional_records.each do |record| %>
|
||||||
<div class="col-12">
|
<option value="<%= record.id %>"><%= record.name if record.respond_to?(:name) %></option>
|
||||||
<div class="item-card">
|
|
||||||
<div class="item-title"><%= record.name if record.respond_to?(:name) %></div>
|
|
||||||
<% if record.respond_to?(:description) %>
|
|
||||||
<p class="item-desc"><%= record.description.truncate(100) %></p>
|
|
||||||
<% end %>
|
|
||||||
<div class="item-footer">
|
|
||||||
<%= link_to "View", record, class: "btn btn-primary-custom btn-sm btn-custom" %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p class="item-desc text-center">No exclusive traditional records yet.</p>
|
<p class="item-desc text-center text-muted">No exclusive traditional records yet.</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="text-center mt-3">
|
<div class="text-center mt-3">
|
||||||
<%= link_to "➕ New Record", new_exclusive_traditional_record_path, class: "btn btn-success-custom btn-custom" %>
|
<%= link_to "➕ New Record", new_exclusive_traditional_record_path, class: "btn btn-success-custom me-2" %>
|
||||||
|
<%= link_to "📚 All Records", exclusive_traditional_records_path, class: "btn btn-primary-custom" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% content_for :title, "Expenses" %>
|
|
||||||
|
|
||||||
|
<!-- Finance Card -->
|
||||||
|
<div class="row mt-4 justify-content-center">
|
||||||
|
<div class="col-12 d-flex justify-content-center">
|
||||||
|
<div class="finance-card p-4 w-100">
|
||||||
|
<h2 class="section-title text-warning mb-4">💼 Finance Overview</h2>
|
||||||
|
|
||||||
|
<div class="row g-4 justify-content-center">
|
||||||
|
|
||||||
<style>
|
|
||||||
/* Main card container */
|
|
||||||
.expense-card {
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 16px;
|
|
||||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
|
||||||
padding: 20px 25px;
|
|
||||||
max-width: 420px;
|
|
||||||
margin: 30px auto;
|
|
||||||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hover effect */
|
|
||||||
.expense-card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: 0 8px 20px rgba(0,0,0,0.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Card header */
|
|
||||||
.expense-card h1 {
|
|
||||||
font-size: 1.7rem;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
color: #333333;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Flash notice */
|
|
||||||
.expense-card .flash-notice {
|
|
||||||
background-color: #d4edda;
|
|
||||||
color: #155724;
|
|
||||||
border: 1px solid #c3e6cb;
|
|
||||||
padding: 10px 14px;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Button styling */
|
|
||||||
.expense-card .btn {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #007bff;
|
|
||||||
color: #fff;
|
|
||||||
padding: 10px 0;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: 500;
|
|
||||||
text-decoration: none;
|
|
||||||
transition: background-color 0.3s ease, transform 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Button hover */
|
|
||||||
.expense-card .btn:hover {
|
|
||||||
background-color: #0056b3;
|
|
||||||
transform: scale(1.03);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Main card container */
|
|
||||||
.income-card {
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 16px;
|
|
||||||
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
|
||||||
padding: 20px 25px;
|
|
||||||
max-width: 420px;
|
|
||||||
margin: 30px auto;
|
|
||||||
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hover effect */
|
|
||||||
.income-card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: 0 8px 20px rgba(0,0,0,0.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Card header */
|
|
||||||
.income-card h1 {
|
|
||||||
font-size: 1.7rem;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
color: #333333;
|
|
||||||
text-align: center;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Flash notice */
|
|
||||||
.income-card .flash-notice {
|
|
||||||
background-color: #d4edda;
|
|
||||||
color: #155724;
|
|
||||||
border: 1px solid #c3e6cb;
|
|
||||||
padding: 10px 14px;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Button styling */
|
|
||||||
.income-card .btn {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #007bff;
|
|
||||||
color: #fff;
|
|
||||||
padding: 10px 0;
|
|
||||||
border-radius: 8px;
|
|
||||||
font-size: 1rem;
|
|
||||||
font-weight: 500;
|
|
||||||
text-decoration: none;
|
|
||||||
transition: background-color 0.3s ease, transform 0.2s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Button hover */
|
|
||||||
.income-card .btn:hover {
|
|
||||||
background-color: #0056b3;
|
|
||||||
transform: scale(1.03);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="row mt-4 g-4 justify-content-center">
|
|
||||||
<!-- Expense Card -->
|
<!-- Expense Card -->
|
||||||
<div class="col-lg-5 d-flex">
|
<div class="col-lg-5 d-flex justify-content-center">
|
||||||
<div class="expense-card w-100">
|
<div class="expense-card w-100">
|
||||||
<% if notice.present? %>
|
<% if notice.present? %>
|
||||||
<div class="flash-notice">
|
<div class="flash-notice"><%= notice %></div>
|
||||||
<%= notice %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<h3>📊 Expenses</h3>
|
||||||
<h1>📊 Expenses</h1>
|
<p class="stat-value"><%= number_to_currency(@total_expense || 0) %></p>
|
||||||
<%= link_to "Expenses List", expenses_path, class: "btn" %>
|
<%= link_to "Expenses List", expenses_path, class: "btn btn-primary-custom mt-2" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Income Card -->
|
<!-- Income Card -->
|
||||||
<div class="col-lg-5 d-flex">
|
<div class="col-lg-5 d-flex justify-content-center">
|
||||||
<div class="income-card w-100">
|
<div class="income-card w-100">
|
||||||
<% if notice.present? %>
|
<% if notice.present? %>
|
||||||
<div class="flash-notice">
|
<div class="flash-notice"><%= notice %></div>
|
||||||
<%= notice %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<h3>💰 Incomes</h3>
|
||||||
|
<p class="stat-value"><%= number_to_currency(@total_income || 0) %></p>
|
||||||
|
<%= link_to "Incomes List", incomes_path, class: "btn btn-primary-custom mt-2" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h1>💰 Incomes</h1>
|
<!-- Profit Summary -->
|
||||||
<%= link_to "Incomes List", incomes_path, class: "btn" %>
|
<div class="text-center mt-4">
|
||||||
|
<h3>📈 BALANCE</h3>
|
||||||
|
<p class="stat-value fs-3"><%= number_to_currency(@profit || 0) %></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div> <!-- container -->
|
</div> <!-- container -->
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,121 @@
|
||||||
|
<div class="container-fluid min-vh-100 p-4 gradient-bg">
|
||||||
<div class="mb-4">
|
|
||||||
<% if notice %>
|
<% if notice %>
|
||||||
<div class="alert alert-success"><%= notice %></div>
|
<div class="alert alert-success"><%= notice %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card bg-white shadow p-4 mb-4">
|
<!-- Institution Header Card -->
|
||||||
<div class="card-body">
|
<div class="card institution-card shadow mb-4 p-4">
|
||||||
<h2 class="card-title mb-3 text-primary"><%= @institution.name %></h2>
|
<h1 class="institution-name mb-3 text-primary"><%= @institution.name %></h1>
|
||||||
<%# Add more institution details here if needed %>
|
<div class="btn-group">
|
||||||
<div class="mb-3">
|
|
||||||
<%= link_to "Edit Institution", edit_institution_path(@institution), class: "btn btn-secondary me-2" %>
|
<%= 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" %>
|
<%= 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" %>
|
<%= button_to "Destroy Institution", @institution, method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger" %>
|
||||||
|
<%= link_to "➕ New Student", new_institution_student_path(@institution), class: "btn btn-primary ms-2" %>
|
||||||
</div>
|
</div>
|
||||||
</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>
|
|
||||||
|
|
||||||
|
<!-- Students Section -->
|
||||||
|
<h2 class="mb-3 text-white">Students</h2>
|
||||||
|
<% if @students.present? && @students.any? %>
|
||||||
<div class="row g-4">
|
<div class="row g-4">
|
||||||
<% @institution.students.each do |student| %>
|
<% @students.each do |student| %>
|
||||||
<div class="col-md-6">
|
<div class="col-12 col-sm-6 col-md-4 col-lg-3">
|
||||||
<div class="card bg-white shadow-sm h-100 border-info">
|
<div class="student-card shadow p-3">
|
||||||
<div class="card-body">
|
<h4 class="student-name"><%= student.first_name %> <%= student.last_name %></h4>
|
||||||
<h5 class="card-title text-info"><%= student.first_name %> <%= student.last_name %></h5>
|
<p class="student-info"><strong>Place:</strong> <%= student.place %></p>
|
||||||
<p class="card-text mb-1"><strong>Email:</strong> <%= student.email %></p>
|
<p class="student-info">
|
||||||
</div>
|
<strong>Institution:</strong>
|
||||||
<div class="card-footer bg-transparent border-0 d-flex justify-content-end">
|
<% if student.institution.present? %>
|
||||||
<%= link_to "Show", institution_student_path(@institution, student), class: "btn btn-primary btn-sm me-2" %>
|
<%= link_to student.institution.name, institution_path(student.institution), class: "badge badge-primary" %>
|
||||||
<%= link_to "Edit", edit_institution_student_path(@institution, student), class: "btn btn-secondary btn-sm me-2" %>
|
<% else %>
|
||||||
<%= button_to "Delete", institution_student_path(@institution, student), method: :delete, data: { confirm: "Are you sure?" }, class: "btn btn-danger btn-sm" %>
|
<span class="badge badge-secondary">No institution</span>
|
||||||
</div>
|
<% end %>
|
||||||
|
</p>
|
||||||
|
<% view_path = @institution.present? ? institution_student_path(@institution, student) :
|
||||||
|
(student.institution.present? ? institution_student_path(student.institution, student) : student_path(student)) %>
|
||||||
|
<%= link_to "View →", view_path, class: "btn-small" %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<p class="text-center text-white mt-4">No students found.</p>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Styles -->
|
||||||
|
<style>
|
||||||
|
/* Background Gradient Animation */
|
||||||
|
.gradient-bg {
|
||||||
|
background: linear-gradient(-45deg, #1e88e5, #43a047, #6a1b9a, #d81b60);
|
||||||
|
background-size: 400% 400%;
|
||||||
|
animation: gradientBG 15s ease infinite;
|
||||||
|
min-height: 100vh;
|
||||||
|
padding-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes gradientBG {
|
||||||
|
0% { background-position: 0% 50%; }
|
||||||
|
50% { background-position: 100% 50%; }
|
||||||
|
100% { background-position: 0% 50%; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Institution Card */
|
||||||
|
.institution-card {
|
||||||
|
background-color: rgba(24, 26, 27, 0.95);
|
||||||
|
color: #e0e0e0;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Buttons */
|
||||||
|
.btn-primary {
|
||||||
|
background: #2563eb;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 600;
|
||||||
|
transition: 0.2s ease;
|
||||||
|
}
|
||||||
|
.btn-primary:hover { background: #1e4fc4; transform: translateY(-2px); }
|
||||||
|
|
||||||
|
.btn-secondary, .btn-outline-light, .btn-danger {
|
||||||
|
transition: 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Student Cards */
|
||||||
|
.student-card {
|
||||||
|
background-color: #181a1b;
|
||||||
|
color: #e0e0e0;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
min-height: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.student-name { font-weight: 600; font-size: 1.1rem; margin-bottom: 6px; }
|
||||||
|
|
||||||
|
.student-info { font-size: 0.9rem; margin: 2px 0; color: #a0a0a0; }
|
||||||
|
|
||||||
|
.btn-small {
|
||||||
|
background: #10b981;
|
||||||
|
color: #fff;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: center;
|
||||||
|
transition: 0.2s ease;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
.btn-small:hover { background: #0a8d63; }
|
||||||
|
|
||||||
|
.badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 999px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
text-decoration: none;
|
||||||
|
margin-top: 2px;
|
||||||
|
}
|
||||||
|
.badge-primary { background: #2563eb; }
|
||||||
|
.badge-secondary { background: #6b7280; }
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<div class="trix-content">
|
||||||
|
<%= yield -%>
|
||||||
|
</div>
|
||||||
|
|
@ -8,6 +8,9 @@
|
||||||
<%= csrf_meta_tags %>
|
<%= csrf_meta_tags %>
|
||||||
<%= csp_meta_tag %>
|
<%= csp_meta_tag %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<%= yield :head %>
|
<%= yield :head %>
|
||||||
|
|
||||||
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
||||||
|
|
@ -23,12 +26,22 @@
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: #181a1b !important;
|
margin: 0;
|
||||||
color: #e0e0e0 !important;
|
color: #e0e0e0 !important;
|
||||||
|
background: linear-gradient(-45deg, #1e88e5, #43a047, #6a1b9a, #d81b60);
|
||||||
|
background-size: 400% 400%;
|
||||||
|
animation: gradientBG 15s ease infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes gradientBG {
|
||||||
|
0% { background-position: 0% 50%; }
|
||||||
|
50% { background-position: 100% 50%; }
|
||||||
|
100% { background-position: 0% 50%; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.bg-white {
|
.bg-white {
|
||||||
background-color: #23272b !important;
|
background-color: #181a1b !important;
|
||||||
color: #e0e0e0 !important;
|
color: #e0e0e0 !important;
|
||||||
}
|
}
|
||||||
.navbar, .footer {
|
.navbar, .footer {
|
||||||
|
|
@ -62,11 +75,40 @@
|
||||||
.btn {
|
.btn {
|
||||||
color: #e0e0e0 !important;
|
color: #e0e0e0 !important;
|
||||||
}
|
}
|
||||||
|
.dropdown-menu {
|
||||||
|
max-height: 300px;
|
||||||
|
overflow-y: auto;
|
||||||
|
background-color: #2a3038 !important;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 1px solid rgba(255,255,255,0.1);
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
.dropdown-item {
|
||||||
|
color: #e0e0e0 !important;
|
||||||
|
padding: 8px 16px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
.dropdown-item:hover {
|
||||||
|
background: rgba(30,136,229,0.2) !important;
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
.dropdown-divider {
|
||||||
|
border-color: rgba(255,255,255,0.1);
|
||||||
|
}
|
||||||
|
.dropdown-menu.show {
|
||||||
|
display: block !important;
|
||||||
|
opacity: 1 !important;
|
||||||
|
visibility: visible !important;
|
||||||
|
}
|
||||||
|
.nav-item.dropdown .dropdown-menu {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
min-width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
||||||
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
|
|
||||||
<%= javascript_importmap_tags %>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
@ -92,7 +134,7 @@
|
||||||
<%= link_to "🏠 Home", root_path, class: "nav-link active" %>
|
<%= link_to "🏠 Home", root_path, class: "nav-link active" %>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<%= link_to "🏫 Institutions", institutions_path, class: "nav-link" %>
|
<%= link_to "🏫 MARKET", shop_now.products_path, class: "nav-link" %>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<%= link_to "🎓 Programs", programs_path, class: "nav-link" %>
|
<%= link_to "🎓 Programs", programs_path, class: "nav-link" %>
|
||||||
|
|
@ -101,7 +143,7 @@
|
||||||
<%= link_to "🕌 Ziyara", ziyaras_path, class: "nav-link" %>
|
<%= link_to "🕌 Ziyara", ziyaras_path, class: "nav-link" %>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<%= link_to "👩🎓 Students", students_path, class: "nav-link" %>
|
<%= link_to "📚 All Students", students_path, class: "nav-link" %>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<%= link_to "📊 Expenses", expenses_path, class: "nav-link" %>
|
<%= link_to "📊 Expenses", expenses_path, class: "nav-link" %>
|
||||||
|
|
@ -109,6 +151,12 @@
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<%= link_to "📞 Contact", contact_path, class: "nav-link" %>
|
<%= link_to "📞 Contact", contact_path, class: "nav-link" %>
|
||||||
</li>
|
</li>
|
||||||
|
<% if user_signed_in? %>
|
||||||
|
<%= button_to "Sign Out", destroy_user_session_path, method: :delete, class: "btn btn-danger" %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to "Sign In", new_user_session_path, class: "btn btn-primary" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -184,15 +232,19 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="container shadow rounded p-4 bg-white mt-4">
|
<% if flash.any? %>
|
||||||
<% if notice %>
|
<% flash.each do |name, message| %>
|
||||||
<div class="alert alert-success"><%= notice %></div>
|
<% if name.to_s == 'notice' || name.to_s == 'alert' %>
|
||||||
|
<div class="alert alert-<%= name.to_s == 'notice' ? 'success' : 'danger' %>">
|
||||||
|
<%= message %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<div class="container shadow rounded p-4 bg-white mt-4">
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
<% if alert %>
|
|
||||||
<div class="alert alert-danger"><%= alert %></div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
<footer class="footer text-center mt-5 mb-3 text-muted">
|
<footer class="footer text-center mt-5 mb-3 text-muted">
|
||||||
© <%= Time.current.year %> Badar Madeena
|
© <%= Time.current.year %> Badar Madeena
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,89 @@
|
||||||
<%= form_with(model: program) do |form| %>
|
<%# app/views/programs/_form.html.erb %>
|
||||||
<% if program.errors.any? %>
|
|
||||||
<div style="color: red">
|
|
||||||
<h2><%= pluralize(program.errors.count, "error") %> prohibited this program from being saved:</h2>
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* 🔹 FORM CONTAINER ANIMATION */
|
||||||
|
.animated-form {
|
||||||
|
background: linear-gradient(135deg, #f0f8ff, #e8f5e9);
|
||||||
|
border-radius: 15px;
|
||||||
|
padding: 2.5rem;
|
||||||
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 3rem auto;
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.animated-form:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🔹 LABEL + INPUT STYLE */
|
||||||
|
.animated-form label {
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
transition: color 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.animated-form input {
|
||||||
|
width: 100%;
|
||||||
|
padding: 10px 15px;
|
||||||
|
border-radius: 8px;
|
||||||
|
border: 2px solid #ccc;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.animated-form input:focus {
|
||||||
|
border-color: #4caf50;
|
||||||
|
box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🔹 SUBMIT BUTTON */
|
||||||
|
.animated-form .submit-btn {
|
||||||
|
background: linear-gradient(135deg, #4caf50, #2e7d32);
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 12px 20px;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-top: 1.2rem;
|
||||||
|
cursor: pointer;
|
||||||
|
width: 100%;
|
||||||
|
transition: background 0.3s ease, transform 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.animated-form .submit-btn:hover {
|
||||||
|
background: linear-gradient(135deg, #43a047, #1b5e20);
|
||||||
|
transform: scale(1.03);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 🔹 ERROR STYLING */
|
||||||
|
.animated-form .error-box {
|
||||||
|
background: rgba(255, 0, 0, 0.1);
|
||||||
|
border-left: 4px solid #e53935;
|
||||||
|
color: #b71c1c;
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
animation: fadeIn 0.6s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from { opacity: 0; transform: translateY(-10px); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="animated-form">
|
||||||
|
<%= form_with(model: program, local: true) do |form| %>
|
||||||
|
|
||||||
|
<% if program.errors.any? %>
|
||||||
|
<div class="error-box">
|
||||||
|
<h5><%= pluralize(program.errors.count, "error") %> prevented this program from being saved:</h5>
|
||||||
<ul>
|
<ul>
|
||||||
<% program.errors.each do |error| %>
|
<% program.errors.each do |error| %>
|
||||||
<li><%= error.full_message %></li>
|
<li><%= error.full_message %></li>
|
||||||
|
|
@ -11,22 +92,21 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div>
|
<div class="mb-3">
|
||||||
<%= form.label :name, style: "display: block" %>
|
<%= form.label :name %>
|
||||||
<%= form.text_field :name %>
|
<%= form.text_field :name, placeholder: "Enter program name" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="mb-3">
|
||||||
<%= form.label :date, style: "display: block" %>
|
<%= form.label :date %>
|
||||||
<%= form.date_field :date %>
|
<%= form.date_field :date %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="mb-3">
|
||||||
<%= form.label :leadingPerson, style: "display: block" %>
|
<%= form.label :leadingPerson, "Leading Person" %>
|
||||||
<%= form.text_field :leadingPerson %>
|
<%= form.text_field :leadingPerson, placeholder: "Who leads this program?" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<%= form.submit "Save Program", class: "submit-btn" %>
|
||||||
<%= form.submit %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,36 @@
|
||||||
<p style="color: green"><%= notice %></p>
|
|
||||||
|
|
||||||
<% content_for :title, "Programs" %>
|
<% content_for :title, "Programs" %>
|
||||||
|
|
||||||
<h1>Programs</h1>
|
<% if notice.present? %>
|
||||||
|
<div class="alert alert-success alert-dismissible fade show mt-3" role="alert">
|
||||||
<div id="programs">
|
<%= notice %>
|
||||||
<% @programs.each do |program| %>
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
<%= render program %>
|
</div>
|
||||||
<p>
|
|
||||||
<%= link_to "Show this program", program %>
|
|
||||||
</p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<div class="container my-5">
|
||||||
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||||
|
<h1 class="fw-bold text-primary mb-0">🎓 Programs</h1>
|
||||||
|
<%= link_to "➕ New Program", new_program_path, class: "btn btn-success btn-lg" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%= link_to "New program", new_program_path %>
|
<% if @programs.any? %>
|
||||||
|
<div id="programs" class="row g-4">
|
||||||
|
<% @programs.each do |program| %>
|
||||||
|
<div class="col-md-6 col-lg-4">
|
||||||
|
<div class="card shadow-sm border-0 h-100">
|
||||||
|
<div class="card-body">
|
||||||
|
<%= render program %>
|
||||||
|
<div class="mt-3 text-end">
|
||||||
|
<%= link_to "View Details →", program, class: "btn btn-outline-primary btn-sm" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<div class="text-center text-muted mt-5">
|
||||||
|
<p>No programs available yet. Start by creating one!</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,12 @@ module BadarMadeena
|
||||||
#
|
#
|
||||||
# config.time_zone = "Central Time (US & Canada)"
|
# config.time_zone = "Central Time (US & Canada)"
|
||||||
# config.eager_load_paths << Rails.root.join("extras")
|
# config.eager_load_paths << Rails.root.join("extras")
|
||||||
|
config.assets.enabled = true
|
||||||
|
# Set the URL options for ActiveStorage
|
||||||
|
config.active_storage.service_urls_expire_in = 5.minutes # Optional: You can set the expiration time for URLs here if you need
|
||||||
|
|
||||||
|
# Ensure URLs are generated correctly
|
||||||
|
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
|
||||||
|
config.active_storage.routes_prefix = '/rails/active_storage' # Ensure correct route prefix
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,18 @@ Rails.application.configure do
|
||||||
# Store uploaded files on the local file system (see config/storage.yml for options).
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
||||||
config.active_storage.service = :local
|
config.active_storage.service = :local
|
||||||
|
|
||||||
|
# Configure basic URL options
|
||||||
|
host = 'localhost'
|
||||||
|
port = 3000
|
||||||
|
|
||||||
|
# Configure URL options for various Rails components
|
||||||
|
config.action_controller.default_url_options = { host: host, port: port }
|
||||||
|
config.action_mailer.default_url_options = { host: host, port: port }
|
||||||
|
Rails.application.routes.default_url_options = { host: host, port: port }
|
||||||
|
|
||||||
|
# Configure ActiveStorage
|
||||||
|
config.active_storage.variant_processor = :mini_magick
|
||||||
|
|
||||||
# Don't care if the mailer can't send.
|
# Don't care if the mailer can't send.
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
|
|
@ -69,4 +81,6 @@ Rails.application.configure do
|
||||||
|
|
||||||
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
|
||||||
# config.generators.apply_rubocop_autocorrect_after_generate!
|
# config.generators.apply_rubocop_autocorrect_after_generate!
|
||||||
|
Rails.application.config.action_controller.default_url_options = { host: 'localhost', port: 3000 }
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
# Pin npm packages by running ./bin/importmap
|
# Pin npm packages by running ./bin/importmap
|
||||||
|
|
||||||
pin "application"
|
pin "application", preload: true
|
||||||
pin "@hotwired/turbo-rails", to: "turbo.min.js"
|
pin "@hotwired/turbo-rails", to: "turbo.min.js"
|
||||||
pin "@hotwired/stimulus", to: "stimulus.min.js"
|
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
|
||||||
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js"
|
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
|
||||||
|
pin "bootstrap", to: "https://ga.jspm.io/npm:bootstrap@5.3.2/dist/js/bootstrap.esm.js"
|
||||||
|
pin "@popperjs/core", to: "https://ga.jspm.io/npm:@popperjs/core@2.11.8/lib/index.js"
|
||||||
pin_all_from "app/javascript/controllers", under: "controllers"
|
pin_all_from "app/javascript/controllers", under: "controllers"
|
||||||
|
pin "dropdown", to: "dropdown.js"
|
||||||
|
pin "flash_messages", to: "flash_messages.js"
|
||||||
|
pin "trix"
|
||||||
|
pin "@rails/actiontext", to: "actiontext.esm.js"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
Rails.application.config.active_storage.service_urls_expire_in = 1.hour
|
||||||
|
|
||||||
|
# Configure URL options for Active Storage
|
||||||
|
Rails.application.config.to_prepare do
|
||||||
|
ActiveStorage::BaseController.include(ActiveStorage::SetCurrent)
|
||||||
|
ActiveStorage::Current.url_options = {
|
||||||
|
host: 'localhost',
|
||||||
|
port: 3000,
|
||||||
|
protocol: 'http'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,313 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Assuming you have not yet modified this file, each configuration option below
|
||||||
|
# is set to its default value. Note that some are commented out while others
|
||||||
|
# are not: uncommented lines are intended to protect your configuration from
|
||||||
|
# breaking changes in upgrades (i.e., in the event that future versions of
|
||||||
|
# Devise change the default values for those options).
|
||||||
|
#
|
||||||
|
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||||
|
# Many of these configuration options can be set straight in your model.
|
||||||
|
Devise.setup do |config|
|
||||||
|
# The secret key used by Devise. Devise uses this key to generate
|
||||||
|
# random tokens. Changing this key will render invalid all existing
|
||||||
|
# confirmation, reset password and unlock tokens in the database.
|
||||||
|
# Devise will use the `secret_key_base` as its `secret_key`
|
||||||
|
# by default. You can change it below and use your own secret key.
|
||||||
|
# config.secret_key = 'c00a6f7a93ccad4da7050c8d24d97f96c0b9693b1c39d8c716283168ad6e155058e593d87932cbc91a959941cb5057e62f109560933dec687cf2f4940b27ec4d'
|
||||||
|
|
||||||
|
# ==> Controller configuration
|
||||||
|
# Configure the parent class to the devise controllers.
|
||||||
|
# config.parent_controller = 'DeviseController'
|
||||||
|
|
||||||
|
# ==> Mailer Configuration
|
||||||
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
|
# note that it will be overwritten if you use your own mailer class
|
||||||
|
# with default "from" parameter.
|
||||||
|
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
||||||
|
|
||||||
|
# Configure the class responsible to send e-mails.
|
||||||
|
# config.mailer = 'Devise::Mailer'
|
||||||
|
|
||||||
|
# Configure the parent class responsible to send e-mails.
|
||||||
|
# config.parent_mailer = 'ActionMailer::Base'
|
||||||
|
|
||||||
|
# ==> ORM configuration
|
||||||
|
# Load and configure the ORM. Supports :active_record (default) and
|
||||||
|
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
||||||
|
# available as additional gems.
|
||||||
|
require 'devise/orm/active_record'
|
||||||
|
|
||||||
|
# ==> Configuration for any authentication mechanism
|
||||||
|
# Configure which keys are used when authenticating a user. The default is
|
||||||
|
# just :email. You can configure it to use [:username, :subdomain], so for
|
||||||
|
# authenticating a user, both parameters are required. Remember that those
|
||||||
|
# parameters are used only when authenticating and not when retrieving from
|
||||||
|
# session. If you need permissions, you should implement that in a before filter.
|
||||||
|
# You can also supply a hash where the value is a boolean determining whether
|
||||||
|
# or not authentication should be aborted when the value is not present.
|
||||||
|
# config.authentication_keys = [:email]
|
||||||
|
|
||||||
|
# Configure parameters from the request object used for authentication. Each entry
|
||||||
|
# given should be a request method and it will automatically be passed to the
|
||||||
|
# find_for_authentication method and considered in your model lookup. For instance,
|
||||||
|
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
||||||
|
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
||||||
|
# config.request_keys = []
|
||||||
|
|
||||||
|
# Configure which authentication keys should be case-insensitive.
|
||||||
|
# These keys will be downcased upon creating or modifying a user and when used
|
||||||
|
# to authenticate or find a user. Default is :email.
|
||||||
|
config.case_insensitive_keys = [:email]
|
||||||
|
|
||||||
|
# Configure which authentication keys should have whitespace stripped.
|
||||||
|
# These keys will have whitespace before and after removed upon creating or
|
||||||
|
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||||
|
config.strip_whitespace_keys = [:email]
|
||||||
|
|
||||||
|
# Tell if authentication through request.params is enabled. True by default.
|
||||||
|
# It can be set to an array that will enable params authentication only for the
|
||||||
|
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
||||||
|
# enable it only for database (email + password) authentication.
|
||||||
|
# config.params_authenticatable = true
|
||||||
|
|
||||||
|
# Tell if authentication through HTTP Auth is enabled. False by default.
|
||||||
|
# It can be set to an array that will enable http authentication only for the
|
||||||
|
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
||||||
|
# enable it only for database authentication.
|
||||||
|
# For API-only applications to support authentication "out-of-the-box", you will likely want to
|
||||||
|
# enable this with :database unless you are using a custom strategy.
|
||||||
|
# The supported strategies are:
|
||||||
|
# :database = Support basic authentication with authentication key + password
|
||||||
|
# config.http_authenticatable = false
|
||||||
|
|
||||||
|
# If 401 status code should be returned for AJAX requests. True by default.
|
||||||
|
# config.http_authenticatable_on_xhr = true
|
||||||
|
|
||||||
|
# The realm used in Http Basic Authentication. 'Application' by default.
|
||||||
|
# config.http_authentication_realm = 'Application'
|
||||||
|
|
||||||
|
# It will change confirmation, password recovery and other workflows
|
||||||
|
# to behave the same regardless if the e-mail provided was right or wrong.
|
||||||
|
# Does not affect registerable.
|
||||||
|
# config.paranoid = true
|
||||||
|
|
||||||
|
# By default Devise will store the user in session. You can skip storage for
|
||||||
|
# particular strategies by setting this option.
|
||||||
|
# Notice that if you are skipping storage for all authentication paths, you
|
||||||
|
# may want to disable generating routes to Devise's sessions controller by
|
||||||
|
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
||||||
|
config.skip_session_storage = [:http_auth]
|
||||||
|
|
||||||
|
# By default, Devise cleans up the CSRF token on authentication to
|
||||||
|
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
||||||
|
# requests for sign in and sign up, you need to get a new CSRF token
|
||||||
|
# from the server. You can disable this option at your own risk.
|
||||||
|
# config.clean_up_csrf_token_on_authentication = true
|
||||||
|
|
||||||
|
# When false, Devise will not attempt to reload routes on eager load.
|
||||||
|
# This can reduce the time taken to boot the app but if your application
|
||||||
|
# requires the Devise mappings to be loaded during boot time the application
|
||||||
|
# won't boot properly.
|
||||||
|
# config.reload_routes = true
|
||||||
|
|
||||||
|
# ==> Configuration for :database_authenticatable
|
||||||
|
# For bcrypt, this is the cost for hashing the password and defaults to 12. If
|
||||||
|
# using other algorithms, it sets how many times you want the password to be hashed.
|
||||||
|
# The number of stretches used for generating the hashed password are stored
|
||||||
|
# with the hashed password. This allows you to change the stretches without
|
||||||
|
# invalidating existing passwords.
|
||||||
|
#
|
||||||
|
# Limiting the stretches to just one in testing will increase the performance of
|
||||||
|
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
||||||
|
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
||||||
|
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
||||||
|
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
||||||
|
config.stretches = Rails.env.test? ? 1 : 12
|
||||||
|
|
||||||
|
# Set up a pepper to generate the hashed password.
|
||||||
|
# config.pepper = '894dcc2c9c996a5637c03df7821e0b2641b4509081ca7dc59cf6e41c53e3cd3e211a7cf3faa5f99a62e247f93e708d13faa40735c93da11031a92ccec9669836'
|
||||||
|
|
||||||
|
# Send a notification to the original email when the user's email is changed.
|
||||||
|
# config.send_email_changed_notification = false
|
||||||
|
|
||||||
|
# Send a notification email when the user's password is changed.
|
||||||
|
# config.send_password_change_notification = false
|
||||||
|
|
||||||
|
# ==> Configuration for :confirmable
|
||||||
|
# A period that the user is allowed to access the website even without
|
||||||
|
# confirming their account. For instance, if set to 2.days, the user will be
|
||||||
|
# able to access the website for two days without confirming their account,
|
||||||
|
# access will be blocked just in the third day.
|
||||||
|
# You can also set it to nil, which will allow the user to access the website
|
||||||
|
# without confirming their account.
|
||||||
|
# Default is 0.days, meaning the user cannot access the website without
|
||||||
|
# confirming their account.
|
||||||
|
# config.allow_unconfirmed_access_for = 2.days
|
||||||
|
|
||||||
|
# A period that the user is allowed to confirm their account before their
|
||||||
|
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
||||||
|
# their account within 3 days after the mail was sent, but on the fourth day
|
||||||
|
# their account can't be confirmed with the token any more.
|
||||||
|
# Default is nil, meaning there is no restriction on how long a user can take
|
||||||
|
# before confirming their account.
|
||||||
|
# config.confirm_within = 3.days
|
||||||
|
|
||||||
|
# If true, requires any email changes to be confirmed (exactly the same way as
|
||||||
|
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
||||||
|
# db field (see migrations). Until confirmed, new email is stored in
|
||||||
|
# unconfirmed_email column, and copied to email column on successful confirmation.
|
||||||
|
config.reconfirmable = true
|
||||||
|
|
||||||
|
# Defines which key will be used when confirming an account
|
||||||
|
# config.confirmation_keys = [:email]
|
||||||
|
|
||||||
|
# ==> Configuration for :rememberable
|
||||||
|
# The time the user will be remembered without asking for credentials again.
|
||||||
|
# config.remember_for = 2.weeks
|
||||||
|
|
||||||
|
# Invalidates all the remember me tokens when the user signs out.
|
||||||
|
config.expire_all_remember_me_on_sign_out = true
|
||||||
|
|
||||||
|
# If true, extends the user's remember period when remembered via cookie.
|
||||||
|
# config.extend_remember_period = false
|
||||||
|
|
||||||
|
# Options to be passed to the created cookie. For instance, you can set
|
||||||
|
# secure: true in order to force SSL only cookies.
|
||||||
|
# config.rememberable_options = {}
|
||||||
|
|
||||||
|
# ==> Configuration for :validatable
|
||||||
|
# Range for password length.
|
||||||
|
config.password_length = 6..128
|
||||||
|
|
||||||
|
# Email regex used to validate email formats. It simply asserts that
|
||||||
|
# one (and only one) @ exists in the given string. This is mainly
|
||||||
|
# to give user feedback and not to assert the e-mail validity.
|
||||||
|
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
||||||
|
|
||||||
|
# ==> Configuration for :timeoutable
|
||||||
|
# The time you want to timeout the user session without activity. After this
|
||||||
|
# time the user will be asked for credentials again. Default is 30 minutes.
|
||||||
|
# config.timeout_in = 30.minutes
|
||||||
|
|
||||||
|
# ==> Configuration for :lockable
|
||||||
|
# Defines which strategy will be used to lock an account.
|
||||||
|
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
||||||
|
# :none = No lock strategy. You should handle locking by yourself.
|
||||||
|
# config.lock_strategy = :failed_attempts
|
||||||
|
|
||||||
|
# Defines which key will be used when locking and unlocking an account
|
||||||
|
# config.unlock_keys = [:email]
|
||||||
|
|
||||||
|
# Defines which strategy will be used to unlock an account.
|
||||||
|
# :email = Sends an unlock link to the user email
|
||||||
|
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
||||||
|
# :both = Enables both strategies
|
||||||
|
# :none = No unlock strategy. You should handle unlocking by yourself.
|
||||||
|
# config.unlock_strategy = :both
|
||||||
|
|
||||||
|
# Number of authentication tries before locking an account if lock_strategy
|
||||||
|
# is failed attempts.
|
||||||
|
# config.maximum_attempts = 20
|
||||||
|
|
||||||
|
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
||||||
|
# config.unlock_in = 1.hour
|
||||||
|
|
||||||
|
# Warn on the last attempt before the account is locked.
|
||||||
|
# config.last_attempt_warning = true
|
||||||
|
|
||||||
|
# ==> Configuration for :recoverable
|
||||||
|
#
|
||||||
|
# Defines which key will be used when recovering the password for an account
|
||||||
|
# config.reset_password_keys = [:email]
|
||||||
|
|
||||||
|
# Time interval you can reset your password with a reset password key.
|
||||||
|
# Don't put a too small interval or your users won't have the time to
|
||||||
|
# change their passwords.
|
||||||
|
config.reset_password_within = 6.hours
|
||||||
|
|
||||||
|
# When set to false, does not sign a user in automatically after their password is
|
||||||
|
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
||||||
|
# config.sign_in_after_reset_password = true
|
||||||
|
|
||||||
|
# ==> Configuration for :encryptable
|
||||||
|
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
||||||
|
# You can use :sha1, :sha512 or algorithms from others authentication tools as
|
||||||
|
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
||||||
|
# for default behavior) and :restful_authentication_sha1 (then you should set
|
||||||
|
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
||||||
|
#
|
||||||
|
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
||||||
|
# config.encryptor = :sha512
|
||||||
|
|
||||||
|
# ==> Scopes configuration
|
||||||
|
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
||||||
|
# "users/sessions/new". It's turned off by default because it's slower if you
|
||||||
|
# are using only default views.
|
||||||
|
# config.scoped_views = false
|
||||||
|
|
||||||
|
# Configure the default scope given to Warden. By default it's the first
|
||||||
|
# devise role declared in your routes (usually :user).
|
||||||
|
# config.default_scope = :user
|
||||||
|
|
||||||
|
# Set this configuration to false if you want /users/sign_out to sign out
|
||||||
|
# only the current scope. By default, Devise signs out all scopes.
|
||||||
|
# config.sign_out_all_scopes = true
|
||||||
|
|
||||||
|
# ==> Navigation configuration
|
||||||
|
# Lists the formats that should be treated as navigational. Formats like
|
||||||
|
# :html should redirect to the sign in page when the user does not have
|
||||||
|
# access, but formats like :xml or :json, should return 401.
|
||||||
|
#
|
||||||
|
# If you have any extra navigational formats, like :iphone or :mobile, you
|
||||||
|
# should add them to the navigational formats lists.
|
||||||
|
#
|
||||||
|
# The "*/*" below is required to match Internet Explorer requests.
|
||||||
|
# config.navigational_formats = ['*/*', :html, :turbo_stream]
|
||||||
|
|
||||||
|
# The default HTTP method used to sign out a resource. Default is :delete.
|
||||||
|
config.sign_out_via = :delete
|
||||||
|
|
||||||
|
# ==> OmniAuth
|
||||||
|
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
||||||
|
# up on your models and hooks.
|
||||||
|
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
||||||
|
|
||||||
|
# ==> Warden configuration
|
||||||
|
# If you want to use other strategies, that are not supported by Devise, or
|
||||||
|
# change the failure app, you can configure them inside the config.warden block.
|
||||||
|
#
|
||||||
|
# config.warden do |manager|
|
||||||
|
# manager.intercept_401 = false
|
||||||
|
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
||||||
|
# end
|
||||||
|
|
||||||
|
# ==> Mountable engine configurations
|
||||||
|
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
||||||
|
# is mountable, there are some extra configurations to be taken into account.
|
||||||
|
# The following options are available, assuming the engine is mounted as:
|
||||||
|
#
|
||||||
|
# mount MyEngine, at: '/my_engine'
|
||||||
|
#
|
||||||
|
# The router that invoked `devise_for`, in the example above, would be:
|
||||||
|
# config.router_name = :my_engine
|
||||||
|
#
|
||||||
|
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
||||||
|
# so you need to do it manually. For the users scope, it would be:
|
||||||
|
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
||||||
|
|
||||||
|
# ==> Hotwire/Turbo configuration
|
||||||
|
# When using Devise with Hotwire/Turbo, the http status for error responses
|
||||||
|
# and some redirects must match the following. The default in Devise for existing
|
||||||
|
# apps is `200 OK` and `302 Found` respectively, but new apps are generated with
|
||||||
|
# these new defaults that match Hotwire/Turbo behavior.
|
||||||
|
# Note: These might become the new default in future versions of Devise.
|
||||||
|
config.responder.error_status = :unprocessable_entity
|
||||||
|
config.responder.redirect_status = :see_other
|
||||||
|
|
||||||
|
# ==> Configuration for :registerable
|
||||||
|
|
||||||
|
# When set to false, does not sign a user in automatically after their password is
|
||||||
|
# changed. Defaults to true, so a user is signed in automatically after changing a password.
|
||||||
|
# config.sign_in_after_change_password = true
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
# Additional translations at https://github.com/heartcombo/devise/wiki/I18n
|
||||||
|
|
||||||
|
en:
|
||||||
|
devise:
|
||||||
|
confirmations:
|
||||||
|
confirmed: "Your email address has been successfully confirmed."
|
||||||
|
send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||||
|
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
|
||||||
|
failure:
|
||||||
|
already_authenticated: "You are already signed in."
|
||||||
|
inactive: "Your account is not activated yet."
|
||||||
|
invalid: "Invalid %{authentication_keys} or password."
|
||||||
|
locked: "Your account is locked."
|
||||||
|
last_attempt: "You have one more attempt before your account is locked."
|
||||||
|
not_found_in_database: "Invalid %{authentication_keys} or password."
|
||||||
|
timeout: "Your session expired. Please sign in again to continue."
|
||||||
|
unauthenticated: "You need to sign in or sign up before continuing."
|
||||||
|
unconfirmed: "You have to confirm your email address before continuing."
|
||||||
|
mailer:
|
||||||
|
confirmation_instructions:
|
||||||
|
subject: "Confirmation instructions"
|
||||||
|
reset_password_instructions:
|
||||||
|
subject: "Reset password instructions"
|
||||||
|
unlock_instructions:
|
||||||
|
subject: "Unlock instructions"
|
||||||
|
email_changed:
|
||||||
|
subject: "Email Changed"
|
||||||
|
password_change:
|
||||||
|
subject: "Password Changed"
|
||||||
|
omniauth_callbacks:
|
||||||
|
failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
|
||||||
|
success: "Successfully authenticated from %{kind} account."
|
||||||
|
passwords:
|
||||||
|
no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
|
||||||
|
send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
|
||||||
|
send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
|
||||||
|
updated: "Your password has been changed successfully. You are now signed in."
|
||||||
|
updated_not_active: "Your password has been changed successfully."
|
||||||
|
registrations:
|
||||||
|
destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
|
||||||
|
signed_up: "Welcome! You have signed up successfully."
|
||||||
|
signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
|
||||||
|
signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
|
||||||
|
signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
|
||||||
|
update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
|
||||||
|
updated: "Your account has been updated successfully."
|
||||||
|
updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
|
||||||
|
sessions:
|
||||||
|
signed_in: "Signed in successfully."
|
||||||
|
signed_out: "Signed out successfully."
|
||||||
|
already_signed_out: "Signed out successfully."
|
||||||
|
unlocks:
|
||||||
|
send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
|
||||||
|
send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
|
||||||
|
unlocked: "Your account has been unlocked successfully. Please sign in to continue."
|
||||||
|
errors:
|
||||||
|
messages:
|
||||||
|
already_confirmed: "was already confirmed, please try signing in"
|
||||||
|
confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
|
||||||
|
expired: "has expired, please request a new one"
|
||||||
|
not_found: "not found"
|
||||||
|
not_locked: "was not locked"
|
||||||
|
not_saved:
|
||||||
|
one: "1 error prohibited this %{resource} from being saved:"
|
||||||
|
other: "%{count} errors prohibited this %{resource} from being saved:"
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
|
devise_for :users
|
||||||
|
|
||||||
resources :students
|
resources :students
|
||||||
resources :incomes do
|
resources :incomes do
|
||||||
|
|
@ -19,19 +20,14 @@ Rails.application.routes.draw do
|
||||||
resources :institutions do
|
resources :institutions do
|
||||||
resources :students
|
resources :students
|
||||||
end
|
end
|
||||||
resources :institutions do
|
|
||||||
resources :students
|
|
||||||
end
|
|
||||||
|
|
||||||
get "up" => "rails/health#show", as: :rails_health_check
|
get "up" => "rails/health#show", as: :rails_health_check
|
||||||
get 'contact', to: 'institutions#contact'
|
get 'contact', to: 'institutions#contact'
|
||||||
get 'institutions', to: 'institutions#index'
|
|
||||||
get 'programs', to: 'programs#index'
|
|
||||||
get 'ziyaras', to: 'ziyaras#index'
|
|
||||||
get 'students', to: 'students#index'
|
|
||||||
get 'expenses', to: 'expenses#index'
|
|
||||||
|
|
||||||
|
|
||||||
root "institutions#index"
|
root "institutions#index"
|
||||||
|
|
||||||
|
|
||||||
|
mount ShopNow::Engine, at: "/shop_now"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
development:
|
||||||
|
service: Disk
|
||||||
|
root: <%= Rails.root.join("storage") %>
|
||||||
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
service: Disk
|
service: Disk
|
||||||
root: <%= Rails.root.join("tmp/storage") %>
|
root: <%= Rails.root.join("tmp/storage") %>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
class AddPricingToProducts < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
add_column :products, :purchase_price, :decimal
|
||||||
|
add_column :products, :selling_price, :decimal
|
||||||
|
add_column :products, :quantity, :integer
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
class RemovePriceFromProducts < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
remove_column :products, :price, :decimal
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class DeviseCreateAdminUsers < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :admin_users do |t|
|
||||||
|
## Database authenticatable
|
||||||
|
t.string :email, null: false, default: ""
|
||||||
|
t.string :encrypted_password, null: false, default: ""
|
||||||
|
|
||||||
|
## Recoverable
|
||||||
|
t.string :reset_password_token
|
||||||
|
t.datetime :reset_password_sent_at
|
||||||
|
|
||||||
|
## Rememberable
|
||||||
|
t.datetime :remember_created_at
|
||||||
|
|
||||||
|
## Trackable
|
||||||
|
# t.integer :sign_in_count, default: 0, null: false
|
||||||
|
# t.datetime :current_sign_in_at
|
||||||
|
# t.datetime :last_sign_in_at
|
||||||
|
# t.string :current_sign_in_ip
|
||||||
|
# t.string :last_sign_in_ip
|
||||||
|
|
||||||
|
## Confirmable
|
||||||
|
# t.string :confirmation_token
|
||||||
|
# t.datetime :confirmed_at
|
||||||
|
# t.datetime :confirmation_sent_at
|
||||||
|
# t.string :unconfirmed_email # Only if using reconfirmable
|
||||||
|
|
||||||
|
## Lockable
|
||||||
|
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
||||||
|
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
||||||
|
# t.datetime :locked_at
|
||||||
|
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :admin_users, :email, unique: true
|
||||||
|
add_index :admin_users, :reset_password_token, unique: true
|
||||||
|
# add_index :admin_users, :confirmation_token, unique: true
|
||||||
|
# add_index :admin_users, :unlock_token, unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
class CreateActiveAdminComments < ActiveRecord::Migration[8.0]
|
||||||
|
def self.up
|
||||||
|
create_table :active_admin_comments do |t|
|
||||||
|
t.string :namespace
|
||||||
|
t.text :body
|
||||||
|
t.references :resource, polymorphic: true
|
||||||
|
t.references :author, polymorphic: true
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :active_admin_comments, [:namespace]
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
drop_table :active_admin_comments
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# This migration was generated by Devise but the original Devise create migration
|
||||||
|
# for AdminUser already adds the required columns. Running this migration would
|
||||||
|
# attempt to add duplicate columns and fail (SQLite: duplicate column name).
|
||||||
|
# To keep schema history consistent, make this migration a no-op so `rails db:migrate`
|
||||||
|
# can proceed without errors.
|
||||||
|
|
||||||
|
class AddDeviseToAdminUsers < ActiveRecord::Migration[8.0]
|
||||||
|
def up
|
||||||
|
say "Skipping AddDeviseToAdminUsers migration — already applied by earlier migration"
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
# No-op (irreversible)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class DeviseCreateUsers < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :users do |t|
|
||||||
|
## Database authenticatable
|
||||||
|
t.string :email, null: false, default: ""
|
||||||
|
t.string :encrypted_password, null: false, default: ""
|
||||||
|
|
||||||
|
## Recoverable
|
||||||
|
t.string :reset_password_token
|
||||||
|
t.datetime :reset_password_sent_at
|
||||||
|
|
||||||
|
## Rememberable
|
||||||
|
t.datetime :remember_created_at
|
||||||
|
|
||||||
|
## Trackable
|
||||||
|
# t.integer :sign_in_count, default: 0, null: false
|
||||||
|
# t.datetime :current_sign_in_at
|
||||||
|
# t.datetime :last_sign_in_at
|
||||||
|
# t.string :current_sign_in_ip
|
||||||
|
# t.string :last_sign_in_ip
|
||||||
|
|
||||||
|
## Confirmable
|
||||||
|
# t.string :confirmation_token
|
||||||
|
# t.datetime :confirmed_at
|
||||||
|
# t.datetime :confirmation_sent_at
|
||||||
|
# t.string :unconfirmed_email # Only if using reconfirmable
|
||||||
|
|
||||||
|
## Lockable
|
||||||
|
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
||||||
|
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
||||||
|
# t.datetime :locked_at
|
||||||
|
|
||||||
|
|
||||||
|
t.timestamps null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :users, :email, unique: true
|
||||||
|
add_index :users, :reset_password_token, unique: true
|
||||||
|
# add_index :users, :confirmation_token, unique: true
|
||||||
|
# add_index :users, :unlock_token, unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
class CreateProducts < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :products do |t|
|
||||||
|
t.string :name
|
||||||
|
t.decimal :price
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
# This migration comes from action_text (originally 20180528164100)
|
||||||
|
class CreateActionTextTables < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
# Use Active Record's configured type for primary and foreign keys
|
||||||
|
primary_key_type, foreign_key_type = primary_and_foreign_key_types
|
||||||
|
|
||||||
|
create_table :action_text_rich_texts, id: primary_key_type do |t|
|
||||||
|
t.string :name, null: false
|
||||||
|
t.text :body, size: :long
|
||||||
|
t.references :record, null: false, polymorphic: true, index: false, type: foreign_key_type
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
|
||||||
|
t.index [ :record_type, :record_id, :name ], name: "index_action_text_rich_texts_uniqueness", unique: true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def primary_and_foreign_key_types
|
||||||
|
config = Rails.configuration.generators
|
||||||
|
setting = config.options[config.orm][:primary_key_type]
|
||||||
|
primary_key_type = setting || :primary_key
|
||||||
|
foreign_key_type = setting || :bigint
|
||||||
|
[ primary_key_type, foreign_key_type ]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
class CreateShopNowProducts < ActiveRecord::Migration[8.0]
|
||||||
|
def change
|
||||||
|
create_table :shop_now_products do |t|
|
||||||
|
t.string :name
|
||||||
|
t.decimal :price
|
||||||
|
t.text :description
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -10,7 +10,31 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[8.0].define(version: 2025_10_22_133611) do
|
ActiveRecord::Schema[8.0].define(version: 2025_11_02_124707) do
|
||||||
|
create_table "action_text_rich_texts", force: :cascade do |t|
|
||||||
|
t.string "name", null: false
|
||||||
|
t.text "body"
|
||||||
|
t.string "record_type", null: false
|
||||||
|
t.bigint "record_id", null: false
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
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|
|
create_table "active_storage_attachments", force: :cascade do |t|
|
||||||
t.string "name", null: false
|
t.string "name", null: false
|
||||||
t.string "record_type", null: false
|
t.string "record_type", null: false
|
||||||
|
|
@ -39,6 +63,45 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_22_133611) do
|
||||||
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true
|
||||||
end
|
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|
|
create_table "exclusive_traditional_records", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "author"
|
t.string "author"
|
||||||
|
|
@ -82,6 +145,13 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_22_133611) do
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "products", force: :cascade do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.decimal "price"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "programs", force: :cascade do |t|
|
create_table "programs", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.date "date"
|
t.date "date"
|
||||||
|
|
@ -90,6 +160,14 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_22_133611) do
|
||||||
t.datetime "updated_at", null: false
|
t.datetime "updated_at", null: false
|
||||||
end
|
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|
|
create_table "students", force: :cascade do |t|
|
||||||
t.string "first_name"
|
t.string "first_name"
|
||||||
t.string "last_name"
|
t.string "last_name"
|
||||||
|
|
@ -103,6 +181,18 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_22_133611) do
|
||||||
t.index ["institution_id"], name: "index_students_on_institution_id"
|
t.index ["institution_id"], name: "index_students_on_institution_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "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_users_on_email", unique: true
|
||||||
|
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
|
||||||
|
end
|
||||||
|
|
||||||
create_table "ziyaras", force: :cascade do |t|
|
create_table "ziyaras", force: :cascade do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
|
|
@ -111,5 +201,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_10_22_133611) do
|
||||||
|
|
||||||
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
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 "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"
|
add_foreign_key "students", "institutions"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,4 @@
|
||||||
# end
|
# end
|
||||||
Institution.create!(name: "Badar Madeena Dars", institution_type: "dars")
|
Institution.create!(name: "Badar Madeena Dars", institution_type: "dars")
|
||||||
Institution.create!(name: "Hiflul Quraan College", institution_type: "college")
|
Institution.create!(name: "Hiflul Quraan College", institution_type: "college")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
# one:
|
||||||
|
# record: name_of_fixture (ClassOfFixture)
|
||||||
|
# name: content
|
||||||
|
# body: <p>In a <i>million</i> stars!</p>
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
# This model initially had no columns defined. If you add columns to the
|
||||||
|
# model remove the "{}" from the fixture names and add the columns immediately
|
||||||
|
# below each fixture, per the syntax in the comments below
|
||||||
|
#
|
||||||
|
one: {}
|
||||||
|
# column: value
|
||||||
|
#
|
||||||
|
two: {}
|
||||||
|
# column: value
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
# This model initially had no columns defined. If you add columns to the
|
||||||
|
# model remove the "{}" from the fixture names and add the columns immediately
|
||||||
|
# below each fixture, per the syntax in the comments below
|
||||||
|
#
|
||||||
|
one: {}
|
||||||
|
# column: value
|
||||||
|
#
|
||||||
|
two: {}
|
||||||
|
# column: value
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
cart: one
|
||||||
|
product: one
|
||||||
|
quantity: 1
|
||||||
|
|
||||||
|
two:
|
||||||
|
cart: two
|
||||||
|
product: two
|
||||||
|
quantity: 1
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
# This model initially had no columns defined. If you add columns to the
|
||||||
|
# model remove the "{}" from the fixture names and add the columns immediately
|
||||||
|
# below each fixture, per the syntax in the comments below
|
||||||
|
#
|
||||||
|
one: {}
|
||||||
|
# column: value
|
||||||
|
#
|
||||||
|
two: {}
|
||||||
|
# column: value
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
one:
|
||||||
|
name: MyString
|
||||||
|
price: 9.99
|
||||||
|
|
||||||
|
two:
|
||||||
|
name: MyString
|
||||||
|
price: 9.99
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||||
|
|
||||||
|
# This model initially had no columns defined. If you add columns to the
|
||||||
|
# model remove the "{}" from the fixture names and add the columns immediately
|
||||||
|
# below each fixture, per the syntax in the comments below
|
||||||
|
#
|
||||||
|
one: {}
|
||||||
|
# column: value
|
||||||
|
#
|
||||||
|
two: {}
|
||||||
|
# column: value
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class AdminTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class AdminUserTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class CartItemTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class CartTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class ProductTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
require "test_helper"
|
||||||
|
|
||||||
|
class UserTest < ActiveSupport::TestCase
|
||||||
|
# test "the truth" do
|
||||||
|
# assert true
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
require "application_system_test_case"
|
||||||
|
|
||||||
|
class CartItemsTest < ApplicationSystemTestCase
|
||||||
|
setup do
|
||||||
|
@cart_item = cart_items(:one)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "visiting the index" do
|
||||||
|
visit cart_items_url
|
||||||
|
assert_selector "h1", text: "Cart items"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should create cart item" do
|
||||||
|
visit cart_items_url
|
||||||
|
click_on "New cart item"
|
||||||
|
|
||||||
|
fill_in "Cart", with: @cart_item.cart_id
|
||||||
|
fill_in "Product", with: @cart_item.product_id
|
||||||
|
fill_in "Quantity", with: @cart_item.quantity
|
||||||
|
click_on "Create Cart item"
|
||||||
|
|
||||||
|
assert_text "Cart item was successfully created"
|
||||||
|
click_on "Back"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should update Cart item" do
|
||||||
|
visit cart_item_url(@cart_item)
|
||||||
|
click_on "Edit this cart item", match: :first
|
||||||
|
|
||||||
|
fill_in "Cart", with: @cart_item.cart_id
|
||||||
|
fill_in "Product", with: @cart_item.product_id
|
||||||
|
fill_in "Quantity", with: @cart_item.quantity
|
||||||
|
click_on "Update Cart item"
|
||||||
|
|
||||||
|
assert_text "Cart item was successfully updated"
|
||||||
|
click_on "Back"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should destroy Cart item" do
|
||||||
|
visit cart_item_url(@cart_item)
|
||||||
|
click_on "Destroy this cart item", match: :first
|
||||||
|
|
||||||
|
assert_text "Cart item was successfully destroyed"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
require "application_system_test_case"
|
||||||
|
|
||||||
|
class CartsTest < ApplicationSystemTestCase
|
||||||
|
setup do
|
||||||
|
@cart = carts(:one)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "visiting the index" do
|
||||||
|
visit carts_url
|
||||||
|
assert_selector "h1", text: "Carts"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should create cart" do
|
||||||
|
visit carts_url
|
||||||
|
click_on "New cart"
|
||||||
|
|
||||||
|
click_on "Create Cart"
|
||||||
|
|
||||||
|
assert_text "Cart was successfully created"
|
||||||
|
click_on "Back"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should update Cart" do
|
||||||
|
visit cart_url(@cart)
|
||||||
|
click_on "Edit this cart", match: :first
|
||||||
|
|
||||||
|
click_on "Update Cart"
|
||||||
|
|
||||||
|
assert_text "Cart was successfully updated"
|
||||||
|
click_on "Back"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should destroy Cart" do
|
||||||
|
visit cart_url(@cart)
|
||||||
|
click_on "Destroy this cart", match: :first
|
||||||
|
|
||||||
|
assert_text "Cart was successfully destroyed"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
require "application_system_test_case"
|
||||||
|
|
||||||
|
class ProductsTest < ApplicationSystemTestCase
|
||||||
|
setup do
|
||||||
|
@product = products(:one)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "visiting the index" do
|
||||||
|
visit products_url
|
||||||
|
assert_selector "h1", text: "Products"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should create product" do
|
||||||
|
visit products_url
|
||||||
|
click_on "New product"
|
||||||
|
|
||||||
|
fill_in "Name", with: @product.name
|
||||||
|
fill_in "Price", with: @product.price
|
||||||
|
click_on "Create Product"
|
||||||
|
|
||||||
|
assert_text "Product was successfully created"
|
||||||
|
click_on "Back"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should update Product" do
|
||||||
|
visit product_url(@product)
|
||||||
|
click_on "Edit this product", match: :first
|
||||||
|
|
||||||
|
fill_in "Name", with: @product.name
|
||||||
|
fill_in "Price", with: @product.price
|
||||||
|
click_on "Update Product"
|
||||||
|
|
||||||
|
assert_text "Product was successfully updated"
|
||||||
|
click_on "Back"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "should destroy Product" do
|
||||||
|
visit product_url(@product)
|
||||||
|
click_on "Destroy this product", match: :first
|
||||||
|
|
||||||
|
assert_text "Product was successfully destroyed"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -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,16 @@
|
||||||
|
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"
|
||||||
|
|
@ -0,0 +1,254 @@
|
||||||
|
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
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
# 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).
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
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"
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
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
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue