mirror of
https://github.com/oonyeje/Pearlception_Website_RoR.git
synced 2025-12-25 11:47:41 +00:00
Added Dashboard Integration and Authentication
- Signin and Signup views still not being shown and defaulting to default
This commit is contained in:
parent
9d17166e8f
commit
c0564fff14
@ -1,13 +1,23 @@
|
|||||||
class RegistrationsController < Devise::RegistrationsController
|
class RegistrationsController < Devise::RegistrationsController
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
protected
|
#protected
|
||||||
|
|
||||||
def create
|
def create
|
||||||
super
|
|
||||||
binding.pry
|
binding.pry
|
||||||
|
@user = User.new(sign_up_params)
|
||||||
|
if !@user.admin?
|
||||||
|
#search by company token given by one of pearlception admins to the company
|
||||||
|
#and look up comany_id #
|
||||||
|
@user.company_id = 0
|
||||||
|
else
|
||||||
|
@user.company_id = -1
|
||||||
|
end
|
||||||
|
@user.save
|
||||||
|
sign_in @user
|
||||||
|
redirect_to "/"
|
||||||
end
|
end
|
||||||
|
|
||||||
def sign_up_params
|
def sign_up_params
|
||||||
params.require(:user).permit(:company_id, :email, :password, :password_confirmation)
|
params.require(:user).permit(:email, :password, :password_confirmation, :company_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -10,23 +10,23 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="#">Pearlception</a>
|
<a class="navbar-brand" href="/">Pearlception</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="navbar" class="navbar-collapse collapse">
|
<div id="navbar" class="navbar-collapse collapse">
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<!-- <li><a href="#">Dashboard</a></li> -->
|
<!-- <li><a href="#">Dashboard</a></li> -->
|
||||||
<li><a href="#">Settings</a></li>
|
<!-- <li><a href="#">Settings</a></li>
|
||||||
<li><a href="#">Profile</a></li>
|
<li><a href="#">Profile</a></li>
|
||||||
<li><a href="#">Help</a></li>
|
<li><a href="#">Help</a></li> -->
|
||||||
<li>
|
<li>
|
||||||
<%= link_to(destroy_user_session_path, class: 'logout-link', :method => :delete) do %>
|
<%= link_to(destroy_user_session_path, class: 'logout-link', :method => :delete) do %>
|
||||||
<i class="fa fa-external-link"></i> Logout
|
<i class="fa fa-external-link"></i> Logout
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<form class="navbar-form navbar-right">
|
<!-- <form class="navbar-form navbar-right">
|
||||||
<input type="text" class="form-control" placeholder="Search...">
|
<input type="text" class="form-control" placeholder="Search...">
|
||||||
</form>
|
</form> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@ -35,10 +35,15 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3 col-md-2 sidebar">
|
<div class="col-sm-3 col-md-2 sidebar">
|
||||||
<ul class="nav nav-sidebar">
|
<ul class="nav nav-sidebar">
|
||||||
<li class="active"><a href="#">Overview <span class="sr-only">(current)</span></a></li>
|
<li class="active"><a href="/">Overview <span class="sr-only">(current)</span></a></li>
|
||||||
<li><a href="#">Reports</a></li>
|
<!-- This will be removed and placed with correct logic in corresponding controller -->
|
||||||
<li><a href="#">Analytics</a></li>
|
<% if current_user.admin? %>
|
||||||
<li><a href="#">Export</a></li>
|
<li><a href="companies#index">Companies</a></li>
|
||||||
|
<% else %>
|
||||||
|
<!-- <li><a>Reports</a></li>
|
||||||
|
<li><a>Analytics</a></li>
|
||||||
|
<li><a>Export</a></li> -->
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<!-- <ul class="nav nav-sidebar">
|
<!-- <ul class="nav nav-sidebar">
|
||||||
<li><a href="">Nav item</a></li>
|
<li><a href="">Nav item</a></li>
|
||||||
@ -84,126 +89,58 @@
|
|||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>Run Date</th>
|
||||||
<th>Header</th>
|
<th>Location</th>
|
||||||
<th>Header</th>
|
<th>Harvest Time</th>
|
||||||
<th>Header</th>
|
<th>Supplier</th>
|
||||||
<th>Header</th>
|
<th>Distributor</th>
|
||||||
|
<th>Total Processed</th>
|
||||||
|
<th>Other</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<% @results.each_slice(1) do |row| %>
|
||||||
<td>1,001</td>
|
<tr>
|
||||||
<td>Lorem</td>
|
<% row.each do |result|
|
||||||
<td>ipsum</td>
|
run = Run.find(result.id) %>
|
||||||
<td>dolor</td>
|
<!-- run date -->
|
||||||
<td>sit</td>
|
<td>
|
||||||
</tr>
|
<%= run.runDate %>
|
||||||
<tr>
|
</td>
|
||||||
<td>1,002</td>
|
|
||||||
<td>amet</td>
|
<!-- location -->
|
||||||
<td>consectetur</td>
|
<td>
|
||||||
<td>adipiscing</td>
|
<%= run.location ? run.location : "" %>
|
||||||
<td>elit</td>
|
</td>
|
||||||
</tr>
|
|
||||||
<tr>
|
<!-- harvest time -->
|
||||||
<td>1,003</td>
|
<td>
|
||||||
<td>Integer</td>
|
<%= "" %>
|
||||||
<td>nec</td>
|
</td>
|
||||||
<td>odio</td>
|
|
||||||
<td>Praesent</td>
|
<!-- supplier -->
|
||||||
</tr>
|
<td>
|
||||||
<tr>
|
|
||||||
<td>1,003</td>
|
<%= run.supplier ? run.supplier : "" %>
|
||||||
<td>libero</td>
|
</td>
|
||||||
<td>Sed</td>
|
|
||||||
<td>cursus</td>
|
<!-- distributor -->
|
||||||
<td>ante</td>
|
<td>
|
||||||
</tr>
|
<%= run.distributor ? run.distributor : "" %>
|
||||||
<tr>
|
</td>
|
||||||
<td>1,004</td>
|
|
||||||
<td>dapibus</td>
|
<!-- total processed -->
|
||||||
<td>diam</td>
|
<td>
|
||||||
<td>Sed</td>
|
<%= result.total %>
|
||||||
<td>nisi</td>
|
</td>
|
||||||
</tr>
|
|
||||||
<tr>
|
<!-- other -->
|
||||||
<td>1,005</td>
|
<td>
|
||||||
<td>Nulla</td>
|
<%= run.other ? run.other : "" %>
|
||||||
<td>quis</td>
|
</td>
|
||||||
<td>sem</td>
|
<% end %>
|
||||||
<td>at</td>
|
</tr>
|
||||||
</tr>
|
<% end %>
|
||||||
<tr>
|
|
||||||
<td>1,006</td>
|
|
||||||
<td>nibh</td>
|
|
||||||
<td>elementum</td>
|
|
||||||
<td>imperdiet</td>
|
|
||||||
<td>Duis</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1,007</td>
|
|
||||||
<td>sagittis</td>
|
|
||||||
<td>ipsum</td>
|
|
||||||
<td>Praesent</td>
|
|
||||||
<td>mauris</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1,008</td>
|
|
||||||
<td>Fusce</td>
|
|
||||||
<td>nec</td>
|
|
||||||
<td>tellus</td>
|
|
||||||
<td>sed</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1,009</td>
|
|
||||||
<td>augue</td>
|
|
||||||
<td>semper</td>
|
|
||||||
<td>porta</td>
|
|
||||||
<td>Mauris</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1,010</td>
|
|
||||||
<td>massa</td>
|
|
||||||
<td>Vestibulum</td>
|
|
||||||
<td>lacinia</td>
|
|
||||||
<td>arcu</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1,011</td>
|
|
||||||
<td>eget</td>
|
|
||||||
<td>nulla</td>
|
|
||||||
<td>Class</td>
|
|
||||||
<td>aptent</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1,012</td>
|
|
||||||
<td>taciti</td>
|
|
||||||
<td>sociosqu</td>
|
|
||||||
<td>ad</td>
|
|
||||||
<td>litora</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1,013</td>
|
|
||||||
<td>torquent</td>
|
|
||||||
<td>per</td>
|
|
||||||
<td>conubia</td>
|
|
||||||
<td>nostra</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1,014</td>
|
|
||||||
<td>per</td>
|
|
||||||
<td>inceptos</td>
|
|
||||||
<td>himenaeos</td>
|
|
||||||
<td>Curabitur</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>1,015</td>
|
|
||||||
<td>sodales</td>
|
|
||||||
<td>ligula</td>
|
|
||||||
<td>in</td>
|
|
||||||
<td>libero</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<h2>Sign up</h2>
|
<h2>Sign up!</h2>
|
||||||
|
|
||||||
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
|
||||||
<%= devise_error_messages! %>
|
<%= devise_error_messages! %>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user