From 4f33a3e0a0a119b135ccd0588f438ffd1a8092df Mon Sep 17 00:00:00 2001 From: David Date: Tue, 1 Dec 2015 00:33:36 -0800 Subject: [PATCH 01/43] updated gem file --- Gemfile.lock | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e06038e..99bcc38 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -41,7 +41,7 @@ GEM binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) builder (3.2.2) - byebug (6.0.2) + byebug (8.2.1) cancancan (1.13.1) coffee-rails (4.1.0) coffee-script (>= 2.2.0) @@ -49,7 +49,7 @@ GEM coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.9.1.1) + coffee-script-source (1.10.0) debug_inspector (0.0.2) devise (3.5.2) bcrypt (~> 3.0) @@ -75,14 +75,14 @@ GEM nokogiri (>= 1.5.9) mail (2.6.3) mime-types (>= 1.16, < 3) - mime-types (2.6.2) - mini_portile (0.6.2) - minitest (5.8.1) + mime-types (2.99) + mini_portile2 (2.0.0) + minitest (5.8.3) multi_json (1.11.2) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) + nokogiri (1.6.7) + mini_portile2 (~> 2.0.0.rc2) orm_adapter (0.5.0) - pg (0.18.3) + pg (0.18.4) rack (1.6.4) rack-test (0.6.3) rack (>= 1.0) @@ -117,7 +117,6 @@ GEM thor (>= 0.18.1, < 2.0) rake (10.4.2) rdoc (4.2.0) - json (~> 1.4) responders (2.1.0) railties (>= 4.2.0, < 5) sass (3.4.19) @@ -130,8 +129,8 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - spring (1.4.0) - sprockets (3.4.0) + spring (1.5.0) + sprockets (3.4.1) rack (> 1, < 3) sprockets-rails (2.3.3) actionpack (>= 3.0) From 3bd0c750896cee05b76343584ab1507b149ccb4f Mon Sep 17 00:00:00 2001 From: David Date: Tue, 1 Dec 2015 22:10:17 -0800 Subject: [PATCH 02/43] ignore bundle dependencies --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 050c9d9..827620e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Ignore bundler config. /.bundle +/vendor/bundle # Ignore the default SQLite database. /db/*.sqlite3 From 154e42c6f61c109b040970f4dc07f31a1e901316 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Dec 2015 00:27:21 -0800 Subject: [PATCH 03/43] add image links to shapes view --- app/views/shapes/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shapes/index.html.erb b/app/views/shapes/index.html.erb index 7861499..4040aff 100644 --- a/app/views/shapes/index.html.erb +++ b/app/views/shapes/index.html.erb @@ -15,7 +15,7 @@ <% @shapes.each do |shape| %> <%= shape.name %> - <%= shape.image %> + <%= link_to 'Show', shape %> <%= link_to 'Edit', edit_shape_path(shape) %> <%= link_to 'Destroy', shape, method: :delete, data: { confirm: 'Are you sure?' } %> From d3cb5bcddccc6ae74f0855605118219099237fd9 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Dec 2015 00:53:00 -0800 Subject: [PATCH 04/43] added pet, color, and shape image to view --- app/views/colors/index.html.erb | 2 +- app/views/pets/index.html.erb | 4 ++-- app/views/shapes/index.html.erb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/colors/index.html.erb b/app/views/colors/index.html.erb index e857550..1d583c9 100644 --- a/app/views/colors/index.html.erb +++ b/app/views/colors/index.html.erb @@ -13,7 +13,7 @@ <% @colors.each do |color| %> - <%= color.hex_value %> + <%= link_to 'Show', color %> <%= link_to 'Edit', edit_color_path(color) %> <%= link_to 'Destroy', color, method: :delete, data: { confirm: 'Are you sure?' } %> diff --git a/app/views/pets/index.html.erb b/app/views/pets/index.html.erb index e49229f..7e43478 100644 --- a/app/views/pets/index.html.erb +++ b/app/views/pets/index.html.erb @@ -15,8 +15,8 @@ <% @pets.each do |pet| %> - <%= pet.color %> - <%= pet.shape %> + + <%= image_tag(pet.shape.image)%> <%= pet.full_name %> <%= link_to 'Show', pet %> <%= link_to 'Edit', edit_pet_path(pet) %> diff --git a/app/views/shapes/index.html.erb b/app/views/shapes/index.html.erb index 4040aff..8d82e3d 100644 --- a/app/views/shapes/index.html.erb +++ b/app/views/shapes/index.html.erb @@ -15,7 +15,7 @@ <% @shapes.each do |shape| %> <%= shape.name %> - + <%= image_tag(shape.image)%> <%= link_to 'Show', shape %> <%= link_to 'Edit', edit_shape_path(shape) %> <%= link_to 'Destroy', shape, method: :delete, data: { confirm: 'Are you sure?' } %> From 2befe004225163e628cfcf6c8fbba93d7cc70adb Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Dec 2015 12:31:11 -0800 Subject: [PATCH 05/43] uppercased value --- app/views/colors/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/colors/index.html.erb b/app/views/colors/index.html.erb index 1d583c9..5d0e5f2 100644 --- a/app/views/colors/index.html.erb +++ b/app/views/colors/index.html.erb @@ -5,7 +5,7 @@ - + From 2eded369fac23d4711226c02d664179b6dabf925 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Dec 2015 12:45:10 -0800 Subject: [PATCH 06/43] Changed last name to Name --- app/views/pets/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pets/index.html.erb b/app/views/pets/index.html.erb index 7e43478..493f02d 100644 --- a/app/views/pets/index.html.erb +++ b/app/views/pets/index.html.erb @@ -7,7 +7,7 @@ - + From 4090599d7ae4c81f456552a7a031f79c184d4805 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 2 Dec 2015 19:58:37 -0800 Subject: [PATCH 07/43] created drop-down menu for color and shape, removed color column from pets view --- app/views/pets/_form.html.erb | 10 ++-------- app/views/pets/index.html.erb | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/views/pets/_form.html.erb b/app/views/pets/_form.html.erb index 429f415..19a7ad4 100644 --- a/app/views/pets/_form.html.erb +++ b/app/views/pets/_form.html.erb @@ -11,14 +11,8 @@ <% end %> -
- <%= f.label :color_id %>
- <%= f.text_field :color_id %> -
-
- <%= f.label :shape_id %>
- <%= f.text_field :shape_id %> -
+ <%= f.collection_select(:color_id, Color.all, :id, :hex_value ) %> + <%= f.collection_select(:shape_id, Shape.all, :id, :name ) %>
<%= f.label :last_name %>
<%= f.text_field :last_name %> diff --git a/app/views/pets/index.html.erb b/app/views/pets/index.html.erb index 493f02d..d3362b3 100644 --- a/app/views/pets/index.html.erb +++ b/app/views/pets/index.html.erb @@ -15,7 +15,7 @@
<% @pets.each do |pet| %> - + From a500cff12977ecb676c6db923147fa29f594b5a1 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 3 Dec 2015 09:41:22 -0800 Subject: [PATCH 08/43] added Color.all and Shape.all actions to pet controller --- app/controllers/pets_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/pets_controller.rb b/app/controllers/pets_controller.rb index 57497b0..9323738 100644 --- a/app/controllers/pets_controller.rb +++ b/app/controllers/pets_controller.rb @@ -15,6 +15,8 @@ def show # GET /pets/new def new @pet = Pet.new + @colors = Color.all + @shapes = Shape.all end # GET /pets/1/edit From f9b33cecc118429d74abbe151a52784307a6220b Mon Sep 17 00:00:00 2001 From: David Date: Thu, 3 Dec 2015 09:42:16 -0800 Subject: [PATCH 09/43] styled background hex value in colors#show --- app/views/colors/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/colors/show.html.erb b/app/views/colors/show.html.erb index 47fce7c..8f8f59c 100644 --- a/app/views/colors/show.html.erb +++ b/app/views/colors/show.html.erb @@ -1,6 +1,6 @@

<%= notice %>

-

+

Hex value: <%= @color.hex_value %>

From ebe97d09e0fb5816ace3708462fe1fb6887f22ff Mon Sep 17 00:00:00 2001 From: David Date: Thu, 3 Dec 2015 09:46:25 -0800 Subject: [PATCH 10/43] hex value display across whole page in pets show# --- app/views/colors/show.html.erb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/colors/show.html.erb b/app/views/colors/show.html.erb index 8f8f59c..52be820 100644 --- a/app/views/colors/show.html.erb +++ b/app/views/colors/show.html.erb @@ -1,6 +1,12 @@ + +

<%= notice %>

-

+

Hex value: <%= @color.hex_value %>

From 78523f852f5a7276f0e554df295583a14da16e9c Mon Sep 17 00:00:00 2001 From: David Date: Thu, 3 Dec 2015 17:48:12 -0800 Subject: [PATCH 11/43] called @colors and @shapes method --- app/views/pets/_form.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/pets/_form.html.erb b/app/views/pets/_form.html.erb index 19a7ad4..7ee4f4a 100644 --- a/app/views/pets/_form.html.erb +++ b/app/views/pets/_form.html.erb @@ -11,8 +11,8 @@ <% end %> - <%= f.collection_select(:color_id, Color.all, :id, :hex_value ) %> - <%= f.collection_select(:shape_id, Shape.all, :id, :name ) %> + <%= f.collection_select(:color_id, @colors, :id, :hex_value ) %> + <%= f.collection_select(:shape_id, @shapes, :id, :name ) %>
<%= f.label :last_name %>
<%= f.text_field :last_name %> From 5a6c58c227aff58ec3310d33d03f4b4356655dd7 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 3 Dec 2015 17:49:56 -0800 Subject: [PATCH 12/43] put back color attribute on pets view --- app/views/pets/index.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pets/index.html.erb b/app/views/pets/index.html.erb index d3362b3..493f02d 100644 --- a/app/views/pets/index.html.erb +++ b/app/views/pets/index.html.erb @@ -15,7 +15,7 @@
<% @pets.each do |pet| %> - + From 3098992d3dca8bcd60bc92983c5105917edc1d93 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 3 Dec 2015 17:57:10 -0800 Subject: [PATCH 13/43] changed color and shape selection to radio button pets new# --- app/views/pets/_form.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/pets/_form.html.erb b/app/views/pets/_form.html.erb index 7ee4f4a..8fd1f51 100644 --- a/app/views/pets/_form.html.erb +++ b/app/views/pets/_form.html.erb @@ -11,8 +11,8 @@ <% end %> - <%= f.collection_select(:color_id, @colors, :id, :hex_value ) %> - <%= f.collection_select(:shape_id, @shapes, :id, :name ) %> + <%= collection_radio_buttons(:color, :color_id, @colors, :id, :hex_value ) %>
+ <%= collection_radio_buttons(:shape, :shape_id, @shapes, :id, :name ) %>
<%= f.label :last_name %>
<%= f.text_field :last_name %> From be499d7d0c28f2e292e6b6a40d99f86cb563b4de Mon Sep 17 00:00:00 2001 From: David Date: Thu, 3 Dec 2015 19:23:37 -0800 Subject: [PATCH 14/43] replaced collection_radio_button with stylized html pets#form --- app/views/pets/_form.html.erb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/pets/_form.html.erb b/app/views/pets/_form.html.erb index 8fd1f51..59e5150 100644 --- a/app/views/pets/_form.html.erb +++ b/app/views/pets/_form.html.erb @@ -11,7 +11,11 @@
<% end %> - <%= collection_radio_buttons(:color, :color_id, @colors, :id, :hex_value ) %>
+<% @colors.each do |color| %> + + + <% end %> +
<%= collection_radio_buttons(:shape, :shape_id, @shapes, :id, :name ) %>
<%= f.label :last_name %>
From d05cd4f66d2089606aab630b620d2234d69e9607 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 3 Dec 2015 21:05:36 -0800 Subject: [PATCH 15/43] replaced shapes collection_radio_button with stylized html pets#form --- app/views/pets/_form.html.erb | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/app/views/pets/_form.html.erb b/app/views/pets/_form.html.erb index 59e5150..c9edaf1 100644 --- a/app/views/pets/_form.html.erb +++ b/app/views/pets/_form.html.erb @@ -11,17 +11,22 @@
<% end %> -<% @colors.each do |color| %> - - + <% @colors.each do |color| %> + + + <% end %> +
+ <% @shapes.each do |shape| %> + + + <% end %> +
+ +
+ <%= f.label :last_name %>
+ <%= f.text_field :last_name %> +
+
+ <%= f.submit %> +
<% end %> -
- <%= collection_radio_buttons(:shape, :shape_id, @shapes, :id, :name ) %> -
- <%= f.label :last_name %>
- <%= f.text_field :last_name %> -
-
- <%= f.submit %> -
-<% end %> From 869ecea298ec7a26f9d7fb8f953da0f70cc521ca Mon Sep 17 00:00:00 2001 From: David Date: Thu, 3 Dec 2015 21:07:23 -0800 Subject: [PATCH 16/43] added @colors and @shapes pets edit controller --- app/controllers/pets_controller.rb | 2 ++ app/views/pets/_form.html.erb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/pets_controller.rb b/app/controllers/pets_controller.rb index 9323738..7ce4157 100644 --- a/app/controllers/pets_controller.rb +++ b/app/controllers/pets_controller.rb @@ -21,6 +21,8 @@ def new # GET /pets/1/edit def edit + @colors = Color.all + @shapes = Shape.all end # POST /pets diff --git a/app/views/pets/_form.html.erb b/app/views/pets/_form.html.erb index c9edaf1..32fe016 100644 --- a/app/views/pets/_form.html.erb +++ b/app/views/pets/_form.html.erb @@ -21,7 +21,7 @@ <% end %>
- +
<%= f.label :last_name %>
<%= f.text_field :last_name %> From 984ffe8450c99d669dd463661a5f79ae15c497a8 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 4 Dec 2015 14:16:31 -0800 Subject: [PATCH 17/43] added shape image to pets show# --- app/views/pets/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pets/show.html.erb b/app/views/pets/show.html.erb index be8ecbc..1d01319 100644 --- a/app/views/pets/show.html.erb +++ b/app/views/pets/show.html.erb @@ -7,7 +7,7 @@

Shape: - <%= @pet.shape %> + <%= image_tag(@pet.shape.image)%>

From 67265c50eda66dc101295b12db019e242a969aee Mon Sep 17 00:00:00 2001 From: David Date: Fri, 4 Dec 2015 14:26:12 -0800 Subject: [PATCH 18/43] added hex_value to pets show# --- app/views/pets/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pets/show.html.erb b/app/views/pets/show.html.erb index 1d01319..e29948d 100644 --- a/app/views/pets/show.html.erb +++ b/app/views/pets/show.html.erb @@ -2,7 +2,7 @@

Color: - <%= @pet.color %> + <%= @pet.color.hex_value %>

From df731d6f9577351e37d924e9e34a7731eb48139e Mon Sep 17 00:00:00 2001 From: David Date: Fri, 4 Dec 2015 14:28:30 -0800 Subject: [PATCH 19/43] added shape image to shapes show# --- app/views/shapes/show.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/shapes/show.html.erb b/app/views/shapes/show.html.erb index 0fc6c39..d03b0c2 100644 --- a/app/views/shapes/show.html.erb +++ b/app/views/shapes/show.html.erb @@ -7,7 +7,7 @@

Image: - <%= @shape.image %> + <%= image_tag(@shape.image)%>

<%= link_to 'Edit', edit_shape_path(@shape) %> | From f2251daa98cd68b61d028259255bf99689211924 Mon Sep 17 00:00:00 2001 From: David Mazza Date: Fri, 4 Dec 2015 20:41:01 -0800 Subject: [PATCH 20/43] Fix pet#form color and shape fields --- app/views/pets/_form.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/pets/_form.html.erb b/app/views/pets/_form.html.erb index 32fe016..4c6d266 100644 --- a/app/views/pets/_form.html.erb +++ b/app/views/pets/_form.html.erb @@ -12,16 +12,16 @@ <% end %> <% @colors.each do |color| %> - - + + <% end %>
<% @shapes.each do |shape| %> - - + + <% end %>
- +
<%= f.label :last_name %>
<%= f.text_field :last_name %> From 25b6dfb244e9dda940f6f8f849eaf544f916f696 Mon Sep 17 00:00:00 2001 From: David Mazza Date: Fri, 4 Dec 2015 21:04:45 -0800 Subject: [PATCH 21/43] Generate a lucky number on the Pet model, add it to pets#index --- app/models/pet.rb | 9 +++++++++ app/views/pets/index.html.erb | 2 ++ 2 files changed, 11 insertions(+) diff --git a/app/models/pet.rb b/app/models/pet.rb index 13c8a55..0cb1c6f 100644 --- a/app/models/pet.rb +++ b/app/models/pet.rb @@ -9,4 +9,13 @@ def first_name def full_name first_name + " " + last_name end + + def expression_id + 3 # lacking a model for now, default to the higest possible ID + end + + def lucky_number + binary_string = ("%05b" % color_id) + ("%03b" % shape_id) + ("%02b" % expression_id) + binary_string.to_i(2) + end end diff --git a/app/views/pets/index.html.erb b/app/views/pets/index.html.erb index 493f02d..508f8bf 100644 --- a/app/views/pets/index.html.erb +++ b/app/views/pets/index.html.erb @@ -8,6 +8,7 @@
+ @@ -18,6 +19,7 @@ + From 49d63070af6c4fe61b45440519ff6f46032b8b0e Mon Sep 17 00:00:00 2001 From: David Date: Sun, 6 Dec 2015 17:56:08 -0800 Subject: [PATCH 22/43] added current pet color background to shape radio button pet#edit --- app/views/pets/_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pets/_form.html.erb b/app/views/pets/_form.html.erb index 4c6d266..02cb023 100644 --- a/app/views/pets/_form.html.erb +++ b/app/views/pets/_form.html.erb @@ -18,7 +18,7 @@
<% @shapes.each do |shape| %> - + <% end %>
From 6a2cad22fc006fd130447b6df6612df4d623edb6 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 6 Dec 2015 18:09:12 -0800 Subject: [PATCH 23/43] set default color attribute for pets#new created @pet.color instance variable set default color id to 5 --- app/controllers/pets_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/pets_controller.rb b/app/controllers/pets_controller.rb index 7ce4157..cebf651 100644 --- a/app/controllers/pets_controller.rb +++ b/app/controllers/pets_controller.rb @@ -15,6 +15,7 @@ def show # GET /pets/new def new @pet = Pet.new + @pet.color = Color.find(5) @colors = Color.all @shapes = Shape.all end From be2adce68985a1fbaf4b93f25c503c78fb036827 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 6 Dec 2015 18:17:07 -0800 Subject: [PATCH 24/43] set default color attribute for pets#new changed from ID 5 to first --- app/controllers/pets_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/pets_controller.rb b/app/controllers/pets_controller.rb index cebf651..e6266cd 100644 --- a/app/controllers/pets_controller.rb +++ b/app/controllers/pets_controller.rb @@ -15,7 +15,7 @@ def show # GET /pets/new def new @pet = Pet.new - @pet.color = Color.find(5) + @pet.color = Color.first @colors = Color.all @shapes = Shape.all end From 3b07bbdd419f8c8f76f42ffa7fec75e2dabca99b Mon Sep 17 00:00:00 2001 From: David Date: Sun, 6 Dec 2015 18:40:10 -0800 Subject: [PATCH 25/43] redirect pets#update to pets#edit instead of pets#show --- app/controllers/pets_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/pets_controller.rb b/app/controllers/pets_controller.rb index e6266cd..8a5bec9 100644 --- a/app/controllers/pets_controller.rb +++ b/app/controllers/pets_controller.rb @@ -47,7 +47,7 @@ def create def update respond_to do |format| if @pet.update(pet_params) - format.html { redirect_to @pet, notice: 'Pet was successfully updated.' } + format.html { redirect_to edit_pet_url(@pet), notice: 'Pet was successfully updated.' } format.json { render :show, status: :ok, location: @pet } else format.html { render :edit } From b645039e305ecd005da469d608164a99ff6d8134 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 6 Dec 2015 19:33:51 -0800 Subject: [PATCH 26/43] change color and shape attributes with one click --- app/views/pets/edit.html.erb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index 65502cc..889e24c 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -1,6 +1,20 @@

Editing Pet

-<%= render 'form' %> + <% @colors.each do |color| %> + + <%= form_for(@pet) do |f| %> + + + <% end %> + <% end %> + + <% @shapes.each do |shape| %> + + <%= form_for(@pet) do |f| %> + + + <% end %> + <% end %> <%= link_to 'Show', @pet %> | <%= link_to 'Back', pets_path %> From f16890f8553de770d5895bc6e71c380b0d4759b9 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 6 Dec 2015 20:56:32 -0800 Subject: [PATCH 27/43] rendered pets#edit with the pet on the left half, and the form on the right half --- app/views/pets/edit.html.erb | 49 ++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index 889e24c..b7f0ab2 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -1,20 +1,47 @@

Editing Pet

- <% @colors.each do |color| %> + - <%= form_for(@pet) do |f| %> - - +
+ <%= @pet.full_name %> + <%= @pet.lucky_number %> + <%= image_tag(@pet.shape.image) %> +
+ +
+ <% @colors.each do |color| %> + + <%= form_for(@pet) do |f| %> + + + + <% end %> <% end %> - <% end %> - <% @shapes.each do |shape| %> + <% @shapes.each do |shape| %> + + <%= form_for(@pet) do |f| %> + + - <%= form_for(@pet) do |f| %> - - + <% end %> <% end %> - <% end %> +
-<%= link_to 'Show', @pet %> | +<%= link_to 'Show', @pet %> <%= link_to 'Back', pets_path %> From 91f50eed24d796b349f85cc72eae1c1896328f92 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 6 Dec 2015 21:00:47 -0800 Subject: [PATCH 28/43] set pet-render and pet-form to take up half the screen pets#edit --- app/views/pets/edit.html.erb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index b7f0ab2..956db21 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -4,9 +4,11 @@ div.pet-render { float:left; background-color:#<%= @pet.color.hex_value %>; + width: 50%; } div.pet-form { float:left; + width: 50%; } From 6c9192146cb8c15488b3505197ebacb0ebe2153f Mon Sep 17 00:00:00 2001 From: David Date: Sun, 6 Dec 2015 21:18:06 -0800 Subject: [PATCH 29/43] set color to only inside shapes pet#edit --- app/views/pets/edit.html.erb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index 956db21..52f3943 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -1,9 +1,11 @@ -

Editing Pet

+

Create your own Chubbyy 🙃

@@ -37,8 +42,9 @@ <% @shapes.each do |shape| %> <%= form_for(@pet) do |f| %> - + From 1bd68e5298bee3b0da828b47c95b09deabc5dabd Mon Sep 17 00:00:00 2001 From: David Date: Thu, 10 Dec 2015 14:15:50 -0800 Subject: [PATCH 31/43] switched pet shape and color buttons pets/edit# --- app/views/pets/edit.html.erb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index f04dba0..c1274ce 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -26,30 +26,32 @@
- <% @colors.each do |color| %> + + <% @shapes.each do |shape| %> <%= form_for(@pet) do |f| %> - + + <%= image_tag(shape.image, class:"shape")%> <% end %> <% end %> - <% @shapes.each do |shape| %> + <% @colors.each do |color| %> <%= form_for(@pet) do |f| %> - + +
<%= color.hex_value %>
<% end %> <% end %> +
<%= link_to 'Show', @pet %> From 176a79504166a75e32c14a1b5a7d26b884a52fe7 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 10 Dec 2015 15:41:27 -0800 Subject: [PATCH 32/43] turned color buttons into circles --- app/views/pets/edit.html.erb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index c1274ce..f891b76 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -5,11 +5,11 @@ background-color:#<%= @pet.color.hex_value %>; } div.pet-render { - float:left; + float: left; width: 50%; } div.pet-form { - float:left; + float: left; width: 50%; } button { @@ -17,6 +17,12 @@ padding: 0; background-color: white; } + .color_button div { + display: block; + width: 150px; + height: 150px; + border-radius: 75px; + }
@@ -45,9 +51,9 @@ - + for="pet_color_id_<%= color.id %>">
<% end %> <% end %> From be4a94f45faa052407457e9dfbcbd3670df4bf30 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 10 Dec 2015 15:42:11 -0800 Subject: [PATCH 33/43] added padding and increased margin header pets/edit# --- app/views/pets/edit.html.erb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index f891b76..5fbf80c 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -1,6 +1,13 @@

Create your own Chubbyy 🙃

- <%= @pet.full_name %> - <%= @pet.lucky_number %> <%= image_tag(@pet.shape.image, class:"shape") %>
@@ -46,7 +54,7 @@ - <% end %> @@ -58,7 +66,7 @@ - From d8836a5f96d58fec73b2956edf0b8bb979ba3dda Mon Sep 17 00:00:00 2001 From: David Date: Thu, 10 Dec 2015 18:05:58 -0800 Subject: [PATCH 35/43] adding padding color buttons pets/edit# --- app/views/pets/edit.html.erb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index 6512e51..6230008 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -22,20 +22,20 @@ } button { border: 0; - padding: 0; + padding: 15px; background-color: white; } .color-button div { display: block; - width: 70px; - height: 70px; - border-radius: 35px; + width: 40px; + height: 40px; + border-radius: 20px; } .color-button { float: left; } .shape-button img { - width: 140px; + width: 110px; } .shape-button { float: left; @@ -59,6 +59,8 @@ <% end %> <% end %> + +
<% @colors.each do |color| %> From 3859db426e78a624794cf12214bbc90849b40548 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 10 Dec 2015 21:13:34 -0800 Subject: [PATCH 36/43] made selected color larger pets/edit# --- app/controllers/pets_controller.rb | 4 ++++ app/views/pets/edit.html.erb | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/controllers/pets_controller.rb b/app/controllers/pets_controller.rb index 8a5bec9..5b74eae 100644 --- a/app/controllers/pets_controller.rb +++ b/app/controllers/pets_controller.rb @@ -24,6 +24,10 @@ def new def edit @colors = Color.all @shapes = Shape.all + @colors.each do |color| + if @pet.color.id == color.id + end + end end # POST /pets diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index 6230008..0911ee3 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -30,9 +30,12 @@ width: 40px; height: 40px; border-radius: 20px; + border-style: solid; + border-width: 0px; } .color-button { float: left; + } .shape-button img { width: 110px; @@ -40,6 +43,14 @@ .shape-button { float: left; } + .selected { + padding:11px; + } + .selected div { + border-width: 4px; + border-color: black; + border-radius: 24px; + }
@@ -59,7 +70,7 @@ <% end %> <% end %> - +
<% @colors.each do |color| %> @@ -68,8 +79,8 @@ - <% end %> From b7d6db35f49fc5dd4b3dd7f8eac3eb67ca194beb Mon Sep 17 00:00:00 2001 From: David Date: Thu, 10 Dec 2015 23:07:06 -0800 Subject: [PATCH 37/43] moved chubbyy rendered closer to the center pets/edit# --- app/views/pets/edit.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pets/edit.html.erb b/app/views/pets/edit.html.erb index 0911ee3..35cc539 100644 --- a/app/views/pets/edit.html.erb +++ b/app/views/pets/edit.html.erb @@ -14,7 +14,7 @@ div.pet-render { float: left; width: 50%; - margin-top: 150px; + margin-top: 80px; } div.pet-form { float: left; From 5336a5cd08a3eea49c6a6748cd2072ac14aca867 Mon Sep 17 00:00:00 2001 From: David Date: Sat, 12 Dec 2015 21:43:28 -0800 Subject: [PATCH 38/43] gem file update --- Gemfile.lock | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 99bcc38..e00f95e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,8 +50,9 @@ GEM coffee-script-source execjs coffee-script-source (1.10.0) + concurrent-ruby (1.0.0) debug_inspector (0.0.2) - devise (3.5.2) + devise (3.5.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 3.2.6, < 5) @@ -119,7 +120,7 @@ GEM rdoc (4.2.0) responders (2.1.0) railties (>= 4.2.0, < 5) - sass (3.4.19) + sass (3.4.20) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) sass (~> 3.1) @@ -130,7 +131,8 @@ GEM json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) spring (1.5.0) - sprockets (3.4.1) + sprockets (3.5.2) + concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (2.3.3) actionpack (>= 3.0) @@ -146,7 +148,7 @@ GEM uglifier (2.7.2) execjs (>= 0.3.0) json (>= 1.8.0) - warden (1.2.3) + warden (1.2.4) rack (>= 1.0) web-console (2.2.1) activemodel (>= 4.0) From fa33279cf62fba3a81d83dba2406c6c52c23a5f5 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 17 Dec 2015 20:01:43 -0800 Subject: [PATCH 39/43] set register and login url path --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 20e003b..dcb5557 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,7 +5,7 @@ devise_for :users resources :campaigns - devise_scope :users do + devise_scope :user do get 'register', to: 'devise/registrations#new', as: :register get 'login', to: 'devise/sessions#new', as: :login end From 7b8f1146567e7d938ae08e24e5e8178be2afdda4 Mon Sep 17 00:00:00 2001 From: David Mazza Date: Sat, 19 Dec 2015 10:40:37 -0500 Subject: [PATCH 40/43] fix typo --- app/models/pet.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/pet.rb b/app/models/pet.rb index 0cb1c6f..5f6b5a4 100644 --- a/app/models/pet.rb +++ b/app/models/pet.rb @@ -11,7 +11,7 @@ def full_name end def expression_id - 3 # lacking a model for now, default to the higest possible ID + 3 # lacking a model for now, default to the highest possible ID end def lucky_number From 4bc5c9989c9082107773942e310335307b5d773a Mon Sep 17 00:00:00 2001 From: David Mazza Date: Sat, 19 Dec 2015 10:40:52 -0500 Subject: [PATCH 41/43] let registered users manage everything --- app/models/ability.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/models/ability.rb b/app/models/ability.rb index daf06e7..cb4b023 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -5,6 +5,10 @@ def initialize(user) user ||= User.new # guest user (not logged in) if user.id? can :manage, Campaign + can :manage, Pet + can :manage, Color + can :manage, Shape + can :manage, User else can :read, Campaign end From 100d86b7732f6eafb642d59ba1098c43e01057d6 Mon Sep 17 00:00:00 2001 From: David Date: Mon, 21 Dec 2015 21:41:19 -0800 Subject: [PATCH 42/43] devise_scope has to be user, added devise alerts --- app/views/layouts/application.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index c85c2bf..afc4d33 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,7 +10,8 @@ <%= csrf_meta_tags %> - + <%= notice %> + <%= alert %> <%= yield %> From be5fe6a634e1105b14fd19f901db9778660341a4 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 29 Dec 2015 21:44:58 -0800 Subject: [PATCH 43/43] gem update --- Gemfile.lock | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e00f95e..4b9c463 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -43,9 +43,9 @@ GEM builder (3.2.2) byebug (8.2.1) cancancan (1.13.1) - coffee-rails (4.1.0) + coffee-rails (4.1.1) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) + railties (>= 4.0.0, < 5.1.x) coffee-script (2.4.1) coffee-script-source execjs @@ -64,8 +64,8 @@ GEM globalid (0.3.6) activesupport (>= 4.1.0) i18n (0.7.0) - jbuilder (2.3.2) - activesupport (>= 3.0.0, < 5) + jbuilder (2.4.0) + activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) jquery-rails (4.0.5) rails-dom-testing (~> 1.0) @@ -80,7 +80,7 @@ GEM mini_portile2 (2.0.0) minitest (5.8.3) multi_json (1.11.2) - nokogiri (1.6.7) + nokogiri (1.6.7.1) mini_portile2 (~> 2.0.0.rc2) orm_adapter (0.5.0) pg (0.18.4) @@ -117,9 +117,10 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.4.2) - rdoc (4.2.0) - responders (2.1.0) - railties (>= 4.2.0, < 5) + rdoc (4.2.1) + json (~> 1.4) + responders (2.1.1) + railties (>= 4.2.0, < 5.1) sass (3.4.20) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) @@ -130,14 +131,14 @@ GEM sdoc (0.4.1) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) - spring (1.5.0) + spring (1.6.1) sprockets (3.5.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (2.3.3) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) + sprockets-rails (3.0.0) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) thor (0.19.1) thread_safe (0.3.5) tilt (2.0.1)
Hex valueHex Value
Color ShapeLast nameName
<%= image_tag(pet.shape.image)%> <%= pet.full_name %> <%= link_to 'Show', pet %>
<%= image_tag(pet.shape.image)%> <%= pet.full_name %> <%= link_to 'Show', pet %>Color Shape NameLucky Number
<%= image_tag(pet.shape.image)%> <%= pet.full_name %><%= pet.lucky_number %> <%= link_to 'Show', pet %> <%= link_to 'Edit', edit_pet_path(pet) %> <%= link_to 'Destroy', pet, method: :delete, data: { confirm: 'Are you sure?' } %>