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] # Find project of id params[:id]
def find_project def find_project
@project = Project.find_by_id(params[:id]) @project = Project.find(params[:id])
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render_404 render_404
end end

View File

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

View File

@ -44,7 +44,9 @@ class ZipdownController < ApplicationController
if homework != nil if homework != nil
unless homework.attachments.empty? unless homework.attachments.empty?
zipfile = zip_homework_by_user homework 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 else
render file: 'public/no_file_found.html' render file: 'public/no_file_found.html'
end end
@ -78,7 +80,7 @@ class ZipdownController < ApplicationController
homeattach.attachments.each do |attach| homeattach.attachments.each do |attach|
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1) homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end 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 end

View File

@ -156,11 +156,11 @@ module StoresHelper
klass = project.class.to_s klass = project.class.to_s
case klass case klass
when "Project" 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_item = link_to project.to_s, project_path(project)
[project_list, project_item] [project_list, project_item]
when "Course" 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_item = link_to project.name, course_path(project)
[course_list, course_item] [course_list, course_item]
else else

View File

@ -43,13 +43,13 @@
<p style="display: none"> <p style="display: none">
<%= f.select :proportion, proportion_option %> <%= f.select :proportion, proportion_option %>
</p> </p>
<p> <p id="open_anonymous_evaluation_p">
<%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %> <%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %>
<span>未开启匿评作业将直接进入众评点赞阶段</span> <span id='open_anonymous_evaluation_span' style="display: none">未开启匿评作业将直接进入众评点赞阶段</span>
</p> </p>
<p id="evaluation_num_p"> <p id="evaluation_num_p">
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%> <%= 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>
<p> <p>
<%= hidden_field_tag 'course_id', @course.id %> <%= hidden_field_tag 'course_id', @course.id %>

View File

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

View File

@ -48,13 +48,13 @@
<p style="display: none"> <p style="display: none">
<%= f.select :proportion, proportion_option %> <%= f.select :proportion, proportion_option %>
</p> </p>
<p> <p id="open_anonymous_evaluation_p">
<%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %> <%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %>
<span>未开启匿评作业将直接进入众评点赞阶段</span> <span id='open_anonymous_evaluation_span' style="display: none">未开启匿评作业将直接进入众评点赞阶段</span>
</p> </p>
<p id="evaluation_num_p"> <p id="evaluation_num_p">
<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%> <%= 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>
<p> <p>
<%= hidden_field_tag 'course_id', @course.id %> <%= hidden_field_tag 'course_id', @course.id %>

View File

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

View File

@ -8,7 +8,8 @@
<label style="margin-top:3px;">文件浏览:</label> <label style="margin-top:3px;">文件浏览:</label>
<%= render :partial => 'attachement_list',:locals => {:course => course} %> <%= render :partial => 'attachement_list',:locals => {:course => course} %>
<div class="cl"></div> <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 %> <% end %>
</div> </div>

View File

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

View File

@ -4,9 +4,15 @@
<% projects_results.each do |prj| %> <% projects_results.each do |prj| %>
<div> <div>
<p class="font_description2"> <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 /> <br />
<strong><%= l(:label_tags_project_description) %></strong><%= textilizable prj.description %> <strong>
<%= l(:label_tags_project_description) %>
</strong>
<%= textilizable prj.description %>
</p> </p>
</div> </div>
<div class="line_under"></div> <div class="line_under"></div>

View File

@ -2,32 +2,50 @@
<% unless show_flag.nil? %> <% unless show_flag.nil? %>
<% case %> <% case %>
<% when show_flag == '1' %> <% 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}%> <%= render :partial => "show_users",:locals => {:users_results => users_results}%>
<% when show_flag == '2'%> <% 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 }%> <%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%>
<% when show_flag == '3'%> <% when show_flag == '3'%>
<strong><%=l(:label_issue)%>(<%= @results_count %>)</strong> <strong><%=l(:label_issue)%>(<%= @results_count %>)</strong>
<%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%> <%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%>
<% when show_flag == '4'%> <% 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}%> <%= render :partial => "show_bids",:locals => {:bids_results => bids_results}%>
<% when show_flag == '5'%> <% 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}%> <%= render :partial => "show_forums",:locals => {:forums_results => forums_results}%>
<% when show_flag == '6'%> <% 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}%> <%= render :partial => "show_attachments",:locals => {:attachments_results => attachments_results}%>
<% when show_flag == '7'%> <% 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}%> <%= render :partial => "show_contests",:locals => {:contests_results => contests_results}%>
<% when show_flag == '8'%> <% when show_flag == '8'%>
<strong><%#= l(:label_attachment)%> <strong><%#= l(:label_attachment)%>
开源项目:(<%= @results_count %>)</strong> 开源项目:(<%= @results_count %>)
</strong>
<%= render :partial => "show_open_source_projects",:locals => {:projects_results => open_source_projects_results}%> <%= render :partial => "show_open_source_projects",:locals => {:projects_results => open_source_projects_results}%>
<% when show_flag == '9'%> <% 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}%> <%= render :partial => "show_courses",:locals => {:courses_results => courses_results}%>
<% else %> <% else %>
<strong><%= l(:label_tags_all_objects)%></strong> <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 %> <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
</span> </span>
<span class="memo_last_person"> <span class="memo_last_person">
<%= l(:label_final_reply)%>
<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %> <% 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%> <%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%>
<% end %> <% end %>
</span> </span>

View File

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