编辑个人简介
This commit is contained in:
parent
d942cc3123
commit
2a522f144e
|
@ -48,7 +48,7 @@ class UsersController < ApplicationController
|
||||||
:watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
:watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index,
|
||||||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,
|
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,
|
||||||
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages]
|
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction]
|
||||||
before_filter :auth_user_extension, only: :show
|
before_filter :auth_user_extension, only: :show
|
||||||
#before_filter :rest_user_score, only: :show
|
#before_filter :rest_user_score, only: :show
|
||||||
#before_filter :select_entry, only: :user_projects
|
#before_filter :select_entry, only: :user_projects
|
||||||
|
@ -1044,6 +1044,16 @@ class UsersController < ApplicationController
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#修改个人简介
|
||||||
|
def edit_brief_introduction
|
||||||
|
if @user && @user.extensions
|
||||||
|
@user.extensions.update_column("brief_introduction",params[:brief_introduction])
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_user
|
def find_user
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<% if user.user_extensions && user.user_extensions.brief_introduction && !user.user_extensions.brief_introduction.empty? %>
|
||||||
|
<%= user.user_extensions.brief_introduction %>
|
||||||
|
<% else%>
|
||||||
|
这位童鞋很懒,什么也没有留下~
|
||||||
|
<% end %>
|
||||||
|
<% if User.current == user%>
|
||||||
|
<a href="javascript:void(0);" onclick="show_edit_user_introduction();">
|
||||||
|
<img src="../images/signature_edit.png" width="12" height="12" />
|
||||||
|
</a>
|
||||||
|
<% end%>
|
|
@ -58,24 +58,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="homepageSignature">
|
<div class="homepageSignature">
|
||||||
<% if @user.user_extensions && @user.user_extensions.brief_introduction && !@user.user_extensions.brief_introduction.empty? %>
|
<p id="user_brief_introduction_show">
|
||||||
<p>
|
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
|
||||||
<%= @user.user_extensions.brief_introduction %>
|
</p>
|
||||||
<a href="javascript:void(0);">
|
|
||||||
<img src="../images/signature_edit.png" width="12" height="12" />
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
<% else%>
|
|
||||||
<% if is_current_user%>
|
|
||||||
<p>
|
|
||||||
这位童鞋很懒,什么也没有留下~
|
|
||||||
<a href="javascript:void(0);">
|
|
||||||
<img src="../images/signature_edit.png" width="12" height="12" />
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
<% end%>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
<textarea class="homepageSignatureTextarea none" placeholder="请输入回复" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id)%>');"><%= @user.user_extensions.brief_introduction %></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="homepageImageBlock">
|
<div class="homepageImageBlock">
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
$("#user_brief_introduction_show").html("<%= escape_javascript render(:partial => "layouts/user_brief_introduction", :locals => {:user => @user}) %>");
|
||||||
|
$("#user_brief_introduction_show").show();
|
||||||
|
$("#user_brief_introduction_edit").hide();
|
|
@ -345,6 +345,7 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'file_score_index', :to => 'projects#file_score_index', :via => [:get, :post]
|
match 'file_score_index', :to => 'projects#file_score_index', :via => [:get, :post]
|
||||||
match 'code_submit_score_index', :to => 'projects#code_submit_score_index', :via => [:get, :post]
|
match 'code_submit_score_index', :to => 'projects#code_submit_score_index', :via => [:get, :post]
|
||||||
match 'projects_topic_score_index', :to => 'projects#projects_topic_score_index', :via => [:get, :post]
|
match 'projects_topic_score_index', :to => 'projects#projects_topic_score_index', :via => [:get, :post]
|
||||||
|
get 'edit_brief_introduction'
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,6 +11,24 @@ $(function(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//编辑个人简介
|
||||||
|
function show_edit_user_introduction() {
|
||||||
|
$("#user_brief_introduction_show").hide();
|
||||||
|
$("#user_brief_introduction_edit").show();
|
||||||
|
$("#user_brief_introduction_edit").focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
//编辑个人简介完成之后提交
|
||||||
|
function edit_user_introduction(url){
|
||||||
|
$.get(
|
||||||
|
url,
|
||||||
|
{ brief_introduction: $("#user_brief_introduction_edit").val() },
|
||||||
|
function (data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
$(".newsType").mouseover(function(){
|
$(".newsType").mouseover(function(){
|
||||||
$(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px -25px no-repeat"});
|
$(".resourcesIcon").css({background:"url(images/resource_icon_list.png) 0px -25px no-repeat"});
|
||||||
|
|
|
@ -412,6 +412,7 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
|
||||||
.homepageImageName {font-size:16px; color:#484848; margin-left:15px; height:21px; float:left;max-width: 100px;}
|
.homepageImageName {font-size:16px; color:#484848; margin-left:15px; height:21px; float:left;max-width: 100px;}
|
||||||
.homepageImageSexMan {width:20px; height:20px; background:url(../images/homepage_icon.png) -10px -112px no-repeat; float:left;}
|
.homepageImageSexMan {width:20px; height:20px; background:url(../images/homepage_icon.png) -10px -112px no-repeat; float:left;}
|
||||||
.homepageImageSexWomen {width: 20px;height: 20px;background: url(../images/homepage_icon.png) -10px -149px no-repeat;float: left;}
|
.homepageImageSexWomen {width: 20px;height: 20px;background: url(../images/homepage_icon.png) -10px -149px no-repeat;float: left;}
|
||||||
|
.homepageSignatureTextarea {width:207px; height:80px; max-width:207px; max-height:80px; border:1px solid #d9d9d9; outline:none; margin:0px 0px 12px 15px;;}
|
||||||
.homepageSignature {font-size:12px; color:#888888; margin-left:15px; margin-top:10px; margin-bottom:12px; width:208px;}
|
.homepageSignature {font-size:12px; color:#888888; margin-left:15px; margin-top:10px; margin-bottom:12px; width:208px;}
|
||||||
.homepageImageBlock {margin:0 auto; width:78px; float:left; text-align:center; display:inline-block;}
|
.homepageImageBlock {margin:0 auto; width:78px; float:left; text-align:center; display:inline-block;}
|
||||||
.homepageImageNumber {font-size:12px; color:#484848;}
|
.homepageImageNumber {font-size:12px; color:#484848;}
|
||||||
|
|
Loading…
Reference in New Issue