Adding contracts
This commit is contained in:
36
app/views/contracts/_form.html.erb
Normal file
36
app/views/contracts/_form.html.erb
Normal file
@@ -0,0 +1,36 @@
|
||||
<%= form_for(@contract, html: {class: "col-sm-6"}) do |f| %>
|
||||
<% if @contract.errors.any? %>
|
||||
<div id="error_explanation">
|
||||
<h2><%= pluralize(@contract.errors.count, "error") %> prohibited this contract from being saved:</h2>
|
||||
|
||||
<ul>
|
||||
<% @contract.errors.full_messages.each do |msg| %>
|
||||
<li><%= msg %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<%= f.label :first_name %><br />
|
||||
<%= f.text_field :first_name, class: "form-control" %>
|
||||
</p>
|
||||
<p>
|
||||
<%= f.label :last_name %><br />
|
||||
<%= f.text_field :last_name, class: "form-control" %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.label :signed_at %><br />
|
||||
<%= f.date_select :signed_at, class: "form-control" %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.label :document %><br />
|
||||
<%= f.file_field :document %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= f.submit nil, class: "btn btn-primary" %>
|
||||
</p>
|
||||
<% end %>
|
||||
21
app/views/contracts/index.html.erb
Normal file
21
app/views/contracts/index.html.erb
Normal file
@@ -0,0 +1,21 @@
|
||||
<div class="row">
|
||||
<h1 class="col-md-8">Contracts
|
||||
<%= link_to 'Add Contract', new_contract_path, :class => "btn btn-success" if can? :create, Contract %>
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<% @contracts.sort_by{|r| [r.last_name] }.each do |contract| %>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">
|
||||
<%= contract.last_name %>
|
||||
<%= contract.first_name %>
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
4
app/views/contracts/new.html.erb
Normal file
4
app/views/contracts/new.html.erb
Normal file
@@ -0,0 +1,4 @@
|
||||
<h1>New Contract
|
||||
<%= link_to 'Back', contracts_path, class: "btn btn-default" %>
|
||||
</h1>
|
||||
<%= render 'form' %>
|
||||
Reference in New Issue
Block a user