source 'https://rubygems.org'
#ruby-2.3.0
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.6'
gem 'coffee-rails', '~> 4.2'
gem 'jbuilder', '~> 2.5'
gem 'jquery-rails'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'rails', '~> 5.0.2'
gem 'sass-rails', '~> 5.0'
gem 'turbolinks', '~> 5'
gem 'uglifier', '>= 1.3.0'
group :development, :test do
gem 'byebug', platform: :mri
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.0.5'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]$rails g scaffold Ally first_name last_name email address city state zipcode country phone affiliation website kids:text notes:text birthday:date anniversary:date
$rails g scaffold Card occasion_date:date occasion mail_by:date mailed_on:date written:boolean received:boolean note_in_card:text notes:test ally:references
config/routes.rb
Rails.application.routes.draw do
resources :cards
resources :allies
root 'allies#index'
enddb/migrate/20170401051410_add_spouse_to_allies.rb
class AddSpouseToAllies < ActiveRecord::Migration[5.0]
def change
add_column :allies, :spouse, :string
end
end def ally_params
params.require(:ally).permit(:first_name, :last_name, :email, :address, :city,
:state, :zipcode, :country, :phone, :affiliation, :email, :website, :spouse, :kids,
:notes, :birthday, :anniversary)
endapp/views/allies/index.html.erb
<p id="notice"><%= notice %></p>
<h1>Allies</h1>
<table>
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
<th>Email</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zipcode</th>
<th>Country</th>
<th>Phone</th>
<th>Affiliation</th>
<th>Email</th>
<th>Website</th>
+ <th>Spouse</th>
<th>Kids</th>
<th>Notes</th>
<th>Birthday</th>
<th>Anniversary</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @allies.each do |ally| %>
<tr>
<td><%= ally.first_name %></td>
<td><%= ally.last_name %></td>
<td><%= ally.email %></td>
<td><%= ally.address %></td>
<td><%= ally.city %></td>
<td><%= ally.state %></td>
<td><%= ally.zipcode %></td>
<td><%= ally.country %></td>
<td><%= ally.phone %></td>
<td><%= ally.affiliation %></td>
<td><%= ally.email %></td>
<td><%= ally.website %></td>
+ <td><%= ally.spouse %></td>
<td><%= ally.kids %></td>
<td><%= ally.notes %></td>
<td><%= ally.birthday %></td>
<td><%= ally.anniversary %></td>
<td><%= link_to 'Show', ally %></td>
<td><%= link_to 'Edit', edit_ally_path(ally) %></td>
<td><%= link_to 'Destroy', ally, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Ally', new_ally_path %>app/views/allies/_form.html.erb
<%= form_for(ally) do |f| %>
<% if ally.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(ally.errors.count, "error") %> prohibited this ally from being saved:</h2>
<ul>
<% ally.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :first_name %>
<%= f.text_field :first_name %>
</div>
<div class="field">
<%= f.label :last_name %>
<%= f.text_field :last_name %>
</div>
<div class="field">
<%= f.label :email %>
<%= f.text_field :email %>
</div>
<div class="field">
<%= f.label :address %>
<%= f.text_field :address %>
</div>
<div class="field">
<%= f.label :city %>
<%= f.text_field :city %>
</div>
<div class="field">
<%= f.label :state %>
<%= f.text_field :state %>
</div>
<div class="field">
<%= f.label :zipcode %>
<%= f.text_field :zipcode %>
</div>
<div class="field">
<%= f.label :country %>
<%= f.text_field :country %>
</div>
<div class="field">
<%= f.label :phone %>
<%= f.text_field :phone %>
</div>
<div class="field">
<%= f.label :affiliation %>
<%= f.text_field :affiliation %>
</div>
<div class="field">
<%= f.label :email %>
<%= f.text_field :email %>
</div>
<div class="field">
<%= f.label :website %>
<%= f.text_field :website %>
</div>
+ <div class="field">
+ <%= f.label :spouse %>
+ <%= f.text_area :spouse %>
+ </div>
<div class="field">
<%= f.label :kids %>
<%= f.text_area :kids %>
</div>
<div class="field">
<%= f.label :notes %>
<%= f.text_area :notes %>
</div>
<div class="field">
<%= f.label :birthday %>
<%= f.date_select :birthday %>
</div>
<div class="field">
<%= f.label :anniversary %>
<%= f.date_select :anniversary %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>app/views/allies/_form.html.erb
<p id="notice"><%= notice %></p>
<p>
<strong>First name:</strong>
<%= @ally.first_name %>
</p>
<p>
<strong>Last name:</strong>
<%= @ally.last_name %>
</p>
<p>
<strong>Email:</strong>
<%= @ally.email %>
</p>
<p>
<strong>Address:</strong>
<%= @ally.address %>
</p>
<p>
<strong>City:</strong>
<%= @ally.city %>
</p>
<p>
<strong>State:</strong>
<%= @ally.state %>
</p>
<p>
<strong>Zipcode:</strong>
<%= @ally.zipcode %>
</p>
<p>
<strong>Country:</strong>
<%= @ally.country %>
</p>
<p>
<strong>Phone:</strong>
<%= @ally.phone %>
</p>
<p>
<strong>Affiliation:</strong>
<%= @ally.affiliation %>
</p>
<p>
<strong>Email:</strong>
<%= @ally.email %>
</p>
<p>
<strong>Website:</strong>
<%= @ally.website %>
</p>
<p>
<strong>Spouse:</strong>
<%= @ally.spouse %>
</p>
+ <p>
+ <strong>Kids:</strong>
+ <%= @ally.kids %>
+ </p>
<p>
<strong>Notes:</strong>
<%= @ally.notes %>
</p>
<p>
<strong>Birthday:</strong>
<%= @ally.birthday %>
</p>
<p>
<strong>Anniversary:</strong>
<%= @ally.anniversary %>
</p>
<%= link_to 'Edit', edit_ally_path(@ally) %> |
<%= link_to 'Back', allies_path %>bootstrap-sass Rubygems | bootstrap-sass Docs Installation
bootstrap-sass is a Sass-powered version of Bootstrap 3, ready to drop right into your Sass powered applications.
This is Bootstrap 3. For Bootstrap 4 use the Bootstrap Ruby gem if you use Ruby, and the main repo otherwise. Add the Gem to your Gemfile
In your Gemfile you need to add the bootstrap-sass gem, and ensure that the sass-rails gem is present - it is added to new Rails applications by default. Gemfile
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.6'
gem 'sass-rails', '>= 3.2'
bundle install and restart your server to make the files available through the pipeline. Import Bootstrap styles
bootstrap-sprockets must be imported before bootstrap for the icon fonts to work. Make sure the file has .scss extension (or .sass for Sass syntax). If you have just generated a new Rails app, it may come with a .css file instead. If this file exists, it will be served instead of Sass, so rename it.
Remove all the *= require_self and *= require_tree . statements from the sass file. Instead, use @import to import Sass files.
Do not use *= require in Sass or your other stylesheets will not be able to access the Bootstrap mixins or variables.
app/assets/stylesheets/application.scss
// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables" @import "bootstrap-sprockets"; @import "bootstrap";
//= require jquery
//= require bootstrap-sprockets
bootstrap-sprockets and bootstrap should not both be included in application.js.
bootstrap-sprockets provides individual Bootstrap Javascript files (alert.js or dropdown.js, for example), while bootstrap provides a concatenated file containing all Bootstrap Javascripts.
===
The full list of Bootstrap variables can be found here. You can override these by simply redefining the variable before the @import directive, e.g.:
$navbar-default-bg: #312312;
$light-orange: #ff8c00;
$navbar-default-color: $light-orange;
@import "bootstrap";
===
The fonts are referenced as:
"#{$icon-font-path}#{$icon-font-name}.eot"
$icon-font-path defaults to bootstrap/ if asset path helpers are used, and ../fonts/bootstrap/ otherwise.
When using bootstrap-sass with Compass, Sprockets, or Mincer, you must import the relevant path helpers before Bootstrap itself, for example:
@import "bootstrap-compass";
@import "bootstrap";