Commit 9495f097
Changed files (11)
app
controllers
views
creations
layouts
profiles
registrations
config
app/controllers/avatars_controller.rb
@@ -5,7 +5,7 @@ class AvatarsController < ApplicationController
def create
@avatar.avatar = params[:avatar][:avatar]
if @avatar.save
- redirect_to(profiles_mine_path, :notice => 'Your new avatar has been uploaded.')
+ redirect_to(profile_path(current_user), :notice => 'Your new avatar has been uploaded.')
else
flash[:error] = "could not upload photo"
end
app/controllers/profiles_controller.rb
@@ -10,10 +10,6 @@ class ProfilesController < ApplicationController
@creations = @profile.creations.page(params[:page]).per(18)
end
- def mine
- @creations = current_user.creations.page(params[:page]).per(100)
- end
-
def favorites
@favorites = current_user.favorites
@creations = @favorites.map {|f| f.creation }
app/controllers/registrations_controller.rb
@@ -9,7 +9,7 @@ class RegistrationsController < Devise::RegistrationsController
@user.interest_ids = params[:user][:interest_ids] ||= []
if @user.update_without_password(params[:user])
sign_in @user, :bypass => true
- redirect_to profiles_mine_path, :notice =>'Your settings have been updated successfully!'
+ redirect_to profile_path(current_user), :notice =>'Your settings have been updated successfully!'
else
render "edit"
end
app/controllers/settings_controller.rb
@@ -11,7 +11,7 @@ class SettingsController < ApplicationController
@user.password=params[:user][:password]
if @user.save
sign_in @user, :bypass => true
- redirect_to profiles_mine_path, notice: 'Your password has been changed!'
+ redirect_to profile_path(current_user), notice: 'Your password has been changed!'
else
flash[:alert] = "Invalid password, must be at least 6 charactors."
redirect_to :back
app/views/creations/_form.html.erb
@@ -20,10 +20,10 @@
</div>
</div>
<div class="control-group">
- <%= f.label :watermark, "Brand this image", :class => "control-label" %>
+ <%= f.label :watermark, "Brand each image", :class => "control-label" %>
<div class="controls">
<%= f.text_field :watermark, :class => "input-medium", :maxlength=> 30 %> on CakeSide.com
- <a class="tooltip-item" data-placement="right" rel="tooltip" href="#" data-original-title="Watermark your name or company to the uploaded image" data-animation="true"><i class="icon-question-sign"></i></a>
+ <a class="tooltip-item" data-placement="right" rel="tooltip" href="#" data-original-title="Watermark your name or company on each uploaded image" data-animation="true"><i class="icon-question-sign"></i></a>
</div>
</div>
<div class="control-group">
app/views/layouts/_header.html.erb
@@ -41,7 +41,7 @@
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><%= current_user.name %><b class="caret"></b></a>
<ul class="dropdown-menu">
- <li><%= link_to "Profile", profiles_mine_path %></li>
+ <li><%= link_to "Profile", profile_path(current_user) %></li>
<li><%= link_to "Favorites", profiles_favorites_path %></li>
<li><%= link_to "Settings", edit_user_registration_path %></li>
<li class="divider"></li>
app/views/profiles/favorites.html.erb
@@ -12,7 +12,7 @@
</div>
<div style="padding: 8px 0;" class="well">
<ul class="nav nav-list">
- <li><a href="<%= url_for profiles_mine_path %>"><i class="icon-user"></i> Profile</a></li>
+ <li><a href="<%= url_for profile_path(current_user) %>"><i class="icon-user"></i> Profile</a></li>
<li><a href="<%= url_for profiles_favorites_path -%>"><i class="icon-book"></i> Favorites</a></li>
<li><a href="<%= url_for edit_user_registration_path %>"><i class="icon-cog"></i> Settings</a></li>
</ul>
app/views/profiles/mine.html.erb
@@ -1,32 +0,0 @@
-<% provide(:title, "My profile") -%>
-<div class="row">
- <div class="span3">
- <div class="thumbnail">
- <%= avatar_for(current_user) %>
- <div class="caption">
- <h5><%= current_user.name %></h5>
- <p> <%= link_to "My Public Profile", profile_path(current_user) %></p>
- <hr>
- <p><%= current_user.city %></p>
- <p>Website or blog: <a href="<%= current_user.website %>" target="_blank"><%= current_user.website %></a></p>
- <p>Twitter: <a href="https://twitter.com/<%= current_user.twitter %>" target="_blank" class="twitter-follow-button" data-show-count="false">@<%= current_user.twitter %></a></p>
- <p>Facebook:<a href="<%= current_user.facebook %>" target="_blank"> <%= current_user.facebook %></a></p>
- </div>
- </div>
- <div style="padding: 8px 0;" class="well">
- <ul class="nav nav-list">
- <li><a href="<%= url_for profiles_mine_path %>"><i class="icon-user"></i> Profile</a></li>
- <li><a href="<%= url_for profiles_favorites_path -%>"><i class="icon-book"></i> Favorites</a></li>
- <li><a href="<%= url_for edit_user_registration_path %>"><i class="icon-cog"></i> Settings</a></li>
- </ul>
- </div>
- </div>
- <div class="span9">
- <% if @creations.any? %>
- <%= render "shared/creation_image_gallery" %>
- <% else %>
- <p><%= t(:share_something) %></p>
- <a href="<%= url_for new_creation_path %>" class="btn btn-primary btn-large">Add Creation</a>
- <% end %>
- </div>
-</div>
app/views/profiles/show.html.erb
@@ -8,6 +8,7 @@
<%= avatar_for(@profile) %>
<div class="caption">
<h5><%= @profile.name %></h5>
+ <hr>
<p><%= @profile.city %></p>
<% unless @profile.website.blank? %>
<p><a href="<%= @profile.website %>" target="_blank"><%= @profile.website %></a></p>
@@ -21,6 +22,15 @@
<% end %>
</div>
</div>
+ <% if user_signed_in? %>
+ <div style="padding: 8px 0;" class="well">
+ <ul class="nav nav-list">
+ <li><a href="<%= url_for profile_path(current_user) %>"><i class="icon-user"></i> My Profile</a></li>
+ <li><a href="<%= url_for profiles_favorites_path -%>"><i class="icon-book"></i> My Favorites</a></li>
+ <li><a href="<%= url_for edit_user_registration_path %>"><i class="icon-cog"></i> My Settings</a></li>
+ </ul>
+ </div>
+ <% end %>
</div>
<div class="span9">
<%= render "shared/creation_image_gallery" %>
app/views/registrations/edit.html.erb
@@ -14,24 +14,19 @@ $(function(){ DeviseUsers.Edit.initialize(jQuery); });
<div class="caption">
<h5><%= current_user.name %></h5>
<p>last signed in: <%= current_user.last_sign_in_at.to_s :foomat %></p>
- <p><a id="change-avatar" class="btn btn-primary" data-toggle="modal" href="#change-avatar-dialog">Change My Picture</a></p>
- <p><a id="change-password-button" class="btn btn-primary" data-toggle="modal" href="#change-password-dialog">Change My Password</a></p>
</div>
</div>
<div style="padding: 8px 0;" class="well">
<ul class="nav nav-list">
- <li><a href="<%= url_for profiles_mine_path %>"><i class="icon-user"></i> Profile</a></li>
+ <li><a href="<%= url_for profile_path(current_user) %>"><i class="icon-user"></i> Profile</a></li>
<li><a href="<%= url_for profiles_favorites_path -%>"><i class="icon-book"></i> Favorites</a></li>
<li><a href="<%= url_for edit_user_registration_path %>"><i class="icon-cog"></i> Settings</a></li>
</ul>
</div>
- <h4>Cancel My Account</h4>
- <p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete, :class => "btn btn-danger" %></p>
</div>
- <div class="span9">
+ <div class="span7">
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class=> "form-horizontal" }) do |f| %>
<fieldset>
- <legend>Update your settings</legend>
<div class="control-group">
<%= f.label :name, :class => "control-label" %>
<div class="controls"> <%= f.text_field :name, :class => "input-xlarge" %> </div>
@@ -79,6 +74,12 @@ $(function(){ DeviseUsers.Edit.initialize(jQuery); });
</fieldset>
<% end %>
</div>
+ <div class="span2">
+ <p><a id="change-avatar" class="btn btn-primary" data-toggle="modal" href="#change-avatar-dialog">Change My Picture</a></p>
+ <p><a id="change-password-button" class="btn btn-primary" data-toggle="modal" href="#change-password-dialog">Change My Password</a></p>
+ <h4>Cancel My Account</h4>
+ <p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete, :class => "btn btn-danger" %></p>
+ </div>
</div>
<div id="change-avatar-dialog" class="modal hide fade">
<%= form_tag(avatars_path(current_user), :method => "post", :multipart => true) do |f| %>
@@ -87,10 +88,14 @@ $(function(){ DeviseUsers.Edit.initialize(jQuery); });
<h3>Change My Picture</h3>
</div>
<div class="modal-body">
- <%= avatar_for(current_user) %>
+ <p style="margin-left:auto; margin-right:auto;text-align:center;">
+ <%= avatar_for(current_user) %>
+ </p>
+ <p style="margin-left:auto; margin-right:auto;text-align:center;">
<%= fields_for Avatar.new do |f| %>
<%= f.file_field :avatar, :rel => avatars_path(current_user) %>
<% end %>
+ </p>
</div>
<div class="modal-footer">
<input type="submit" class="btn btn-primary" value="Save changes" />
config/routes.rb
@@ -17,18 +17,16 @@ Cake::Application.routes.draw do
resources :favorites, :only => [:index, :create]
resources :comments, :only => [:index, :new, :create]
end
- match "creations/fast_upload" => "creations#create", :as => 'fast_upload', :method => "POST"
# /profiles
resources :profiles, :only => [:index, :show]
- match "profiles" => "profiles#index", :as => 'profiles', :method => "GET"
- match 'profiles/:id' => 'profiles#show', :as => 'profile', :method => 'GET'
- match 'mine' => 'profiles#mine', :as => 'profiles_mine', :method => 'GET'
+ #match "profiles" => "profiles#index", :as => 'profiles', :method => "GET"
+ #match 'profiles/:id' => 'profiles#show', :as => 'profile', :method => 'GET'
match 'favorites' => 'profiles#favorites', :as => 'profiles_favorites', :method => 'GET'
# /categories
- match 'categories/:id' => 'categories#show', :method => 'GET'
- get 'categories/show'
+ resources :categories, :only => [:show]
+ #match 'categories/:id' => 'categories#show', :method => 'GET'
# /tags
match 'tags/:id' => 'tags#show', :method => 'GET'