user profile tweaks

- fix active tab issue in sidebar on group settings page
- stats table is now composed of followers, collections, collection
  items

Change-Id: I88df0001b1cdffcb7f92e7b365b3ae00880f72e8
This commit is contained in:
Cameron Matheson 2012-06-01 16:45:39 -06:00
parent 1f75a5ba26
commit fa47409374
5 changed files with 14 additions and 18 deletions

View File

@ -21,7 +21,6 @@ class ProfileController < ApplicationController
before_filter :require_user, :except => :show
before_filter :require_user_for_private_profile, :only => :show
before_filter :reject_student_view_student
before_filter { |c| c.active_tab = "profile" }
include Api::V1::User
include Api::V1::Avatar
@ -29,13 +28,16 @@ class ProfileController < ApplicationController
include TextHelper
def show
@user ||= @current_user
# FFT TODO: should this be conditional based on a setting? i.e. use the old
# styles like we do on the dashboard
@use_new_styles = true
@user ||= @current_user
@active_tab = "profile"
@context = UserProfile.new(@current_user) if @user == @current_user
@items_count = @user.collection_items.scoped(:conditions => {'collections.visibility' => 'public'}).count
if @user.private? && @user != @current_user
if @user.grants_right?(@current_user, :view_statistics)
return render :action => :show, :layout => "new_application"
@ -87,9 +89,10 @@ class ProfileController < ApplicationController
@pseudonyms = @user.pseudonyms.active
@password_pseudonyms = @pseudonyms.select{|p| !p.managed_password? }
@context = UserProfile.new(@user)
@active_tab = "edit_profile"
respond_to do |format|
format.html do
add_crumb(t(:crumb, "%{user}'s profile", :user => @user.short_name), profile_path )
add_crumb(t(:crumb, "%{user}'s profile", :user => @user.short_name), edit_profile_path )
render :action => "profile"
end
format.json do

View File

@ -133,6 +133,7 @@ class User < ActiveRecord::Base
has_many :messages
has_many :collections, :as => :context
has_many :collection_items, :through => :collections
include StickySisFields
are_sis_sticky :name, :sortable_name, :short_name

View File

@ -24,12 +24,8 @@ class UserProfile
delegate :id, :short_name, :name, :asset_string, :opaque_identifier, :to => :@user
TAB_PROFILE = 0
TAB_COMMUNICATION_PREFERENCES = 1
TAB_FILES = 2
TAB_EPORTFOLIOS = 3
TAB_HOME = 4
TAB_PROFILE_SETTINGS = 5
TAB_PROFILE, TAB_COMMUNICATION_PREFERENCES, TAB_FILES, TAB_EPORTFOLIOS,
TAB_HOME, TAB_PROFILE_SETTINGS = *0..10
def tabs_available(user=nil, opts={})
unless @tabs

View File

@ -1,5 +1,5 @@
<% content_for :page_title do %>
<%= join_title t(:page_title, "Profile"), @user.name %>
<%= join_title t(:page_title, "Profile Settings"), @user.name %>
<% end %>
<% content_for :right_side do %>

View File

@ -24,14 +24,10 @@
<td>103</td>
</tr><tr>
<th>Collections</th>
<td>5</td>
<td><%= @user.collections.public.count %></td>
</tr><tr>
<th>Comments</th>
<td>223</td>
</tr> <tr>
<th>Posts</th>
<td>37</td>
</tr>
<th>Items</th>
<td><%= @items_count %></td>
</table>
<% if @user.show_user_services? %>