Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
got bootstrap forms working
Browse files Browse the repository at this point in the history
  • Loading branch information
romkey committed Jun 17, 2020
1 parent 2f76fa3 commit 35448dd
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ group :production, :test do
gem 'pg'
end

gem "bootstrap_form"

gem 'devise'

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ GEM
bindex (0.8.1)
bootsnap (1.4.6)
msgpack (~> 1.0)
bootstrap_form (4.5.0)
actionpack (>= 5.2)
activemodel (>= 5.2)
builder (3.2.4)
byebug (11.1.3)
capybara (3.32.2)
Expand Down Expand Up @@ -213,6 +216,7 @@ PLATFORMS

DEPENDENCIES
bootsnap (>= 1.4.2)
bootstrap_form
byebug
capybara (>= 2.15)
devise
Expand Down
1 change: 1 addition & 0 deletions app/javascript/packs/stylesheets.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'rails_bootstrap_forms'
3 changes: 1 addition & 2 deletions app/views/categories/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= form_with(model: category, local: true) do |form| %>
<%= bootstrap_form_with(model: category, local: true) do |form| %>
<% if category.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(category.errors.count, "error") %> prohibited this category from being saved:</h2>
Expand All @@ -12,7 +12,6 @@
<% end %>

<div class="field">
<%= form.label :name %>
<%= form.text_field :name %>
</div>

Expand Down
6 changes: 1 addition & 5 deletions app/views/items/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= form_with(model: item, local: true) do |form| %>
<%= bootstrap_form_with(model: item, local: true) do |form| %>
<% if item.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(item.errors.count, "error") %> prohibited this item from being saved:</h2>
Expand All @@ -12,22 +12,18 @@
<% end %>

<div class="field">
<%= form.label :name %>
<%= form.text_field :name %>
</div>

<div class="field">
<%= form.label :category_id %>
<%= form.text_field :category_id %>
</div>

<div class="field">
<%= form.label :serial_number %>
<%= form.text_field :serial_number %>
</div>

<div class="field">
<%= form.label :available %>
<%= form.check_box :available %>
</div>

Expand Down
8 changes: 1 addition & 7 deletions app/views/loans/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= form_with(model: loan, local: true) do |form| %>
<%= bootstrap_form_with(model: loan, local: true) do |form| %>
<% if loan.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(loan.errors.count, "error") %> prohibited this loan from being saved:</h2>
Expand All @@ -12,32 +12,26 @@
<% end %>

<div class="field">
<%= form.label :user_id %>
<%= form.text_field :user_id %>
</div>

<div class="field">
<%= form.label :item_id %>
<%= form.text_field :item_id %>
</div>

<div class="field">
<%= form.label :requested_at %>
<%= form.datetime_select :requested_at %>
</div>

<div class="field">
<%= form.label :fulfilled_at %>
<%= form.datetime_select :fulfilled_at %>
</div>

<div class="field">
<%= form.label :returned_at %>
<%= form.datetime_select :returned_at %>
</div>

<div class="field">
<%= form.label :status %>
<%= form.number_field :status %>
</div>

Expand Down
2 changes: 1 addition & 1 deletion config/webpacker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ default: &default
cache_manifest: false

# Extract and emit a css file
extract_css: false
extract_css: true

static_assets_extensions:
- .jpg
Expand Down

0 comments on commit 35448dd

Please sign in to comment.