Permalink
Browse files

Favorite hearts set if favorited. Moving on to ajax part.

  • Loading branch information...
1 parent b980cb9 commit 5759f2d4a86756adc9a1a35bba881745f0cc714e @robertmilner committed Mar 22, 2012
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="140px" height="140px" viewBox="-6 -14 140 140"
+ overflow="visible" enable-background="new -6 -14 140 140" xml:space="preserve">
+<defs>
+</defs>
+<path display="none" fill="#FFFFFF" d="M118.043,9.959C111.619,3.537,103.082,0,94,0S76.38,3.537,69.959,9.959
+ c-2.401,2.4-4.398,5.098-5.959,8.008c-1.561-2.91-3.557-5.607-5.957-8.008C51.619,3.537,43.082,0,34,0S16.38,3.537,9.959,9.959
+ C3.537,16.38,0,24.918,0,34s3.537,17.62,9.959,24.041l48.178,51.402C59.65,111.074,61.775,112,64,112s4.349-0.926,5.862-2.557
+ l48.181-51.402C124.463,51.62,128,43.082,128,34S124.463,16.38,118.043,9.959z"/>
+<path display="none" d="M118.043,9.959C111.619,3.537,103.082,0,94,0S76.38,3.537,69.959,9.959c-2.401,2.4-4.398,5.098-5.959,8.008
+ c-1.561-2.91-3.557-5.607-5.957-8.008C51.619,3.537,43.082,0,34,0S16.38,3.537,9.959,9.959C3.537,16.38,0,24.918,0,34
+ s3.537,17.62,9.959,24.041l48.178,51.402C59.65,111.074,61.775,112,64,112s4.349-0.926,5.862-2.557l48.181-51.402
+ C124.463,51.62,128,43.082,128,34S124.463,16.38,118.043,9.959z"/>
+<path fill="#BD3B36" d="M118.043,9.959C111.619,3.537,103.082,0,94,0S76.38,3.537,69.959,9.959c-2.401,2.4-4.398,5.098-5.959,8.008
+ c-1.561-2.91-3.557-5.607-5.957-8.008C51.619,3.537,43.082,0,34,0S16.38,3.537,9.959,9.959C3.537,16.38,0,24.918,0,34
+ s3.537,17.62,9.959,24.041l48.178,51.402C59.65,111.074,61.775,112,64,112s4.349-0.926,5.862-2.557l48.181-51.402
+ C124.463,51.62,128,43.082,128,34S124.463,16.38,118.043,9.959z"/>
+</svg>
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="140px" height="140px" viewBox="-6 -14 140 140"
+ overflow="visible" enable-background="new -6 -14 140 140" xml:space="preserve">
+<defs>
+</defs>
+<path display="none" fill="#FFFFFF" d="M118.043,9.959C111.619,3.537,103.082,0,94,0S76.38,3.537,69.959,9.959
+ c-2.401,2.4-4.398,5.098-5.959,8.008c-1.561-2.91-3.557-5.607-5.957-8.008C51.619,3.537,43.082,0,34,0S16.38,3.537,9.959,9.959
+ C3.537,16.38,0,24.918,0,34s3.537,17.62,9.959,24.041l48.178,51.402C59.65,111.074,61.775,112,64,112s4.349-0.926,5.862-2.557
+ l48.181-51.402C124.463,51.62,128,43.082,128,34S124.463,16.38,118.043,9.959z"/>
+<path display="none" d="M118.043,9.959C111.619,3.537,103.082,0,94,0S76.38,3.537,69.959,9.959c-2.401,2.4-4.398,5.098-5.959,8.008
+ c-1.561-2.91-3.557-5.607-5.957-8.008C51.619,3.537,43.082,0,34,0S16.38,3.537,9.959,9.959C3.537,16.38,0,24.918,0,34
+ s3.537,17.62,9.959,24.041l48.178,51.402C59.65,111.074,61.775,112,64,112s4.349-0.926,5.862-2.557l48.181-51.402
+ C124.463,51.62,128,43.082,128,34S124.463,16.38,118.043,9.959z"/>
+<path fill="#A53430" d="M118.043,9.959C111.619,3.537,103.082,0,94,0S76.38,3.537,69.959,9.959c-2.401,2.4-4.398,5.098-5.959,8.008
+ c-1.561-2.91-3.557-5.607-5.957-8.008C51.619,3.537,43.082,0,34,0S16.38,3.537,9.959,9.959C3.537,16.38,0,24.918,0,34
+ s3.537,17.62,9.959,24.041l48.178,51.402C59.65,111.074,61.775,112,64,112s4.349-0.926,5.862-2.557l48.181-51.402
+ C124.463,51.62,128,43.082,128,34S124.463,16.38,118.043,9.959z"/>
+</svg>
@@ -82,6 +82,14 @@ section {
}
.favorite {
border-left: 0;
+ input.btn-favorite {
+ width: 40px;
+ height: auto;
+ opacity: 0.2;
+ }
+ input.btn-favorite.active {
+ opacity: 1;
+ }
}
.location {
li {
@@ -1,2 +1,7 @@
module PagesHelper
+
+ def favorited(excuse, user)
+ "active" if excuse.favorites.find_by_favorable_id(excuse.id) == user.favorites.find_by_favorable_id(excuse.id)
+ end
+
end
@@ -10,7 +10,7 @@
%h3 Favorite
= form_tag favorites_path do
= hidden_field_tag :excuse, excuse.id
- = submit_tag "Favorite", :name => nil
+ %input{ :type => "image", :src => "/assets/heart_black.svg", :alt => "Yeah favorite!", :class => "btn-favorite #{favorited(excuse, @current_user)}" }
.location
%h3 Location
%ul
@@ -31,7 +31,7 @@
%h3 Favorite
= form_tag favorites_path do
= hidden_field_tag :excuse, excuse.id
- = submit_tag "Favorite", :name => nil
+ %input{ :type => "image", :src => "/assets/heart_black.svg", :alt => "Yeah favorite!", :class => "btn-favorite" }
.location
%h3 Location
%ul

0 comments on commit 5759f2d

Please sign in to comment.