Merge branch 'develop' into szzh

This commit is contained in:
sw 2014-12-10 17:52:51 +08:00
commit 428aec2895
15 changed files with 76 additions and 35 deletions

View File

@ -309,7 +309,7 @@ class ApplicationController < ActionController::Base
# Find project of id params[:id]
def find_project
@project = Project.find_by_id(params[:id])
@project = Project.find(params[:id])
rescue ActiveRecord::RecordNotFound
render_404
end

View File

@ -37,7 +37,7 @@ class ContestsController < ApplicationController
def index
render_404
render_404 unless params[:name]
# @contests = Contest.visible
# @contests ||= []
@offset, @limit = api_offset_and_limit(:limit => 10)

View File

@ -44,7 +44,9 @@ class ZipdownController < ApplicationController
if homework != nil
unless homework.attachments.empty?
zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.user.user_extensions.student_id + "_" + homework.user.lastname + homework.user.firstname + "_" + homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile)
send_file zipfile, :filename => (homework.user.user_extensions.student_id.nil? ? "" : homework.user.user_extensions.student_id) +
"_" + (homework.user.lastname.nil? ? "" : homework.user.lastname) + (homework.user.firstname.nil? ? "" : homework.user.firstname) +
"_" + homework.name + ".zip", :type => detect_content_type(zipfile) if(zipfile)
else
render file: 'public/no_file_found.html'
end
@ -78,7 +80,7 @@ class ZipdownController < ApplicationController
homeattach.attachments.each do |attach|
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end
zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{homeattach.user.user_extensions.student_id}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
zipping("#{homeattach.user.lastname}#{homeattach.user.firstname}_#{(homework.user.user_extensions.student_id.nil? ? "" : homework.user.user_extensions.student_id)}_#{Time.now.to_i.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true)
end

View File

@ -156,11 +156,11 @@ module StoresHelper
klass = project.class.to_s
case klass
when "Project"
project_list = link_to l(:label_project_plural), projects_path
project_list = "<lable>#{l(:label_project_plural)}</lable>"
project_item = link_to project.to_s, project_path(project)
[project_list, project_item]
when "Course"
course_list = link_to l(:label_new_course), courses_path
course_list = "<lable>#{l(:label_new_course)}</lable>"
course_item = link_to project.name, course_path(project)
[course_list, course_item]
else

View File

@ -43,13 +43,13 @@
<p style="display: none">
<%= f.select :proportion, proportion_option %>
</p>
<p>
<p id="open_anonymous_evaluation_p">
<%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %>
<span>未开启匿评作业将直接进入众评点赞阶段</span>
<span id='open_anonymous_evaluation_span' style="display: none">未开启匿评作业将直接进入众评点赞阶段</span>
</p>
<p id="evaluation_num_p">
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
<span id="bid_evaluation_num_span">匿评分配数量不宜太大,否则会影响开启匿评速度</span>
<span id="bid_evaluation_num_span">即每份作业被允许匿评的人数</span>
</p>
<p>
<%= hidden_field_tag 'course_id', @course.id %>

View File

@ -91,16 +91,19 @@
}
});
});
$(function(){
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
$("#evaluation_num_p").show();
}
else
{
$("#evaluation_num_p").hide();
}
$("#bid_open_anonymous_evaluation").click(function(){
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
$("#evaluation_num_p").slideDown();
$("#open_anonymous_evaluation_span").slideUp();
}
else
{
$("#evaluation_num_p").slideUp();
$("#open_anonymous_evaluation_span").slideDown();
}
});
});
function submitHomework(id)

View File

@ -48,13 +48,13 @@
<p style="display: none">
<%= f.select :proportion, proportion_option %>
</p>
<p>
<p id="open_anonymous_evaluation_p">
<%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %>
<span>未开启匿评作业将直接进入众评点赞阶段</span>
<span id='open_anonymous_evaluation_span' style="display: none">未开启匿评作业将直接进入众评点赞阶段</span>
</p>
<p id="evaluation_num_p">
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%>
<span id="bid_evaluation_num_span">匿评分配数量不宜太大,否则会影响开启匿评速度</span>
<span id="bid_evaluation_num_span">即每份作业被允许匿评的人数</span>
</p>
<p>
<%= hidden_field_tag 'course_id', @course.id %>

View File

@ -84,10 +84,12 @@
if($("#bid_open_anonymous_evaluation").attr("checked") == "checked")
{
$("#evaluation_num_p").slideDown();
$("#open_anonymous_evaluation_span").slideUp();
}
else
{
$("#evaluation_num_p").slideUp();
$("#open_anonymous_evaluation_span").slideDown();
}
});
});

View File

@ -8,7 +8,8 @@
<label style="margin-top:3px;">文件浏览:</label>
<%= render :partial => 'attachement_list',:locals => {:course => course} %>
<div class="cl"></div>
<a id="submit_resource" href="javascript:void(0);" class="upload_btn" onclick="submit_resource();">上传资源</a><a href="javascript:void(0);" class="upload_btn upload_btn_grey" onclick="closeModal();">取&nbsp;&nbsp;消</a>
<a id="submit_resource" href="javascript:void(0);" class="upload_btn" onclick="submit_resource();">确&nbsp;&nbsp;认</a>
<a href="javascript:void(0);" class="upload_btn upload_btn_grey" onclick="closeModal();">取&nbsp;&nbsp;消</a>
<% end %>
</div>

View File

@ -249,7 +249,7 @@
<%= l(:label_course_description_no) %>
</div>
<% end %>
<div class="created_on_course">
<div class="created_on_course" style="padding-left: 10px;">
<strong style="color: #068d9c">
<%= l(:label_create_time) %>
</strong>

View File

@ -4,9 +4,15 @@
<% projects_results.each do |prj| %>
<div>
<p class="font_description2">
<strong><%= l(:label_tags_project_name) %><%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %></strong>
<strong>
<%= l(:label_tags_project_name) %>
<%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %>
</strong>
<br />
<strong><%= l(:label_tags_project_description) %></strong><%= textilizable prj.description %>
<strong>
<%= l(:label_tags_project_description) %>
</strong>
<%= textilizable prj.description %>
</p>
</div>
<div class="line_under"></div>

View File

@ -2,32 +2,50 @@
<% unless show_flag.nil? %>
<% case %>
<% when show_flag == '1' %>
<strong><%=l(:label_user)%>(<%= @results_count %>)</strong>
<strong>
<%=l(:label_user)%>
(
<%= @results_count %>
)
</strong>
<%= render :partial => "show_users",:locals => {:users_results => users_results}%>
<% when show_flag == '2'%>
<strong><%=l(:label_project)%>(<%= @results_count %>)</strong>
<strong>
<%=l(:label_project)%>(<%= @results_count %>)
</strong>
<%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%>
<% when show_flag == '3'%>
<strong><%=l(:label_issue)%>(<%= @results_count %>)</strong>
<%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%>
<% when show_flag == '4'%>
<strong><%= l(:label_requirement)%>(<%= @results_count %>)</strong>
<strong>
<%= l(:label_requirement)%>(<%= @results_count %>)
</strong>
<%= render :partial => "show_bids",:locals => {:bids_results => bids_results}%>
<% when show_flag == '5'%>
<strong><%= l(:label_forum)%>(<%= @results_count %>)</strong>
<strong>
<%= l(:label_forum)%>(<%= @results_count %>)
</strong>
<%= render :partial => "show_forums",:locals => {:forums_results => forums_results}%>
<% when show_flag == '6'%>
<strong><%= l(:label_attachment)%>(<%= @results_count %>)</strong>
<strong>
<%= l(:label_attachment)%>(<%= @results_count %>)
</strong>
<%= render :partial => "show_attachments",:locals => {:attachments_results => attachments_results}%>
<% when show_flag == '7'%>
<strong><%= l(:label_contest_innovate)%>(<%= @results_count %>)</strong>
<strong>
<%= l(:label_contest_innovate)%>(<%= @results_count %>)
</strong>
<%= render :partial => "show_contests",:locals => {:contests_results => contests_results}%>
<% when show_flag == '8'%>
<strong><%#= l(:label_attachment)%>
开源项目:(<%= @results_count %>)</strong>
开源项目:(<%= @results_count %>)
</strong>
<%= render :partial => "show_open_source_projects",:locals => {:projects_results => open_source_projects_results}%>
<% when show_flag == '9'%>
<strong><%= l(:label_course)%>(<%= @results_count %>)</strong>
<strong>
<%= l(:label_course)%>(<%= @results_count %>)
</strong>
<%= render :partial => "show_courses",:locals => {:courses_results => courses_results}%>
<% else %>
<strong><%= l(:label_tags_all_objects)%></strong>

View File

@ -174,8 +174,8 @@
<%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
</span>
<span class="memo_last_person">
<%= l(:label_final_reply)%>
<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %>
<%= l(:label_final_reply)%>
<%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
<% end %>
</span>

View File

@ -1379,7 +1379,7 @@ zh:
label_activity_time: 发布时间
label_update_time: 更新时间
label_current_contributors: 位当前贡献者
label_commit_limit: 作业提交时间已过!
label_commit_limit: 截止了,可补交
label_commit_ar: 作业提交截止时间快到了!
lable_has_commit_homework: 您已提交过作业
#modify by men

View File

@ -0,0 +1,9 @@
class ChangeStudentScore < ActiveRecord::Migration
def up
sql = ActiveRecord::Base.connection()
sql.update_sql("update seems_rateable_rates set stars = 5 where stars > 5")
end
def down
end
end