Permalink
Browse files

Bootstrap view templates

  • Loading branch information...
danielfone committed Oct 19, 2013
1 parent 2c3fe47 commit f4cd02940a06b1cf1972a71a557f11612b61db39
@@ -1,69 +0,0 @@
-body {
- background-color: #fff;
- color: #333;
- font-family: verdana, arial, helvetica, sans-serif;
- font-size: 13px;
- line-height: 18px;
-}
-
-p, ol, ul, td {
- font-family: verdana, arial, helvetica, sans-serif;
- font-size: 13px;
- line-height: 18px;
-}
-
-pre {
- background-color: #eee;
- padding: 10px;
- font-size: 11px;
-}
-
-a {
- color: #000;
- &:visited {
- color: #666;
- }
- &:hover {
- color: #fff;
- background-color: #000;
- }
-}
-
-div {
- &.field, &.actions {
- margin-bottom: 10px;
- }
-}
-
-#notice {
- color: green;
-}
-
-.field_with_errors {
- padding: 2px;
- background-color: red;
- display: table;
-}
-
-#error_explanation {
- width: 450px;
- border: 2px solid red;
- padding: 7px;
- padding-bottom: 0;
- margin-bottom: 20px;
- background-color: #f0f0f0;
- h2 {
- text-align: left;
- font-weight: bold;
- padding: 5px 5px 5px 15px;
- font-size: 12px;
- margin: -7px;
- margin-bottom: 0px;
- background-color: #c00;
- color: #fff;
- }
- ul li {
- font-size: 12px;
- list-style: square;
- }
-}
@@ -1,21 +1,14 @@
-<%= form_for(@employee) do |f| %>
- <% if @employee.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@employee.errors.count, "error") %> prohibited this employee from being saved:</h2>
-
- <ul>
- <% @employee.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
+<%= form_for @employee, :html => { :class => 'form-horizontal' } do |f| %>
+ <div class="control-group">
+ <%= f.label :name, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :name, :class => 'text_field' %>
</div>
- <% end %>
-
- <div class="field">
- <%= f.label :name %><br>
- <%= f.text_field :name %>
</div>
- <div class="actions">
- <%= f.submit %>
+
+ <div class="form-actions">
+ <%= f.submit nil, :class => 'btn btn-primary' %>
+ <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
+ employees_path, :class => 'btn' %>
</div>
<% end %>
@@ -1,6 +1,5 @@
-<h1>Editing employee</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Show', @employee %> |
-<%= link_to 'Back', employees_path %>
+<%- model_class = Employee -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize %></h1>
+</div>
+<%= render :partial => 'form' %>
@@ -1,27 +1,36 @@
-<h1>Listing employees</h1>
-
-<table>
+<%- model_class = Employee -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => model_class.model_name.human.pluralize.titleize %></h1>
+</div>
+<table class="table table-striped">
<thead>
<tr>
- <th>Name</th>
- <th></th>
- <th></th>
- <th></th>
+ <th><%= model_class.human_attribute_name(:id) %></th>
+ <th><%= model_class.human_attribute_name(:name) %></th>
+ <th><%= model_class.human_attribute_name(:created_at) %></th>
+ <th><%=t '.actions', :default => t("helpers.actions") %></th>
</tr>
</thead>
-
<tbody>
<% @employees.each do |employee| %>
<tr>
+ <td><%= link_to employee.id, employee_path(employee) %></td>
<td><%= employee.name %></td>
- <td><%= link_to 'Show', employee %></td>
- <td><%= link_to 'Edit', edit_employee_path(employee) %></td>
- <td><%= link_to 'Destroy', employee, method: :delete, data: { confirm: 'Are you sure?' } %></td>
+ <td><%=l employee.created_at %></td>
+ <td>
+ <%= link_to t('.edit', :default => t("helpers.links.edit")),
+ edit_employee_path(employee), :class => 'btn btn-mini' %>
+ <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
+ employee_path(employee),
+ :method => :delete,
+ :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
+ :class => 'btn btn-mini btn-danger' %>
+ </td>
</tr>
<% end %>
</tbody>
</table>
-<br>
-
-<%= link_to 'New Employee', new_employee_path %>
+<%= link_to t('.new', :default => t("helpers.links.new")),
+ new_employee_path,
+ :class => 'btn btn-primary' %>
@@ -1,5 +1,5 @@
-<h1>New employee</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Back', employees_path %>
+<%- model_class = Employee -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize %></h1>
+</div>
+<%= render :partial => 'form' %>
@@ -1,9 +1,21 @@
-<p id="notice"><%= notice %></p>
+<%- model_class = Employee -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => model_class.model_name.human.titleize %></h1>
+</div>
-<p>
- <strong>Name:</strong>
- <%= @employee.name %>
-</p>
+<dl class="dl-horizontal">
+ <dt><strong><%= model_class.human_attribute_name(:name) %>:</strong></dt>
+ <dd><%= @employee.name %></dd>
+</dl>
-<%= link_to 'Edit', edit_employee_path(@employee) %> |
-<%= link_to 'Back', employees_path %>
+<div class="form-actions">
+ <%= link_to t('.back', :default => t("helpers.links.back")),
+ employees_path, :class => 'btn' %>
+ <%= link_to t('.edit', :default => t("helpers.links.edit")),
+ edit_employee_path(@employee), :class => 'btn' %>
+ <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
+ employee_path(@employee),
+ :method => 'delete',
+ :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
+ :class => 'btn btn-danger' %>
+</div>
@@ -1,33 +1,32 @@
-<%= form_for(@reimbursement) do |f| %>
- <% if @reimbursement.errors.any? %>
- <div id="error_explanation">
- <h2><%= pluralize(@reimbursement.errors.count, "error") %> prohibited this reimbursement from being saved:</h2>
-
- <ul>
- <% @reimbursement.errors.full_messages.each do |msg| %>
- <li><%= msg %></li>
- <% end %>
- </ul>
+<%= form_for @reimbursement, :html => { :class => 'form-horizontal' } do |f| %>
+ <div class="control-group">
+ <%= f.label :reference, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :reference, :class => 'text_field' %>
</div>
- <% end %>
-
- <div class="field">
- <%= f.label :reference %><br>
- <%= f.text_field :reference %>
</div>
- <div class="field">
- <%= f.label :payee %><br>
- <%= f.text_field :payee %>
+ <div class="control-group">
+ <%= f.label :payee_id, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :payee_id, :class => 'text_field' %>
+ </div>
</div>
- <div class="field">
- <%= f.label :comments %><br>
- <%= f.text_area :comments %>
+ <div class="control-group">
+ <%= f.label :comments, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :comments, :class => 'text_field' %>
+ </div>
</div>
- <div class="field">
- <%= f.label :data %><br>
- <%= f.text_area :data %>
+ <div class="control-group">
+ <%= f.label :data, :class => 'control-label' %>
+ <div class="controls">
+ <%= f.text_field :data, :class => 'text_field' %>
+ </div>
</div>
- <div class="actions">
- <%= f.submit %>
+
+ <div class="form-actions">
+ <%= f.submit nil, :class => 'btn btn-primary' %>
+ <%= link_to t('.cancel', :default => t("helpers.links.cancel")),
+ reimbursements_path, :class => 'btn' %>
</div>
<% end %>
@@ -1,6 +1,5 @@
-<h1>Editing reimbursement</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Show', @reimbursement %> |
-<%= link_to 'Back', reimbursements_path %>
+<%- model_class = Reimbursement -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize %></h1>
+</div>
+<%= render :partial => 'form' %>
@@ -1,33 +1,42 @@
-<h1>Listing reimbursements</h1>
-
-<table>
+<%- model_class = Reimbursement -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => model_class.model_name.human.pluralize.titleize %></h1>
+</div>
+<table class="table table-striped">
<thead>
<tr>
- <th>Reference</th>
- <th>Payee</th>
- <th>Comments</th>
- <th>Data</th>
- <th></th>
- <th></th>
- <th></th>
+ <th><%= model_class.human_attribute_name(:id) %></th>
+ <th><%= model_class.human_attribute_name(:reference) %></th>
+ <th><%= model_class.human_attribute_name(:payee_id) %></th>
+ <th><%= model_class.human_attribute_name(:comments) %></th>
+ <th><%= model_class.human_attribute_name(:data) %></th>
+ <th><%= model_class.human_attribute_name(:created_at) %></th>
+ <th><%=t '.actions', :default => t("helpers.actions") %></th>
</tr>
</thead>
-
<tbody>
<% @reimbursements.each do |reimbursement| %>
<tr>
+ <td><%= link_to reimbursement.id, reimbursement_path(reimbursement) %></td>
<td><%= reimbursement.reference %></td>
- <td><%= reimbursement.payee %></td>
+ <td><%= reimbursement.payee_id %></td>
<td><%= reimbursement.comments %></td>
<td><%= reimbursement.data %></td>
- <td><%= link_to 'Show', reimbursement %></td>
- <td><%= link_to 'Edit', edit_reimbursement_path(reimbursement) %></td>
- <td><%= link_to 'Destroy', reimbursement, method: :delete, data: { confirm: 'Are you sure?' } %></td>
+ <td><%=l reimbursement.created_at %></td>
+ <td>
+ <%= link_to t('.edit', :default => t("helpers.links.edit")),
+ edit_reimbursement_path(reimbursement), :class => 'btn btn-mini' %>
+ <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
+ reimbursement_path(reimbursement),
+ :method => :delete,
+ :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
+ :class => 'btn btn-mini btn-danger' %>
+ </td>
</tr>
<% end %>
</tbody>
</table>
-<br>
-
-<%= link_to 'New Reimbursement', new_reimbursement_path %>
+<%= link_to t('.new', :default => t("helpers.links.new")),
+ new_reimbursement_path,
+ :class => 'btn btn-primary' %>
@@ -1,5 +1,5 @@
-<h1>New reimbursement</h1>
-
-<%= render 'form' %>
-
-<%= link_to 'Back', reimbursements_path %>
+<%- model_class = Reimbursement -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => [:'helpers.titles.new', 'New %{model}'], :model => model_class.model_name.human.titleize %></h1>
+</div>
+<%= render :partial => 'form' %>
@@ -1,24 +1,27 @@
-<p id="notice"><%= notice %></p>
+<%- model_class = Reimbursement -%>
+<div class="page-header">
+ <h1><%=t '.title', :default => model_class.model_name.human.titleize %></h1>
+</div>
-<p>
- <strong>Reference:</strong>
- <%= @reimbursement.reference %>
-</p>
+<dl class="dl-horizontal">
+ <dt><strong><%= model_class.human_attribute_name(:reference) %>:</strong></dt>
+ <dd><%= @reimbursement.reference %></dd>
+ <dt><strong><%= model_class.human_attribute_name(:payee_id) %>:</strong></dt>
+ <dd><%= @reimbursement.payee_id %></dd>
+ <dt><strong><%= model_class.human_attribute_name(:comments) %>:</strong></dt>
+ <dd><%= @reimbursement.comments %></dd>
+ <dt><strong><%= model_class.human_attribute_name(:data) %>:</strong></dt>
+ <dd><%= @reimbursement.data %></dd>
+</dl>
-<p>
- <strong>Payee:</strong>
- <%= @reimbursement.payee %>
-</p>
-
-<p>
- <strong>Comments:</strong>
- <%= @reimbursement.comments %>
-</p>
-
-<p>
- <strong>Data:</strong>
- <%= @reimbursement.data %>
-</p>
-
-<%= link_to 'Edit', edit_reimbursement_path(@reimbursement) %> |
-<%= link_to 'Back', reimbursements_path %>
+<div class="form-actions">
+ <%= link_to t('.back', :default => t("helpers.links.back")),
+ reimbursements_path, :class => 'btn' %>
+ <%= link_to t('.edit', :default => t("helpers.links.edit")),
+ edit_reimbursement_path(@reimbursement), :class => 'btn' %>
+ <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
+ reimbursement_path(@reimbursement),
+ :method => 'delete',
+ :data => { :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')) },
+ :class => 'btn btn-danger' %>
+</div>

0 comments on commit f4cd029

Please sign in to comment.