分組作业的动态和详情的调整、作品列表增加项目提示和老师加入项目的功能

This commit is contained in:
cxt 2016-10-21 19:58:02 +08:00
parent f730b48eac
commit fefc1bf800
5 changed files with 32 additions and 50 deletions

View File

@ -5,6 +5,9 @@ class AppliedProjectController < ApplicationController
if params[:object_id]
@project = Project.find_by_id(params[:object_id])
end
if params[:is_teacher]
@is_teacher = 1
end
# @user_id = params[:user_id]
# if params[:project_join]
# if @project

View File

@ -6,11 +6,19 @@
<div class="sy_popup_con" style="width:370px;">
<%= form_tag( url_for(:controller => 'applied_project', :action => 'applied_project_info', :project_id => (@project.nil? ? nil : @project.id)), :remote => true, :id => 'project_applied_form') do %>
<ul class="sy_popup_add ">
<li>
<label >项目邀请码:</label>
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" style="width:250px"/>
<div class="cl"></div>
</li>
<% if @is_teacher && @is_teacher == 1 %>
<li class="none">
<label >项目邀请码:</label>
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" value="<%=@project.invite_code %>" style="width:250px"/>
<div class="cl"></div>
</li>
<% else %>
<li>
<label >项目邀请码:</label>
<input name="invite_code" class=" sy_input_txt fl" placeholder="请输入六位项目邀请码" style="width:250px"/>
<div class="cl"></div>
</li>
<% end %>
<li>
<label >身份:</label>
<input name="member" value="member_manager" type="radio" class="ml5 mr5 " /><span class="mr10">管理人员</span>

View File

@ -11,18 +11,22 @@
<% if @homework.homework_detail_group.base_on_project == 1 %>
<div class="pr fr projectName">
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fr hidden', :style => "max-width:200px;", :title => "项目名称"%>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fr hidden', :style => "max-width:200px;", :title => "项目名称", :target => "_blank"%>
<% elsif User.current.allowed_to?(:as_teacher, @homework.course) %>
<%= link_to student_work.project.name, applied_join_project_path(:object_id => student_work.project.id, :is_teacher => 1), :remote => true, :method => "post", :class => 'link-blue fr hidden', :style => "max-width:200px;", :title => "项目名称" %>
<% else %>
<span class="fontBlue fr hidden" style="max-width:200px;" title="该项目是私有的"><%= student_work.project.name %></span>
<% end %>
<% project = student_work.project %>
<div class="score-tip none tl f12" style="width:300px; top:-48px; right:-362px;">
<em style="bottom:45px;"></em>
<font style="bottom:45px;"></font>
<p class="fb"><%= student_work.project.name %></p>
<p class="mb10"><span class="mr15">创建者:刘逸舟</span><span>成员数量5</span></p>
<p>项目综合得分106703</p>
<p>= 代码提交得分 + issue得分 + 资源得分 + 讨论区得分</p>
<p>= 67716 + 38679 + 80 + 20</p>
<p class="fb"><%= project.name %></p>
<p class="mb10"><span class="mr15">创建者:<%=project.creater %></span><span>成员数量:<%=project.members.count %></span></p>
<% project_score = project.project_score %>
<p>项目综合得分:<%=static_project_score(project_score).to_i %></p>
<p>= 代码提交得分 + issue得分 + 资源得分 + 帖子得分</p>
<p>= <%=(project_score.changeset_num||0) * 4 %> + <%=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>
</div>
</div>
<span class="fr">关联项目:</span>

View File

@ -87,47 +87,9 @@
<% first_pro = Project.find sort_projects.first.project_id %>
<% commit_time = first_pro.project_score.commit_time %>
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
#&nbsp;<%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目
</div>
<div class="cl"></div>
<% sort_projects.each_with_index do |pro, i| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>_<%=activity.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>_<%=activity.id %>").css("display","none");
});
});
</script>
<div class="mr10 mb10 mt10 fl w100 fontGrey2" style="text-align: center;">
<% com_time = project.project_score.commit_time %>
<% forge_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像", :target => '_blank' %>
<p class="mh18 hidden"><%=link_to (User.find project.user_id).show_name+"(组长)", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{(User.find project.user_id).show_name}(组长)" %></p>
<% update_time = time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
<p class="mh18 hidden"><%=link_to update_time+" "+project.project_score.changeset_num.to_s+"提交", project_path(project.id,:host=>Setting.host_name), :target => '_blank', :title => "#{update_time} #{project.project_score.changeset_num.to_s}提交" %></p>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius relatePImage",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像",:title => "私有项目不可访问") %>
<p class="mh18 hidden" title="私有项目不可访问"><span class="captainName" title="<%=(User.find project.user_id).show_name %>"><%=(User.find project.user_id).show_name %></span><span style="vertical-align: top;">(组长)</span></p>
<p class="mh18 hidden" title="私有项目不可访问"><%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>&nbsp;&nbsp;<%= project.project_score.changeset_num %>提交</p>
<% end %>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>_<%=activity.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
更新时间:<%=time_from_now !com_time.nil? && format_time(com_time) > format_time(forge_time) ? com_time : forge_time %>
</div>
</div>
<% if i == 9 && projects.count > 10 %>
<a href="javascript:void(0);" class="linkGrey2 fl ml50" style="margin-top:68px;" id="moreProject_<%=user_activity_id %>">更多>></a>
<% end %>
<% if i > 9 && i == (projects.count - 1) %>
<a href="javascript:void(0);" class="linkGrey2 fr mr10" style="margin-top:68px;" id="hideProject_<%=user_activity_id %>">收回&lt;&lt;</a>
<% end %>
<% end %>
</div>
<% end %>
<% end %>

View File

@ -37,6 +37,11 @@
</div>
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group%>
<% if activity.homework_detail_group.base_on_project == 1 %>
<div class="homepagePostDeadline mr15">
项目(<%=activity.student_work_projects.where("is_leader = 1").count %>)
</div>
<% end %>
<div class="homepagePostDeadline mr15">
分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
</div>