diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 809bf73ac..55bac3e46 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -758,22 +758,26 @@ class CoursesController < ApplicationController def homework if @course.is_public != 0 || User.current.member_of_course?(@course) || User.current.admin? - @offset, @limit = api_offset_and_limit({:limit => 10}) - @bids = @course.homeworks.order('deadline DESC') - @bids = @bids.like(params[:name]) if params[:name].present? - @bid_count = @bids.count - @bid_pages = Paginator.new @bid_count, @limit, params['page'] - - @offset ||= @bid_pages.reverse_offset - unless @offset == 0 - @bids = @bids.offset(@offset).limit(@limit).all.reverse - else - limit = @bid_count % @limit - if limit == 0 - limit = 10 - end - @bids = @bids.offset(@offset).limit(limit).all.reverse - end + bids = @course.homeworks.order('created_on DESC') + bids = bids.like(params[:name]) if params[:name].present? + @bids = paginateHelper bids,10 + @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) + # + # @offset, @limit = api_offset_and_limit({:limit => 10}) + # + # @bid_count = @bids.count + # @bid_pages = Paginator.new @bid_count, @limit, params['page'] + # + # @offset ||= @bid_pages.reverse_offset + # unless @offset == 0 + # @bids = @bids.offset(@offset).limit(@limit).all.reverse + # else + # limit = @bid_count % @limit + # if limit == 0 + # limit = 10 + # end + # @bids = @bids.offset(@offset).limit(limit).all.reverse + # end render :layout => 'base_courses' else render_403 diff --git a/app/views/courses/homework.html.erb b/app/views/courses/homework.html.erb index 81201bef5..731e155ff 100644 --- a/app/views/courses/homework.html.erb +++ b/app/views/courses/homework.html.erb @@ -1,63 +1,36 @@ - -<%= javascript_include_tag 'attachments' %> - -
- <% if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.nil? && (Member.where('user_id = ? and course_id = ?', User.current.id, @course.id).first.roles&Role.where(id: [3, 4, 7, 9] )).size >0))%> - <%= link_to(l(:label_course_homework_new), {:controller => 'courses', :action => 'new_homework'}, :class => 'icon icon-add') %> - <% else %> - - <%= l(:label_coursejoin_tip) %> - - <% end %> +
+

课程作业

-
- <%= render :partial => 'bids/bid_homework_show', :locals => {:bids => @bids, :bid_pages => @bid_pages} %> +
+

+ 共有<%= @obj_count%>个作业 +

+ <%= link_to( l(:label_course_homework_new), new_homework_course_path(@course), :class => 'problem_new_btn fl c_dorange') if @is_teacher %> +
- -
-
-
-

课程: <%= @course.name%>

-

上传作业

- -
-
- -
+<% @bids.each do |bid|%> +
+ <%= link_to(image_tag(url_to_avatar(bid.author), :width => "42", :height => "42"), user_path(bid.author), :class => "problem_pic fl") %> +
+ <%= link_to(bid.author.lastname+bid.author.firstname, user_path(bid.author),:class => 'problem_name fl') %> + <%= l(:label_user_create_project_homework) %>: + <%= link_to(bid.name, course_for_bid_path(bid), :class => 'problem_tit fl fb c_dblue') %> +
+

已提交的作业 (<%= link_to bid.homeworks.count, course_for_bid_path(bid.id), :class => 'c_red'%> )

+ 关闭匿评编辑 +
+

项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题
创建时间 : 2014-11-26 10:19

+
展开更多信息
+
+
-
- - -<% html_title(l(:label_homework)) -%> \ No newline at end of file + +
\ No newline at end of file diff --git a/public/javascripts/course.js b/public/javascripts/course.js index be3833cf7..e359c91f6 100644 --- a/public/javascripts/course.js +++ b/public/javascripts/course.js @@ -27,4 +27,21 @@ function show_more_msg() $(document).ready(function () { $("#RSide").css("min-height",$("#LSide").height()-30); -}); \ No newline at end of file +}); + +function ShowCountDown(year,month,day,divname) +{ + var now = new Date(); + var endDate = new Date(year, month-1, day); + var leftTime=endDate.getTime()-now.getTime(); + var leftsecond = parseInt(leftTime/1000); + var day1=Math.floor(leftsecond/(60*60*24)); + var hour=Math.floor((leftsecond-day1*24*60*60)/3600); + var minute=Math.floor((leftsecond-day1*24*60*60-hour*3600)/60); + var second=Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60); + $("#"+divname).html("作业提交还剩 : " + +day1+"  " + +hour+"  " + +minute+"  " + +second+" "); +} \ No newline at end of file