Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MIS21_Final_Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chanelle Lunod
MIS21_Final_Project
Commits
a53e92a3
Commit
a53e92a3
authored
Jul 14, 2018
by
Chanelle Lunod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parent
7f2ca038
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
328 additions
and
79 deletions
+328
-79
Gemfile.lock
Gemfile.lock
+0
-3
transactions.coffee
app/assets/javascripts/transactions.coffee
+3
-0
transactions.scss
app/assets/stylesheets/transactions.scss
+3
-0
application_controller.rb
app/controllers/application_controller.rb
+22
-16
products_controller.rb
app/controllers/products_controller.rb
+5
-9
transactions_controller.rb
app/controllers/transactions_controller.rb
+10
-0
transactions_helper.rb
app/helpers/transactions_helper.rb
+2
-0
admin_user.rb
app/models/admin_user.rb
+1
-2
product.rb
app/models/product.rb
+1
-0
user.rb
app/models/user.rb
+11
-0
new.html.erb
app/views/admin_users/confirmations/new.html.erb
+16
-0
confirmation_instructions.html.erb
...ews/admin_users/mailer/confirmation_instructions.html.erb
+5
-0
email_changed.html.erb
app/views/admin_users/mailer/email_changed.html.erb
+7
-0
password_change.html.erb
app/views/admin_users/mailer/password_change.html.erb
+3
-0
reset_password_instructions.html.erb
...s/admin_users/mailer/reset_password_instructions.html.erb
+8
-0
unlock_instructions.html.erb
app/views/admin_users/mailer/unlock_instructions.html.erb
+7
-0
edit.html.erb
app/views/admin_users/passwords/edit.html.erb
+19
-0
new.html.erb
app/views/admin_users/passwords/new.html.erb
+15
-0
edit.html.erb
app/views/admin_users/registrations/edit.html.erb
+27
-0
new.html.erb
app/views/admin_users/registrations/new.html.erb
+17
-0
new.html.erb
app/views/admin_users/sessions/new.html.erb
+15
-0
_links.html.erb
app/views/admin_users/shared/_links.html.erb
+25
-0
new.html.erb
app/views/admin_users/unlocks/new.html.erb
+16
-0
application.html.erb
app/views/layouts/application.html.erb
+6
-5
edit.html.erb
app/views/products/edit.html.erb
+1
-1
index.html.erb
app/views/products/index.html.erb
+3
-8
new.html.erb
app/views/products/new.html.erb
+2
-3
show.html.erb
app/views/products/show.html.erb
+16
-9
index.html.erb
app/views/publics/index.html.erb
+17
-8
index.html.erb
app/views/transactions/index.html.erb
+2
-0
routes.rb
config/routes.rb
+20
-8
seeds.rb
db/seeds.rb
+14
-7
transactions_controller_test.rb
test/controllers/transactions_controller_test.rb
+9
-0
No files found.
Gemfile.lock
View file @
a53e92a3
...
...
@@ -254,8 +254,5 @@ DEPENDENCIES
uglifier (>= 1.3.0)
web-console (>= 3.3.0)
RUBY VERSION
ruby 2.3.3p222
BUNDLED WITH
1.14.6
app/assets/javascripts/transactions.coffee
0 → 100644
View file @
a53e92a3
# 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/
app/assets/stylesheets/transactions.scss
0 → 100644
View file @
a53e92a3
// 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/
app/controllers/application_controller.rb
View file @
a53e92a3
class
ApplicationController
<
ActionController
::
Base
protected
def
after_sign_in_path_for
(
resource
)
#
if resource.is_a?(AdminUser)
# # Go to this page
#
elsif resource.is_a?(User)
# # Go to this page instead
#
end
authenticated_root_url
end
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
#
authenticated_root_url
end
def
after_sign_up_path_for
(
resource
)
authenticated_root_url
end
def
after_sign_up_path_for
(
resource
)
authenticated_root_url
end
def
after_sign_out_path_for
(
resource
)
unauthenticated_root_url
end
end
def
after_sign_out_path_for
(
resource
)
if
resource
==
:user
new_user_session_path
elsif
resource
==
:admin_user
new_admin_user_session_path
else
root_path
end
end
end
\ No newline at end of file
app/controllers/products_controller.rb
View file @
a53e92a3
class
ProductsController
<
ApplicationController
before_action
:authenticate_user!
before_action
:authenticate_
admin_
user!
def
index
@products
=
Product
.
all
#if @product.status == active
#else
end
def
show
...
...
@@ -17,7 +19,7 @@ class ProductsController < ApplicationController
@product
=
Product
.
new
(
product_params
)
if
@product
.
save
redirect_to
products_path
,
notice:
"You have successfully created a new product
.
"
redirect_to
products_path
,
notice:
"You have successfully created a new product
!
"
else
render
'new'
end
...
...
@@ -31,18 +33,12 @@ class ProductsController < ApplicationController
@product
=
Product
.
find_by
(
id:
params
[
:id
])
if
@product
.
update
(
product_params
)
redirect_to
products_path
,
notice:
"
Product
updated!"
redirect_to
products_path
,
notice:
"
#{
@product
.
name
}
has been
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
private
def
product_params
params
.
require
(
:product
).
permit!
...
...
app/controllers/transactions_controller.rb
0 → 100644
View file @
a53e92a3
class
TransactionsController
<
ApplicationController
before_action
:authenticate_user!
def
index
end
def
show
end
end
app/helpers/transactions_helper.rb
0 → 100644
View file @
a53e92a3
module
TransactionsHelper
end
app/models/admin_user.rb
View file @
a53e92a3
class
AdminUser
<
ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise
:database_authenticatable
,
:recoverable
,
:rememberable
,
:trackable
,
:validatable
devise
:database_authenticatable
,
:recoverable
,
:rememberable
,
:trackable
,
:validatable
end
app/models/product.rb
View file @
a53e92a3
class
Product
<
ApplicationRecord
has_many
:transactions
end
app/models/user.rb
View file @
a53e92a3
...
...
@@ -3,4 +3,15 @@ class User < ApplicationRecord
# :confirmable, :lockable, :timeoutable and :omniauthable
devise
:database_authenticatable
,
:registerable
,
:recoverable
,
:rememberable
,
:trackable
,
:validatable
# has_many :transactions
# has_many :comments
# def to_s
# if first_name && last_name
# "#{first_name} #{last_name}"
# else
# email
# end
# end
end
app/views/admin_users/confirmations/new.html.erb
0 → 100644
View file @
a53e92a3
<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
"admin_users/shared/links"
%>
app/views/admin_users/mailer/confirmation_instructions.html.erb
0 → 100644
View file @
a53e92a3
<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>
app/views/admin_users/mailer/email_changed.html.erb
0 → 100644
View file @
a53e92a3
<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
%>
app/views/admin_users/mailer/password_change.html.erb
0 → 100644
View file @
a53e92a3
<p>
Hello
<%=
@resource
.
email
%>
!
</p>
<p>
We're contacting you to notify you that your password has been changed.
</p>
app/views/admin_users/mailer/reset_password_instructions.html.erb
0 → 100644
View file @
a53e92a3
<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>
app/views/admin_users/mailer/unlock_instructions.html.erb
0 → 100644
View file @
a53e92a3
<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>
app/views/admin_users/passwords/edit.html.erb
0 → 100644
View file @
a53e92a3
<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
"admin_users/shared/links"
%>
app/views/admin_users/passwords/new.html.erb
0 → 100644
View file @
a53e92a3
<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
"admin_users/shared/links"
%>
app/views/admin_users/registrations/edit.html.erb
0 → 100644
View file @
a53e92a3
<h2>
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"
>
<%=
f
.
input
:email
,
required:
true
,
autofocus:
true
%>
<%
if
devise_mapping
.
confirmable?
&&
resource
.
pending_reconfirmation?
%>
<p>
Currently waiting confirmation for:
<%=
resource
.
unconfirmed_email
%>
</p>
<%
end
%>
<%=
f
.
input
:password
,
autocomplete:
"off"
,
hint:
"leave it blank if you don't want to change it"
,
required:
false
%>
<%=
f
.
input
:password_confirmation
,
required:
false
%>
<%=
f
.
input
:current_password
,
hint:
"we need your current password to confirm your changes"
,
required:
true
%>
</div>
<div
class=
"form-actions"
>
<%=
f
.
button
:submit
,
"Update"
%>
</div>
<%
end
%>
<h3>
Cancel my account
</h3>
<p>
Unhappy?
<%=
link_to
"Cancel my account"
,
registration_path
(
resource_name
),
data:
{
confirm:
"Are you sure?"
},
method: :delete
%>
</p>
<%=
link_to
"Back"
,
:back
%>
app/views/admin_users/registrations/new.html.erb
0 → 100644
View file @
a53e92a3
<h2>
Sign up
</h2>
<%=
simple_form_for
(
resource
,
as:
resource_name
,
url:
registration_path
(
resource_name
))
do
|
f
|
%>
<%=
f
.
error_notification
%>
<div
class=
"form-inputs"
>
<%=
f
.
input
:email
,
required:
true
,
autofocus:
true
%>
<%=
f
.
input
:password
,
required:
true
,
hint:
(
"
#{
@minimum_password_length
}
characters minimum"
if
@minimum_password_length
)
%>
<%=
f
.
input
:password_confirmation
,
required:
true
%>
</div>
<div
class=
"form-actions"
>
<%=
f
.
button
:submit
,
"Sign up"
%>
</div>
<%
end
%>
<%=
render
"admin_users/shared/links"
%>
app/views/admin_users/sessions/new.html.erb
0 → 100644
View file @
a53e92a3
<h2>
Log in
</h2>
<%=
simple_form_for
(
resource
,
as:
resource_name
,
url:
session_path
(
resource_name
))
do
|
f
|
%>
<div
class=
"form-inputs"
>
<%=
f
.
input
:email
,
required:
false
,
autofocus:
true
%>
<%=
f
.
input
:password
,
required:
false
%>
<%=
f
.
input
:remember_me
,
as: :boolean
if
devise_mapping
.
rememberable?
%>
</div>
<div
class=
"form-actions"
>
<%=
f
.
button
:submit
,
"Log in"
%>
</div>
<%
end
%>
<%=
render
"admin_users/shared/links"
%>
app/views/admin_users/shared/_links.html.erb
0 → 100644
View file @
a53e92a3
<%-
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
|
%>
<%=
link_to
"Sign in with
#{
OmniAuth
::
Utils
.
camelize
(
provider
)
}
"
,
omniauth_authorize_path
(
resource_name
,
provider
)
%>
<br
/>
<%
end
-%>
<%
end
-%>
app/views/admin_users/unlocks/new.html.erb
0 → 100644
View file @
a53e92a3
<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
"admin_users/shared/links"
%>
app/views/layouts/application.html.erb
View file @
a53e92a3
...
...
@@ -13,7 +13,7 @@
<body>
<nav
class=
"navbar navbar-expand-lg navbar-light bg-light"
>
<%=
link_to
"
Products
"
,
root_path
,
class:
"navbar-brand"
%>
<%=
link_to
"
Main
"
,
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>
...
...
@@ -24,16 +24,17 @@
<span
class=
"navbar-text"
>
<%
if
user_signed_in?
%>
Logged in as
<strong>
<%=
current_user
.
email
%>
</strong>
.
<%=
link_to
'Edit
p
rofile'
,
edit_user_registration_path
,
:class
=>
'navbar-link'
%>
|
<%=
link_to
'Edit
P
rofile'
,
edit_user_registration_path
,
:class
=>
'navbar-link'
%>
|
<%=
link_to
"Logout"
,
destroy_user_session_path
,
method: :delete
,
:class
=>
'navbar-link'
%>
<%
else
%>
<%=
link_to
"Sign up"
,
new_user_registration_path
,
:class
=>
'navbar-link'
%>
|
<%=
link_to
"Login"
,
new_user_session_path
,
:class
=>
'navbar-link'
%>
<%
elsif
admin_user_signed_in?
%>
<%=
link_to
"Logout"
,
destroy_admin_user_session_path
,
method: :delete
,
:class
=>
'navbar-link'
%>
<%
end
%>
</span>
</div>
</nav>
<div
class=
"container"
id=
"container"
>
<%
if
notice
%>
<p
class=
"alert alert-success"
>
<%=
notice
%>
</p>
...
...
app/views/products/edit.html.erb
View file @
a53e92a3
...
...
@@ -3,7 +3,7 @@
<%=
simple_form_for
@product
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
input
:description
,
as: :text
%>
<%=
f
.
input
:status
,
as: :radio_buttons
,
collection:
[[
'A
CTIVE'
],
[
'INACTIVE'
]],
label_method: :first
%>
<%=
f
.
input
:status
,
as: :radio_buttons
,
collection:
[[
'A
ctive'
,
'Active'
],
[
'Inactive'
,
'Inactive'
]],
value_method: :first
,
label_method: :second
%>
<%=
f
.
button
:submit
,
"Save"
,
class:
"btn btn-primary"
%>
<%=
link_to
"Back"
,
products_path
,
class:
"btn btn-default"
%>
<%
end
%>
app/views/products/index.html.erb
View file @
a53e92a3
<h1>
Products
</h1>
<h1>
Inventory System
</h1>
<div>
<%=
link_to
"Create new product"
,
new_product_path
,
class:
"btn btn-primary"
%>
...
...
@@ -16,13 +16,14 @@
<th>
Name
</th>
<th>
Description
</th>
<th>
Status
</th>
<th>
Time Created
</th>
<th
colspan=
"4"
></th>
</thead>
<tbody>
<%
@products
.
each
do
|
product
|
%>
<tr>
<td>
<%=
product
.
name
%>
<%=
link_to
product
.
name
,
product_path
(
product
)
%>
</td>
<td>
<%=
product
.
description
%>
...
...
@@ -36,12 +37,6 @@
<td>
<%=
link_to
"Edit"
,
edit_product_path
(
product
),
class:
"btn btn-primary"
%>
</td>
<td>
<%=
link_to
"Delete"
,
product_path
(
product
),
method: :delete
,
class:
"btn btn-danger"
,
data:
{
confirm:
"Are you sure?"
}
%>
</td>
<td>
<%=
link_to
"View"
,
product_path
(
product
)
%>
</td>
</tr>
<%
end
%>
</tbody>
...
...
app/views/products/new.html.erb
View file @
a53e92a3
...
...
@@ -2,9 +2,8 @@
<%=
simple_form_for
@product
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
input
:description
%>
<%=
f
.
radio_button
:status
,
'ACTIVE'
%>
<%=
f
.
radio_button
:status
,
'INACTIVE'
%>
<%=
f
.
input
:description
,
as: :text
%>
<%=
f
.
input
:status
,
as: :radio_buttons
,
collection:
[[
'Active'
,
'Active'
],
[
'Inactive'
,
'Inactive'
]],
value_method: :first
,
label_method: :second
%>
<%=
f
.
button
:submit
,
"Create Product"
,
class:
"btn btn-primary"
%>
<%=
link_to
"Back"
,
products_path
,
class:
"btn btn-default"
%>
<%
end
%>
app/views/products/show.html.erb
View file @
a53e92a3
<h1>
Product #
<%=
@product
.
id
%>
</h1>
<h2>
<%=
@product
.
name
%>
</h2>
<h1>
<%=
@product
.
name
%>
</h1>
<p>
<%=
@product
.
description
%>
</p>
<small>
<p>
Status:
<%=
@product
.
status
%>
</p>
<p>
<small>
Created At:
<%=
@product
.
created_at
.
to_s
:short
%>
</small>
<small>
</small>
<small>
Updated At:
<%=
@product
.
updated_at
.
to_s
:long
%>
</small>
</small>
</p>
<p>
<%=
link_to
"Back"
,
products_path
%>
</p>
<%=
link_to
"Back"
,
products_path
%>
app/views/publics/index.html.erb
View file @
a53e92a3
<div
class=
"row"
>
<div
class=
"col"
>
<h3>
Sign Up
</h3>
<%=
simple_form_for
:user
,
url:
registration_path
(
:
user
)
do
|
f
|
%>
<%=
f
.
input
:email
%>
<%=
f
.
input
:password
%>
<%=
f
.
input
:password_confirmation
%>
<%=
f
.
button
:submit
,
"Sign Up
"
%>
<%
end
%>
<h3>
Admin User Log In
</h3>
<%=
simple_form_for
:admin_user
,
url:
session_path
(
:admin_
user
)
do
|
f
|
%>
<%=
f
.
input
:email
%>
<%=
f
.
input
:password
%>
<%=
f
.
input
:password_confirmation
%>
<%=
f
.
button
:submit
,
"Log In
"
%>
<%
end
%>
</div>
<div
class=
"col"
>
<h3>
Log In
</h3>
<h3>
User
Log In
</h3>
<%=
simple_form_for
:user
,
url:
session_path
(
:user
)
do
|
f
|
%>
<%=
f
.
input
:email
%>
<%=
f
.
input
:password
%>
<%=
f
.
input
:password_confirmation
%>
<%=
f
.
button
:submit
,
"Log In"
%>
<%=
link_to
"Sign Up"
,
new_user_registration_path
,
:class
=>
'navbar-link'
%>
<%
end
%>
</div>
</div>
app/views/transactions/index.html.erb
0 → 100644
View file @
a53e92a3
<h1>
Transactions#index
</h1>
<p>
Find me in app/views/transactions/index.html.erb
</p>
config/routes.rb
View file @
a53e92a3
Rails
.
application
.
routes
.
draw
do
devise_for
:admin_users
devise_scope
:admin_user
do
authenticated
:admin_user
do
resources
:products
root
to:
'products#index'
,
as: :authenticated_admin_user_root
end
unauthenticated
:admin_user
do
root
to:
'publics#index'
,
as: :unauthenticated_admin_user_root
end
end
devise_for
:users
#devise_for :admin_users, path: 'admin_users', skip: :registrations
devise_scope
:user
do
authenticated
:user
do
resources
:products
root
to:
'products#index'
,
as: :authenticated_root
end
unauthenticated
:user
do
root
to:
'publics#index'
,
as: :unauthenticated_root
authenticated
:user
do
resources
:products
,
only:
[]
do
resources
:orders
,
only:
[
:new
,
:create
]
resources
:supplies
,
only:
[
:new
,
:create
]
end
root
to:
'transactions#index'
,
as: :authenticated_user_root
end
unauthenticated
:user
do
root
to:
'publics#index'
,
as: :unauthenticated_user_root
end
end
root
to:
'publics#index'
end
db/seeds.rb
View file @
a53e92a3
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Character.create(name: 'Luke', movie: movies.first)
if
AdminUser
.
count
==
0
AdminUser
.
create!
({
email:
'andrea.dolendo@obf.ateneo.edu'
,
password:
'Andrea25'
,
password_confirmation
:'Andrea25'
})
end
if
AdminUser
.
valid?
admin
.
save
()
# email: 'chanelle.lunod@obf.ateneo.edu',
# password: 'December5',
# password_confirmation:'December5'
\ No newline at end of file
test/controllers/transactions_controller_test.rb
0 → 100644
View file @
a53e92a3
require
'test_helper'
class
TransactionsControllerTest
<
ActionDispatch
::
IntegrationTest
test
"should get index"
do
get
transactions_index_url
assert_response
:success
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment