diff options
| author | mo khan <mo@mokhan.ca> | 2014-05-21 22:43:19 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-05-21 22:43:19 -0600 |
| commit | e49bef1d3606217baeba3efbaa44ce5f11f2c93e (patch) | |
| tree | 15719e332e48c188b683eedd658067c000b616c9 /app | |
| parent | 0e1f35bf3f1a023e3f71b916ec5927ab46800249 (diff) | |
move avatars to my/avatars.
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/avatars_controller.rb | 23 | ||||
| -rw-r--r-- | app/controllers/my/avatars_controller.rb | 24 | ||||
| -rw-r--r-- | app/views/my/avatars/edit.html.erb (renamed from app/views/avatars/edit.html.erb) | 2 | ||||
| -rw-r--r-- | app/views/shared/_account_nav.html.erb | 2 |
4 files changed, 26 insertions, 25 deletions
diff --git a/app/controllers/avatars_controller.rb b/app/controllers/avatars_controller.rb deleted file mode 100644 index de803eb7..00000000 --- a/app/controllers/avatars_controller.rb +++ /dev/null @@ -1,23 +0,0 @@ -class AvatarsController < ApplicationController - before_filter :authenticate_user! - before_filter :find_or_build_avatar - - def edit - end - - def update - @avatar.attach(params[:avatar][:avatar]) - redirect_to edit_avatar_path(current_user), :notice => t(:avatar_uploaded) - end - - protected - - def find_or_build_avatar - if current_user.avatar == nil - @avatar = current_user.avatar = Avatar.new - current_user.save - else - @avatar = current_user.avatar - end - end -end diff --git a/app/controllers/my/avatars_controller.rb b/app/controllers/my/avatars_controller.rb new file mode 100644 index 00000000..cb534ba9 --- /dev/null +++ b/app/controllers/my/avatars_controller.rb @@ -0,0 +1,24 @@ +module My + class AvatarsController < BaseController + before_filter :find_or_build_avatar + + def edit + end + + def update + @avatar.attach(params[:avatar][:avatar]) + redirect_to edit_my_avatar_path(current_user), :notice => t(:avatar_uploaded) + end + + protected + + def find_or_build_avatar + if current_user.avatar == nil + @avatar = current_user.avatar = Avatar.new + current_user.save + else + @avatar = current_user.avatar + end + end + end +end diff --git a/app/views/avatars/edit.html.erb b/app/views/my/avatars/edit.html.erb index 394f70e1..d33dd6a1 100644 --- a/app/views/avatars/edit.html.erb +++ b/app/views/my/avatars/edit.html.erb @@ -8,7 +8,7 @@ try { mixpanel.track_forms(".edit_avatar", "uploaded avatar"); } catch {} <div class="row"> <div class="span12"> <%= avatar_for(current_user) %> - <%= form_for(@avatar, :url => avatar_path(@avatar), :method => :put, :multipart => true, remote: true, authenticity_token: true) do |f| %> + <%= form_for(@avatar, :url => my_avatar_path(@avatar), :method => :put, :multipart => true, remote: true, authenticity_token: true) do |f| %> <div class="control-group"> <div class="controls"> <%= f.file_field :avatar %> diff --git a/app/views/shared/_account_nav.html.erb b/app/views/shared/_account_nav.html.erb index e65fdf21..a33c9a6f 100644 --- a/app/views/shared/_account_nav.html.erb +++ b/app/views/shared/_account_nav.html.erb @@ -6,7 +6,7 @@ <li class="<%= selected == :favorites ? "active" : "" %>"><%= link_to "Favorites", my_favorites_path %></li> <li class="<%= selected == :basic_info ? "active" : "" %>"><%= link_to "Settings", my_settings_path %></li> <li class="<%= selected == :password ? "active" : "" %>"><%= link_to "Password", my_passwords_path %></li> - <li class="<%= selected == :picture ? "active" : "" %>"><%= link_to "Picture", edit_avatar_path(current_user) %></li> + <li class="<%= selected == :picture ? "active" : "" %>"><%= link_to "Picture", edit_my_avatar_path(current_user) %></li> <li class="pull-right"><%= link_to t('.logout'), destroy_user_session_path, class: "btn btn-inverse" %></li> <% if current_user.is_admin? %> <li class="pull-right"><%= link_to t('.admin'), admin_root_path %></li> |
