Commit 4a58201c
Changed files (17)
app
assets
stylesheets
helpers
views
authentications
categories
devise
sessions
home
layouts
profiles
registrations
search
config
app/assets/stylesheets/interface.css
@@ -18,10 +18,8 @@ a:hover { color: #000; }
/* body */
#bd { background: #fff; padding-top: 0px; }
-#bd .sidebar .summary { background: #990000; color: #fff; padding: 10px; margin-left: -10px; margin-bottom: 20px; position: relative; }
+#bd .sidebar .summary { background: #000; color: #fff; padding: 10px; position: relative; }
#bd .sidebar .summary p { margin-bottom: 5px; }
-#bd .sidebar .summary p.credits { font-size: 28px; margin-bottom: 10px; line-height: 28px; }
-#bd .sidebar .summary .shaddow { position: absolute; left: -15px; top: 65px; }
#bd .sidebar .menu { font-size: 20px; }
#bd .sidebar .menu h1 { padding: 20px 0 12px 30px; }
#bd .sidebar .menu ul.level_2 { height: 375px; margin-bottom: 0; padding: 10px 0 70px 0; background: url(/assets/sidebar.png) no-repeat; }
app/controllers/authentications_controller.rb
@@ -1,43 +0,0 @@
-class AuthenticationsController < ApplicationController
- before_filter :authenticate_user!, :except => [:create]
- # GET /authentications
- # GET /authentications.xml
- def index
- @authentications = current_user.authentications if current_user
- end
-
- # POST /authentications
- # POST /authentications.xml
- def create
- omniauth = request.env["omniauth.auth"]
- authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
- if authentication
- flash[:notice] = "Signed in successfully."
- sign_in_and_redirect(:user, authentication.user)
- elsif current_user
- current_user.authentications.create!(:provider => omniauth['provider'], :uid => omniauth['uid'])
- flash[:notice] = "Authentication successful."
- redirect_to authentications_url
- else
- user = User.new
- user.apply_omniauth(omniauth)
- if user.save
- flash[:notice] = "Signed in successfully."
- sign_in_and_redirect(:user, user)
- else
- session[:omniauth] = omniauth.except('extra')
- redirect_to new_user_registration_url
- end
- end
-
- end
-
- # DELETE /authentications/1
- # DELETE /authentications/1.xml
- def destroy
- @authentication = current_user.authentications.find(params[:id])
- @authentication.destroy
- flash[:notice] = "Successfully destroyed authentication."
- redirect_to authentications_url
- end
-end
app/controllers/home_controller.rb
@@ -1,5 +1,5 @@
class HomeController < ApplicationController
def index
- @creations = Creation.all.reverse.take(16)
+ @creations = Creation.page(params[:page]).per(16)
end
end
app/controllers/profiles_controller.rb
@@ -9,4 +9,8 @@ class ProfilesController < ApplicationController
@profile = User.find(params[:id])
end
+ def mine
+ @creations = current_user.creations.page(params[:page]).per(16)
+ end
+
end
app/helpers/application_helper.rb
@@ -1,6 +1,6 @@
module ApplicationHelper
def avatar_url(user)
- default_url = "#{root_url}images/rails.png"
+ default_url = "#{root_url}assets/rails.png"
gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
"http://gravatar.com/avatar/#{gravatar_id}.png?&d=#{CGI.escape(default_url)}"
end
app/views/authentications/index.html.erb
@@ -1,33 +0,0 @@
-<% content_for :title do %>
- My Authentications
-<% end %>
-
-
-<div class="grid_9 alpha omega">
- <% if @authentications %>
- <% unless @authentications.empty? %>
- <p><strong>You can sign in to this account using:</strong></p>
- <div class="authentications">
- <% for authentication in @authentications %>
- <div class="authentication">
- <%= image_tag "#{authentication.provider}_32.png", :size => "32x32" %>
- <div class="provider"><%= authentication.provider_name %></div>
- <div class="uid"><%= authentication.uid %></div>
- <%= link_to "X", authentication, :confirm => 'Are you sure you want to remove this authentication option?', :method => :delete, :class => "remove" %>
- </div>
- <% end %>
- <div class="clear"></div>
- </div>
- <% end %>
- <p><strong>Add another service to sign in with:</strong></p>
- <% else %>
- <p><strong>Sign in through one of these services:</strong></p>
- <% end %>
-
- <a href="/auth/twitter" class="auth_provider"> <%= image_tag "twitter_64.png", :size => "64x64", :alt => "Twitter" %> Twitter </a>
- <a href="/auth/facebook" class="auth_provider"> <%= image_tag "facebook_64.png", :size => "64x64", :alt => "Facebook" %> Facebook </a>
- <a href="/auth/google_apps" class="auth_provider"> <%= image_tag "google_64.png", :size => "64x64", :alt => "Google" %> Google </a>
- <a href="/auth/open_id" class="auth_provider"> <%= image_tag "openid_64.png", :size => "64x64", :alt => "OpenID" %> OpenID </a>
-</div>
-<div class="clear"></div>
-
app/views/categories/show.html.erb
@@ -2,6 +2,10 @@
All Creations in <%= @category.name %>
<% end %>
+<% content_for :sidebar do %>
+ <%= render "shared/categories_sidebar" %>
+<% end %>
+
<h1>Category <em><%= @category.name %></em></h1>
<% @creations.each_with_index do |creation, index| %>
<% if index % 4 == 0 %>
app/views/devise/sessions/new.html.erb
@@ -16,12 +16,5 @@
<% end %>
<%= render :partial => "devise/shared/links" %>
</div>
- <div class="grid_4 omega">
- <h2>Sign in through one of these services</h2>
- <a href="/auth/twitter" class="auth_provider"><%= image_tag "twitter_64.png", :size => "64x64", :alt => "Twitter" %>Twitter</a>
- <a href="/auth/facebook" class="auth_provider"><%= image_tag "facebook_64.png", :size => "64x64", :alt => "Facebook" %>Facebook</a>
- <a href="/auth/google_apps" class="auth_provider"><%= image_tag "google_64.png", :size => "64x64", :alt => "Google" %>Google</a>
- <a href="/auth/open_id" class="auth_provider"><%= image_tag "openid_64.png", :size => "64x64", :alt => "OpenID" %>OpenID</a>
- </div>
</div>
<div class="clear" />
app/views/home/index.html.erb
@@ -2,24 +2,9 @@
Welcome to the CakeSide
<% end %>
-<h1>Recently Added Creations</h1>
-<% @creations.each_with_index do |creation, index| %>
- <% if index % 4 == 0 %>
- <div class="grid_2 alpha">
- <a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a>
- <p><%= creation.name %> <br /><%= link_to creation.user.name, creation %></p>
- </div>
- <% elsif (index+1) % 4 == 0 %>
- <div class="grid_2 omega">
- <a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a>
- <p><%= creation.name %> <br /><%= link_to creation.user.name, creation %></p>
- </div>
- <div class="clear"></div>
- <% else %>
- <div class="grid_2">
- <a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a>
- <p><%= creation.name %> <br /><%= link_to creation.user.name, creation %></p>
- </div>
- <% end %>
+<% content_for :sidebar do %>
+ <%= render "shared/categories_sidebar" %>
<% end %>
-<div class="clear"></div>
+
+<h1>Recently Added Creations</h1>
+<%= render "shared/creation_thumbs" %>
app/views/layouts/application.html.erb
@@ -6,6 +6,7 @@
<link rel="shortcut icon" href="/favicon.ico">
<link href='http://fonts.googleapis.com/css?family=Julee' rel='stylesheet' type='text/css'>
<%= stylesheet_link_tag "application" %>
+ <style type="text/css"><%= yield :stylesheets %></style>
<%= csrf_meta_tags %>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<%= javascript_include_tag "application" %>
@@ -32,7 +33,9 @@
</div>
<div class="grid_2 omega">
<% if user_signed_in? %>
- Hi <%= link_to current_user.name, edit_user_registration_path %> <%= link_to "Sign Out", destroy_user_session_path %>
+
+ Hi <%= link_to current_user.name, profiles_mine_path %>
+ <%= link_to "Sign Out", destroy_user_session_path %>
<% else %>
<%= link_to "Sign Up", new_user_registration_path %> or <%= link_to "Sign In", new_user_session_path %>
<% end %>
@@ -57,17 +60,10 @@
<div class="grid_2 omega"> </div>
<div class="clear"></div>
- <div class="grid_4 sidebar">
- <div class="menu">
- <h1 style="background: url(/assets/Menu.png) no-repeat;">Categories</h1>
- <ul class="level_2 nojot">
- <% Category.all.each do |category| %>
- <li class="level_2"><a href='/categories/<%= category.slug %>'><%= category.name %></a></li>
- <% end %>
- </ul>
- </div><!-- /.menu -->
+ <div class="grid_3 sidebar">
+ <%= yield :sidebar %>
</div>
- <div class="grid_8 content">
+ <div class="grid_9 content">
<p class="notice"><%= notice %></p>
<p class="alert"><%= alert %></p>
<%= yield %>
app/views/profiles/mine.html.erb
@@ -0,0 +1,12 @@
+<% content_for :title do %>
+ My profile
+<% end %>
+<% content_for :stylesheets do %>
+<% end %>
+
+<% content_for :sidebar do %>
+ <%= render "shared/my_profile_sidebar" %>
+<% end %>
+
+<h1>My Creations</h1>
+<%= render "shared/creation_thumbs" %>
app/views/registrations/edit.html.erb
@@ -1,6 +1,12 @@
<% content_for :title do %>
Update My Account
<% end %>
+<% content_for :stylesheets do %>
+<% end %>
+
+<% content_for :sidebar do %>
+ <%= render "shared/my_profile_sidebar" %>
+<% end %>
<div class="grid_9 alpha omega">
<div class="grid_6 alpha">
@@ -47,7 +53,6 @@
<div class="helpbox">
<h4>other</h4>
<ul>
- <li><%= link_to "my other authentications", authentications_path %></li>
<li><a href="http://en.gravatar.com/">change your photo</a></li>
</ul>
</div>
app/views/search/index.html.erb
@@ -2,26 +2,9 @@
Search Results for <%= @search %>
<% end %>
-<h1>Search Results for <em><%= @search %></em></h1>
-
-<% @creations.each_with_index do |creation, index| %>
- <% if index % 4 == 0 %>
- <div class="grid_2 alpha">
- <a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a>
- <p><%= creation.name %> <br /><%= link_to creation.user.name, creation %></p>
- </div>
- <% elsif (index+1) % 4 == 0 %>
- <div class="grid_2 omega">
- <a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a>
- <p><%= creation.name %> <br /><%= link_to creation.user.name, creation %></p>
- </div>
- <div class="clear"></div>
- <% else %>
- <div class="grid_2">
- <a href="<%= url_for creation %>"><%= image_tag creation.image.thumb.url, :alt => creation.name %></a>
- <p><%= creation.name %> <br /><%= link_to creation.user.name, creation %></p>
- </div>
- <% end %>
+<% content_for :sidebar do %>
+ <%= render "shared/categories_sidebar" %>
<% end %>
-<div class="clear"></div>
-<p> <%= paginate @creations %> </p>
+
+<h1>Search Results for <em><%= @search %></em></h1>
+<%= render "shared/creation_thumbs" %>
config/routes.rb
@@ -11,6 +11,7 @@ Cake::Application.routes.draw do
# /profiles
get "profiles/index"
get "profiles/show"
+ get "profiles/mine"
match 'profiles/show/:id' => 'profiles#show', :as => 'profile', :method => 'GET'
# /search
@@ -24,10 +25,6 @@ Cake::Application.routes.draw do
match 'categories/:id' => 'categories#show', :method => 'GET'
get 'categories/show'
- # /authentications
- match 'authentications' => 'authentications#index', :method => 'GET'
- match '/auth/:provider/callback' => 'authentications#create'
-
# /users
devise_for :users, :controllers => {:registrations => 'registrations'}