diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index 9d90cb9f2..e80c56e49 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -40,7 +40,7 @@ class AvatarController < ApplicationController @urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file)) # 用户头像上传时进行特别处理 - if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project') + if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization') diskfile += "temp" @urlfile += "temp" end diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index c4935a1af..ca6484e49 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -96,6 +96,9 @@ class MyController < ApplicationController elsif params[:project] @project = Project.find params[:project] diskfile = disk_filename('Project', @project.id) + elsif params[:organization] + @organization = Organization.find params[:organization] + diskfile = disk_filename('Organization', @organization.id) else @user = User.current diskfile = disk_filename('User', @user.id) @@ -116,6 +119,9 @@ class MyController < ApplicationController when 'Project' @project = Project.find params[:source_id] diskfile = disk_filename('Project', @project.id) + when 'Organization' + @organization = Organization.find params[:source_id] + diskfile = disk_filename('Organization', @organization.id) end end diskfile1 = diskfile + 'temp' diff --git a/app/views/avatar/upload.js.erb b/app/views/avatar/upload.js.erb index c2fa23242..2c7411629 100644 --- a/app/views/avatar/upload.js.erb +++ b/app/views/avatar/upload.js.erb @@ -1,4 +1,4 @@ -<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project') %> +<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization') %> var imgSpan = $("img[nhname='avatar_image']"); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); <% else %> diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 2b9987cb6..3d9f620d6 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -13,7 +13,7 @@ <%= javascript_heads %> <%= heads_for_theme %> <%= stylesheet_link_tag 'prettify','jquery/jquery-ui-1.9.2','css/common','css/structure','css/public','repository','css/courses','css/org','css/project', 'css/popup' %> - <%= javascript_include_tag 'cookie','project', 'organization','header','prettify','select_list_move','org'%> + <%= javascript_include_tag 'cookie','project',"avatars", 'organization','header','prettify','select_list_move','org'%> <%= javascript_include_tag 'attachments' %> <%= call_hook :view_layouts_base_html_head %> @@ -78,16 +78,14 @@
@@ -172,6 +170,10 @@ <%= l(:label_loading) %>
+ +