diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 32cfefa9d..78ac4d208 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index af532cd87..6213b2315 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -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) diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index f0dc157b5..d4699b6c4 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -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 diff --git a/app/helpers/stores_helper.rb b/app/helpers/stores_helper.rb index e987367ad..0ae91a644 100644 --- a/app/helpers/stores_helper.rb +++ b/app/helpers/stores_helper.rb @@ -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 = "#{l(:label_project_plural)}" 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 = "#{l(:label_new_course)}" course_item = link_to project.name, course_path(project) [course_list, course_item] else diff --git a/app/views/bids/_homework_form.html.erb b/app/views/bids/_homework_form.html.erb index 12393c558..ffe0fc1b9 100644 --- a/app/views/bids/_homework_form.html.erb +++ b/app/views/bids/_homework_form.html.erb @@ -43,13 +43,13 @@

<%= f.select :proportion, proportion_option %>

-

+

<%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %> - 未开启匿评作业将直接进入众评点赞阶段 +

<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%> - 匿评分配数量不宜太大,否则会影响开启匿评速度 + 即每份作业被允许匿评的人数

<%= hidden_field_tag 'course_id', @course.id %> diff --git a/app/views/bids/edit.html.erb b/app/views/bids/edit.html.erb index 17e805fce..ee2142dd5 100644 --- a/app/views/bids/edit.html.erb +++ b/app/views/bids/edit.html.erb @@ -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) diff --git a/app/views/courses/_homework_form.html.erb b/app/views/courses/_homework_form.html.erb index 2d20ecf07..7e09e84fc 100644 --- a/app/views/courses/_homework_form.html.erb +++ b/app/views/courses/_homework_form.html.erb @@ -48,13 +48,13 @@

<%= f.select :proportion, proportion_option %>

-

+

<%= f.check_box :open_anonymous_evaluation, :style => "margin-left:10px;" %> - 未开启匿评作业将直接进入众评点赞阶段 +

<%= f.text_field :evaluation_num, :required => true, :size => 60, :style => "width:150px;", :onblur => "regexEvaluationNum();" , :maxlength => 4%> - 匿评分配数量不宜太大,否则会影响开启匿评速度 + 即每份作业被允许匿评的人数

<%= hidden_field_tag 'course_id', @course.id %> diff --git a/app/views/courses/new_homework.html.erb b/app/views/courses/new_homework.html.erb index e3121c6ad..2e0b35c6d 100644 --- a/app/views/courses/new_homework.html.erb +++ b/app/views/courses/new_homework.html.erb @@ -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(); } }); }); diff --git a/app/views/files/_upload_show.html.erb b/app/views/files/_upload_show.html.erb index a979715de..13bcd043e 100644 --- a/app/views/files/_upload_show.html.erb +++ b/app/views/files/_upload_show.html.erb @@ -8,7 +8,8 @@ <%= render :partial => 'attachement_list',:locals => {:course => course} %>

- 上传资源取  消 + 确  认 + 取  消 <% end %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index beb3291d0..978eb7e35 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -249,7 +249,7 @@ <%= l(:label_course_description_no) %> <% end %> -
+
<%= l(:label_create_time) %>: diff --git a/app/views/tags/_show_projects.html.erb b/app/views/tags/_show_projects.html.erb index 2b6b42189..de8e10018 100644 --- a/app/views/tags/_show_projects.html.erb +++ b/app/views/tags/_show_projects.html.erb @@ -4,9 +4,15 @@ <% projects_results.each do |prj| %>

- <%= l(:label_tags_project_name) %><%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %> + + <%= l(:label_tags_project_name) %> + <%= link_to "#{prj.name}",:controller => "projects",:action => "show",:id => prj.id %> +
- <%= l(:label_tags_project_description) %><%= textilizable prj.description %> + + <%= l(:label_tags_project_description) %> + + <%= textilizable prj.description %>

diff --git a/app/views/tags/_tag_search_results.html.erb b/app/views/tags/_tag_search_results.html.erb index 84a672617..591a86a70 100644 --- a/app/views/tags/_tag_search_results.html.erb +++ b/app/views/tags/_tag_search_results.html.erb @@ -2,32 +2,50 @@ <% unless show_flag.nil? %> <% case %> <% when show_flag == '1' %> - <%=l(:label_user)%>(<%= @results_count %>) + + <%=l(:label_user)%> + ( + <%= @results_count %> + ) + <%= render :partial => "show_users",:locals => {:users_results => users_results}%> <% when show_flag == '2'%> - <%=l(:label_project)%>(<%= @results_count %>) + + <%=l(:label_project)%>(<%= @results_count %>) + <%= render :partial => "show_projects",:locals => {:projects_results => projects_results }%> <% when show_flag == '3'%> <%=l(:label_issue)%>(<%= @results_count %>) <%= render :partial => "show_issues",:locals => {:issues_results => issues_results }%> <% when show_flag == '4'%> - <%= l(:label_requirement)%>(<%= @results_count %>) + + <%= l(:label_requirement)%>(<%= @results_count %>) + <%= render :partial => "show_bids",:locals => {:bids_results => bids_results}%> <% when show_flag == '5'%> - <%= l(:label_forum)%>(<%= @results_count %>) + + <%= l(:label_forum)%>(<%= @results_count %>) + <%= render :partial => "show_forums",:locals => {:forums_results => forums_results}%> <% when show_flag == '6'%> - <%= l(:label_attachment)%>(<%= @results_count %>) + + <%= l(:label_attachment)%>(<%= @results_count %>) + <%= render :partial => "show_attachments",:locals => {:attachments_results => attachments_results}%> <% when show_flag == '7'%> - <%= l(:label_contest_innovate)%>(<%= @results_count %>) + + <%= l(:label_contest_innovate)%>(<%= @results_count %>) + <%= render :partial => "show_contests",:locals => {:contests_results => contests_results}%> <% when show_flag == '8'%> <%#= l(:label_attachment)%> - 开源项目:(<%= @results_count %>) + 开源项目:(<%= @results_count %>) + <%= render :partial => "show_open_source_projects",:locals => {:projects_results => open_source_projects_results}%> <% when show_flag == '9'%> - <%= l(:label_course)%>(<%= @results_count %>) + + <%= l(:label_course)%>(<%= @results_count %>) + <%= render :partial => "show_courses",:locals => {:courses_results => courses_results}%> <% else %> <%= l(:label_tags_all_objects)%> diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index 424d4eff0..4dd58641b 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -174,8 +174,8 @@ <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %> - <%= 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 %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index c0bc4df73..156880f13 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -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 diff --git a/db/migrate/20141210070327_change_student_score.rb b/db/migrate/20141210070327_change_student_score.rb new file mode 100644 index 000000000..192689229 --- /dev/null +++ b/db/migrate/20141210070327_change_student_score.rb @@ -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