move current user profile page to profile/edit
also adds a bio field to the user model Change-Id: I5e4a77a39403a31462dbaeae20a289d5a5f6761c
This commit is contained in:
parent
4aa5c4adaa
commit
b07c4b760c
|
@ -25,6 +25,11 @@ class ProfileController < ApplicationController
|
|||
include Api::V1::User
|
||||
include Api::V1::Avatar
|
||||
|
||||
def show
|
||||
@context = UserProfile.new(@current_user)
|
||||
render :text => "new profile page", :layout => true
|
||||
end
|
||||
|
||||
# @API Get user profile
|
||||
# Returns user profile data, including user id, name, and profile pic.
|
||||
#
|
||||
|
@ -44,7 +49,7 @@ class ProfileController < ApplicationController
|
|||
# 'avatar_url': '..url..',
|
||||
# 'calendar': { 'ics' => '..url..' }
|
||||
# }
|
||||
def show
|
||||
def edit
|
||||
if api_request?
|
||||
# allow querying this basic profile data for the current user, or any
|
||||
# user the current user has view_statistics access to
|
||||
|
|
|
@ -25,7 +25,7 @@ class User < ActiveRecord::Base
|
|||
|
||||
include Context
|
||||
|
||||
attr_accessible :name, :short_name, :sortable_name, :time_zone, :show_user_services, :gender, :visible_inbox_types, :avatar_image, :subscribe_to_emails, :locale
|
||||
attr_accessible :name, :short_name, :sortable_name, :time_zone, :show_user_services, :gender, :visible_inbox_types, :avatar_image, :subscribe_to_emails, :locale, :bio
|
||||
attr_accessor :original_id, :menu_data
|
||||
|
||||
before_save :infer_defaults
|
||||
|
|
|
@ -35,7 +35,7 @@ class UserProfile
|
|||
{ :id => TAB_HOME, :label => I18n.t('#tabs.home', "Home"), :css_class => 'home', :href => :dashboard_path, :no_args => true },
|
||||
{ :id => TAB_PROFILE, :label => I18n.t('#user_profile.tabs.profile', "Profile"), :css_class => 'profile', :href => :profile_path, :no_args => true },
|
||||
{ :id => TAB_COMMUNICATION_PREFERENCES, :label => I18n.t('#user_profile.tabs.notifications', "Notifications"), :css_class => 'notifications', :href => :communication_profile_path, :no_args => true },
|
||||
{ :id => TAB_FILES, :label => I18n.t('#tabs.files', "Files"), :css_class => 'files', :href => :dashboard_files_path, :no_args => true }
|
||||
{ :id => TAB_FILES, :label => I18n.t('#tabs.files', "Files"), :css_class => 'files', :href => :dashboard_files_path, :no_args => true },
|
||||
]
|
||||
@tabs << { :id => TAB_EPORTFOLIOS, :label => I18n.t('#tabs.eportfolios', "ePortfolios"), :css_class => 'eportfolios', :href => :dashboard_eportfolios_path, :no_args => true } if @user.eportfolios_enabled?
|
||||
if user && opts[:root_account]
|
||||
|
|
|
@ -11,6 +11,10 @@
|
|||
.profile_table.editing .display_data
|
||||
display: none
|
||||
|
||||
#user_bio
|
||||
width: 100%
|
||||
height: 200px
|
||||
|
||||
#registered_services .service
|
||||
font-size: 1.2em
|
||||
padding: 2px
|
||||
|
|
|
@ -43,6 +43,13 @@
|
|||
<span class="edit_or_show_data" style="font-size: 0.8em; color: #888;"><br/><%= t('hints.sortable_name', "This name appears in sorted lists.") %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= f.blabel :bio, :en => "Bio" %></td>
|
||||
<td>
|
||||
<span class="display_data"><%= @user.bio %></span>
|
||||
<%= f.text_area :bio, :class => :edit_data, :id => 'user_bio' %>
|
||||
</td>
|
||||
</tr>
|
||||
<% active_email_channels = @email_channels.select { |cc| cc.active? } %>
|
||||
<% if active_email_channels.length > 1 %>
|
||||
<tr>
|
||||
|
|
|
@ -524,7 +524,9 @@ ActionController::Routing::Routes.draw do |map|
|
|||
user.media_download 'media_download', :controller => 'users', :action => 'media_download'
|
||||
user.resources :messages, :only => [:index]
|
||||
end
|
||||
map.resource :profile, :only => [:show, :update], :controller => "profile", :member => { :communication => :get, :update_communication => :post } do |profile|
|
||||
map.resource :profile, :only => %w(show edit update),
|
||||
:controller => "profile",
|
||||
:member => { :communication => :get, :update_communication => :post } do |profile|
|
||||
profile.resources :pseudonyms, :except => %w(index)
|
||||
profile.resources :tokens, :except => %w(index)
|
||||
profile.pics 'profile_pictures', :controller => 'profile', :action => 'profile_pics'
|
||||
|
@ -781,7 +783,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||
end
|
||||
|
||||
api.get 'users/:user_id/page_views', :controller => :page_views, :action => :index, :path_name => 'user_page_views'
|
||||
api.get 'users/:user_id/profile', :controller => :profile, :action => :show
|
||||
api.get 'users/:user_id/profile', :controller => :profile, :action => :edit
|
||||
api.get 'users/:user_id/avatars', :controller => :profile, :action => :profile_pics
|
||||
|
||||
api.with_options(:controller => :conversations) do |conversations|
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
class AddBioToUser < ActiveRecord::Migration
|
||||
tag :predeploy
|
||||
|
||||
def self.up
|
||||
add_column :users, :bio, :text
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_column :users, :bio, :text
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue