Second Commit
This commit is contained in:
2
app/assets/config/manifest.js
Normal file
2
app/assets/config/manifest.js
Normal file
@@ -0,0 +1,2 @@
|
||||
//= link_tree ../images
|
||||
//= link_directory ../stylesheets .css
|
||||
0
app/assets/images/.keep
Normal file
0
app/assets/images/.keep
Normal file
BIN
app/assets/images/img1.jpg
Normal file
BIN
app/assets/images/img1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 402 KiB |
BIN
app/assets/images/img2.jpg
Normal file
BIN
app/assets/images/img2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 194 KiB |
BIN
app/assets/images/img3.jpg
Normal file
BIN
app/assets/images/img3.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 194 KiB |
BIN
app/assets/images/img4.jpg
Normal file
BIN
app/assets/images/img4.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
3
app/assets/stylesheets/admin/books.scss
Normal file
3
app/assets/stylesheets/admin/books.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the admin/books controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: https://sass-lang.com/
|
||||
17
app/assets/stylesheets/application.css
Normal file
17
app/assets/stylesheets/application.css
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
||||
* listed below.
|
||||
*
|
||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
|
||||
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
||||
*
|
||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
||||
* It is generally better to create a new file per style scope.
|
||||
*
|
||||
*= require bootstrap
|
||||
*= require_tree .
|
||||
*= require_self
|
||||
*/
|
||||
|
||||
3
app/assets/stylesheets/books.scss
Normal file
3
app/assets/stylesheets/books.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the books controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: https://sass-lang.com/
|
||||
3
app/assets/stylesheets/check_outs.scss
Normal file
3
app/assets/stylesheets/check_outs.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the check_outs controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: https://sass-lang.com/
|
||||
28
app/assets/stylesheets/custom.scss
Normal file
28
app/assets/stylesheets/custom.scss
Normal file
@@ -0,0 +1,28 @@
|
||||
body {
|
||||
padding-top: 56px;
|
||||
}
|
||||
|
||||
.carousel-item {
|
||||
height: 65vh;
|
||||
min-height: 300px;
|
||||
background: no-repeat center center scroll;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.portfolio-item {
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
background-color: red;
|
||||
color: white;
|
||||
text-align: center;
|
||||
z-index: 2;
|
||||
}
|
||||
3
app/assets/stylesheets/dashboard.scss
Normal file
3
app/assets/stylesheets/dashboard.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the dashboard controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: https://sass-lang.com/
|
||||
3
app/assets/stylesheets/home.scss
Normal file
3
app/assets/stylesheets/home.scss
Normal file
@@ -0,0 +1,3 @@
|
||||
// Place all the styles related to the home controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: https://sass-lang.com/
|
||||
4
app/channels/application_cable/channel.rb
Normal file
4
app/channels/application_cable/channel.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
module ApplicationCable
|
||||
class Channel < ActionCable::Channel::Base
|
||||
end
|
||||
end
|
||||
4
app/channels/application_cable/connection.rb
Normal file
4
app/channels/application_cable/connection.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
module ApplicationCable
|
||||
class Connection < ActionCable::Connection::Base
|
||||
end
|
||||
end
|
||||
58
app/controllers/admin/books_controller.rb
Normal file
58
app/controllers/admin/books_controller.rb
Normal file
@@ -0,0 +1,58 @@
|
||||
class Admin::BooksController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
before_action :authorized_user!
|
||||
|
||||
def index
|
||||
@books = Book.all.order(created_at: :desc).page params[:page]
|
||||
end
|
||||
|
||||
def new
|
||||
@book = Book.new
|
||||
end
|
||||
|
||||
def create
|
||||
@book = Book.new(book_params)
|
||||
if @book.save
|
||||
flash[:notice] = 'Book created successfully.'
|
||||
redirect_to admin_books_path
|
||||
else
|
||||
flash[:alert] = @book.errors.full_messages.join(', ')
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
@book = Book.find(params[:id])
|
||||
end
|
||||
|
||||
def update
|
||||
@book = Book.find(params[:id])
|
||||
if @book.update(book_params)
|
||||
flash[:notice] = 'Book updated successfully.'
|
||||
redirect_to admin_books_path
|
||||
else
|
||||
flash[:alert] = @book.errors.full_messages.join(', ')
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@book = Book.find(params[:id])
|
||||
if @book.destroy
|
||||
flash[:notice] = 'Book removed successfully.'
|
||||
else
|
||||
flash[:alert] = @book.errors.full_messages.join(', ')
|
||||
end
|
||||
redirect_to admin_books_path
|
||||
end
|
||||
|
||||
def show
|
||||
@book = Book.find(params[:id])
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def book_params
|
||||
params.require(:book).permit(:title, :author, :genre, :sub_genre, :pages, :copies)
|
||||
end
|
||||
end
|
||||
16
app/controllers/application_controller.rb
Normal file
16
app/controllers/application_controller.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
def after_sign_in_path_for(resource)
|
||||
if resource.admin?
|
||||
stored_location_for(resource) || admin_books_path
|
||||
else
|
||||
stored_location_for(resource) || dashboard_index_path
|
||||
end
|
||||
end
|
||||
|
||||
def authorized_user!
|
||||
unless current_user && current_user.admin?
|
||||
flash[:alert] = 'You are not authorized to access this page.'
|
||||
redirect_to root_path
|
||||
end
|
||||
end
|
||||
end
|
||||
5
app/controllers/books_controller.rb
Normal file
5
app/controllers/books_controller.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class BooksController < ApplicationController
|
||||
def index
|
||||
@books = Book.all.page params[:page]
|
||||
end
|
||||
end
|
||||
19
app/controllers/check_outs_controller.rb
Normal file
19
app/controllers/check_outs_controller.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
class CheckOutsController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
def borrow
|
||||
@book = Book.find(params[:id])
|
||||
current_user.books << @book
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def returns
|
||||
@book = current_user.books.find(params[:id])
|
||||
user_book = UsersBook.find_by(book_id: @book.id, user_id: current_user.id)
|
||||
user_book.update(status: :returned, returned_at: Time.zone.now)
|
||||
redirect_to dashboard_index_path
|
||||
end
|
||||
end
|
||||
0
app/controllers/concerns/.keep
Normal file
0
app/controllers/concerns/.keep
Normal file
7
app/controllers/dashboard_controller.rb
Normal file
7
app/controllers/dashboard_controller.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class DashboardController < ApplicationController
|
||||
before_action :authenticate_user!
|
||||
|
||||
def index
|
||||
@books = current_user.books.page params[:page]
|
||||
end
|
||||
end
|
||||
5
app/controllers/home_controller.rb
Normal file
5
app/controllers/home_controller.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
class HomeController < ApplicationController
|
||||
def index
|
||||
@books = Book.last(9)
|
||||
end
|
||||
end
|
||||
2
app/helpers/admin/books_helper.rb
Normal file
2
app/helpers/admin/books_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module Admin::BooksHelper
|
||||
end
|
||||
5
app/helpers/application_helper.rb
Normal file
5
app/helpers/application_helper.rb
Normal file
@@ -0,0 +1,5 @@
|
||||
module ApplicationHelper
|
||||
def decorate_date(datetime)
|
||||
datetime&.strftime('%b %d %Y, %H:%M')
|
||||
end
|
||||
end
|
||||
2
app/helpers/books_helper.rb
Normal file
2
app/helpers/books_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module BooksHelper
|
||||
end
|
||||
2
app/helpers/check_outs_helper.rb
Normal file
2
app/helpers/check_outs_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module CheckOutsHelper
|
||||
end
|
||||
2
app/helpers/dashboard_helper.rb
Normal file
2
app/helpers/dashboard_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module DashboardHelper
|
||||
end
|
||||
2
app/helpers/home_helper.rb
Normal file
2
app/helpers/home_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module HomeHelper
|
||||
end
|
||||
6
app/javascript/channels/consumer.js
Normal file
6
app/javascript/channels/consumer.js
Normal file
@@ -0,0 +1,6 @@
|
||||
// Action Cable provides the framework to deal with WebSockets in Rails.
|
||||
// You can generate new channels where WebSocket features live using the `bin/rails generate channel` command.
|
||||
|
||||
import { createConsumer } from "@rails/actioncable"
|
||||
|
||||
export default createConsumer()
|
||||
5
app/javascript/channels/index.js
Normal file
5
app/javascript/channels/index.js
Normal file
@@ -0,0 +1,5 @@
|
||||
// Load all the channels within this directory and all subdirectories.
|
||||
// Channel files must be named *_channel.js.
|
||||
|
||||
const channels = require.context('.', true, /_channel\.js$/)
|
||||
channels.keys().forEach(channels)
|
||||
14
app/javascript/packs/application.js
Normal file
14
app/javascript/packs/application.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// This file is automatically compiled by Webpack, along with any other files
|
||||
// present in this directory. You're encouraged to place your actual application logic in
|
||||
// a relevant structure within app/javascript and only use these pack files to reference
|
||||
// that code so it'll be compiled.
|
||||
|
||||
import Rails from "@rails/ujs"
|
||||
import Turbolinks from "turbolinks"
|
||||
import * as ActiveStorage from "@rails/activestorage"
|
||||
import "channels"
|
||||
Rails.start()
|
||||
Turbolinks.start()
|
||||
ActiveStorage.start()
|
||||
|
||||
import "bootstrap"
|
||||
7
app/jobs/application_job.rb
Normal file
7
app/jobs/application_job.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
class ApplicationJob < ActiveJob::Base
|
||||
# Automatically retry jobs that encountered a deadlock
|
||||
# retry_on ActiveRecord::Deadlocked
|
||||
|
||||
# Most jobs are safe to ignore if the underlying records are no longer available
|
||||
# discard_on ActiveJob::DeserializationError
|
||||
end
|
||||
4
app/mailers/application_mailer.rb
Normal file
4
app/mailers/application_mailer.rb
Normal file
@@ -0,0 +1,4 @@
|
||||
class ApplicationMailer < ActionMailer::Base
|
||||
default from: 'from@example.com'
|
||||
layout 'mailer'
|
||||
end
|
||||
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
@@ -0,0 +1,3 @@
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
||||
49
app/models/book.rb
Normal file
49
app/models/book.rb
Normal file
@@ -0,0 +1,49 @@
|
||||
class Book < ApplicationRecord
|
||||
has_many :users_books
|
||||
has_many :users, through: :users_books
|
||||
|
||||
enum genre: [ :tech, :science, :nonfiction, :fiction, :philosophy ]
|
||||
|
||||
enum sub_genre: {
|
||||
signal_processing: 0,
|
||||
data_science: 1,
|
||||
mathematics: 2,
|
||||
economics: 3,
|
||||
history: 4,
|
||||
psychology: 5,
|
||||
classic: 6,
|
||||
computer_science: 7,
|
||||
novel: 8,
|
||||
science: 9,
|
||||
autobiography: 10,
|
||||
physics: 11,
|
||||
objectivism: 12,
|
||||
trivia: 13,
|
||||
misc: 14,
|
||||
poetry: 15,
|
||||
education: 16,
|
||||
philosophy: 17,
|
||||
anthology: 18,
|
||||
politics: 19,
|
||||
comic: 20,
|
||||
legal: 21
|
||||
}, _prefix: :sub
|
||||
|
||||
def description
|
||||
str = ''
|
||||
str += genre if genre
|
||||
str += ' / ' if sub_genre
|
||||
str += sub_genre if sub_genre
|
||||
str += ', ' if author
|
||||
str += "by #{author}" if author
|
||||
str += ', ' if publisher
|
||||
str += "published by #{publisher}" if publisher
|
||||
str += ' - ' if available_copies > 0
|
||||
str += "<b>#{available_copies} copies left</b>" if available_copies > 0
|
||||
str.html_safe
|
||||
end
|
||||
|
||||
def available_copies
|
||||
copies - users_books.where(status: :borrowed).count
|
||||
end
|
||||
end
|
||||
0
app/models/concerns/.keep
Normal file
0
app/models/concerns/.keep
Normal file
2
app/models/library.rb
Normal file
2
app/models/library.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class Library < ApplicationRecord
|
||||
end
|
||||
9
app/models/user.rb
Normal file
9
app/models/user.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class User < ApplicationRecord
|
||||
# Include default devise modules. Others available are:
|
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
devise :database_authenticatable, :registerable,
|
||||
:recoverable, :rememberable, :validatable
|
||||
|
||||
has_many :users_books
|
||||
has_many :books, through: :users_books
|
||||
end
|
||||
21
app/models/users_book.rb
Normal file
21
app/models/users_book.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class UsersBook < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :book
|
||||
validates_uniqueness_of :book_id, scope: :user_id
|
||||
|
||||
enum status: {
|
||||
borrowed: 0,
|
||||
returned: 1,
|
||||
overdue: 2
|
||||
}, _default: :borrowed
|
||||
|
||||
before_save :assign_identifier
|
||||
|
||||
def assign_identifier
|
||||
self.identifier = "#{book.title.first(5).upcase + SecureRandom.urlsafe_base64.upcase}"
|
||||
end
|
||||
|
||||
def due_date
|
||||
created_at + 7.days
|
||||
end
|
||||
end
|
||||
31
app/views/admin/books/_form.html.erb
Normal file
31
app/views/admin/books/_form.html.erb
Normal file
@@ -0,0 +1,31 @@
|
||||
<%= form_with model: [:admin, @book] do |f| %>
|
||||
<div class="form-group">
|
||||
<label for="title">Title</label>
|
||||
<%= f.text_field :title, class: 'form-control', id: 'title' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="author">Author</label>
|
||||
<%= f.text_field :author, class: 'form-control', id: 'author' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="genre">Genre</label>
|
||||
<%= f.select :genre, Book.genres.keys.map {|genre| [genre.titleize,genre]},{}, class: 'form-control', id: 'genre' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="sub_genre">Sub Genre</label>
|
||||
<%= f.select :sub_genre, Book.sub_genres.keys.map {|sub_genre| [sub_genre.titleize,sub_genre]},{}, class: 'form-control', id: 'sub_genre' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="pages">Pages</label>
|
||||
<%= f.number_field :pages, class: 'form-control', id: 'pages' %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="copies">Copies</label>
|
||||
<%= f.number_field :copies, class: 'form-control', id: 'copies' %>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<%= f.submit 'Save', class: 'btn btn-primary'%>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
2
app/views/admin/books/edit.html.erb
Normal file
2
app/views/admin/books/edit.html.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
<h1 class="my-4">Edit Book details</h1>
|
||||
<%= render 'form' %>
|
||||
39
app/views/admin/books/index.html.erb
Normal file
39
app/views/admin/books/index.html.erb
Normal file
@@ -0,0 +1,39 @@
|
||||
<div class="row">
|
||||
<div class="col-sm-12 ">
|
||||
<h1 class="my-4">Manage Books</h1>
|
||||
<%= link_to 'Add New Book', new_admin_book_path, class: 'btn btn-sm btn-primary mb-2'%>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Title</th>
|
||||
<th scope="col">Genre</th>
|
||||
<th scope="col">SubGenre</th>
|
||||
<th scope="col">Author</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @books.each_with_index do |book, index| %>
|
||||
<tr>
|
||||
<th scope="row"><%= index + 1 %></th>
|
||||
<td><%= book.title %></td>
|
||||
<td><%= book.genre %></td>
|
||||
<td><%= book.sub_genre %></td>
|
||||
<td><%= book.author %></td>
|
||||
<td>
|
||||
<%= link_to 'Edit', edit_admin_book_path(book), class: 'btn btn-sm btn-primary' %>
|
||||
<%= link_to 'Delete', admin_book_path(book), method: :delete, class: 'btn btn-sm btn-danger', data: { confirm: 'Are you sure?'} %>
|
||||
<%= link_to 'View', admin_book_path(book), class: 'btn btn-sm btn-secondary' %></td>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @books, theme: 'twitter-bootstrap-4' %>
|
||||
</div>
|
||||
</div>
|
||||
2
app/views/admin/books/new.html.erb
Normal file
2
app/views/admin/books/new.html.erb
Normal file
@@ -0,0 +1,2 @@
|
||||
<h1 class="my-4">New Book details</h1>
|
||||
<%= render 'form' %>
|
||||
64
app/views/admin/books/show.html.erb
Normal file
64
app/views/admin/books/show.html.erb
Normal file
@@ -0,0 +1,64 @@
|
||||
<h1 class="my-4">Book Details</h1>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<table class="table table-bordered">
|
||||
<tr>
|
||||
<th scope="col">Title</th>
|
||||
<td><%= @book.title %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">Genre</th>
|
||||
<td><%= @book.genre %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">Sub Genre</th>
|
||||
<td><%= @book.sub_genre %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">Author</th>
|
||||
<td><%= @book.author %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">Pages</th>
|
||||
<td><%= @book.pages %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">Total Copies</th>
|
||||
<td><%= @book.copies %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="col">Available Copies</th>
|
||||
<td><%= @book.available_copies %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<h3 class="my-4">Check out Status</h3>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<th>#</th>
|
||||
<th>Book copy code</th>
|
||||
<th>Status</th>
|
||||
<th>Email</th>
|
||||
<th>Borrow date</th>
|
||||
<th>Expected Return date</th>
|
||||
<th>Actual Returned Date</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @book.users_books.each_with_index do |user_book, index| %>
|
||||
<tr>
|
||||
<td><%= index + 1 %></td>
|
||||
<td><%= user_book.identifier %></td>
|
||||
<td><%= user_book.status %></td>
|
||||
<td><%= user_book.user.email %></td>
|
||||
<td><%= decorate_date(user_book.created_at) %></td>
|
||||
<td><%= decorate_date(user_book.due_date) %></td>
|
||||
<td><%= decorate_date(user_book.returned_at) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
22
app/views/books/_book.html.erb
Normal file
22
app/views/books/_book.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<div class="col-lg-4 mb-4" id="book_<%= book.id%>">
|
||||
<div class="card h-100 shadow-sm">
|
||||
<h4 class="card-header"><%= book.title %></h4>
|
||||
<div class="card-body">
|
||||
<p class="card-text">
|
||||
<span> <%= book.description %> </span>
|
||||
</div>
|
||||
<% if current_user %>
|
||||
<div class="card-footer">
|
||||
<% if book.available_copies > 0 %>
|
||||
<% unless current_user.books.include?book %>
|
||||
<%= link_to 'Borrow', borrow_path(book), class: "btn btn-success", remote: true %>
|
||||
<% else %>
|
||||
<%= link_to 'Borrowed', 'javascript:;', class: "btn btn-primary", remote: true %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<a href="javascript:;" class= "btn btn-secondary">Not available</a>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
5
app/views/books/index.html.erb
Normal file
5
app/views/books/index.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1 class="my-4">The complete list of all books</h1>
|
||||
<div class="row">
|
||||
<%= render partial: 'books/book', collection: @books%>
|
||||
</div>
|
||||
<%= paginate @books, theme: 'twitter-bootstrap-4' %>
|
||||
1
app/views/check_outs/borrow.js.erb
Normal file
1
app/views/check_outs/borrow.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#book_<%= @book.id %>").replaceWith("<%= escape_javascript render(partial: 'books/book', :locals => { book: @book }) %>")
|
||||
33
app/views/dashboard/index.html.erb
Normal file
33
app/views/dashboard/index.html.erb
Normal file
@@ -0,0 +1,33 @@
|
||||
<h1 class="my-4">My Books</h1>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Title</th>
|
||||
<th scope="col">Borrow date</th>
|
||||
<th scope="col">Expected Return date</th>
|
||||
<th scope="col">Actual Return date</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @books.each_with_index do |book, index| %>
|
||||
<% user_book = book.users_books.first %>
|
||||
<tr>
|
||||
<th scope="row"><%= index + 1 %></th>
|
||||
<td><%= book.title %></td>
|
||||
<td><%= decorate_date(user_book.created_at) %></td>
|
||||
<td><%= decorate_date(user_book.due_date) %></td>
|
||||
<td><%= decorate_date(user_book.returned_at) %></td>
|
||||
<td><%= user_book.status.titleize %></td>
|
||||
<% if user_book.returned? %>
|
||||
<td></td>
|
||||
<% else %>
|
||||
<td td><%= link_to 'Return', returns_path(book), class: 'btn btn-primary btn-sm', data: { confirm: 'Are you sure?'} %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
<%= paginate @books, theme: 'twitter-bootstrap-4' %>
|
||||
16
app/views/devise/confirmations/new.html.erb
Normal file
16
app/views/devise/confirmations/new.html.erb
Normal file
@@ -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>
|
||||
7
app/views/devise/mailer/email_changed.html.erb
Normal file
7
app/views/devise/mailer/email_changed.html.erb
Normal file
@@ -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 %>
|
||||
3
app/views/devise/mailer/password_change.html.erb
Normal file
3
app/views/devise/mailer/password_change.html.erb
Normal file
@@ -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>
|
||||
7
app/views/devise/mailer/unlock_instructions.html.erb
Normal file
7
app/views/devise/mailer/unlock_instructions.html.erb
Normal file
@@ -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>
|
||||
25
app/views/devise/passwords/edit.html.erb
Normal file
25
app/views/devise/passwords/edit.html.erb
Normal file
@@ -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" %>
|
||||
16
app/views/devise/passwords/new.html.erb
Normal file
16
app/views/devise/passwords/new.html.erb
Normal file
@@ -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" %>
|
||||
43
app/views/devise/registrations/edit.html.erb
Normal file
43
app/views/devise/registrations/edit.html.erb
Normal file
@@ -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>
|
||||
|
||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
50
app/views/devise/registrations/new.html.erb
Normal file
50
app/views/devise/registrations/new.html.erb
Normal file
@@ -0,0 +1,50 @@
|
||||
<div id="layoutAuthentication">
|
||||
<div id="layoutAuthentication_content">
|
||||
<main>
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-7">
|
||||
<div class="card shadow-lg border-0 rounded-lg mt-5">
|
||||
<div class="card-header">
|
||||
<h3 class="text-center font-weight-light my-4">Create Account</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||
<%= render "devise/shared/error_messages", resource: resource %>
|
||||
<div class="form-group">
|
||||
<label class="small mb-1" for="inputEmailAddress">Email</label>
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email", class: "form-control py-4", id: "inputEmailAddress" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="small mb-1" for="inputPassword">Password</label>
|
||||
<% if @minimum_password_length %>
|
||||
<em><small>(<%= @minimum_password_length %> characters minimum)</small></em>
|
||||
<% end %><br />
|
||||
<%= f.password_field :password, autocomplete: "new-password", id: 'inputPassword', class: "form-control py-4" %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="small mb-1" for="inputConfirmPassword">Confirm Password</label>
|
||||
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control py-4", id: "inputConfirmPassword" %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group mt-4 mb-0">
|
||||
<%= f.submit "Create Account", class: "btn btn-primary btn-block"%>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="card-footer text-center">
|
||||
<div class="small">
|
||||
<%= link_to 'Have an account? Go to login', new_user_session_path%></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
35
app/views/devise/sessions/new.html.erb
Normal file
35
app/views/devise/sessions/new.html.erb
Normal file
@@ -0,0 +1,35 @@
|
||||
<div id="layoutAuthentication">
|
||||
<div id="layoutAuthentication_content">
|
||||
<main>
|
||||
<div class="container">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-lg-5">
|
||||
<div class="card shadow-lg border-0 rounded-lg mt-5">
|
||||
<div class="card-header">
|
||||
<h3 class="text-center font-weight-light my-4">Login</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||
<div class="form-group">
|
||||
<label class="small mb-1" for="inputEmailAddress">Email</label>
|
||||
<%= f.email_field :email, autofocus: true, autocomplete: "email", id: 'inputEmailAddress', class: "form-control py-4" %>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="small mb-1" for="inputPassword">Password</label>
|
||||
<%= f.password_field :password, autocomplete: "current-password", class: "form-control py-4", id: "inputPassword"%>
|
||||
</div>
|
||||
<div class="form-group d-flex align-items-center justify-content-between mt-4 mb-0">
|
||||
<%= f.submit "Login", class: "btn btn-primary" %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="card-footer text-center">
|
||||
<div class="small"><%= link_to "Need an account? Sign up!", new_user_registration_path %></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
15
app/views/devise/shared/_error_messages.html.erb
Normal file
15
app/views/devise/shared/_error_messages.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<% if resource.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<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 %>
|
||||
25
app/views/devise/shared/_links.html.erb
Normal file
25
app/views/devise/shared/_links.html.erb
Normal file
@@ -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| %>
|
||||
<%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %><br />
|
||||
<% end %>
|
||||
<% end %>
|
||||
16
app/views/devise/unlocks/new.html.erb
Normal file
16
app/views/devise/unlocks/new.html.erb
Normal file
@@ -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" %>
|
||||
28
app/views/home/_slider.html.erb
Normal file
28
app/views/home/_slider.html.erb
Normal file
@@ -0,0 +1,28 @@
|
||||
<header>
|
||||
<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
|
||||
<ol class="carousel-indicators">
|
||||
<li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
|
||||
<li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
|
||||
<li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
|
||||
</ol>
|
||||
<div class="carousel-inner" role="listbox">
|
||||
<!-- Slide One - Set the background image for this slide in the line below -->
|
||||
<div class="carousel-item active" style="background-image: url(<%= asset_url('img1.jpg')%>)">
|
||||
</div>
|
||||
<!-- Slide Two - Set the background image for this slide in the line below -->
|
||||
<div class="carousel-item" style="background-image: url(<%= asset_url('img2.jpg')%>)">
|
||||
</div>
|
||||
<!-- Slide Three - Set the background image for this slide in the line below -->
|
||||
<div class="carousel-item" style="background-image: url(<%= asset_url('img3.jpg')%>)">
|
||||
</div>
|
||||
</div>
|
||||
<a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
|
||||
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
|
||||
<span class="carousel-control-next-icon" aria-hidden="true"></span>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
40
app/views/home/index.html.erb
Normal file
40
app/views/home/index.html.erb
Normal file
@@ -0,0 +1,40 @@
|
||||
<h1 class="my-4">Welcome to Modern Library</h1>
|
||||
|
||||
<!-- Marketing Icons Section -->
|
||||
<div class="row">
|
||||
<%= render partial: 'books/book', collection: @books%>
|
||||
</div>
|
||||
|
||||
<!-- Features Section -->
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<h2>Modern Library Features</h2>
|
||||
<p>The Modern Library includes:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Easy Borrow</strong>
|
||||
</li>
|
||||
<li>1000000+ books</li>
|
||||
<li>Premium service</li>
|
||||
<li>Unlimited membership</li>
|
||||
<li>One stop for all you need</li>
|
||||
</ul>
|
||||
<p>The modern library is a one stop solution for all the book lovers to borrow books with ease. This is world's first online library system haing millions of books at one place. So register tody and get its benifits</p>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<%= image_tag "img4.jpg", class: 'img-fluid rounded', alt: '' %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- Call to Action Section -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-8">
|
||||
<p>Excited to see the full list of all available images? Click here and view millions of books available in our system.</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<%= link_to 'View full list', books_path , class: 'btn btn-lg btn-primary btn-block' %>
|
||||
</div>
|
||||
</div>
|
||||
8
app/views/layouts/_flash.html.erb
Normal file
8
app/views/layouts/_flash.html.erb
Normal file
@@ -0,0 +1,8 @@
|
||||
<% if notice || alert %>
|
||||
<% if notice %>
|
||||
<p class="alert alert-success"><%= notice %></p>
|
||||
<% end %>
|
||||
<% if alert %>
|
||||
<p class="alert alert-danger"><%= alert %></p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
5
app/views/layouts/_footer.html.erb
Normal file
5
app/views/layouts/_footer.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<footer class="footer py-3 bg-dark">
|
||||
<div class="container">
|
||||
<p class="m-0 text-center text-white">Copyright © The Modern Library 2021</p>
|
||||
</div>
|
||||
</footer>
|
||||
38
app/views/layouts/_header.html.erb
Normal file
38
app/views/layouts/_header.html.erb
Normal file
@@ -0,0 +1,38 @@
|
||||
<!-- Navigation -->
|
||||
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-dark fixed-top">
|
||||
<div class="container">
|
||||
<%= link_to 'THE MODERN LIBRARY', root_path, class: 'navbar-brand' %>
|
||||
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarResponsive">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item">
|
||||
<%= link_to 'All Books', books_path, class: 'nav-link' %>
|
||||
</li>
|
||||
<% if current_user %>
|
||||
<% if current_user.admin? %>
|
||||
<li class="nav-item">
|
||||
<%= link_to 'Admin panel', admin_books_path, class: 'nav-link' %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="nav-item">
|
||||
<%= link_to 'Dashboard', dashboard_index_path, class: 'nav-link' %>
|
||||
</li>
|
||||
<% end %>
|
||||
|
||||
<li class="nav-item">
|
||||
<%= link_to 'Signout', destroy_user_session_path, method: :delete, class: 'nav-link' %>
|
||||
</li>
|
||||
<% else %>
|
||||
<li class="nav-item">
|
||||
<%= link_to 'Login', new_user_session_path, class: 'nav-link' %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to 'Join us now!', new_user_registration_path, class: 'nav-link' %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
26
app/views/layouts/application.html.erb
Normal file
26
app/views/layouts/application.html.erb
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>LibraryMgmtSys</title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<%= csrf_meta_tags %>
|
||||
<%= csp_meta_tag %>
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= render 'layouts/header' %>
|
||||
<% if params[:controller] == 'home' && params[:action] == 'index' %>
|
||||
<%= render 'home/slider' %>
|
||||
<% end %>
|
||||
<%= render 'layouts/flash' %>
|
||||
<div class="container" style="padding-bottom: 50px">
|
||||
<%= yield %>
|
||||
</div>
|
||||
<%= render 'layouts/footer' %>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
13
app/views/layouts/mailer.html.erb
Normal file
13
app/views/layouts/mailer.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<style>
|
||||
/* Email styles need to be inline */
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= yield %>
|
||||
</body>
|
||||
</html>
|
||||
1
app/views/layouts/mailer.text.erb
Normal file
1
app/views/layouts/mailer.text.erb
Normal file
@@ -0,0 +1 @@
|
||||
<%= yield %>
|
||||
Reference in New Issue
Block a user