-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from rubyforgood/styled-dogs
#108 Add stylized dogs#index page
- Loading branch information
Showing
14 changed files
with
142 additions
and
20 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
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
File renamed without changes.
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,31 @@ | ||
class DogsController < ApplicationController | ||
|
||
def index | ||
@dogs = fetch_mock_dog_data | ||
end | ||
|
||
private | ||
|
||
# | ||
# Returns an array of mock dog data | ||
# @return [Array] | ||
def fetch_mock_dog_data | ||
names = [ "Bella", "Buddy", "Buster", "Cali", "Charlie", "Max", "Oliver", "Oscar", "Penny", "Riley", "Shadow", "Sophie", "Toby", "Tucker", "Winston" ] | ||
ages = [ 'Puppy', 'Adult', 'Senior' ] | ||
breeds = [ 'Labrador', 'Poodle', 'German Shepherd', 'Golden Retriever', 'Pug' ] | ||
weights = [ 'Small', 'Medium', 'Large' ] | ||
sexs = [ 'Male', 'Female' ] | ||
|
||
12.times.map do |i| | ||
name = names.sample | ||
age = ages.sample | ||
breed = breeds.sample | ||
weight = weights.sample | ||
sex = sexs.sample | ||
|
||
dog_photo = "https://placedog.net/500/280?id=#{rand(1..100)}" | ||
OpenStruct.new(image_src: dog_photo, name: name, age: age, breed: breed, weight: weight, sex: sex) | ||
end | ||
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,15 @@ | ||
<div class="fixed h-full w-full -z-10"> | ||
<div class="inset-0 bg-teal h-full"></div> | ||
</div> | ||
|
||
<div class="relative w-full h-full"> | ||
<div class='max-w-[1200px] mx-auto bg-white min-h-full p-12'> | ||
<div class='flex justify-end space-x-6 mb-12'> | ||
<%= partial.yield :header %> | ||
</div> | ||
|
||
<div class='px-0 lg:px-16'> | ||
<%= partial.yield :content %> | ||
</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 @@ | ||
<h1 class='text-4xl'> <%= local_assigns[:text] %></h1> |
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,3 @@ | ||
<div class='text-xl text-gray-400'> | ||
<%= yield %> | ||
</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,35 @@ | ||
<div class='shadow-2xl w-[300px] flex-grow mx-2 my-2 p-6 bg-white'> | ||
<div class='h-62 overflow-hidden'> | ||
<%= image_tag dog.image_src, class: 'object-cover w-full h-[325px] transition hover:scale-150 ease-in-out duration-[2000ms]' %> | ||
</div> | ||
|
||
<div class='text-center text-4xl font-bold uppercase my-2'> | ||
<%= dog.name %> | ||
</div> | ||
|
||
<div class='space-y-2'> | ||
<div class='flex'> | ||
<div class='w-1/2'> | ||
<label class='text-gray-500'>Breed:</label> | ||
<div class='text-[15px] font-medium'><%= dog.breed %></div> | ||
</div> | ||
|
||
<div class='w-1/2'> | ||
<label class='text-gray-500'>Age:</label> | ||
<div class='text-[15px] font-medium'><%= dog.age %></div> | ||
</div> | ||
</div> | ||
|
||
<div class='flex'> | ||
<div class='w-1/2'> | ||
<label class='text-gray-500'>Sex:</label> | ||
<div class='text-[15px] font-medium'><%= dog.sex %></div> | ||
</div> | ||
|
||
<div class='w-1/2'> | ||
<label class='text-gray-500'>Weight (lbs):</label> | ||
<div class='text-[15px] font-medium'><%= dog.weight %></div> | ||
</div> | ||
</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,13 @@ | ||
<div> | ||
<%= render 'components/header', text: 'Fosterable Dogs' %> | ||
|
||
<%= render 'components/textbody' do %> | ||
<p> Thinking about fostering? These adorable dogs from local rescues need someone to foster them while they await their furever home. Click on a dog below to see more information about each dog. </p> | ||
<% end %> | ||
|
||
<div class='flex flex-wrap justify-center mt-6 content-between'> | ||
<% @dogs.each do |dog| %> | ||
<%= render 'dogs/dog_card', dog: dog %> | ||
<% end %> | ||
</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
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
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 |
---|---|---|
|
@@ -10,6 +10,7 @@ module.exports = { | |
theme: { | ||
extend: { | ||
colors: { | ||
'teal': '#4FADBE', | ||
'landing': '#13C2C2', | ||
} | ||
} | ||
|
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,14 @@ | ||
require "test_helper" | ||
|
||
class DogsControllerTest < ActionController::TestCase | ||
|
||
test "should get index with proper content" do | ||
get :index | ||
|
||
assert_response :success | ||
assert_not_nil assigns(:dogs) | ||
assert_includes @response.body, "Fosterable Dogs" | ||
assert_includes @response.body, "Thinking about fostering? These adorable dogs from local rescues need someone to foster them while they await their furever home. Click on a dog below to see more information about each dog." | ||
end | ||
|
||
end |