mirror of
https://github.com/oonyeje/Pearlception_Website_RoR.git
synced 2025-12-25 11:47:41 +00:00
Create implemented Company
- Create route and view implemented with minimal info - index implemented and shows number of registered companies
This commit is contained in:
parent
ace1290a76
commit
7c6cf0f38d
@ -1,4 +1,4 @@
|
|||||||
class Company < ApplicationRecord
|
class Company < ApplicationRecord
|
||||||
belongs_to :user
|
has_many :users
|
||||||
has_many :runs
|
has_many :runs
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
has_one :company
|
belongs_to :company
|
||||||
has_many :runs
|
has_many :runs
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :confirmable, :lockable, :timeoutable and :omniauthable
|
# :confirmable, :lockable, :timeoutable and :omniauthable
|
||||||
|
|||||||
@ -59,15 +59,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
|
||||||
<h1 class="page-header">Companies</h1>
|
<h1 class="page-header">Companies</h1>
|
||||||
<h2 class="sub-header">Registered Companies</h2>
|
<h2 class="sub-header">Registered Companies: <%= @companies.count %> </h2>
|
||||||
<div class="table-responsive">
|
<div class="panel panel-primary table-responsive">
|
||||||
<%= link_to(new_company_path, :method => :get) do %>
|
<%= link_to(new_company_path, :method => :get) do %>
|
||||||
<i class="fa fa-external-link"></i> Register a Company
|
<i class="fa fa-external-link"></i> Register a Company
|
||||||
<% end %>
|
<% end %>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
|
||||||
<th>Company ID</th>
|
<th>Company ID</th>
|
||||||
<th>Company Name</th>
|
<th>Company Name</th>
|
||||||
<th>Registration Serial Key</th>
|
<th>Registration Serial Key</th>
|
||||||
@ -80,6 +79,27 @@
|
|||||||
</div>
|
</div>
|
||||||
<% else %>
|
<% else %>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
<% @companies.each_slice(1) do |row| %>
|
||||||
|
<tr>
|
||||||
|
<% row.each do |company|%>
|
||||||
|
|
||||||
|
<!-- company id -->
|
||||||
|
<td>
|
||||||
|
<%= company.id %>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- company_name -->
|
||||||
|
<td>
|
||||||
|
<%= company.company_name %>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- company registration token -->
|
||||||
|
<td>
|
||||||
|
<%= company.company_token %>
|
||||||
|
</td>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user