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

This commit is contained in:
cxt 2017-03-03 14:45:17 +08:00
commit 4688fbaec9
29 changed files with 285 additions and 196 deletions

View File

@ -29,7 +29,7 @@ class AtController < ApplicationController
case type
when "Issue"
find_issue(id)
whne 'TrainingTask'
when 'TrainingTask'
find_training_task(id)
when 'Project'
find_project(id)

View File

@ -853,7 +853,9 @@ class ProjectsController < ApplicationController
params = {jobName: jobName, pipeLine: pipeLine}
res = uri_exec uri, params
training_project_notice res
@project.update_attribute(:training_status, 1)
if res['code'] == 0
@project.update_attribute(:training_status, 1)
end
end
def training_project_update
@ -863,7 +865,9 @@ class ProjectsController < ApplicationController
params = {jobName: jobName, pipeLine: pipeLine}
res = uri_exec uri, params
training_project_notice res
@project.update_attribute(:training_status, 1)
if res['code'] == 0
@project.update_attribute(:training_status, 1)
end
end
def training_project_notice res
@ -891,18 +895,30 @@ class ProjectsController < ApplicationController
gitlab_address = Redmine::Configuration['gitlab_address']
gitUrl = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ rep_identify + "."+"git"
gitUrl = Base64.encode64(gitUrl)
if @training_task.status == 0
params = {:jobName => "#{jobName}", :taskId => "#{taskId}", :step => "#{step}", :gitUrl => "#{gitUrl}"}
uri = URI.parse("http://123.59.135.74:9999/jenkins-exec/api/buildJob")
begin
res = uri_exec uri, params
# 任务开启成功后创建一条留言提示,并发布
@training_task.update_attribute(:status, 2)
return
# 轮询获取
for i in 0..60 do
sleep(1)
result = TrainingTask.where(:id => @training_task.id).first.try(:result)
if (result != 0)
break
end
end
# @training_task = TrainingTask.find(@training_task.id)
@page = params[:page] ? params[:page].to_i + 1 : 0
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'TrainingTask','Message','News', 'Project', 'Attachment','Commit')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
rescue Exception => e
puts e
end
end
respond_to do |format|
format.js
end
end
def uri_exec uri, params
@ -931,7 +947,7 @@ class ProjectsController < ApplicationController
forked_count = @project.forked_count.to_i + 1
@project.update_attributes(:forked_count => forked_count)
# 发布实训任务,只发布实训任务的第一个
publish_training_tasks(@project.id, new_training_project.id, 1)
publish_training_tasks(@project.id, new_training_project.id, 1, @project.user_id)
end
end
end
@ -944,7 +960,7 @@ class ProjectsController < ApplicationController
def training_task_status
status = params[:status].to_i
task_id = params[:taskId]
message = Base64.decode64(params[:msg])
message = Base64.decode64(params[:msg]) unless params[:msg].blank?
begin
@training_task = TrainingTask.find(task_id)
# 如果已经执行成功过,则不重复执行
@ -961,11 +977,12 @@ class ProjectsController < ApplicationController
ActiveRecord::Base.transaction do
if position < original_tasks_count
# 继续发布下一个任务
publish_training_tasks original_project_id, @training_task.project_id, position + 1
publish_training_tasks original_project_id, @training_task.project_id, position + 1, original_project.user_id
end
@training_task.update_attribute(:status, 1)
@training_task.update_attribute(:result, 1)
# 创建一条回复提醒
content = (position == original_tasks_count) ? "恭喜您,您已经完成了实训项目的所有任务" : "恭喜您,您已经完成了本任务"
content = (position == original_tasks_count) ? "恭喜您,您已经完成了实训项目的所有任务" : "恭喜您,您已经完成了本任务,请继续下一任务"
add_training_task_journal(content, original_project.user_id)
end
else
@ -973,6 +990,7 @@ class ProjectsController < ApplicationController
add_training_task_journal(content, original_project.user_id)
# 失败的时候可以继续提交
@training_task.update_attribute(:status, 0)
@training_task.update_attribute(:result, 2)
end
end
@ -989,7 +1007,7 @@ class ProjectsController < ApplicationController
# 实训开启成功后,发布第一个任务
# REDO:失败后提醒用户,及相关处理
def publish_training_tasks original_project_id, new_training_project_id, position
def publish_training_tasks original_project_id, new_training_project_id, position, user_id
original_task = TrainingTask.where(:project_id => original_project_id, :position => position).first
training_task = TrainingTask.new
training_task.save_attachments(params[:attachments] || (params[:training_task] && params[:training_task][:uploads]))
@ -998,13 +1016,12 @@ class ProjectsController < ApplicationController
training_task.position = original_task.position
training_task.project_id = new_training_project_id
training_task.author_id = User.current.id
if training_task.save
respond_to do |format|
format.html{redirect_to project_url(new_training_project_id)}
end
else
raise "create task failed"
begin
training_task.save
rescue Exception => e
puts e
end
end
# 复制项目

View File

@ -4448,6 +4448,10 @@ class UsersController < ApplicationController
format.html {render :layout => 'clear_base'}
end
end
# 邮件激活页面,用户修改邮件地址弹框
def change_user_email
@user = User.find params[:id]
end
private
def show_system_message

View File

@ -7,25 +7,26 @@
<p class="email_prompt_p">如果您尚未收到激活邮件,请按照以下步骤操作:</p>
<li>检查邮箱的“订阅邮件”、“垃圾邮件”,可能会发现激活邮件。 </li>
<li>如果激活邮件已无效,请点击重新发送激活邮件按钮。</li>
<li>如果重发注册验证邮箱邮件仍然没有收到,请<a href="javascript:void(0);" class="link-blue" onclick="change_user_email()">更换邮箱地址</a>,重新发送激活邮件</li>
<li>如果重发注册验证邮箱邮件仍然没有收到,请<a href="javascript:void(0);" class="link-blue" id="change_email">更换邮箱地址</a>,重新发送激活邮件</li>
<li>如果您始终无法收到激活邮件,请直接给我们留言:</li>
<div class="mt10">
<% get_memo %>
<%= form_for(@new_memo, :url => mail_feedback_forum_path(@public_forum, :user_id => @user.id), :remote => true) do |f| %>
<%= f.text_area :subject, :id => "subject", :class => "email_prompt_mes", :style => "width: 568px;", :placeholder => l(:label_email_feedback_tips) %>
<%= f.hidden_field :content, :id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<span class="c_red fl" id="mail_valid_feedback_tip" style="display: none;">内容不能为空</span>
<a href="javascript:void(0);" class="btn btn-blue fr" onclick="f_submit();">确定</a>
<% end %>
<textarea style="resize: none;width: 570px;" class="email_prompt_mes" placeholder="<%= l(:label_email_feedback_tips) %>"></textarea>
<div class="c1"></div>
<button class="email_sub_btn fr" onclick="leave_email_activation_message('<%= leave_email_activation_message_path(1)%>','<%= @user.id %>');">确定</button>
<div class="cl"></div>
</div>
</ul>
</div>
</div>
<script type="text/javascript">
function change_user_email(){
var htmlvalue = "<%= j (render :partial => 'account/change_user_email', :locals => {:user => @user}) %>";
pop_box_new(htmlvalue,520,316);
}
$(document).ready(function(){
$("#change_email").click(function(){
$.ajax({
url: "<%= change_user_email_user_path(@user) %>"
});
});
});
function resendMail(url,id)
{
$.get(

View File

@ -17,16 +17,12 @@
<li>请确认是否填写了正确的邮箱地址 </li>
<li>请注意查看邮箱中的“订阅邮件”、“垃圾邮件”可能Trustie的邮件被误杀了</li>
<li>请点击重新发送激活邮件按钮</li>
<li>如果重发注册验证邮箱邮件仍然没有收到,请<a href="javascript:void(0);" class="link-blue" onclick="change_user_email()">更换邮箱地址</a>,重新发送激活邮件</li>
<li>如果重发注册验证邮箱邮件仍然没有收到,请<a href="javascript:void(0);" class="link-blue" id="change_email">更换邮箱地址</a>,重新发送激活邮件</li>
<li>如果您始终无法收到激活邮件,请直接给我们留言:</li>
<div class="mt10 clearfix">
<% get_memo %>
<%= form_for(@new_memo, :url => mail_feedback_forum_path(@public_forum, :user_id => @user.id), :remote => true) do |f| %>
<%= f.text_area :subject, :id => "subject", :class => "email_prompt_mes", :style => "width: 568px;", :placeholder => l(:label_email_feedback_tips) %>
<%= f.hidden_field :content, :id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
<span class="c_red fl" id="mail_valid_feedback_tip" style="display: none;">内容不能为空</span>
<a href="javascript:void(0);" class="btn btn-blue fr" onclick="f_submit();">确定</a>
<% end %>
<div class="mt10">
<textarea style="resize: none;width: 570px;" class="email_prompt_mes" placeholder="<%= l(:label_email_feedback_tips) %>"></textarea>
<div class="c1"></div>
<button class="email_sub_btn fr" onclick="leave_email_activation_message('<%= leave_email_activation_message_path(1)%>','<%= @user.id %>');">确定</button>
<div class="cl"></div>
</div>
</ul>
@ -34,10 +30,34 @@
</div>
<script>
$(document).ready(function(){
$("#change_email").click(function(){
$.ajax({
url: "<%= change_user_email_user_path(@user) %>"
});
});
});
function change_user_email(){
var htmlvalue = "<%= j (render :partial => 'account/change_user_email', :locals => {:user => @user}) %>";
pop_box_new(htmlvalue,520,316);
function leave_email_activation_message(url,user)
{
if ($(".email_prompt_mes").val().length == 0){
//弹框请他输入文字
var htmlvalue = "</br><div style='width:550px;text-align:center'>您的留言不能为空</div></br><div style='width:67px; margin:0 auto; text-align:center'><a href='javascript:void(0);' class='Blue-btn' onclick='hideModal()'>确定</a></div>";
pop_up_box(htmlvalue,580,30,50);
return;
}
$.ajax({
url: url,
data: {user: user, text: $(".email_prompt_mes").val() },
type: "POST",
success: function (data) {
var htmlvalue = "<div class='email_tancon'><h2 class='email_tan_title'>您的留言已发送</h2><p class='email_tan_p'>我们将尽快处理好并通知您。感谢您的反馈!</p></div>"
pop_up_box(htmlvalue, 580, 30, 50);
$(".email_prompt_mes").val("");
}
});
}
function regex_mv_name()
{

View File

@ -58,7 +58,7 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索" style="width: 300px" />
<input type="text" name="q" value="<%= name.nil? ? "" : name %>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索" style="width: 300px" />
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','css/syllabus','css/moduel', 'css/user', 'css/font-awesome.css', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
@ -79,61 +79,72 @@
<div class="cl"></div>
<div class="homepageContent">
<div class="homepageLeft mt10" id="LSide">
<div class="user_leftinfo mb10">
<div class="home-user-new-img mb10">
<% if User.current.logged? && User.current == @user %>
<div class="pr" style="width: 80px; margin:0 auto;">
<%= link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'),
my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true %>
<div class="homepageEditProfile undis">
<%=link_to '', my_clear_user_avatar_temp_path, :class => 'homepageEditProfileIcon', :remote => true, :title => '点击编辑Logo' %>
</div>
</div>
<%= link_to image_tag(url_to_avatar(@user),width:"238", height: "200", :id => 'nh_source_tx'),
my_clear_user_avatar_temp_path, :remote => true %>
<% else %>
<a href="javascript:void(0)" class="user_leftinfo_img" style="cursor: default">
<%=image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_source_tx') %>
</a>
<% end %>
<% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
<span class="<%= @user.user_extensions.gender == 1 ? 'user_leftinfo_female' : 'user_leftinfo_male' %> "></span>
<%=image_tag(url_to_avatar(@user),width:"238", height: "200", :id=>'nh_source_tx') %>
<% end %>
<div class="user_info_inner">
<div class=" user_leftinfo_namebox" >
<%= link_to @user.show_name, user_path(@user), :class => "user_leftinfo_name" %>
<% if @user.user_extensions && @user.user_extensions.identity %>
<span class="user_cirbtn_yellow" ><%= get_user_roll @user %></span>
<% end%>
</div>
<div>
<div class="user_info_intro" style="word-wrap:break-word; text-align:justify;">
<div id="user_brief_introduction_show">
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
</div>
</div>
<!-- <textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%#= edit_brief_introduction_user_path(@user.id)%>');"><%#= @user.user_extensions.brief_introduction %></textarea>-->
</div>
<ul class="user_atten clear">
<li>
<a href="<%= user_blogs_path(:user_id => @user) %>">
<strong style="font-weight:normal;">博客</strong><br />
<span class="sy_cgrey"><%= @user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %></span>
</a>
</li>
<li>
<a href="<%= user_watchlist_user_path(@user) %>">
<strong style="font-weight:normal;">关注</strong><br />
<span class="sy_cgrey" id="user_watchers_number"><%= User.watched_by(@user).count %></span>
</a>
</li>
<li>
<a href="<%= user_fanslist_user_path(@user) %>">
<strong style="font-weight:normal;">粉丝</strong><br />
<span id="user_fans_number" class="sy_cgrey"><%= @user.watcher_users.count %></span>
</a>
</li>
</ul>
</div>
<div id="watch_user_btn_div">
<%= render :partial => 'layouts/user_watch_btn', :locals => {:target => @user} %>
</div>
<div class="home-user-newinfo-box mb10">
<h3 class="mb5 fontGrey3 break_full_word">
<%= link_to @user.show_name, user_path(@user), :class => "mb5 fontGrey3" %>
<% if @user.user_extensions && @user.user_extensions.identity %>
<%= get_user_roll @user %>
<% end%>
<% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
<span class="<%= @user.user_extensions.gender == 1 ? 'user_leftinfo_female fr' : 'user_leftinfo_male fr' %> "></span>
<% end %>
</h3>
<h4 class="fontGrey2 mb5"><%= @user.login %></h4>
<p class="fontGrey2">
<% if !@user.user_extensions.school_id.blank? %>
<%= @user.user_extensions.school.name %>
<% end %>
</p>
<span class="border-line mt10 mb10"></span>
<ul class="home-user-newinfo-ul ">
<li class="clear">
<a href="<%= user_blogs_path(:user_id => @user) %>" class="fl linkGrey7 f14">博客</a>
<span class="issues_nav_tag fr"><%= @user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %></span>
</li>
<li class="clear">
<a href="<%= user_watchlist_user_path(@user) %>" class="fl linkGrey7 f14" >关注</a>
<span class="issues_nav_tag fr" id="user_watchers_number"><%= User.watched_by(@user).count %></span>
</li>
<li class="clear">
<a href="<%= user_fanslist_user_path(@user) %>" class="fl linkGrey7 f14">粉丝</a>
<span class="issues_nav_tag fr" id="user_fans_number"><%= @user.watcher_users.count %></span>
</li>
</ul>
<div class="clear">
<% if User.current.logged?%>
<% if User.current == @user %>
<%= link_to '个人主页', homepage_user_path(@user), :class => "home-big-btn-grey", :target => '_blank' %>
<% else %>
<% if(@user.watched_by?(User.current)) %>
<%= link_to "取消关注",
watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id),
:class => "home-btn-grey fl mr12",
:method => "delete",
:remote => "true",
:title => "取消关注" %>
<% else %>
<%= link_to "添加关注",
watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id),
:class => "home-btn-grey fl mr12",
:method => "post",
:remote => "true",
:title => "添加关注" %>
<% end %>
<% if @user.base_homepage.nil? %>
<a href="javascript:void(0)" class ="home-btn-grey fl" title="该用户暂未设置主页">TA的主页</a>
<% else %>
<%= link_to "TA的主页", homepage_user_path(@user.login), :class => 'home-btn-grey fl', :target => '_blank' %>
<% end %>
<% end %>
<% end %>
</div>
</div>
<% if is_current_user %>
@ -217,19 +228,19 @@
<ul>
<% if hidden_unproject_infos && user_course_count > 0 %>
<li class="home-user-leftnav-li icons-class clear">
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140'>#{user_course_count}</span>".html_safe : "课程",
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_course_count}</span>".html_safe : "课程",
user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %>
</li>
<% end %>
<% if user_project_count > 0 %>
<li class="home-user-leftnav-li icons-project clear">
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag ml140'>#{user_project_count}</span>".html_safe : "项目",
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag ml140' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_project_count}</span>".html_safe : "项目",
user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %>
</li>
<% end %>
<% if hidden_unproject_infos && user_contest_count > 0 %>
<li class="home-user-leftnav-li icons-project clear">
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag ml140'>#{user_contest_count}</span>".html_safe : "竞赛",
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag ml140' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_contest_count}</span>".html_safe : "竞赛",
user_contest_community_path(@user), :id => 'user_contest_list', :class => "fl", :target => "_blank" %>
</li>
<% end %>
@ -246,7 +257,15 @@
<%# 更新访问数,刷新的时候更新访问次数 %>
<% update_visiti_count @user %>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> 自2016年5月</div>
<div class="">
<ul class="home-user-footerinfo">
<li><i class="icon-map-marker mr5 ml10 f14"></i>
<span><%= @user.user_extensions.location %><% unless @user.user_extensions.location_city.blank? %>-<%= @user.user_extensions.location_city %><% end %></span>
</li>
<li><i class="icon-time mr5 ml10 f14"></i><span><%= @user.created_on.strftime('%Y-%m-%d') %>开始使用</span></li>
<li style="color:#b3b3b3"><i class="icon-eye-open mr5 ml10 f14"></i><span><%= @user.visits.to_i %>次访问自2016年5月</span></li>
</ul>
</div>
</div>
<div class="homepageRight">
<%= yield %>

View File

@ -1,6 +1,6 @@
<% if @user %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_source_tx',:style=>"width:78px;height:78px;overflow:hidden",:alt=>"头像") %>');
$("#nh_user_logo").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_logo',:width =>"40",:height => "40",:alt=>"头像") %>');
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_source_tx',:style=>"width:238px;height:200px;overflow:hidden",:alt=>"头像") %>');
$("#nh_user_logo").replaceWith('<%= image_tag(url_to_avatar(@user), :id=>'nh_user_logo',:width =>"40",:height => "40", :style=>"border-radius: 50px;", :alt=>"头像") %>');
<% elsif @course %>
$("#nh_source_tx").replaceWith('<%= image_tag(url_to_avatar(@course), :id=>'nh_source_tx',:style=>"width:96px;height:96px;overflow:hidden",:alt=>"班级logo") %>');
if($("#course_avatar_form").length > 0) {

View File

@ -1,3 +1,4 @@
<% project = Project.find(project_id) %>
<% unless activity.author.nil? %>
<div class="container-big mt10" id="user_activity_<%= user_activity_id%>">
<div class="pr">
@ -11,7 +12,7 @@
TO
<%= link_to activity.project.name.to_s+" | 实训任务", project_training_tasks_path(activity.project), :class => "newsBlue ml15"%>
</div>
<% if !@project.is_child_training_project? && User.current.logged? && (is_project_manager?(User.current.id, project_id) || activity.author_id == User.current.id) %>
<% if !project.is_child_training_project? && User.current.logged? && (is_project_manager?(User.current.id, project_id) || activity.author_id == User.current.id) %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
@ -46,7 +47,7 @@
<div class="mb10" style="font-weight:normal;">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
</div>
<% if @project.is_child_training_project? %>
<% if project.is_child_training_project? %>
<div id="training_project_task_status_<%= activity.id %>">
<%= render :partial => "training_tasks/action_status", :locals => {:activity => activity} %>
</div>

View File

@ -42,14 +42,16 @@
<%= render :partial => 'projects/act_issues', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
<% when "TrainingTask" %>
<% if User.current.admin? || is_project_manager?(User.current.id, @project.id) || is_project_manager?(User.current, @project.try(:forked_from_project_id)) %>
<%= render :partial => 'projects/act_training_tasks', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
<div id="project_show_training_task_<%= @project.id %>">
<%= render :partial => 'projects/act_training_tasks', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
</div>
<% end %>
<!--message-->
<% when "Message" %>
<%= render :partial => 'projects/act_messages', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %>
<!--Attachment -->
<% when "Attachment" %>
<%= render :partial => 'projects/project_attachment', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %>
<%#= render :partial => 'projects/project_attachment', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id } %>
<% when "Commit" %>
<%= render :partial => 'projects/project_commit', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :identifier => get_rep_identifier_by_project(@project) } %>
<% end %>

View File

@ -3,7 +3,7 @@
<div id="project_invite_code"><%= render :partial => 'projects/invite_code' %></div>
<div id="project_description_code" style="padding: 0 15px 10px 15px;font-size: 14px;">
<% if @project.description.blank? %>
<p style="padding-top:5px"><%= @project.name %></p>
<p style="padding-top:5px;font-size:20px;font-weight:bold;"><%= @project.name %></p>
<% else %>
<p style="padding-top:5px"><%= h @project.description.html_safe %></p>
<% end %>
@ -34,8 +34,9 @@
</ul>
<div class="cl"></div>
</div>
<%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %>
<div id="project_act_show_<%= @project.id %>">
<%= render :partial => "project_activities", :locals => {:forge_acts => @events_pages, :page => 0, :type => @type} %>
</div>
</div>
<script>
autoUrl('project_description_code');

View File

@ -1,2 +1,4 @@
$("#training_project_task_status_<%= @training_task.id %>").html('<%= escape_javascript( render :partial => 'training_tasks/action_status', :locals => {:activity => @training_task}) %>');
$("#training_task_details").html('<%= escape_javascript( render :partial => 'training_tasks/training_task_details', :locals => {:activity => @training_task, :project_id => @project.id}) %>');
//$("#training_project_task_status_<%#= @training_task.id %>").html('<%#= escape_javascript( render :partial => 'training_tasks/action_status', :locals => {:activity => @training_task}) %>');
//$("#training_task_details").html('<%#= escape_javascript( render :partial => 'training_tasks/training_task_details', :locals => {:activity => @training_task, :project_id => @project.id}) %>');
//$("#project_show_training_task_<%#= @training_task.project_id %>").html('<%#= escape_javascript( render :partial => 'projects/act_training_tasks', :locals => {:activity => @training_task, :user_activity_id => @training_task.id, :project_id => @training_task.project_id}) %>');
$("#project_act_show_<%= @project.id %>").html('<%= escape_javascript( render :partial => 'projects/project_activities', :locals => {:forge_acts => @events_pages, :page => 0, :type => @type}) %>');

View File

@ -1 +1 @@
$("#task_action_status_<%= @training_task.id %>").html('<%= escape_javascript( render :partial => 'training_tasks/action_status', :locals => {:activity => @training_task}) %>');
alert("test");

View File

@ -5,55 +5,49 @@
<ul class="new_roadmap_nav fl" >
<li class="new_roadmap_nav_hover" id="new_roadmap_nav_1" onclick="HoverLi(1);">
<%= link_to "待处理<span class='new_roadmap_nav_taghover ml5' id='new_roadmap_num_1'>#{@requests_opened_count}</span>".html_safe,
project_pull_requests_path(:type => "1"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_1" %>
project_pull_requests_path(:type => "1"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1" %>
</li>
<li id="new_roadmap_nav_2" onclick="HoverLi(2);">
<%= link_to "已处理<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_2'>#{@requests_merged_count}</span>".html_safe,
project_pull_requests_path(:type => "2"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_2" %>
project_pull_requests_path(:type => "2"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_2" %>
</li>
<li id="new_roadmap_nav_3" onclick="HoverLi(3);">
<%= link_to "已关闭<span class='new_roadmap_nav_tagnomal ml5' id='new_roadmap_num_3'>#{@requests_closed_count}</span>".html_safe,
project_pull_requests_path(:type => "3"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_1", :id => "new_roadmap_type_3" %>
project_pull_requests_path(:type => "3"), :remote => true, :class => "new_roadmap_type_nomal", :id => "new_roadmap_type_3" %>
</li>
</ul>
<% if allow_pull_request(@project) && User.current.member_of?(@project) %>
<%= link_to "创建Pull Request", new_project_pull_request_path, :class => "btn btn-green fr mr15 mt10" %>
<% end %>
</div>
<!--<div class="pullreques_category clear ">-->
<!--<a href="javascript:void(0);" class="sortdownbtn mt10 fr mr15"></a>-->
<!--<a href="javascript:void(0);" class="sy_cgrey fr">更新时间</a>-->
<!--<a href="javascript:void(0);" class="sortupbtn mt10 fr"></a>-->
<!--<a href="javascript:void(0);" class="sy_cgrey fr">创建时间 </a>-->
<!--</div>-->
<div id="pull_requests_list">
<div id="pull_requests_list" style="width:100%">
<%= render "pull_requests/pull_requests_list" %>
</div>
</div>
<script>
// $("#mergeBanner").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
// $("#mergeBanner").parent().before("<div class='homepageRightBanner mb10'><span class='f16 fontGrey3'>Pull Request</span></div>");
function g(o){
return document.getElementById(o);
}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=3;i++){
g('new_roadmap_nav_'+i).className='new_roadmap_nav_nomal';
g('new_roadmap_type_'+i).className='new_roadmap_type_nomal';
g('new_roadmap_num_'+i).className='new_roadmap_nav_tagnomal';
g('pull_requests_list').className='undis';
}
g('new_roadmap_nav_'+n).className='new_roadmap_nav_hover';
g('new_roadmap_type_'+n).className='new_roadmap_type_hover';
g('new_roadmap_num_'+n).className='new_roadmap_nav_taghover';
g('pull_requests_list').className='dis';
}
</script>
<% else %>
<div class="mb10">
<%= render :partial => "projects/no_data" %>
<%= render :partial => "projects/no_data" %>
</div>
<% end %>
<script>
// $("#mergeBanner").parent().css({"width":"730px","background-color":"#fff","padding":"10px","margin-left":"10px","margin-bottom":"10px"});
// $("#mergeBanner").parent().before("<div class='homepageRightBanner mb10'><span class='f16 fontGrey3'>Pull Request</span></div>");
function g(o){
return document.getElementById(o);
}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=1;i<=3;i++){
g('new_roadmap_nav_'+i).className='new_roadmap_nav_nomal';
g('new_roadmap_type_'+i).className='new_roadmap_type_nomal';
g('new_roadmap_num_'+i).className='new_roadmap_nav_tagnomal';
g('pull_requests_list').className='undis';
}
g('new_roadmap_nav_'+n).className='new_roadmap_nav_hover';
g('new_roadmap_type_'+n).className='new_roadmap_type_hover';
g('new_roadmap_num_'+n).className='new_roadmap_nav_taghover';
g('pull_requests_list').className='dis';
}
</script>

View File

@ -6,11 +6,19 @@
<span class="task-display-span alert-blue mt10">当前任务正在后台测评中,稍后将显示您的任务完成情况......</span>
<% else %>
<% if User.current.member_of?(@project) && @project.is_child_training_project? %>
<%= link_to "提交评测", task_execute_project_path(@project, :training_task_id => activity.id), :class => "task-display-span bBlue mt10", :remote => true %>
<div id="training_tasl_commit">
<%= link_to "提交评测", task_execute_project_path(@project, :training_task_id => activity.id), :class => "task-display-span bBlue mt10", :onclick => "training_task_submmit();", :remote => true %>
</div>
<% end %>
<% end %>
</div>
<script>
function training_task_submmit(){
$("#training_tasl_commit").html("<span class='task-display-span alert-blue mt10'>当前任务正在后台测评中,稍后将显示您的任务完成情况......</span>")
}
</script>

View File

@ -32,9 +32,7 @@
<%= render :partial => 'task_attachments', :locals => {:training_task => @training_task} %>
</div>
<div class="cl"></div>
<div id="training_project_task_status_<%= @training_task.id %>">
<%= render :partial => "training_tasks/action_status", :locals => {:activity => @training_task} %>
</div>
</div>
<script type="text/javascript">

View File

@ -0,0 +1,2 @@
var htmlvalue = "<%= j (render :partial => 'account/change_user_email', :locals => {:user => @user}) %>";
pop_box_new(htmlvalue,520,316);

View File

@ -216,7 +216,7 @@
$(document).ready(function(){
if($.browser.webkit){
$("#issues_filter_por").css("padding-left","5px");
$("#issue_filter_status").css("padding-left","10px");
$("#issue_filter_status").css("padding-left","15px");
}
});
</script>

View File

@ -52,7 +52,7 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">班级</span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description %></li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : (h item.description.html_safe) %></li>
<li class="f12 fontGrey2">
<% user = User.find(item.tea_id)%>
<span class="mr30">教师:<%= user.realname %></span>
@ -93,7 +93,7 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">项目</span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? item.highlight.description[0].html_safe : item.description%></li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:description) ? (h item.highlight.description[0].html_safe) : (h item.description.html_safe) %></li>
<li class="f12 fontGrey2"><span class="mr30">管理人员:<%= item.user_id ? User.find(item.user_id).login : '无' %></span><span class="mr30">更新时间:<%= date_format_local( Project.find(item.id).updated_on) %></span></li>
</ul>
</li>
@ -109,7 +109,7 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">帖子</span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:content) ? item.highlight.content[0].html_safe : item.content.html_safe%></li>
<li class="fontGrey3 mb5"><%= item.try(:highlight).try(:content) ? item.highlight.content[0].html_safe : item.content.html_safe %></li>
<li class="f12 fontGrey2"><span class="mr30">发帖人:<%= item.author_id ? User.find(item.author_id).login : '无' %></span><span class="mr30">更新时间:<%= format_date( item.updated_at) %></span></li>
</ul>
</li>

View File

@ -11,7 +11,7 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">班级</span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= course.try(:highlight).try(:description) ? course.highlight.description[0].html_safe : (course.description.present? ? course.description : '暂时没有该班级描述') %></li>
<li class="fontGrey3 mb5"><%= course.try(:highlight).try(:description) ? (h course.highlight.description[0].html_safe) : (course.description.present? ? (h course.description.html_safe) : '暂时没有该班级描述') %></li>
<li class="f12 fontGrey2">
<% user = User.find(course.tea_id)%>
<span class="mr30">教师:<%= user.realname %></span>

View File

@ -11,7 +11,7 @@
<div class="mt5 fl"><%= image_tag("search_icon_03.png", :width=>"8", :height=>"16" ,:class=>"fl") %><span class="searchTag">项目</span></div>
<div class="cl"></div>
</li>
<li class="fontGrey3 mb5"><%= project.try(:highlight).try(:description) ? project.highlight.description[0].html_safe : project.description%></li>
<li class="fontGrey3 mb5"><%= project.try(:highlight).try(:description) ? (h project.highlight.description[0].html_safe) : (h project.description.html_safe) %></li>
<li class="f12 fontGrey2"><span class="mr30">管理人员:<%= project.user_id ? User.find(project.user_id).login : '无' %></span><span class="mr30">更新时间:<%= date_format_local( Project.find(project.id).updated_on) %></span></li>
</ul>
</li>

View File

@ -709,6 +709,7 @@ RedmineApp::Application.routes.draw do
get 'user_import_resource'
match 'watch_projects', :to => 'users#watch_projects', :via => :get
get 'update_message_viewed'
get 'change_user_email'
#
# added by bai
match 'show_score', :to => 'users#show_score', :via => :get

View File

@ -1,43 +1,43 @@
class HomeworkBankMigration < ActiveRecord::Migration
def up
add_column :homework_commons, :homework_bank_id, :integer
add_column :homework_commons, :is_update, :boolean, :default => false
count =Course.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Course.page(i).per(30).each do |course|
if course.is_delete == 0
course.homework_commons.each do |homework|
unless homework.user.homework_banks.select("name").to_s.include?(homework.name)
homework_bank = HomeworkBank.create(:user_id => homework.user_id, :name => homework.name, :description => homework.description, :homework_type => homework.homework_type,
:quotes => 1, :is_public => course.is_public, :applicable_syllabus => course.syllabus.title, :homework_common_id => homework.id, :created_at => homework.created_at)
if homework.homework_type == 2 && homework.homework_detail_programing
homework_bank.update_attributes(:language => homework.homework_detail_programing.language, :standard_code => homework.homework_detail_programing.standard_code)
homework.homework_tests.each do |test|
homework_bank.homework_bank_tests << HomeworkBankTest.create(
input: test.input,
output: test.output,
test_type: true
)
end
homework.homework_samples.each do |test|
homework_bank.homework_bank_tests << HomeworkBankTest.create(
input: test.input,
output: test.output,
test_type: false
)
end
elsif homework.homework_type == 3 && homework.homework_detail_group
homework_bank.update_attributes(:min_num => homework.homework_detail_group.min_num, :max_num => homework.homework_detail_group.max_num, :base_on_project => homework.homework_detail_group.base_on_project)
end
homework.update_column('homework_bank_id', homework_bank.id)
end
end
end
end
end
end
# add_column :homework_commons, :homework_bank_id, :integer
# add_column :homework_commons, :is_update, :boolean, :default => false
#
# count =Course.all.count / 30 + 2
# transaction do
# for i in 1 ... count do i
# Course.page(i).per(30).each do |course|
# if course.is_delete == 0
# course.homework_commons.each do |homework|
# unless homework.user.homework_banks.select("name").to_s.include?(homework.name)
# homework_bank = HomeworkBank.create(:user_id => homework.user_id, :name => homework.name, :description => homework.description, :homework_type => homework.homework_type,
# :quotes => 1, :is_public => course.is_public, :applicable_syllabus => course.syllabus.title, :homework_common_id => homework.id, :created_at => homework.created_at)
# if homework.homework_type == 2 && homework.homework_detail_programing
# homework_bank.update_attributes(:language => homework.homework_detail_programing.language, :standard_code => homework.homework_detail_programing.standard_code)
# homework.homework_tests.each do |test|
# homework_bank.homework_bank_tests << HomeworkBankTest.create(
# input: test.input,
# output: test.output,
# test_type: true
# )
# end
# homework.homework_samples.each do |test|
# homework_bank.homework_bank_tests << HomeworkBankTest.create(
# input: test.input,
# output: test.output,
# test_type: false
# )
# end
# elsif homework.homework_type == 3 && homework.homework_detail_group
# homework_bank.update_attributes(:min_num => homework.homework_detail_group.min_num, :max_num => homework.homework_detail_group.max_num, :base_on_project => homework.homework_detail_group.base_on_project)
# end
# homework.update_column('homework_bank_id', homework_bank.id)
# end
# end
# end
# end
# end
# end
end
def down

View File

@ -0,0 +1,5 @@
class AddResultToTrainingTask < ActiveRecord::Migration
def change
add_column :training_tasks, :result, :integer, :default => 0
end
end

View File

@ -4795,7 +4795,8 @@ function _bindFocusEvent() {
}
}).blur(function(e) {
if(self.isEmpty()) {
self.edit.html("<span id='hint' style='color:#999999;font-size:12px;'>" + self.placeholder + "</span>");
self.edit.html(self.placeholder);
// self.edit.html("<span id='hint' style='color:#999999;font-size:12px;'>" + self.placeholder + "</span>");
}
if (self.afterBlur) {
self.afterBlur.call(self, e);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -452,8 +452,8 @@ a.shadowbox_news_all{ display:block; width:305px; height:40px; line-height:40px;
.user_leftinfo{ width:238px;border:1px solid #e5e5e5; background:#fff url(/images/user/user_bg_info.jpg) 0 0 no-repeat; position:relative; }
a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;}
.user_leftinfo_img img{ width:74px; height:74px;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px; border:3px solid #dcdcdc; }
.user_leftinfo_female{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) 5px -378px no-repeat; position:absolute; top:80px; left:160px;}
.user_leftinfo_male{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) -25px -378px no-repeat; position:absolute; top:80px; left:160px;}
.user_leftinfo_female{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) 5px -378px no-repeat;}
.user_leftinfo_male{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) -25px -378px no-repeat;}
.user_leftinfo_namebox{ text-align:center; height:16px; line-height:16px; }
.user_leftinfo_name{ display: inline-block; max-width:160px; font-size:14px; font-weight:bold; overflow:hidden;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.user_leftinfo_namebox a{ color: #333;}

View File

@ -87,8 +87,8 @@ a:hover.pro_new_topbtn_left{background-image: linear-gradient(#ededed, #dddddd);
.user_leftdata_background{ width:238px;border:1px solid #e5e5e5; background:#fff url(/images/user/user_bg_info2.jpg) 0 0 no-repeat; position:relative; }
a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;}
.user_leftinfo_img img{ width:74px; height:74px;-webkit-border-radius:50px;-moz-border-radius:50px;-o-border-radius:50px;border-radius:50px; border:3px solid #dcdcdc; }
.user_leftinfo_female{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) 5px -378px no-repeat; position:absolute; top:80px; left:160px;}
.user_leftinfo_male{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) -25px -378px no-repeat; position:absolute; top:80px; left:160px;}
.user_leftinfo_female{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) 5px -378px no-repeat;}
.user_leftinfo_male{ display:block; width:20px; height:20px;background:url(/images/user/icons_user_leftnav.png) -25px -378px no-repeat;}
.user_leftinfo_namebox{ text-align:center; height:16px; line-height:16px; }
.user_leftinfo_name{ display: inline-block; max-width:160px; font-size:14px; font-weight:bold; overflow:hidden;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
.user_cirbtn_yellow{ color:#fff; background:#ffb400; padding:0 5px;-webkit-border-radius:10px;-moz-border-radius:10px;-o-border-radius:10px;border-radius:10px; line-height:16px; }
@ -179,3 +179,16 @@ a.user_navmorebox .user_icons_closeclass{display:block;position: absolute;top:5p
.homepageTabPollTitle { max-width:490px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}
.homepageTabAvatar img{border: 3px solid #fff;-webkit-border-radius:30px;-moz-border-radius:30px;-o-border-radius:30px;border-radius:30px;}
.homepageTabAvatar img:hover{border: 3px solid #e6e6e6;}
/* 新版个人主页左侧信息170214byLB */
.home-user-new-img{ width: 238px; height: 200px; border-radius:5px;border: 1px solid #ddd;}
.home-user-new-img img{border-radius:5px;}
.home-user-newinfo-box{ width: 218px; padding:10px; border: 1px solid #e5e5e5; background:#fff;}
.issues_nav_tag{ background-color:#eaeaea; padding:2px 8px;border-radius:15px; font-size:12px; display: inline-block; color: #666;}
.home-user-newinfo-ul li{ height: 40px;}
.border-line{ width:100%; display: block; border-top: 1px solid #e5e5e5;}
a.home-btn-grey{ display:inline-block; width:100px; height: 28px; line-height:28px; font-size: 14px; color: #666; text-align: center; background:#fff; border:1px solid #e5e5e5; border-radius:5px; }
a:hover.home-btn-grey{ background:#f0f0f0;}
a.home-big-btn-grey{ display:inline-block; width:212px; height: 28px; line-height:28px; font-size: 14px; color: #666; text-align: center; background:#fff; border:1px solid #e5e5e5; border-radius:5px; }
a:hover.home-big-btn-grey{ background:#f0f0f0;}
.home-user-footerinfo li{ height: 24px; color: #888; }