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/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 5bd5fb0e3..6738d2135 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -73,7 +73,7 @@ class TagsController < ApplicationController @issues_results, @bids_results, @forums_results, - @attachments_results, + @attachments_results, @contests_results, @courses_results, @open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags) @@ -109,7 +109,7 @@ class TagsController < ApplicationController @issues_results, @bids_results, @forums_results, - @attachments_results, + @attachments_results, @contests_results, @courses_results, @open_source_projects_results= refresh_results(@obj_id,@show_flag) 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

+
展开更多信息
+
+
-
- +<% end%> -<% html_title(l(:label_homework)) -%> \ No newline at end of file + +
\ No newline at end of file diff --git a/app/views/tags/_new_tag_name.html.erb b/app/views/tags/_new_tag_name.html.erb index a1fb3fa46..3e8c2c021 100644 --- a/app/views/tags/_new_tag_name.html.erb +++ b/app/views/tags/_new_tag_name.html.erb @@ -9,9 +9,21 @@ <%= link_to tag, :controller => "tags", :action => "index", :q => tag, :object_flag => object_flag, :obj_id => obj.id, :class => 'pt5' %> - <%= link_to('x', :controller => "tags", :action => "remove_tag", :remote => true, :tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag) if (CourseInfos.find_by_course_id(obj.id)).try(:user_id) == User.current.id %> + <%= link_to('x', remove_tag_path(:tag_name => tag,:taggable_id => obj.id, :taggable_type => object_flag), :remote => true, :confirm => l(:text_are_you_sure) ) if (CourseInfos.find_by_course_id(obj.id)).try(:user_id) == User.current.id %> <% end %> <% end %> -<% end %> \ No newline at end of file +<% end %> + +<% if User.current.logged?%> + <%= l(:label_add_tag)%> + +<% end%> \ No newline at end of file diff --git a/app/views/tags/remove_tag.js.erb b/app/views/tags/remove_tag.js.erb index dbad80f96..b102776d5 100644 --- a/app/views/tags/remove_tag.js.erb +++ b/app/views/tags/remove_tag.js.erb @@ -6,8 +6,10 @@ $('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_n $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false, :object_flag => @object_flag}) %>'); -<% else %> +<% elsif @object_flag == '9'%> + $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); +<% else%> $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @object_flag}) %>'); - <% end %> \ No newline at end of file diff --git a/app/views/tags/tag_save.js.erb b/app/views/tags/tag_save.js.erb index 20ffb54cf..b4866bb89 100644 --- a/app/views/tags/tag_save.js.erb +++ b/app/views/tags/tag_save.js.erb @@ -1,9 +1,23 @@ //本js使用的新的tag显示方法 -<% if @obj_flag == '6'%> +<% if @obj_flag == '3'%> +$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +//$('#put-tag-form-issue').hide(); +$('#name-issue').val(""); +<% elsif @obj_flag == '6'%> $("#tags_show-<%=@obj.class%>-<%=@obj.id%>").empty(); -$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_list', +$("#tags_show-<%=@obj.class%>-<%=@obj.id%>").html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); //$("#put-tag-form-<%#=@obj.class%>-<%#=@obj.id%>").hide(); -$("#tags_name_<%= @obj.id%>").val(""); +$("#put-tag-form-<%=@obj.class%>-<%=@obj.id%> #name").val(""); +<% elsif @obj_flag == '9'%> + $('#tags_show').html('<%= escape_javascript(render :partial => 'tags/new_tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); + $('#tags_name').val(""); +<% else%> +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', + :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); +$('#tags_name').val(""); //$('#put-tag-form').hide(); -<% end %> \ No newline at end of file +<% end %> + 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