summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo k <m@mokhan.ca>2012-02-07 21:22:45 -0700
committermo k <m@mokhan.ca>2012-02-07 21:22:45 -0700
commite62510757a84df16c0c29828641b3bbdd5cfde63 (patch)
treef8b95610a379ffaa27ff9e95e27607c845db11f9
parentf361e6465b2770d4f4a3146caa624d50b11beecc (diff)
add favorites page.
-rw-r--r--app/controllers/profiles_controller.rb4
-rw-r--r--app/views/creations/new.html.erb1
-rw-r--r--app/views/profiles/favorites.html.erb30
-rw-r--r--app/views/profiles/mine.html.erb1
-rw-r--r--app/views/registrations/edit.html.erb1
-rw-r--r--config/routes.rb1
6 files changed, 38 insertions, 0 deletions
diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index 16d0df3e..243af0c7 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -14,4 +14,8 @@ class ProfilesController < ApplicationController
@creations = current_user.creations.page(params[:page]).per(16)
end
+ def favorites
+ @favorites = current_user.favorites
+ @creations = @favorites.map {|f| f.creation }
+ end
end
diff --git a/app/views/creations/new.html.erb b/app/views/creations/new.html.erb
index 02c122dd..2b5d6939 100644
--- a/app/views/creations/new.html.erb
+++ b/app/views/creations/new.html.erb
@@ -4,6 +4,7 @@
<ul class="tabs">
<li> <%= link_to "Profile", profiles_mine_path %></li>
+ <li> <%= link_to "Favorites", profiles_favorites_path %></li>
<li class="active"> <%= link_to "Share", new_creation_path %></li>
<li> <%= link_to "Settings", edit_user_registration_path %> </li>
</ul>
diff --git a/app/views/profiles/favorites.html.erb b/app/views/profiles/favorites.html.erb
new file mode 100644
index 00000000..32aaa78b
--- /dev/null
+++ b/app/views/profiles/favorites.html.erb
@@ -0,0 +1,30 @@
+<% content_for :title do %>
+ My profile
+<% end %>
+
+<ul class="tabs">
+ <li> <%= link_to "Profile", profiles_mine_path %></li>
+ <li class="active"> <%= link_to "Favorites", profiles_favorites_path %></li>
+ <li> <%= link_to "Share", new_creation_path %></li>
+ <li> <%= link_to "Settings", edit_user_registration_path %> </li>
+</ul>
+
+<div class="row">
+ <div class="span4">
+ <div class="media-grid">
+ <a href="<%= url_for profile_path(current_user) %>"><img src="<%= avatar_url current_user %>&amp;s=200" alt="<%= current_user.name %>" /></a>
+ </div>
+ <h3><%= current_user.name %></h3>
+ <p>member since: <%= current_user.created_at.to_s :foomat %></p>
+ <p>last signed in: <%= current_user.last_sign_in_at.to_s :foomat %></p>
+ <a href="http://en.gravatar.com/" target="_blank">Change My Photo</a>
+ </div>
+ <div class="span12">
+ <h2>My Favorites</h2>
+ <ul class="media-grid">
+ <% @creations.each do |creation| %>
+ <li><a href="<%= url_for creation %>"><img class="thumbnail" src="<%= creation.image.thumb.url %>" alt="<%= creation.name %>"></a></li>
+ <% end %>
+ </ul>
+ </div>
+</div>
diff --git a/app/views/profiles/mine.html.erb b/app/views/profiles/mine.html.erb
index 1879b3ac..04fc1df8 100644
--- a/app/views/profiles/mine.html.erb
+++ b/app/views/profiles/mine.html.erb
@@ -4,6 +4,7 @@
<ul class="tabs">
<li class="active"> <%= link_to "Profile", profiles_mine_path %></li>
+ <li> <%= link_to "Favorites", profiles_favorites_path %></li>
<li> <%= link_to "Share", new_creation_path %></li>
<li> <%= link_to "Settings", edit_user_registration_path %> </li>
</ul>
diff --git a/app/views/registrations/edit.html.erb b/app/views/registrations/edit.html.erb
index 8d0993b6..c78fa0e8 100644
--- a/app/views/registrations/edit.html.erb
+++ b/app/views/registrations/edit.html.erb
@@ -3,6 +3,7 @@
<% end %>
<ul class="tabs">
<li> <%= link_to "Profile", profiles_mine_path %></li>
+ <li> <%= link_to "Favorites", profiles_favorites_path %></li>
<li> <%= link_to "Share", new_creation_path %></li>
<li class="active"> <%= link_to "Settings", edit_user_registration_path %> </li>
</ul>
diff --git a/config/routes.rb b/config/routes.rb
index 7a627e77..4b9928bc 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -19,6 +19,7 @@ Cake::Application.routes.draw do
get "profiles/index"
get "profiles/show"
get "profiles/mine"
+ get "profiles/favorites"
match 'profiles/show/:id' => 'profiles#show', :as => 'profile', :method => 'GET'
# /search