Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
huang 2017-02-24 13:52:18 +08:00
commit 6e96f6e9ec
7 changed files with 19 additions and 7 deletions

View File

@ -1237,6 +1237,16 @@ class User < Principal
Thread.current[:current_user] ||= User.anonymous
end
def user_real_extension
ue = self.user_extensions
if ue.nil?
ue = UserExtensions.new
ue.user_id = self.id
ue.save
end
ue
end
# Returns the anonymous user. If the anonymous user does not exist, it is created. There can be only
# one anonymous user per database.
def self.anonymous

View File

@ -36,7 +36,7 @@
<%= link_to '管理员身份', switch_role_contest_path(@contest, :user_id => User.current.id, :curr_role => 14, :tar_role => 13), :class => "fr sy_btn_blue mt28 ml10", :title => "由评委身份切换至管理员身份" %>
<% end %>
<% end %>
<% else %>
<% elsif User.current.logged? %>
<%= link_to "加入竞赛",join_contest_contests_path(),:remote => true, :method => "get", :class => "fr sy_btn_blue mt28 ml10" %>
<% end %>
<span class="fr mt30 f16"> 邀请码:

View File

@ -83,7 +83,7 @@
<%= link_to user.show_name, user_path(user), :class => 'fl sy_class_users_st_name' ,:title => "#{user.show_name}", :target => '_blank' %>
</td>
<td>
<span class="sy_class_users_st_num" title="<%= user.user_extensions.student_id %>"><%= user.user_extensions.student_id %></span>
<span class="sy_class_users_st_num" title="<%= user.user_real_extension.student_id %>"><%= user.user_real_extension.student_id %></span>
</td>
<td>
<% if !is_teacher && User.current.id != member.user_id && course_has_score_open_common_homework(@course) %>

View File

@ -116,6 +116,7 @@
$("#navHomepageSearchType").hide();
});
<% unless @force %>
$("#user_messages").mouseenter(function(){
onNotice = true;
$("#user_messages_list").show();
@ -134,6 +135,7 @@
obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
} }, 500);
});
<% end %>
$("#message_list_detail").mouseenter(function(event){
event.stopPropagation();
onUserMessages = true;

View File

@ -132,7 +132,7 @@
role_str = "参赛者"
end
end %>
<li><a href="<%=contest_path(ma.contest_id) %>" target="_blank" title='<%= user.show_name%> <%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"" %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%>'><span class="shadowbox_news_user"><%= user.show_name%> </span><%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"" %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%></a></li>
<li><a href="<%=contest_path(ma.contest_id) %>" target="_blank" title='<%= user.show_name%> <%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"" %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%>'><span class="shadowbox_news_user"><%= user.show_name%> </span><%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"" %>申请以"<%= role_str%>"的身份加入竞赛:<%=Contest.find(ma.contest_id).name %> <%= User.find(ma.contest_message_id).show_name %><%= ma.status == 1 ? "已同意" : "已拒绝"%></a></li>
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 0 %>
<li><a href="<%=contest_path(ma.contest) %>" target="_blank" title="<%=User.find(ma.contest_message_id).show_name %> 将您加入了竞赛:<%= ma.contest.name%>"><span class="shadowbox_news_user"><%=User.find(ma.contest_message_id).show_name %> </span>将您加入了竞赛:<%= ma.contest.name%></a></li>
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 1 %>
@ -177,8 +177,8 @@
<% applied_contest = ma.applied %>
<% contest = Contest.find applied_contest.contest_id %>
<% message_user = User.find(applied_contest.user_id) %>
<% content = '<span class="shadowbox_news_user">'+message_user.show_name+' </span>'+(message_user.user_extensions.school_id.blank? ? "" : "来自")+message_user.user_extensions.school.name+""+'申请以"'+ get_role_str(ma.role) + '"的身份加入竞赛:' + contest.name%>
<%= link_to content.html_safe, contest_path(contest.id), :title => "#{message_user.show_name} #{message_user.user_extensions.school_id.blank? ? '' : '来自'+message_user.user_extensions.school.name}申请以'#{get_role_str(ma.role)}'的身份加入竞赛:#{contest.name}", :target => '_blank' %>
<% content = '<span class="shadowbox_news_user">'+message_user.show_name+' </span>'+(message_user.user_extensions.school_id.blank? || message_user.user_extensions.school.nil? ? "" : "来自"+message_user.user_extensions.school.name+"")+'申请以"'+ get_role_str(ma.role) + '"的身份加入竞赛:' + contest.name%>
<%= link_to content.html_safe, contest_path(contest.id), :title => "#{message_user.show_name} #{message_user.user_extensions.school_id.blank? || message_user.user_extensions.school.nil? ? '' : '来自'+message_user.user_extensions.school.name+""}申请以'#{get_role_str(ma.role)}'的身份加入竞赛:#{contest.name}", :target => '_blank' %>
</li>
<% end %>
<% elsif ma.class == ForgeMessage %>

View File

@ -13,7 +13,7 @@
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
</span>
<span class="homepageNewsType fl">
<%= message_user.user_extensions.school_id.blank? ? "" : "来自"+message_user.user_extensions.school.name+"" %>
<%= message_user.user_extensions.school_id.blank? || message_user.user_extensions.school.nil? ? "" : "来自"+message_user.user_extensions.school.name+"" %>
申请以"<%= get_role_str ma.role %>"的身份加入竞赛:
</span>
</li>

View File

@ -25,7 +25,7 @@
<%=link_to user.show_name, user_path(user),
:class => "newsBlue homepageNewsPublisher", :target => '_blank' %></span>
<span class="homepageNewsType fl">
<%= user.user_extensions.school_id.blank? ? "" : "来自"+user.user_extensions.school.name+"" %>
<%= user.user_extensions.school_id.blank? || user.user_extensions.school.nil? ? "" : "来自"+user.user_extensions.school.name+"" %>
申请以"<%= role_str%>"的身份加入竞赛:
</span>
</li>