Commit d68997b9 authored by Miguel Fortuna's avatar Miguel Fortuna

Initial commit

parents
# Prefix for docker images, containers, volumes and networks
COMPOSE_PROJECT_NAME=blog_crud
# What Rails environment are we in?
RAILS_ENV=development
# More details about these Puma variables can be found in config/puma.rb.
# Which address should the Puma app server bind to?
BIND_ON=0.0.0.0:3000
# Puma supports multiple threads but in development mode you'll want to use 1
# thread to ensure that you can properly debug your application.
RAILS_MAX_THREADS=5
# Puma supports multiple workers but you should stick to 1 worker in dev mode.
WEB_CONCURRENCY=1
\ No newline at end of file
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
.bundle
# Ignore the default SQLite database.
db/*.sqlite3
db/*.sqlite3-journal
# Ignore all logfiles and tempfiles.
log/*
tmp/*
!/log/.keep
!/tmp/.keep
# Ignore uploaded files in development
storage/*
node_modules
yarn-error.log
public/assets
.byebug_history
# Ignore master key for decrypting credentials and more.
config/master.key
db/schema.rb
\ No newline at end of file
2.5.1
\ No newline at end of file
FROM ruby:2.5-alpine
#ENV http_proxy http://proxy.admu.edu.ph:3128
#ENV https_proxy http://proxy.admu.edu.ph:3128
RUN apk update && apk add build-base nodejs
RUN apk add --update bash tzdata sqlite sqlite-dev
RUN rm -rf /var/cache/apk/*
RUN mkdir /app
WORKDIR /app
COPY . /app
\ No newline at end of file
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# ruby '2.5.1'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'better_errors'
gem 'binding_of_caller'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15', '< 4.0'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'bootstrap', '~> 4.1.1'
gem 'jquery-rails'
gem 'simple_form'
gem 'devise'
\ No newline at end of file
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.0)
actionpack (= 5.2.0)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.0)
actionview (= 5.2.0)
activesupport (= 5.2.0)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.0)
activesupport (= 5.2.0)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.0)
activesupport (= 5.2.0)
globalid (>= 0.3.6)
activemodel (5.2.0)
activesupport (= 5.2.0)
activerecord (5.2.0)
activemodel (= 5.2.0)
activesupport (= 5.2.0)
arel (>= 9.0)
activestorage (5.2.0)
actionpack (= 5.2.0)
activerecord (= 5.2.0)
marcel (~> 0.3.1)
activesupport (5.2.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
archive-zip (0.11.0)
io-like (~> 0.3.0)
arel (9.0.0)
autoprefixer-rails (8.6.4)
execjs
bcrypt (3.1.12)
bcrypt (3.1.12-x86-mingw32)
better_errors (2.4.0)
coderay (>= 1.0.0)
erubi (>= 1.0.0)
rack (>= 0.9.0)
bindex (0.5.0)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootsnap (1.3.0)
msgpack (~> 1.0)
bootstrap (4.1.1)
autoprefixer-rails (>= 6.0.3)
popper_js (>= 1.12.9, < 2)
sass (>= 3.5.2)
builder (3.2.3)
byebug (10.0.2)
capybara (3.3.1)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
xpath (~> 3.1)
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
chromedriver-helper (1.2.0)
archive-zip (~> 0.10)
nokogiri (~> 1.8)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
crass (1.0.4)
debug_inspector (0.0.3)
devise (4.4.3)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0, < 6.0)
responders
warden (~> 1.2.3)
erubi (1.7.1)
execjs (2.7.0)
ffi (1.9.25)
ffi (1.9.25-x86-mingw32)
globalid (0.4.1)
activesupport (>= 4.2.0)
i18n (1.0.1)
concurrent-ruby (~> 1.0)
io-like (0.3.0)
jbuilder (2.7.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.0)
mini_mime (>= 0.1.1)
marcel (0.3.2)
mimemagic (~> 0.3.2)
method_source (0.9.0)
mimemagic (0.3.2)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
msgpack (1.2.4)
msgpack (1.2.4-x86-mingw32)
multi_json (1.13.1)
nio4r (2.3.1)
nokogiri (1.8.3)
mini_portile2 (~> 2.3.0)
nokogiri (1.8.3-x86-mingw32)
mini_portile2 (~> 2.3.0)
orm_adapter (0.5.0)
popper_js (1.12.9)
public_suffix (3.0.2)
puma (3.11.4)
rack (2.0.5)
rack-test (1.0.0)
rack (>= 1.0, < 3)
rails (5.2.0)
actioncable (= 5.2.0)
actionmailer (= 5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
activemodel (= 5.2.0)
activerecord (= 5.2.0)
activestorage (= 5.2.0)
activesupport (= 5.2.0)
bundler (>= 1.3.0)
railties (= 5.2.0)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.0)
actionpack (= 5.2.0)
activesupport (= 5.2.0)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
responders (2.4.0)
actionpack (>= 4.2.0, < 5.3)
railties (>= 4.2.0, < 5.3)
ruby_dep (1.5.0)
rubyzip (1.2.1)
sass (3.5.6)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
selenium-webdriver (3.13.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
simple_form (4.0.1)
actionpack (>= 5.0)
activemodel (>= 5.0)
spring (2.0.2)
activesupport (>= 4.2)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
spring (>= 1.2, < 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
sqlite3 (1.3.13-x86-mingw32)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.1.1)
turbolinks-source (~> 5.1)
turbolinks-source (5.1.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
tzinfo-data (1.2018.5)
tzinfo (>= 1.0.0)
uglifier (4.1.12)
execjs (>= 0.3.0, < 3)
warden (1.2.7)
rack (>= 1.0)
web-console (3.6.2)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
websocket-driver (0.7.0)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
xpath (3.1.0)
nokogiri (~> 1.8)
PLATFORMS
ruby
x86-mingw32
DEPENDENCIES
better_errors
binding_of_caller
bootsnap (>= 1.1.0)
bootstrap (~> 4.1.1)
byebug
capybara (>= 2.15, < 4.0)
chromedriver-helper
coffee-rails (~> 4.2)
devise
jbuilder (~> 2.5)
jquery-rails
listen (>= 3.0.5, < 3.2)
puma (~> 3.11)
rails (~> 5.2.0)
sass-rails (~> 5.0)
selenium-webdriver
simple_form
spring
spring-watcher-listen (~> 2.0.0)
sqlite3
turbolinks (~> 5)
tzinfo-data
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
BUNDLED WITH
1.16.2
# README
This README would normally document whatever steps are necessary to get the
application up and running.
Things you may want to cover:
* Ruby version
* System dependencies
* Configuration
* Database creation
* Database initialization
* How to run the test suite
* Services (job queues, cache servers, search engines, etc.)
* Deployment instructions
* ...
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative 'config/application'
Rails.application.load_tasks
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= require rails-ujs
//= require turbolinks
//= require jquery3
//= require popper
//= require bootstrap
//= require_tree .
\ No newline at end of file
// Action Cable provides the framework to deal with WebSockets in Rails.
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
//
//= require action_cable
//= require_self
//= require_tree ./channels
(function() {
this.App || (this.App = {});
App.cable = ActionCable.createConsumer();
}).call(this);
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
/*
*= require_tree .
*= require_self
*/
@import "bootstrap";
\ No newline at end of file
// Place all the styles related to the Order controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the Products controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the Publics controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the Supply controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
// Place all the styles related to the Transactions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
class ApplicationController < ActionController::Base
protected
def after_sign_in_path_for(resource)
if resource.is_a?(AdminUser)
authenticated_admin_user_root_url
elsif resource.is_a?(User)
authenticated_user_root_url
end
end
def after_sign_up_path_for(resource)
if resource.is_a?(AdminUser)
authenticated_admin_user_root_url
elsif resource.is_a?(User)
authenticated_user_root_url
end
end
def after_sign_out_path_for(resource)
root_path
end
end
class OrderController < ApplicationController
before_action :authenticate_user!
def index
@products = Products.all
end
def show
end
def new
@product = Product.find_by(id: params[:product_id])
@transaction = @product.transactions.new
end
def create
@product = Product.find_by(id: params[:product_id])
@order = @product.transactions.new(order_params)
@order.user_id = current_user.id
@order.mode = "ORDER"
@order.quantity = @order.quantity
if @product.save
redirect_to authenticated_user_root_path
else
render 'new'
end
end
def edit
end
private
def order_params
params.require(:transaction).permit!
end
class ProductsController < ApplicationController
before_action :authenticate_admin_user!
def index
@product = Product.all
end
def edit
@product = Product.find_by(params[:id])
end
def new
@product = Product.new
end
def create
@product = Product.new(product_params)
if @product.save
redirect_to products_path, notice: 'Product Added!'
else
render 'new'
end
end
def update
@product = Product.find_by(id: params[:id])
if @product.update(product_params)
redirect_to products_path, notice: 'Product Updated!'
else
render 'edit'
end
end
def destroy
@product = Product.find_by(id: params[:id])
@product.destroy
redirect_to products_path, alert: "Product Deleted!"
end
def show
@products = Product.find_by(id: params[:id])
end
private
def product_params
params.require(:product).permit!
end
end
class PublicsController < ApplicationController
def index
end
end
class SupplyController < ApplicationController
before_action :authenticate_user!
def index
end
def show
end
def new
@product = Product.find_by(id: params[:product_id])
@transaction = @product.transactions.new
end
def create
@product = Product.find_by(id: params[:product_id])
@transaction = @product.transactions.new
transaction_quantity = @transaction.supply(transaction_params)
@transaction.user = current_user
if @transaction.save
@product.quantity -= transaction_quantity
@product.quantity_ordered += transaction_quantity
redirect_to transactions_index_path(@product), notice: "Transaction posted"
else
render "new"
end
end
def edit
end
private
def transaction_params
params.require(:transaction).permit!
end
end
class TransactionsController < ApplicationController
def index
@products = Product.all
end
def create
@product = Product.find_by(id: params[:product_id])
@transaction = @product.transactions.new(transaction_params)
@transaction.user = current_user
if @transaction.save
redirect_to root_path, notice: "You have added a new transaction!"
else
render 'new'
end
end
private
def transactions_params
params.require(:transaction).permit!
end
end
module ApplicationHelper
end
module OrderHelper
end
module ProductsHelper
end
module PublicsHelper
end
module SupplyHelper
end
module TransactionsHelper
end
class ApplicationJob < ActiveJob::Base
end
class ApplicationMailer < ActionMailer::Base
default from: 'from@example.com'
layout 'mailer'
end
class AdminUser < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :products
end
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
class Product < ApplicationRecord
has_many :transactions
belongs_to :admin_user
end
class Transaction < ApplicationRecord
belongs_to :user
belongs_to :product
end
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :transactions
def to_s
if first_name && last_name
"#{first_name} #{last_name}"
else
email
end
end
end
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Inventory Management System</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<%= link_to "Home", root_path, class: "navbar-brand" %>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
</ul>
<span class="navbar-text">
<% if user_signed_in? %>
Logged in as <strong><%= current_user.email %></strong>.
<%= link_to 'Edit Profile', edit_user_registration_path, :class => 'navbar-link' %> |
<%= link_to "Logout", destroy_user_session_path, method: :delete, :class => 'navbar-link' %>
<% end %>
<% if admin_user_signed_in? %>
Logged in as <strong><%= current_admin_user.email %></strong>.
<%= link_to 'Edit Profile', edit_admin_user_registration_path, :class => 'navbar-link' %> |
<%= link_to "Logout", destroy_admin_user_session_path, method: :delete, :class => 'navbar-link' %>
<% end %>
</span>
</div>
</nav>
<br>
<div class="container">
<% if notice %>
<p class="alert alert-success"><%= notice %></p>
<% end %>
<% if alert %>
<p class="alert alert-danger"><%= alert %></p>
<% end %>
<%= yield %>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%= yield %>
</body>
</html>
<h1>Order#edit</h1>
<p>Find me in app/views/order/edit.html.erb</p>
<h1>Order#index</h1>
<p>Find me in app/views/order/index.html.erb</p>
<h3 style="text-align: center">Add Order</h3>
Order for <%= @product.name %>
<%= simple_form_for([@product, @transaction]) do |prod| %>
<% order = 0 %>
<% supply = 0 %>
<% @product.transactions.each do |prod| %>
<% case f.status %>
<% when "ORDER" %>
<% order += prod.quantity %>
<% when "SUPPLY" %>
<% supply += prod.quantity %>
<% end %>
<% end %>
<% currinv = supply - order %>
<%= prod.input :quantity, required: true, input_html: {min: 1, max: current}%> <!-- Quick fix. Just use arrow keys for now. -->
<%= prod.input :status, input_html: {value: "ORDER"}, :readonly => true %>
<%= prod.button :submit, "Add Order", class: "btn btn-outline-primary" %>
<%= link_to "Back", transactions_index_path, class: "btn btn-primary", class: "btn btn-outline-danger" %>
<% end %>
<h1>Order#show</h1>
<p>Find me in app/views/order/show.html.erb</p>
<h1>Edit Product</h1>
<%= simple_form_for @product do |p| %>
<%= p.input :name %>
<%= p.input :description %>
<br>
<%= f.button :submit, "Edit Product", class: "btn btn-outline-primary" %>
<%= link_to "Back", products_path, class: "btn btn-outline-danger" %>
<% end %>
\ No newline at end of file
<div class="jumbotron jumbotron-fluid" style="border: 5px solid black; border-width: 3px; background-color: white">
<div class="container">
<h1 class="display-6" style="text-align: center">Product</h1>
<br>
<p class="lead" style="color: black; text-align: center"><span style="border-bottom: 5px solid black; border-width: thin">These are your products <br> <br>Refresh page to see if users are making orders and/or adding supplies</span></p>
</div>
</div>
<div>
<%= link_to "New Product", new_product_path, class: "btn btn-primary" %>
</div>
<br>
<table class="table">
<thead>
<th>Product</th>
<th>Description</th>
<th>Status</th>
<th>Time Added</th>
<th>Supplies</th>
<th>Orders</th>
<th>Inventory</th>
<th colspan="3"></th>
</thead>
<tbody>
<% @product.each do |product| %>
<tr>
<td><%= @product.name %></td>
<td><%= @product.description %></td>
<td><span class="badge badge-primary">Active</span></td>
<td><%= time_ago_in_words(product.created_at) %> ago</td>
<td>
<% @supplies = 0 %>
<% product.transactions.each do |t| %>
<% if t.mode == "SUPPLY" %>
<% @supplies += t.quantity %>
<% else %>
<% end %>
<% end %>
<%= @supplies %>
</td>
<td>
<% @orders = 0 %>
<% product.transactions.each do |t| %>
<% if t.mode == "ORDER" %>
<% @orders += t.quantity %>
<% else %>
<% end %>
<% end %>
<%= "(#{@orders.abs})" %>
</td>
<td>
<% @inventory = 0 %>
<% product.transactions.each do |t| %>
<% @inventory += transactions.quantity %>
<% end %>
<%= @inventory %>
</td>
<td><%= link_to "Edit", edit_product_path(product), class: "btn btn-outline-primary" %></td>
<td><%= link_to "View", show_product_path(product), class: "btn btn-outline-info" %></td>
<td><%= link_to "Delete", product_path(product), method: :delete %></td>
</tr>
<% end %>
</tbody>
</table>
<br><br><br><br><br><br><br><br>
<body style="background-color: black">
<div class="jumbotron jumbotron-fluid" style="background-color: black; border: 3px solid white">
<div class="container">
<h1 class="display-6" style="text-align: center; color: white">Add New Product</h1>
<br>
<p class="lead" style="color: black; text-align: center; color: white"><span style="border-bottom: 2px solid white">Product is automatically made active<br><br> Users can make orders and/or add supplies to your products upon logging in. </span></p>
</div>
</div>
<%= simple_form_for @product do |p| %>
<span style="color: white"><%= p.input :name %></span>
<span style="color: white"><%= p.input :description %></span>
<span style="color: white">Status:</span> <span class="badge badge-primary", style="font-size: 16px">Active</span>
<br>
<br>
<%= p.submit 'Add Product', class: "btn btn-outline-primary" %>
<%= link_to "Back", products_path, class: "btn btn-outline-danger" %>
<% end %>
</body>
<br>
<br>
<br>
<br>
<h1>Product #<%= @product.name %></h1>
<h2>Transactions</h2>
<table class="table">
<thead>
<th>Time Posted</th>
<th>Mode</th>
<th>Quantity</th>
<th>Posted By</th>
</thead>
<tbody>
<% @product.transactions.each do |trans| %>
<tr>
<td>
<%= time_ago_in_words(@product.created_at) %>
</td>
<td>
<%= trans.mode %>
</td>
<td>
<%= trans.quantity %>
</td>
<td>
<%= trans.user %>
</td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to "Back", products_path, class: "btn btn-outline-danger" %>
<body style="background-color: black">
<div class="jumbotron jumbotron-fluid" style="background-color: black">
<div class="container">
<h1 class="display-6" style="text-align: center; color: white">Inventory Management System</h1>
<br>
<p class="lead" style="color: black; text-align: center; color: white">This IMS allows the admin user to add, edit, and delete products whenever he/she wishes to do so. <br> It also allows users to make orders and add supplies to whichever product he/she chooses.</p>
</div>
</div>
<div class="row">
<div class="col">
<h3 style="color: white">Admin Log-In</h3>
<p style="color: white">Only the Admin User may log-in.</p>
<%= simple_form_for :admin_user, url: session_path(:admin_user) do |f| %>
<span style="color: white"><%= f.input :email %></span>
<span style="color: white"><%= f.input :password %></span>
<%= f.button :submit, "Log-In", class: "btn btn-outline-primary" %>
<% end %>
</div>
<div class="col">
<h3 style="color: white">User Log-In</h3>
<p style="color: white">Sign-up for first-time users.</p>
<%= simple_form_for :user, url: session_path(:user) do |f| %>
<span style="color: white"><%= f.input :email %></span>
<span style="color: white"><%= f.input :password %></span>
<%= f.button :submit, "Log-In", class: "btn btn-outline-primary" %>
<%= link_to "Sign-Up", new_registration_path(:user), class: "btn btn-outline-primary" %>
<% end %>
</div>
</div>
</body>
<br>
<br>
<br>
<br><br><br>
<h1>Supply#edit</h1>
<p>Find me in app/views/supply/edit.html.erb</p>
<h1>Supply#index</h1>
<p>Find me in app/views/supply/index.html.erb</p>
<h1 style="text-align: center">Add Supply</h1>
Supply for <%= @product.name %>
<%= simple_form_for([@product, @transaction]) do |prod| %>
<%= prod.input :quantity, required: true %>
<%= prod.input :status, input_html: {value: "SUPPLY"}, :readonly => true %>
<%= prod.button :submit, "Add Supply", class: "btn btn-outline-primary" %>
<%= link_to "Back", transactions_index_path, class: "btn btn-outline-danger" %>
<% end %>
<h1>Supply#show</h1>
<p>Find me in app/views/supply/show.html.erb</p>
<h1 style="margin:30px;">Products</h1>
<% if @products.empty? %>
<small>
Admin has not added any products.
</small>
<% else %>
<div style="display: flex!important;flex-wrap: wrap; ">
<% @products.each do |product|%>
<!-- er to do tags w/o equals. -->
<!-- pe with. -->
<% if product.status == "ACTIVE" %>
<div style=" width: 250px; min-height: 200px; padding:10px; margin: 20px; -webkit-box-shadow: 0px 0px 52px -1px rgba(0,0,0,0.75); -moz-box-shadow: 0px 0px 52px -1px rgba(0,0,0,0.75); box-shadow: 0px 0px 52px -1px rgba(0,0,0,0.75);">
<div style="width: 100%; height: 150px; background: #004e7e; display: flex; justify-content: center; align-items: middle;">
<div style="margin: auto; color: white; font-size: 1.3em">
<%= product.name %>
</div>
</div>
<div style="font-size: 1.4em; font-weight: 600;">
<%= product.name %>
</div>
<div>
<%= product.description %>
</div>
<% order = 0 %>
<% supply = 0 %>
<% product.transactions.each do |prod| %>
<% case prod.status %>
<% when "ORDER" %>
<% order += prod.quantity %>
<% when "SUPPLY" %>
<% supply += prod.quantity %>
<% end %>
<% end %>
<% currinv = supply - order %>
<div>
Inventory: <span style="font-size: 1.2em"><%= current %></span>
</div>
<div style="display: flex; justify-content: space-around; width: 100%;">
<%= link_to "Add Order", new_product_order_path(product), {:style=>' border:solid 1px; padding: 3px 10px; background:#004e7e; color:white; border:0px width:50px; '} %>
<%= link_to "Add Supply", new_product_supply_path(product), {:style=>' border:solid 1px; padding: 3px 10px; background:#004e7e; color:white; border:0px width:50%; '} %>
<br>
</div>
<% end %>
<% end %>
</div>
<% end %>
<h2>Resend confirmation instructions</h2>
<%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
<%= f.error_notification %>
<%= f.full_error :confirmation_token %>
<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Resend confirmation instructions" %>
</div>
<% end %>
<%= render "users/shared/links" %>
<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>
<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 %>
<p>Hello <%= @resource.email %>!</p>
<p>We're contacting you to notify you that your password has been changed.</p>
<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>
<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>
<h2>Change your password</h2>
<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<%= f.error_notification %>
<%= f.input :reset_password_token, as: :hidden %>
<%= f.full_error :reset_password_token %>
<div class="form-inputs">
<%= f.input :password, label: "New password", required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
<%= f.input :password_confirmation, label: "Confirm your new password", required: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Change my password" %>
</div>
<% end %>
<%= render "users/shared/links" %>
<h2>Forgot your password?</h2>
<%= simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Send me reset password instructions" %>
</div>
<% end %>
<%= render "users/shared/links" %>
<body style="background-color: black">
<h2 style="color: white; text-align: center">Edit <%= resource_name.to_s.humanize %></h2>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<span style="color: white"><%= f.input :email, required: true, autofocus: true %></span>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<p>Currently waiting confirmation for: <%= resource.unconfirmed_email %></p>
<% end %>
<span style="color: white"><%= f.input :password, autocomplete: "off", hint: "Leave it blank if you don't want to change it.", required: false %></span>
<span style="color: white"><%= f.input :password_confirmation, required: false %></span>
<span style="color: white"><%= f.input :current_password, hint: "We need your current password to confirm your changes.", required: true %></span>
</div>
<div class="form-actions">
<%= f.button :submit, "Update", class: "btn btn-outline-primary" %>
</div>
<% end %>
<br>
<h3 style="color: red">Cancel Account: Unhappy?</h3>
<%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-outline-danger" %></p>
<%= link_to "Back", :back, class: "btn btn-outline-primary" %>
</body>
<br>
<br>
<br><br><br>
\ No newline at end of file
<body style="background-color: black">
<h2 style="color: white">Sign up</h2>
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<span style="color: white"><%= f.input :email, required: true, autofocus: true %></span>
<span style="color: white"><%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
<span style="color: white"><%= f.input :password_confirmation, required: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Sign up", class: "btn btn-outline-success" %>
</div>
<% end %>
<br>
<%= render "users/shared/links" %>
</body>
<body style="background-color: black">
<h2 style="color: white">Log in</h2>
<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<div class="form-inputs">
<span style="color: white"><%= f.input :email, required: false, autofocus: true %></span>
<span style="color: white"><%= f.input :password, required: false %></span>
<span style="color: white"><%= f.input :remember_me, as: :boolean if devise_mapping.rememberable? %></span>
</div>
<div class="form-actions">
<%= f.button :submit, "Log in", class: "btn btn-outline-primary" %>
</div>
<% end %>
<br>
<%= render "users/shared/links" %>
</body>
<%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name), class: "btn btn-outline-primary" %><br />
<% end -%>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name), class: "btn btn-outline-success" %><br />
<% end -%>
<br>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name), class: "btn btn-outline-danger" %><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| %>
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
<% end -%>
<% end -%>
<h2>Resend unlock instructions</h2>
<%= simple_form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
<%= f.error_notification %>
<%= f.full_error :unlock_token %>
<div class="form-inputs">
<%= f.input :email, required: true, autofocus: true %>
</div>
<div class="form-actions">
<%= f.button :submit, "Resend unlock instructions" %>
</div>
<% end %>
<%= render "users/shared/links" %>
#!/usr/bin/env ruby
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
load Gem.bin_path('bundler', 'bundle')
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
#!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Rake.application.run
#!/usr/bin/env ruby
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a starting point to setup your application.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Preparing database =="
system! 'bin/rails db:setup'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end
#!/usr/bin/env ruby
# This file loads spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
unless defined?(Spring)
require 'rubygems'
require 'bundler'
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
spring = lockfile.specs.detect { |spec| spec.name == "spring" }
if spring
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version
require 'spring/binstub'
end
end
#!/usr/bin/env ruby
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
# Install JavaScript dependencies if using Yarn
# system('bin/yarn')
puts "\n== Updating database =="
system! 'bin/rails db:migrate'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end
#!/usr/bin/env ruby
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
begin
exec "yarnpkg", *ARGV
rescue Errno::ENOENT
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1
end
end
# This file is used by Rack-based servers to start the application.
require_relative 'config/environment'
run Rails.application
require_relative 'boot'
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module App
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
end
end
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
channel_prefix: app_production
YdroL6b7BXO+umtTiD20vBHVEaHG09S2GhbMImrRPWHURuVlv0/1IB8ftFOUgfjibRLD2M7iHLws83XnbEypzuoDBTDSOlAiwEDJbw9fJJ8USsbF+wHmqzLo0MYbzHbZ0aWE3hhOrT9Zp7+XUgTieYt1mlXr8EByWcOmG2XN2mGj2tu41YxUmnyC6IZNYOGHKLcUG0Sv6B1qtig//kO4rwbZgRIU4EC+EP6RDGXQtENxx2BQoSgb9d9ycsMn6tbPifXj4RFl/8qPXgVv0fIfgqSc56mYvtraLa2g2/OIiYN5jqegpZ/280a4/SDUEuBm9tpbV9F+QD5GXb5Pwt7CzXTTvWsfdkvixGyj+dyUwHTfBbUQvgJwLrCM6ZL0R6vaS9jMX8uihssjpR9MUSFUCW4YxR8n3majzKaI--0DWYsKZLa1w70Rwi--6npSqgx0sulaPhWrLAdnPg==
\ No newline at end of file
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
# Load the Rails application.
require_relative 'application'
# Initialize the Rails application.
Rails.application.initialize!
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Highlight code that triggered database queries in logs.
config.active_record.verbose_query_logs = true
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
# config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options)
config.active_storage.service = :local
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "app_#{Rails.env}"
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
# Store uploaded files on the local file system in a temporary directory
config.active_storage.service = :test
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
# Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
if Rails.env.development?
BetterErrors::Middleware.allow_ip! "0.0.0.0/0"
end
\ No newline at end of file
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy
# For further information see the following documentation
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
# Rails.application.config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Report CSP violations to a specified URI
# For further information see the following documentation:
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
# Rails.application.config.content_security_policy_report_only = true
# Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment