Conflicts:
	app/controllers/boards_controller.rb
	db/schema.rb
This commit is contained in:
cxt 2015-10-15 16:22:49 +08:00
commit caa278d9f5
26 changed files with 357 additions and 181 deletions

View File

@ -28,6 +28,7 @@ gem 'ruby-ole'
gem 'rails_kindeditor',path:'lib/rails_kindeditor'
#gem "rmagick", ">= 2.0.0"
gem 'binding_of_caller'
gem 'chinese_pinyin'
group :development do
gem 'grape-swagger'

View File

@ -148,10 +148,7 @@ class BoardsController < ApplicationController
@message = Message.new(:board => @board)
#modify by nwb
respond_to do |format|
format.js
format.html {
if @project
render :action => 'show', :layout => 'base_projects'
elsif @course
@params=params
@ -160,10 +157,6 @@ class BoardsController < ApplicationController
}
format.atom {
@messages = @board.messages.
reorder('created_on DESC').
includes(:author, :board).
limit(Setting.feeds_limit.to_i).
all
if @project
render_feed(@messages, :title => "#{@project}: #{@board}")
elsif @course

View File

@ -126,11 +126,13 @@ class MyController < ApplicationController
end
@se = @user.extensions
if params[:occupation].to_i.to_s == params[:occupation]
@se.school_id = params[:occupation]
else
@se.occupation = params[:occupation]
end
# if params[:occupation].to_i.to_s == params[:occupation]
# @se.school_id = params[:occupation]
# else
# @se.occupation = params[:occupation]
# end
@se.school_id = params[:occupation]
@se.gender = params[:gender]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]

View File

@ -46,16 +46,21 @@ class RepositoriesController < ApplicationController
rescue_from Redmine::Scm::Adapters::CommandFailed, :with => :show_error_command_failed
def new
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@repository.is_default = @project.repository.nil?
@repository.project = @project
@course_tag = params[:course]
if @course_tag == 1
render :layout => 'base_courses'
if @project.repositories.count == 0
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm)
@repository.is_default = @project.repository.nil?
@repository.project = @project
@course_tag = params[:course]
if @course_tag == 1
render :layout => 'base_courses'
else
render :layout => 'base_projects'
end
else
render :layout => 'base_projects'
render_403
end
end

View File

@ -105,4 +105,31 @@ class SchoolController < ApplicationController
render :text => options
end
#根据学校名字或者拼音来查询
def on_search
condition = "#{params[:name].strip}".gsub(" ","")
#将条件截断为汉字和拼音(全汉字 或者 全拼音 或者 汉字和拼音),
#获取拼音的第一次出现的位置
chinese = []
pinyin = []
condition.scan(/./).each_with_index do |char,index|
if char =~ /[a-zA-Z0-9]/
pinyin << char
else
chinese << char
end
end
if(condition == '')
@school = School.all
else
@school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").all
end
result = []
# @school.each do |sc|
# result << {:value=>sc.name,:data=>sc.id}
# end
render :json => @school.to_json
end
end

View File

@ -2349,22 +2349,25 @@ module ApplicationHelper
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
def user_for_homework_common homework,is_teacher
if is_teacher #老师显示作品数量
link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
if work.nil?
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品已交", "javascript:void(0)", :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
if User.current.member_of_course?(homework.course)
if is_teacher #老师显示作品数量
link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
if work.nil?
link_to "提交作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue'
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status != 1 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_path(:homework => homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_type == 2 #编程作业不能修改作品
link_to "修改作品", new_student_work_path(:homework => homework.id),:class => 'c_blue'
else
link_to "修改作品", edit_student_work_path(work.id),:class => 'c_blue'
end
end
end
end
end
def student_anonymous_comment homework

View File

@ -91,8 +91,10 @@ class Project < ActiveRecord::Base
has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags'
# 动态级联删除
has_many :forge_activities, :class_name => 'ForgeActivity', :dependent => :destroy
# 关联虚拟表
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
belongs_to :organization

View File

@ -1,5 +1,5 @@
class School < ActiveRecord::Base
attr_accessible :name, :province
attr_accessible :name, :province,:pinyin
has_many :courses
def to_s

View File

@ -51,9 +51,9 @@
:data => {:confirm => l(:text_are_you_sure)},
:class => 'talk_edit fr',
:style => ' margin-right: 10px;') if topic.destroyable_by?(User.current) %>
<%# if topic.sticky? %>
<!--<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%#= l(:label_board_sticky)%></a>-->
<%# end %>
<% if topic.sticky? %>
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
<% end %>
<script>
//$(function(){if($("#contentmessage<%#=topic.id %>").height()>182){$("#project_show_<%#= topic.id%>").show();}});
//解决由于图片加载慢造成div高度不够 以至于展开按钮不显示的bug

View File

@ -11,10 +11,10 @@
ul,li{ list-style-type:none}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
a:hover{ }
a:hover{}
.alert_box {width:488px;height:550px;position:fixed;z-index:1002;left:50%;top:40%;margin:-215px 0 0 -300px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; padding:5px; overflow:auto; }
#popbox{width:488px;height:308px;}
#popbox{width:488px;height:368px;}
.alert .C{width:476px;height:296px;position:absolute;left:5px;top:5px; }
.C_top{ margin-top:20px; width:368px; height:100px; background:#e9e9e9; padding:0px 60px; }
.C_top h2{ color:#1c1d1d; font-size:24px; font-style:normal; font-weight:normal;}
@ -22,12 +22,15 @@
.C_form{ margin:20px 0 0 60px;}
.C_form ul li{ font-size:14px; color:#3f3a39; line-height:30px; }
.C_form ul li input{ margin-left:20px; border:0px; border:1px solid #e1e1e1; color:#898989; padding-left:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; padding: 0 !important; }
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:90px;}
.C_form ul li.mB5{ color:#898989; font-size:12px; padding-left:97px;}
.width190{ width:190px; height:26px; border-color:#e1e1e1;}
.C_form a{ font-size:12px; color:#15bccf; float:left; display:block; height:40px; width:200px; margin-top:25px;}
.C_form a:hover{ text-decoration:underline;}
.C_form a.btn{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#15bccf; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
.C_form a.btn:hover{ background:#ff821d;}
.C_form a.btn_join{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#269ac9; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
.C_form a.btn_join:hover{ background:#297fb8; text-decoration: none;}
.C_form a.btn_cancel{ display:block; width:100px; height:36px; padding-top:4px; text-align: center; background:#c1c1c1; color:#fff; font-size:14px; margin:20px 20px 0 95px;}
.C_form a.btn_cancel:hover{ background:#717171; text-decoration: none;}
.IDType {border:1px solid #e1e1e1; outline: none; width: 65px; height: 25px;}
</style>
<script type="text/javascript">
function submit_form(obj)
@ -59,7 +62,7 @@
<li>
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<span class="tips">课&nbsp;程&nbsp;ID</span>
<span class="tips" style="width: 72px; display: inline-block;">课&nbsp;程&nbsp;ID</span>
<input class=" width190" name="object_id" id="object_id" type="text" value="" >
<input type="text" style="display: none"/>
</li>
@ -68,11 +71,19 @@
<span class="tips">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</span>
<input class=" width190" type="password" name="course_password" id="course_password" value="" >
</li>
<li style="margin-top: 30px;">
<span style="margin-right: 20px;">身&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;份:</span>
<select class="IDType">
<option>教师</option>
<option>教辅</option>
<option>学生</option>
</select>
</li>
<li>
<a href="javascript:" class="btn" style="margin-left: 50px;" onclick="submit_form(this);">
<a href="javascript:" class="btn_join" style="margin-left: 50px;" onclick="submit_form(this);">
<%= l(:label_new_join) %>
</a>
<a href="javascript:" class="btn" style="margin-left: 20px;" onclick="hideModal(this);">
<a href="javascript:" class="btn_cancel" style="margin-left: 20px;" onclick="hideModal(this);">
<%= l(:button_cancel)%>
</a>
</li>

View File

@ -1,6 +1,6 @@
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'join_private_course') %>');
showModal('ajax-modal', '540px');
$('#ajax-modal').css('height','330px');
$('#ajax-modal').css('height','390px');
//$('#ajax-modal').siblings().remove();
$('#ajax-modal').siblings().hide();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;padding-left: 513px;'>" +

View File

@ -47,7 +47,7 @@
<%= form_tag({:controller => 'issues', :action => 'index', :project_id => @project},:remote=>'true', :method => :get,:id=>"issue_query_form", :class => 'query_form') do %>
<%= hidden_field_tag 'set_filter', '1' %>
<div class="problem_search" >
<input class="problem_search_input fl" id="v_subject" type="text" name="subject" value="<%= @subject ? @subject : ""%>" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<input class="problem_search_input fl" id="v_subject" type="text" name="subject" placeholder="请输入问题名称" onkeypress="EnterPress(event)" onkeydown="EnterPress()">
<a href="javascript:void(0)" class="problem_search_btn fl" onclick="remote_function();" >搜索</a>
<a href="javascript:void(0)" class="grey_btn fl ml10" onclick="nh_reset_form();" >清空</a>
</div><!--problem_search end-->

View File

@ -18,8 +18,8 @@
<li>登录名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>邮箱&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li>身份&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">姓&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">姓(First Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">名(Last Name)&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_2="true" style="display:none;">组织名&nbsp;:&nbsp;<span style="color:red;">*</span></li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">性别&nbsp;:&nbsp;</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">工作单位&nbsp;:&nbsp;</li>
@ -72,21 +72,25 @@
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
<% if User.current.user_extensions.nil? %>
<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;width:130px;" class="w70" type="text" value=<%= l(:field_occupation_click) %> readonly>
<input nhname="tag" autocomplete="off" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;width:130px;" class="w70" type="text" >
<input nhname="tag" nh_tag_3="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="" />
<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;width:130px;" class="w70" type="text" value=<%= l(:field_occupation_click) %> readonly>
<input nhname="tag" autocomplete="off" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;width:130px;" class="w70" type="text" >
<input nhname="tag" nh_tag_3="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.school.nil? %>
<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;width:130px;" class="w70" type="text" value=<%= l(:field_occupation_click) %> readonly>
<input nhname="tag" autocomplete="off" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;width:130px;" class="w70" type="text" >
<input nhname="tag" nh_tag_3="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" />
<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% else %>
<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;width:130px;" class="w70" type="text" value="<%= User.current.user_extensions.school.province %>" readonly/>
<input nhname="tag" autocomplete="off" nh_tag_0="true" nh_tag_1="true" id="province" name="province" style="display: none;width:130px;" class="w70" type="text" value="<%= User.current.user_extensions.school %>" />
<input nhname="tag" nh_tag_3="true" id="occupation" name="occupation" type="text" style="display: none;" class="w210" value="<%= User.current.user_extensions.school.id %>"/>
<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" value="<%= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>
<span id="hint" style="color: #7f7f7f;display: none" >平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" value="<%#= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>-->
<% end %>
</li>
@ -180,7 +184,9 @@
</div><!--users_setting end-->
</div>
<div id="search_school_result_list"
style="width: 135px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto!; !important;display: none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div>
<div id="WOpenWindow">
<a class="modal_close" href="#"></a>
<h2 style="margin: 10px"><%= l(:lable_school_list)%></h2>
@ -202,6 +208,7 @@
</ul>
</div>
</div>
<%= stylesheet_link_tag 'nyan' %>
@ -518,10 +525,77 @@
}
}
}
$(function(){
//学校
$("#province").attr("href", "#WOpenWindow")
$("#province").leanModal({top: 100, closeButton: ".modal_close"});
function changeValue(value,data){
//console.log(value+","+data)
$("input[name='province']").val(value);
$("input[name='occupation']").val(data);
$("#search_school_result_list").hide();
$("#hint").hide();
}
var lastSearchCondition = '';
$(function() {
//查询学校
$("input[name='province']").on('input', function (e) {
$("input[name='occupation']").val(''); //一旦有输入就清空id。
if($(e.target).val().trim() == lastSearchCondition){
return;
}
lastSearchCondition = $(e.target).val().trim();
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value,
type: 'post',
success: function (data) {
if(data.lengh != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < data.length; i++) {
link = '<a onclick="window.changeValue(\'' + data[i].school.name + '\',\'' + data[i].school.id + '\')" href="javascript:void(0)">' + data[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left', $(e.target).offset().left);
$("#search_school_result_list").css('top', $(e.target).offset().top + 28);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
if($(e.target).val().trim() != '') {
$("#hint").html('平台找到了' + data.length + '个包含"' + e.target.value + '"的高校');
$("#hint").show();
}else{
$("#hint").hide();
}
}else{
$("#hint").html('平台没有找到包含"'+e.target.value+'"的高校,创建该高校。');
$("#hint").show();
}
}
});
});
$(document.body).click(function(e){
if($(e.target).attr("id") != 'search_school_result_list')
{
$("#search_school_result_list").hide();
$("#hint").hide();
}
})
$("input[name='province']").on('focus', function (e) {
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value,
type: 'post',
success: function (data) {
var i = 0;
$("#search_school_result_list").html('');
for ( ;i<data.length;i++){
link = '<a onclick="window.changeValue(\''+data[i].school.name+'\',\''+data[i].school.id+'\')" href="javascript:void(0)">' +data[i].school.name+'</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left',$(e.target).offset().left);
$("#search_school_result_list").css('top',$(e.target).offset().top + 28);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
}
});
});
// $("#province").leanModal({top: 100, closeButton: ".modal_close"});
//地区
var province = "<%= "#{province}" %>"
@ -544,6 +618,9 @@
$("#users_tb_2").click();
<% end %>
$('#my_account_form_link').click(function(){
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
return;
}
$('#my_account_form_btn').click();
});
$('#my_password_form_link').click(function(){

View File

@ -8,93 +8,98 @@
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %><!--Added by tanxianbo For formatting project's path-->
<% if @project.repositories.any? %>
<table class="pro_table">
<tbody>
<tr class="pro_table_tit">
<td class=" w150"><%= l(:field_identifier) %></td>
<td class="w150"> <%= l(:field_repository_is_default) %></td>
<td class="w150"><%= l(:label_scm) %> </td>
<td class="w150" ><%= l(:label_repository_path) %> </td>
<td class="w150"> </td>
<td class="w150"> </td>
</tr>
<% @project.repositories.sort.each do |repository| %>
<tr class="<%= cycle 'pro_table_on', '' %>">
<td><a href="javascript:viod(0)" title="<%= repository.identifier %>">
<%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %></a></td>
<td> <%= checked_image repository.is_default? %></td>
<td><%=h repository.scm_name %></td>
<%if repository.scm_name=="Git"%>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %>
<table class="pro_table">
<tbody>
<tr class="pro_table_tit">
<td class=" w150"><%= l(:field_identifier) %></td>
<td class="w150"> <%= l(:field_repository_is_default) %></td>
<td class="w150"><%= l(:label_scm) %> </td>
<td class="w150" ><%= l(:label_repository_path) %> </td>
<td class="w150"> </td>
<td class="w150"> </td>
</tr>
<% @project.repositories.sort.each do |repository| %>
<tr class="<%= cycle 'pro_table_on', '' %>">
<td><a href="javascript:viod(0)" title="<%= repository.identifier %>">
<%= link_to truncate(repository.identifier), ({:controller => 'repositories', :action => 'show', :id => @project, :repository_id => repository.identifier_param} if repository.identifier.present?) %></a></td>
<td> <%= checked_image repository.is_default? %></td>
<td><%=h repository.scm_name %></td>
<%if repository.scm_name=="Git"%>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" title="http://<%= repository.login.to_s %>_<%= repository.identifier.to_s%>@<%= ip %>
<%=h repository.url.slice(project_path_cut, repository.url.length) %>"> <%=truncate( 'http://' << repository.login.to_s << '_'<< repository.identifier.to_s << '@'<< ip.to_s << h( repository.url.slice(project_path_cut, repository.url.length)),:length=>20)%></td><!--Modified by tanxianbo-->
<%else %>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
<% end %>
<td><a href="javascript:viod(0)" class="c_blue" >
<% if repository.scm_name=="Git"%>
<%if User.current.allowed_to?(:manage_repository, @project) %>
<%= link_to(l(:label_user_plural), committers_repository_path(repository)) %>
<% end %>
<% end %>
</a></td>
<td>
<% if repository.login.to_s==User.current.login.to_s %>
<%= delete_new_link repository_path(repository) %>
<% end %></td>
</tr>
<% end %>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>
</tbody>
</table>
<a href="javascript:viod(0)" class="pic_add fl mr5" onclick="pro_st_show_ku();"></a>
<a href="javascript:viod(0)" class="c_blue fl" onclick="pro_st_show_ku();">
<% course_tag = @project.project_type %>
<% if User.current.allowed_to?(:manage_repository, @project) %>
<!--newrepo_project_repository_path(@project, :course => course_tag) -->
<%= link_to l(:label_repository_new_repos),"#" , :onclick=>"pro_st_show_ku();", :class => 'c_blue fl' %></p>
<% end %>
</a>
<div class="cl"></div>
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post",:autocomplete=>'off'} do |f| %>
<div id="pro_st_edit_ku" class="pro_st_edit_ku">
<ul>
<li >
<label class="label02"><%=l(:label_scm)%></label>
<%= select_tag('repository_scm',
options_for_select(["Git"],@repository.class.name.demodulize),
:data => {:remote => true, :method => 'get'})%>
<% if @repository && ! @repository.class.scm_available %>
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
<% end %>
</li>
<% unless judge_main_repository(@project) %>
<li>
<label class="label02"><%=l(:field_repository_is_default)%></label>
<%= f.check_box :is_default, :label => "", :no_label => true %></p>
</li>
<% end %>
<li >
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%></label>
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
<% unless @repository.identifier_frozen? %>
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
<%else %>
<td style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" ><%=h truncate(repository.url,:length=>10) %></td>
<% end %>
<td><a href="javascript:viod(0)" class="c_blue" >
<% if repository.scm_name=="Git"%>
<%if User.current.allowed_to?(:manage_repository, @project) %>
<%= link_to(l(:label_user_plural), committers_repository_path(repository)) %>
<% end %>
<% end %>
</a></td>
<td>
<% if repository.login.to_s==User.current.login.to_s %>
<%= delete_new_link repository_path(repository) %>
<% end %></td>
</tr>
<% end %>
</li>
<li >
<label class="label02"><span class="c_red">*</span><%=l(:label_password)%></label>
<%= f.password_field :upassword, :label=> "", :no_label => true%>
<span class="c_grey"><%= l(:label_upassword_info)%></span>
</li>
<div class="cl"></div>
</ul>
<a href="#" onclick="$('#repository-form').submit();" class="blue_btn fl ml110"><%=l(:button_save)%></a>
<a href="<%= settings_project_path(@project, :tab => 'repositories')%>" class="grey_btn fl ml10"><%=l(:button_cancel)%></a>
</div><!--pro_st_edit_issues end-->
</tbody>
</table>
<% else %>
<p class="nodata"><%= l(:label_repository_no_data) %></p>
<% end %>
<%# 新建版本库 %>
<% if @project.repositories.count == 0 %>
<a href="javascript:viod(0)" class="pic_add fl mr5" onclick="pro_st_show_ku();"></a>
<a href="javascript:viod(0)" class="c_blue fl" onclick="pro_st_show_ku();">
<% course_tag = @project.project_type %>
<% if User.current.allowed_to?(:manage_repository, @project) %>
<!--newrepo_project_repository_path(@project, :course => course_tag) -->
<%= link_to l(:label_repository_new_repos),"#" , :onclick=>"pro_st_show_ku();", :class => 'c_blue fl' %></p>
<% end %>
</a>
<div class="cl"></div>
<%= labelled_form_for :repository, @repository, :url =>project_repositories_path(@project),:html => {:id => 'repository-form',:method=>"post",:autocomplete=>'off'} do |f| %>
<div id="pro_st_edit_ku" class="pro_st_edit_ku">
<ul>
<li >
<label class="label02"><%=l(:label_scm)%></label>
<%= select_tag('repository_scm',
options_for_select(["Git"],@repository.class.name.demodulize),
:data => {:remote => true, :method => 'get'})%>
<% if @repository && ! @repository.class.scm_available %>
<span class="c_grey"><%= l(:text_scm_command_not_available) %></span>
<% end %>
</li>
<% unless judge_main_repository(@project) %>
<li>
<label class="label02"><%=l(:field_repository_is_default)%></label>
<%= f.check_box :is_default, :label => "", :no_label => true %></p>
</li>
<% end %>
<li >
<input type="text" style="display: none"/> <!--阻止表单自动填充 -->
<input type="password" style="display: none"/> <!--阻止表单自动填充 -->
<label class="label02"><span class="c_red">*</span><%=l(:label_repository_name)%></label>
<%= f.text_field :identifier, :disabled =>@repository.nil? || @repository.identifier_frozen? ? true:false,:label=>"", :no_label => true %>
<% unless @repository.identifier_frozen? %>
<span class="c_grey"><%=l(:text_length_between,:min=>1,:max=>254)<<l(:text_project_identifier_info) %></span>
<% end %>
</li>
<li >
<label class="label02"><span class="c_red">*</span><%=l(:label_password)%></label>
<%= f.password_field :upassword, :label=> "", :no_label => true%>
<span class="c_grey"><%= l(:label_upassword_info)%></span>
</li>
<div class="cl"></div>
</ul>
<a href="#" onclick="$('#repository-form').submit();" class="blue_btn fl ml110"><%=l(:button_save)%></a>
<a href="<%= settings_project_path(@project, :tab => 'repositories')%>" class="grey_btn fl ml10"><%=l(:button_cancel)%></a>
</div><!--pro_st_edit_issues end-->
<% end %>
<% end %>

View File

@ -16,7 +16,7 @@
<%= render :partial => 'student_work/student_work_attachment_form', :locals => {:work => work,:score => score} %>
</div>
<%end%>
<a href="javascript:void(0);" class="blue_n_btn fr evaluation_submit" onclick="$(this).parent().parent().submit();">提交</a>
<a href="javascript:void(0);" class="blue_n_btn fr evaluation_submit" onclick="$(this).parent().parent().submit();$('#about_hwork_<%= @work.id%>').html('');">提交</a>
<div class="cl"></div>
</li>
<% end%>

View File

@ -3,7 +3,7 @@
<li class="hworkList340 <%= @homework.homework_type == 2 ? '' : 'width385'%>">
<ul>
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(User.current.id))%>
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(student_work.user)) %>
</li>
<div onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<li class="hworkName mt15 mr15 <%= @homework.homework_type == 2 ? '' : 'width165'%>">

View File

@ -13,7 +13,7 @@
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
</div>
</li>
<li>
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
<%= student_work.user.show_name%>
@ -32,7 +32,7 @@
<%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word width285"%>
</div>
</li>
<li>
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名">
匿名
@ -46,7 +46,7 @@
</ul>
</li>
<li class="hworkList130 c_grey">
<li class="hworkList130 c_grey" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(student_work.created_at.to_s).strftime("%Y-%m-%d") %>
<span class="c_red">[迟交]</span>

View File

@ -6,17 +6,17 @@
});
// 匿评弹框提示
<% if @is_evaluation && !@stundet_works.empty?%>
$(function(){
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/praise_alert') %>');
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
});
<% end%>
<%# if @is_evaluation && !@stundet_works.empty?%>
// $(function(){
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'student_work/praise_alert') %>');
// showModal('ajax-modal', '500px');
// $('#ajax-modal').siblings().remove();
// $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
// "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
// $('#ajax-modal').parent().css("top","").css("left","");
// $('#ajax-modal').parent().addClass("anonymos");
// });
<%# end%>
//设置评分规则
function set_score_rule(){

View File

@ -24,10 +24,12 @@
<span class="grey_btn_cir ml10">匿评已结束</span>
<% end%>
<div class="homepagePostSubmitContainer">
<div class="homepagePostSubmit">
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
</div>
<% if User.current.member_of_course?(activity.course) %>
<div class="homepagePostSubmit">
<% is_teacher = User.current.allowed_to?(:as_teacher,activity.course) %>
<%= user_for_homework_common activity,is_teacher %>
</div>
<% end %>
<% if activity.homework_type == 2 && is_teacher%>
<div class="homepagePostSubmit">

View File

@ -144,9 +144,13 @@
</p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></p>
<p>
截止日期<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span>
匿评截止:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点</span>
</p>
<% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
<p>请您尽早完成匿评!如果您在规定时间内未完成匿评,一次将被扣<%= ma.course_message.homework_detail_manual.absence_penalty %>分。</p>
<% end%>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -193,12 +197,15 @@
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败
失败原因提交作品的人数低于2人
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败
<p> 失败原因提交作品的人数低于2人</p>
</p>
<p>作业详情如下:</p>
<p>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></p>
<p>
提交截止:<span style="color:Red;"><%= ma.course_message.end_time%>&nbsp;&nbsp;24点</span>
</p>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -281,9 +288,22 @@
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></a></li>
<div style="display: none" class="message_title_red system_message_style" >
<%= ma.content.html_safe %>
<p>课程名称:<%= ma.course.name %>(<%= ma.course.term %>)</p>
<p>作业标题:<span style="color:Red;"><%=ma.course_message.student_work.homework_common.name %></span></p>
<% content = ma.content.gsub("作业评分:","").split("&nbsp;&nbsp;&nbsp; 评语:")%>
<p>
作品评分:<%= content[0] %>
</p>
<% if content.size > 1 %>
<div class="fl">作品评语:</div>
<div class="ml60"><%= content[1] %></div>
<% end %>
<p>
本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;24点结束匿评到时您将可以看到所有其他同学的作品啦大家可以进一步互相学习。
</p>
<p>
期待你取得更大的进步!
</p>
</div>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>

View File

@ -199,7 +199,8 @@ zh:
label_descripition_blank: 描述不能为空
label_subject_empty: 主题不能为空
label_no_data: 没有任何数据可供显示
label_no_data: 没有任何数据可供显示
label_repository_no_data: 您还没有创建版本库,每个项目只允许创建一个版本库!
# 项目、课程、用户公用
label_settings: 配置
label_information_plural: 信息

View File

@ -884,6 +884,7 @@ RedmineApp::Application.routes.draw do
post 'school/search_school/', :to => 'school#search_school'
get 'school/search_school/', :to => 'school#search_school'
post 'school/on_search'
######added by nie
match 'tags/show_projects_tags'
########### added by liuping

View File

@ -0,0 +1,5 @@
class AddColumnPinyinToSchools < ActiveRecord::Migration
def change
add_column :schools, :pinyin, :string
end
end

View File

@ -0,0 +1,11 @@
class TransferNameColumnValueToPinyinColumnValue < ActiveRecord::Migration
def up
School.all.each do |school|
school.pinyin = Pinyin.t(school.name, splitter: '')
school.save
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20150930011457) do
ActiveRecord::Schema.define(:version => 20151014023806) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -782,6 +782,16 @@ ActiveRecord::Schema.define(:version => 20150930011457) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_details_copy", :force => true do |t|
t.integer "journal_id", :default => 0, :null => false
t.string "property", :limit => 30, :default => "", :null => false
t.string "prop_key", :limit => 30, :default => "", :null => false
t.text "old_value"
t.text "value"
end
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id"
t.integer "user_id"
@ -1254,6 +1264,7 @@ ActiveRecord::Schema.define(:version => 20150930011457) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "logo_link"
t.string "pinyin"
end
create_table "seems_rateable_cached_ratings", :force => true do |t|
@ -1317,9 +1328,9 @@ ActiveRecord::Schema.define(:version => 20150930011457) do
create_table "student_work_tests", :force => true do |t|
t.integer "student_work_id"
t.integer "status"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "status", :default => 9
t.text "results"
t.text "src"
end
@ -1567,7 +1578,6 @@ ActiveRecord::Schema.define(:version => 20150930011457) do
t.string "identity_url"
t.string "mail_notification", :default => "", :null => false
t.string "salt", :limit => 64
t.integer "gid"
end
add_index "users", ["auth_source_id"], :name => "index_users_on_auth_source_id"

View File

@ -81,7 +81,7 @@ a.select_btn_select{ background:#64bddb; color:#fff;}
.users_dis{display:block; }
.users_undis{display:none;}
.users_ctt{ font-size:14px; color:#666; margin-top:10px;}
.setting_left{ width:85px; text-align:right; float:left;}
.setting_left{ width:115px; text-align:right; float:left;}
.setting_left li{ height:28px;line-height:28px;}
.setting_right{width:500px; text-align:left; float:left; margin-left:8px;}
.setting_right li{ height:28px;line-height:28px;}