分组作业关联的项目若已删除则给出提示

This commit is contained in:
cxt 2016-11-25 13:54:31 +08:00
parent 3d63d2ae2c
commit faa894cb56
2 changed files with 12 additions and 7 deletions

View File

@ -14,28 +14,31 @@
<div class="pr"> <div class="pr">
<span class="fl ml25 fontGrey2">关联项目:</span> <span class="fl ml25 fontGrey2">关联项目:</span>
<div class="fl projectName"> <div class="fl projectName">
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course) %> <% if student_work.project.status != 9 && (student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course)) %>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称", :target => "_blank" %> <%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称", :target => "_blank" %>
<% else %> <% elsif student_work.project.status != 9 %>
<span class="fontBlue fr hidden" style="max-width:550px;" title="该项目是私有的"><%= student_work.project.name %></span> <span class="fontBlue fr hidden" style="max-width:550px;" title="该项目是私有的"><%= student_work.project.name %></span>
<% end %> <% else %>
<span class="fontGrey2 fr hidden" style="max-width:550px;" title="该项目已删除"><%= student_work.project.name %>(已删除)</span><% end %>
<% project = student_work.project %> <% project = student_work.project %>
<div class="score-tip none tl f12" style="width:300px; top:-48px; right:-372px;"> <div class="score-tip none tl f12" style="width:300px; top:-48px; right:-372px;">
<em style="bottom:45px;"></em> <em style="bottom:45px;"></em>
<font style="bottom:45px;"></font> <font style="bottom:45px;"></font>
<p class="fb break_word mw280"><%= project.name %></p> <p class="fb break_word mw280"><%= project.name %><%= project.status == 9 ? "(已删除)" : ""%></p>
<p class="mb10"> <p class="mb10">
<span class="mr15">创建者:<%= project.creater %></span><span>成员数量:<%= project.members.count %></span></p> <span class="mr15">创建者:<%= project.creater %></span><span>成员数量:<%= project.members.count %></span></p>
<% project_score = project.project_score %> <% project_score = project.project_score %>
<p>项目综合得分:<%= static_project_score(project_score).to_i %></p> <p>项目综合得分:<%= project.status == 9 ? 0 : static_project_score(project_score).to_i %></p>
<% if project.status != 9 %>
<p>= 代码提交得分 + issue得分 + 资源得分 + 帖子得分</p> <p>= 代码提交得分 + issue得分 + 资源得分 + 帖子得分</p>
<p>= <%= (project_score.changeset_num||0) * 4 %> <p>= <%= (project_score.changeset_num||0) * 4 %>
+ <%= project_score.issue_num * 4 + project_score.issue_journal_num %> + <%= project_score.attach_num * 5 %> + <%= project_score.issue_num * 4 + project_score.issue_journal_num %> + <%= project_score.attach_num * 5 %>
+ <%= project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %></p> + <%= project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %></p>
<% end %>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,13 +1,15 @@
<div class="syllabus_courses_box"> <div class="syllabus_courses_box">
<% projects.each do |project|%> <% projects.each do |project|%>
<% allow_visit = project.is_public || User.current.member_of?(project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course) %> <% allow_visit = project.status != 9 && (project.is_public || User.current.member_of?(project) || User.current.admin? || User.current.allowed_to?(:as_teacher, @homework.course)) %>
<div class="syllabus_courses_list" style="cursor: default"> <div class="syllabus_courses_list" style="cursor: default">
<div class="sy_courses_open"> <div class="sy_courses_open">
<h3> <h3>
<% if allow_visit %> <% if allow_visit %>
<%= link_to "#{project.name}", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%> <%= link_to "#{project.name}", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%>
<% else %> <% elsif project.status != 9 %>
<a href="javascript:void(0)" class="new_project_title fl" title="私有项目不可访问"><%=project.name %></a> <a href="javascript:void(0)" class="new_project_title fl" title="私有项目不可访问"><%=project.name %></a>
<% else %>
<a href="javascript:void(0)" class="new_project_title fl" title="项目已删除"><%=project.name %></a>
<% end %> <% end %>
</h3> </h3>
<span class="<%= project.is_public? ? 'syllabus_class_open' : 'syllabus_class_private' %> fl ml10 mt3 syllabus_class_property"><%= project.is_public? ? '公开' : '私有' %></span> <span class="<%= project.is_public? ? 'syllabus_class_open' : 'syllabus_class_private' %> fl ml10 mt3 syllabus_class_property"><%= project.is_public? ? '公开' : '私有' %></span>