socialforge/app/views/users/_user_message_contest.html.erb

349 lines
20 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<% if ma.contest_message_type == "ContestRequestDealResult" %>
<% user = User.find(ma.user_id) %>
<% if ma.content
role_str = ""
if ma.content.include?('13') && ma.content.include?('14')
role_str = "管理员、评委"
elsif ma.content.include?('13')
role_str = "管理员"
elsif ma.content.include?('14')
role_str = "评委"
elsif ma.content.include?('15')
role_str = "参赛者"
end
end %>
<ul class="homepageNewsList fl">
<div class="shortMessageWidth">
<li class="homepageNewsPortrait fl">
<div class="navHomepageLogo fl">
<%= link_to image_tag(url_to_avatar(user), :width => "30", :height => "30"), user_path(user), :target => '_blank' %>
</div>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">
<%=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.nil? ? "" : "来自"+user.user_extensions.school.name+"" %>
申请以"<%= role_str%>"的身份加入竞赛:
</span>
</li>
<li class="messageInformationContents">
<%= link_to Contest.find(ma.contest_id).name, contest_path(ma.contest_id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
</div>
<li class="messageOperateContents fl">
<span id="deal_info_<%=ma.id%>">
<% if ma.status == 1%> <!-- 同意 -->
<span title="<%= User.find(ma.contest_message_id).show_name %>已同意"><%= User.find(ma.contest_message_id).show_name %>已同意</span>
<% else%> <!-- 拒绝 -->
<span title="<%= User.find(ma.contest_message_id).show_name %>已拒绝"><%= User.find(ma.contest_message_id).show_name %>已拒绝</span>
<%end %>
</span>
</li>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--被管理员拉入竞赛:学生身份-->
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 0 %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(User.find(ma.contest_message_id)), :width => "30", :height => "30"), user_path(ma.contest_message_id), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.contest_message_id).show_name, user_path(User.find(ma.contest_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">将您加入了竞赛:</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest.name, contest_path(ma.contest), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--被管理员拉入竞赛:老师身份-->
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 1 %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">系统提示</span>
<span class="homepageNewsType fl">您增加了新的竞赛成员:</span>
</li>
<li class="messageInformationContents">
<%= link_to User.find(ma.contest_message_id).login+"("+(User.find(ma.contest_message_id).realname ? User.find(ma.contest_message_id).realname : User.find(ma.contest_message_id).login) +")",
{:controller => 'contests', :action => 'settings', :id => ma.contest_id, :tab=>'member'},
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank' %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--主动加入竞赛-->
<% elsif ma.contest_message_type == "JoinContest" and ma.status == 2 %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<% user = User.find(ma.contest_message_id) %>
<li class="homepageNewsPortrait fl">
<div class="navHomepageLogo fl">
<%= link_to image_tag(url_to_avatar(user), :width => "30", :height => "30"), user_path(user), :target => '_blank' %>
</div>
</li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher">
<%=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.nil? ? "" : "来自"+user.user_extensions.school.name+"" %>
以"参赛者"的身份加入了竞赛:
</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest.name, contest_path(ma.contest), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--被老师移出课程-->
<% elsif ma.contest_message_type == "RemoveFromContest" %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%=link_to image_tag(url_to_avatar(User.find(ma.contest_message_id)), :width => "30", :height => "30"), user_path(ma.contest_message_id), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.contest_message_id).show_name, user_path(User.find(ma.contest_message_id)), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">将您移出了竞赛:</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest.name, contest_path(ma.contest), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--发布竞赛题目-->
<% elsif ma.contest_message_type == "Work" && ma.status.nil? && ma.contest_message %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%=link_to image_tag(url_to_avatar(ma.contest_message.user), :width => "30", :height => "30"), user_path(ma.contest_message.user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.contest_message.user.show_name, user_path(ma.contest_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">发布了竞赛题:</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}"
%>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--竞赛截止时间快到了-->
<% elsif ma.contest_message_type == "Work" && ma.status == 1 && ma.contest_message %>
<ul class="homepageNewsList fl">
<div class="shortMessageWidth">
<li class="homepageNewsPortrait fl">
<%=link_to image_tag(url_to_avatar(ma.contest_message.user), :width => "30", :height => "30"), user_path(ma.contest_message.user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.contest_message.user.show_name, user_path(ma.contest_message.user),
:class => "newsBlue homepageNewsPublisher",
:title => "#{ma.contest_message.user.show_name}",
:target => '_blank' %>
<span class="homepageNewsType fl">发布的竞赛题:</span></li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}"
%>
</li>
</div>
<li class="messageOperateContents fl" title="截止时间快到啦">截止时间快到啦</li>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--竞赛启动在线评审-->
<% elsif ma.contest_message_type == "Work" && ma.status == 2 && ma.contest_message %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(ma.contest_message.user), :width => "30", :height => "30"), user_path(ma.contest_message.user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.contest_message.user.show_name, user_path(ma.contest_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">启动了在线评审:</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}"%>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--关闭在线评审-->
<% elsif ma.contest_message_type == "Work" && ma.status == 3 && ma.contest_message %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(ma.contest_message.user), :width => "30", :height => "30"), user_path(ma.contest_message.user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.contest_message.user.show_name, user_path(ma.contest_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">关闭了在线评审:</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => "_blank"%>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--在线评审启动失败-->
<% elsif ma.contest_message_type == "Work" && ma.status == 4 && ma.contest_message %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(ma.contest_message.user), :width => "30", :height => "30"), user_path(ma.contest_message.user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.contest_message.user.show_name, user_path(ma.contest_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">在线评审启动失败<font class="c_red">(评委数为0或作品数为0)</font></span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id), :class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => "_blank" %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--在线评审时间快到了-->
<% elsif ma.contest_message_type == "Work" && ma.status == 5 && ma.contest_message %>
<ul class="homepageNewsList fl">
<div class="shortMessageWidth">
<li class="homepageNewsPortrait fl">
<%=link_to image_tag(url_to_avatar(ma.contest_message.user), :width => "30", :height => "30"), user_path(ma.contest_message.user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.contest_message.user.show_name, user_path(ma.contest_message.user),
:class => "newsBlue homepageNewsPublisher",
:title => "#{ma.contest_message.user.show_name}",
:target => '_blank' %>
<span class="homepageNewsType fl">启动的在线评审:</span></li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.name, contestant_works_path(:work => ma.contest_message.id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "竞赛题:#{ma.contest_message.name}"
%>
</li>
</div>
<li class="messageOperateContents fl" title="截止时间快到啦">截止时间快到啦</li>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--发布竞赛通知-->
<% elsif ma.contest_message_type == "News" && ma.contest_message %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%=link_to image_tag(url_to_avatar(ma.contest_message.author), :width => "30", :height => "30"),user_path(ma.contest_message.author), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.contest_message.author.try(:show_name), user_path(ma.contest_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">发布了竞赛通知:</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.title, {:controller => 'news', :action => 'show', :id => ma.contest_message.id },
:class =>"#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "#{ma.contest_message.title}"
%>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--回复了竞赛通知-->
<% elsif ma.contest_message_type == "Comment" && ma.contest_message %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%=link_to image_tag(url_to_avatar(ma.contest_message.author), :width => "30", :height => "30"), user_path(ma.contest_message.author), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to User.find(ma.contest_message.author_id).show_name, user_path(ma.contest_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">回复了竞赛通知:</span>
</li>
<li class="messageInformationContents">
<%= link_to ma.contest_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.contest_message.commented.id },
:class =>"#{!ma.viewed ? "newsBlack" : "newsGrey"}" ,
:target => '_blank',
:title => "#{ma.contest_message.commented.title}"
%>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--发布/回复了竞赛帖子-->
<% elsif ma.contest_message_type == "Message" && !ma.nil? && !ma.contest_message.nil? %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%=link_to image_tag(url_to_avatar(ma.contest_message.author), :width => "30", :height => "30"), user_path(ma.contest_message.author), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%=link_to ma.contest_message.author.try(:show_name), user_path(ma.contest_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl">
<%= ma.contest_message.parent_id.nil? ? "发布了竞赛帖子:" : "回复了竞赛帖子:" %></span></li>
<% if ma.contest_message.parent_id.nil? %>
<li class="messageInformationContents">
<%= link_to ma.contest_message.subject, board_message_path(ma.contest_message.board_id, ma.contest_message.id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}",
:target => '_blank',
:title => "#{ma.contest_message.subject}"
%>
</li>
<% else %>
<li class="messageInformationContents">
<%= link_to message_content(ma.contest_message.content), board_message_path(ma.contest_message.board_id, ma.contest_message.parent_id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
<% end %>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<!--发布/回复了竞赛留言-->
<% elsif ma.contest_message_type == "JournalsForMessage" && ma.contest_message && ma.contest_message.jour_type == 'Contest' %>
<ul class="homepageNewsList fl">
<div class="longMessageWidth">
<li class="homepageNewsPortrait fl">
<%= link_to image_tag(url_to_avatar(ma.contest_message.user), :width => "30", :height => "30"), user_path(ma.contest_message.user), :target => '_blank' %>
</li>
<li class="homepageNewsPubType fl">
<%= link_to ma.contest_message.user.try(:show_name), user_path(ma.contest_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
<span class="homepageNewsType fl"><%= ma.contest_message.m_parent_id.nil? ? "发布了竞赛留言:" : "回复了竞赛留言:" %></span>
</li>
<li class="messageInformationContents">
<%= link_to message_content(ma.contest_message.notes), feedback_contest_path(:id => ma.contest_id),
:class => "#{!ma.viewed ? "newsBlack" : "newsGrey"}", :target => '_blank' %>
</li>
</div>
<li class="homepageNewsTime fr"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>