diff --git a/app/assets/images/7apps.jpg b/app/assets/images/7apps.jpg new file mode 100644 index 0000000..b05403b Binary files /dev/null and b/app/assets/images/7apps.jpg differ diff --git a/app/assets/images/adrpo.jpg b/app/assets/images/adrpo.jpg new file mode 100644 index 0000000..25adcd2 Binary files /dev/null and b/app/assets/images/adrpo.jpg differ diff --git a/app/assets/images/dcbang.jpg b/app/assets/images/dcbang.jpg new file mode 100644 index 0000000..d227769 Binary files /dev/null and b/app/assets/images/dcbang.jpg differ diff --git a/app/assets/images/logo.svg b/app/assets/images/logo.svg new file mode 100644 index 0000000..c5ac7de --- /dev/null +++ b/app/assets/images/logo.svg @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/assets/images/rails.png b/app/assets/images/rails.png new file mode 100644 index 0000000..b8441f1 Binary files /dev/null and b/app/assets/images/rails.png differ diff --git a/app/assets/stylesheets/products.scss b/app/assets/stylesheets/products.scss index bff386e..de5df1f 100644 --- a/app/assets/stylesheets/products.scss +++ b/app/assets/stylesheets/products.scss @@ -1,3 +1,50 @@ // Place all the styles related to the Products controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ +.products { + table { + border-collapse: collapse; + } + + table tr td { + padding: 5px; + vertical-align: top; + } + + .list_image { + width: 60px; + height: 70px; + } + + .list_description { + width: 60%; + + dl { + margin: 0; + } + + dt { + color: #244; + font-weight: bold; + font-size: larger; + } + + dd { + margin: 0; + } + } + + .list_actions { + font-size: x-small; + text-align: right; + padding-left: 1em; + } + + .list_line_even { + background: #e0f8f8; + } + + .list_line_odd { + background: #f8b0f8 + } +} diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 64a50be..b2de017 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -8,7 +8,7 @@ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> - + <%= yield %> diff --git a/app/views/products/index.html.erb b/app/views/products/index.html.erb index 64e927f..9060d6a 100644 --- a/app/views/products/index.html.erb +++ b/app/views/products/index.html.erb @@ -3,31 +3,31 @@

Products

- - - - - - - - - +<% @products.each do |product| %> + - - <% @products.each do |product| %> - - - - - - - - - - <% end %> - + + + + + + +<% end %>
TitleDescriptionImage urlPrice
<%= product.title %><%= product.description %><%= product.image_url %><%= product.price %><%= link_to 'Show', product %><%= link_to 'Edit', edit_product_path(product) %><%= link_to 'Destroy', product, method: :delete, data: { confirm: 'Are you sure?' } %>
+ <%= image_tag(product.image_url, class: 'list_image') %> + +
+
<%= product.title %>
+
<%= truncate(strip_tags(product.description), + length: 80) %>
+
+
+ <%= link_to 'Show', product %>
+ <%= link_to 'Edit', edit_product_path(product) %>
+ <%= link_to 'Destroy', product, method: :delete, + data: { confirm: 'Are you sure?' } %> +
-
+
<%= link_to 'New Product', new_product_path %> diff --git a/db/seeds.rb b/db/seeds.rb index 1beea2a..ca904dd 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,7 +1,55 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). -# -# Examples: -# -# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) -# Character.create(name: 'Luke', movie: movies.first) +#--- +# Excerpted from "Agile Web Development with Rails 5", +# published by The Pragmatic Bookshelf. +# Copyrights apply to this code. It may not be used to create training material, +# courses, books, articles, and the like. Contact us if you are in doubt. +# We make no guarantees that this code is fit for any purpose. +# Visit http://www.pragmaticprogrammer.com/titles/rails5 for more book information. +#--- +# encoding: utf-8 +Product.delete_all +Product.create(title: 'Rails, Angular, Postgres, and Bootstrap', + description: + %{

+ Powerful, Effective, and Efficient Full-Stack Web Development + As a Rails developer, you care about user experience and performance, + but you also want simple and maintainable code. Achieve all that by + embracing the full stack of web development, from styling with + Bootstrap, building an interactive user interface with AngularJS, to + storing data quickly and reliably in PostgreSQL. Take a holistic view of + full-stack development to create usable, high-performing applications, + and learn to use these technologies effectively in a Ruby on Rails + environment. +

}, + image_url: 'dcbang.jpg', + price: 45.00) +# . . . +Product.create(title: 'Seven Mobile Apps in Seven Weeks', + description: + %{

+ Native Apps, Multiple Platforms + Answer the question “Can we build this for ALL the devices?” with a + resounding YES. This book will help you get there with a real-world + introduction to seven platforms, whether you’re new to mobile or an + experienced developer needing to expand your options. Plus, you’ll find + out which cross-platform solution makes the most sense for your needs. +

}, + image_url: '7apps.jpg', + price: 26.00) +# . . . + +Product.create(title: 'Ruby Performance Optimization', + description: + %{

+ Why Ruby Is Slow, and How to Fix It + You don’t have to accept slow Ruby or Rails performance. In this + comprehensive guide to Ruby optimization, you’ll learn how to write + faster Ruby code—but that’s just the beginning. See exactly what makes + Ruby and Rails code slow, and how to fix it. Alex Dymo will guide you + through perils of memory and CPU optimization, profiling, measuring, + performance testing, garbage collection, and tuning. You’ll find that + all those “hard” things aren’t so difficult after all, and your code + will run orders of magnitude faster. +

}, + image_url: 'adrpo.jpg', + price: 46.00)