From 83c00d1225e55a660deb984038664b23bd7e50c6 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 6 Jan 2017 15:52:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E5=9B=BE=E7=89=87=E7=9A=84?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/avatar_controller.rb | 2 +- app/views/avatar/upload.js.erb | 2 +- .../contests/_contest_base_info.html.erb | 7 ++++++- app/views/contests/_upload_img.html.erb | 20 ++++++++++++------- app/views/layouts/base_contests.html.erb | 5 +++-- app/views/my/clear_user_avatar_temp.js.erb | 7 ++++++- app/views/my/save_user_avatar.js.erb | 2 ++ public/stylesheets/css/common.css | 1 + 8 files changed, 33 insertions(+), 13 deletions(-) diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index e80c56e49..8a383f6f9 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' || @source_type == 'Organization') + if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization'|| @source_type == 'Contest') diskfile += "temp" @urlfile += "temp" end diff --git a/app/views/avatar/upload.js.erb b/app/views/avatar/upload.js.erb index 2c7411629..3f6f67c2d 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' || @source_type == 'Organization') %> +<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization'|| @source_type == 'Contest') %> var imgSpan = $("img[nhname='avatar_image']"); imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'}); <% else %> diff --git a/app/views/contests/_contest_base_info.html.erb b/app/views/contests/_contest_base_info.html.erb index e7e7bb396..7e4c40d9e 100644 --- a/app/views/contests/_contest_base_info.html.erb +++ b/app/views/contests/_contest_base_info.html.erb @@ -9,7 +9,12 @@
diff --git a/app/views/contests/_upload_img.html.erb b/app/views/contests/_upload_img.html.erb index 775f5cd49..6c54e6a7a 100644 --- a/app/views/contests/_upload_img.html.erb +++ b/app/views/contests/_upload_img.html.erb @@ -1,12 +1,12 @@ -
+

上传图片

-
-
- +
+
+ 上传图片 <%= file_field_tag 'avatar[image]', :id => "upload_avatar", :style => 'display:none;',#added by young @@ -28,10 +28,16 @@
- +
+
+

预览(968px*110px)

+ <%= image_tag(url_to_avatar(source), :style=>"width:968px;height:110px;",:class=>"mb5 mt10 ml16",:nhname=>'avatar_image') %> +
+
- 取  消 - 确  定 + 确  定 + 取  消 +