user role scoped layout and controller
This commit is contained in:
9
app/assets/stylesheets/CRM.scss
Normal file
9
app/assets/stylesheets/CRM.scss
Normal file
@@ -0,0 +1,9 @@
|
||||
@import "bootstrap";
|
||||
@import "font-awesome";
|
||||
@import "theme";
|
||||
|
||||
/* Show it is fixed to the top */
|
||||
// body {
|
||||
// min-height: 75rem;
|
||||
// padding-top: 4.5rem;
|
||||
// }
|
||||
9
app/assets/stylesheets/OQS.scss
Normal file
9
app/assets/stylesheets/OQS.scss
Normal file
@@ -0,0 +1,9 @@
|
||||
@import "bootstrap";
|
||||
@import "font-awesome";
|
||||
@import "theme";
|
||||
|
||||
/* Show it is fixed to the top */
|
||||
// body {
|
||||
// min-height: 75rem;
|
||||
// padding-top: 4.5rem;
|
||||
// }
|
||||
9
app/assets/stylesheets/orgiami.scss
Normal file
9
app/assets/stylesheets/orgiami.scss
Normal file
@@ -0,0 +1,9 @@
|
||||
@import "bootstrap";
|
||||
@import "font-awesome";
|
||||
@import "theme";
|
||||
|
||||
/* Show it is fixed to the top */
|
||||
// body {
|
||||
// min-height: 75rem;
|
||||
// padding-top: 4.5rem;
|
||||
// }
|
||||
9
app/assets/stylesheets/waiter.scss
Normal file
9
app/assets/stylesheets/waiter.scss
Normal file
@@ -0,0 +1,9 @@
|
||||
@import "bootstrap";
|
||||
@import "font-awesome";
|
||||
@import "theme";
|
||||
|
||||
/* Show it is fixed to the top */
|
||||
// body {
|
||||
// min-height: 75rem;
|
||||
// padding-top: 4.5rem;
|
||||
// }
|
||||
9
app/controllers/base_crm_controller.rb
Normal file
9
app/controllers/base_crm_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
class BaseCrmController < ActionController::Base
|
||||
include LoginVerification
|
||||
layout "CRM"
|
||||
|
||||
#before_action :check_installation
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
|
||||
end
|
||||
@@ -3,6 +3,8 @@ module LoginVerification
|
||||
|
||||
included do
|
||||
before_action :authenticate
|
||||
helper_method :current_company,:current_login_employee
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -30,4 +32,28 @@ module LoginVerification
|
||||
redirect_to root_path
|
||||
end
|
||||
|
||||
|
||||
#this is base api base controller to need to inherit.
|
||||
#all token authentication must be done here
|
||||
#response format must be set to JSON
|
||||
def current_company
|
||||
begin
|
||||
return Company.first
|
||||
rescue
|
||||
return nil
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session(session[:session_token])
|
||||
end
|
||||
|
||||
private
|
||||
def check_installation
|
||||
if current_company.nil?
|
||||
redirect_to install_path
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -33,7 +33,6 @@ class HomeController < ApplicationController
|
||||
def destroy
|
||||
session[:session_token] = nil
|
||||
redirect_to root_path
|
||||
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
29
app/views/layouts/CRM.html.erb
Normal file
29
app/views/layouts/CRM.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="author" content=""/>
|
||||
|
||||
<title>SmartSales : Restaurant</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= render 'layouts/header' %>
|
||||
<div class="container-fluid">
|
||||
<% flash.each do |type, message| %>
|
||||
<div class="alert fade in">
|
||||
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||
<%= message %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
29
app/views/layouts/OQS.html.erb
Normal file
29
app/views/layouts/OQS.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="author" content=""/>
|
||||
|
||||
<title>SmartSales : Restaurant</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= render 'layouts/header' %>
|
||||
<div class="container-fluid">
|
||||
<% flash.each do |type, message| %>
|
||||
<div class="alert fade in">
|
||||
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||
<%= message %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -5,14 +5,8 @@
|
||||
<a class="navbar-brand" href="#">H</a>
|
||||
<div class="collapse navbar-collapse" id="navbarCollapse">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="/">Home <span class="sr-only">(current)</span></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Link</a>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Settings<span class="caret"></span></a>
|
||||
<li class="navbar-nav mr-auto dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Settings</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><%= link_to "Menus ", settings_menus_path, :tabindex =>"-1" %></li>
|
||||
<li><%= link_to "Menu Categories", settings_menu_categories_path, :tabindex =>"-1" %></li>
|
||||
@@ -27,7 +21,16 @@
|
||||
<li><%= link_to "Tax Profile", settings_tax_profiles_path, :tabindex =>"-1" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div class="right">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li><%= current_login_employee.name %> </li>
|
||||
<li style="padding-right:10px;padding-left:10px"> | </li>
|
||||
<li ><%= link_to 'Logout', logout_path, method: :delete, data: { confirm: 'Are you sure?' } %>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
29
app/views/layouts/origami.html.erb
Normal file
29
app/views/layouts/origami.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="author" content=""/>
|
||||
|
||||
<title>SmartSales : Restaurant</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= render 'layouts/header' %>
|
||||
<div class="container-fluid">
|
||||
<% flash.each do |type, message| %>
|
||||
<div class="alert fade in">
|
||||
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||
<%= message %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
29
app/views/layouts/waiter.html.erb
Normal file
29
app/views/layouts/waiter.html.erb
Normal file
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="author" content=""/>
|
||||
|
||||
<title>SmartSales : Restaurant</title>
|
||||
<%= csrf_meta_tags %>
|
||||
|
||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<%= render 'layouts/header' %>
|
||||
<div class="container-fluid">
|
||||
<% flash.each do |type, message| %>
|
||||
<div class="alert fade in">
|
||||
<button class="close" aria-hidden="true" data-dismiss="alert" type="button">×</button>
|
||||
<%= message %>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= yield %>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user