socialforge/app/views/student_work/_relate_projects.html.erb

49 lines
3.6 KiB
Plaintext

<div class="syllabus_courses_box">
<% projects.each do |project|%>
<% 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="sy_courses_open">
<% projectUser = User.where("id=?",project.user_id).first %>
<% is_change = project.status == 9 && projectUser == User.current && @homework.student_works.has_committed.where("user_id = #{User.current.id}").count == 1 %>
<h3>
<% 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%>
<% elsif project.status != 9 %>
<a href="javascript:void(0)" class="new_project_title fl" title="私有项目不可访问"><%=project.name %></a>
<% else %>
<a href="javascript:void(0)" onclick="alert_notice_box();" class="new_project_title fl <%= is_change ? 'mw380' : '' %>" title="项目已删除"><%=project.name %></a>
<% end %>
</h3>
<span class="<%= project.is_public? ? 'syllabus_class_open' : 'syllabus_class_private' %> fl ml10 mt3 syllabus_class_property"><%= project.is_public? ? '公开' : '私有' %></span>
<% if is_change %>
<a href="javascript:void(0)" onclick="alert_change_project();" class="btn_grey_mid mt-5 ml10 fr">更换项目</a>
<% end %>
<%=link_to "<span class='fr grayTxt hidden mw150'>创建者:#{projectUser.show_name}</span>".html_safe, user_path(projectUser), :title => "#{projectUser.show_name}" %>
<div class="cl"></div>
</div>
<div>
<p class="fl sy_p_grey" style="margin-left: 0">更新时间:<%= format_date(project.updated_on) %></p>
<div class=" fr">
<p class="list-info fr grayTxt">
<%= link_to project.members.count, allow_visit ? member_project_path(project) : 'javascript:void(0)', :class => "c_blue" %><span class="mr5">成员&nbsp;&nbsp;|</span>
<%= link_to project.project_score.issue_num, allow_visit ? project_issues_path(project) : 'javascript:void(0)', :class => "c_blue" %><span class="mr5">问题&nbsp;&nbsp;|</span>
<%= link_to project.project_score.changeset_num, visible_repository?(project) ? ({:controller => 'repositories', :action => 'show', :id => project, :repository_id => gitlab_repository(project).try(:identifier)}) : 'javascript:void(0)', :class => "c_blue" %><span>提交</span>
</p>
</div>
</div>
<div class="cl"></div>
</div>
<% end %>
</div><!--syllabus_courses_box end-->
<script>
function alert_notice_box(){
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear mt15"><p class="text_c f14">项目已删除,链接无效</p><div class="cl"></div>'+
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 119px;" onclick="hideModal();">确&nbsp;&nbsp;定</a></div></div>';
pop_box_new(htmlvalue, 300, 140);
}
function alert_change_project(){
var htmlvalue = "<%= escape_javascript(render :partial => 'student_work/change_project') %>";
pop_box_new(htmlvalue, 400, 285);
}
</script>