-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class CustomersController < ApplicationController | ||
def index | ||
@customers = Customer.all | ||
end | ||
|
||
def alphabetized | ||
@customers = Customer.order(:full_name) | ||
end | ||
|
||
def missing_email | ||
@customers = Customer.where(email_address: [nil, ""]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module CustomersHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<div class="card mb-4"> | ||
<div class="card-content"> | ||
<div class="media"> | ||
<div class="media-left"> | ||
<figure class="image is-96x96"> | ||
<% if customer.image.attached? %> | ||
<%= image_tag customer.image, class: "is-rounded" %> | ||
<% else %> | ||
<%= image_tag "default_profile.png", class: "is-rounded" %> | ||
<% end %> | ||
</figure> | ||
</div> | ||
<div class="media-content"> | ||
<p class="title is-4"><%= customer.full_name %></p> | ||
<p class="subtitle is-6"> | ||
<% if customer.email_address.present? %> | ||
<%= customer.email_address %> | ||
<% else %> | ||
<span class="has-text-danger">No email provided</span> | ||
<% end %> | ||
</p> | ||
</div> | ||
</div> | ||
<div class="content"> | ||
<p><strong>Phone:</strong> <%= customer.phone_number %></p> | ||
<p><%= customer.notes %></p> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>Customers#alphabetized</h1> | ||
<p>Find me in app/views/customers/alphabetized.html.erb</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>Customers#index</h1> | ||
<p>Find me in app/views/customers/index.html.erb</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>Customers#missing_email</h1> | ||
<p>Find me in app/views/customers/missing_email.html.erb</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require "test_helper" | ||
|
||
class CustomersControllerTest < ActionDispatch::IntegrationTest | ||
test "should get index" do | ||
get customers_index_url | ||
assert_response :success | ||
end | ||
|
||
test "should get alphabetized" do | ||
get customers_alphabetized_url | ||
assert_response :success | ||
end | ||
|
||
test "should get missing_email" do | ||
get customers_missing_email_url | ||
assert_response :success | ||
end | ||
end |