parent
9a5dba7773
commit
ad4fc50fbb
|
@ -18,8 +18,7 @@ class HomeworkCommonController < ApplicationController
|
|||
@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10)
|
||||
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
|
||||
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
|
||||
# @homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset()
|
||||
# @homeworks = paginateHelper homeworks,20
|
||||
@is_new = params[:is_new]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
|
@ -38,7 +37,7 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
def edit
|
||||
@user = User.current
|
||||
@is_in_course = params[:is_in_course]
|
||||
@is_in_course = params[:is_in_course].to_i
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'new_base_user'}
|
||||
end
|
||||
|
|
|
@ -346,6 +346,7 @@ class UsersController < ApplicationController
|
|||
user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")"
|
||||
@homework_commons = HomeworkCommon.where("course_id in #{user_course_ids}").order("created_at desc").limit(10).offset(@page * 10)
|
||||
@is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)
|
||||
@is_in_course = params[:is_in_course].to_i || 0
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html {render :layout => 'new_base_user'}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</div><!----HomeWork end-->
|
||||
<% end%>
|
||||
|
||||
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1} %>
|
||||
<%= render :partial => 'users/user_homework_list', :locals => {:homework_commons => @homeworks,:page => 0,:is_in_course => 1,:course_id => @course.id} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homeworks, :page => @page, :is_in_course => 1,:course_id => @course.id} )%>");
|
|
@ -91,7 +91,7 @@
|
|||
<%= link_to "(#{@course.course_activities.count})", course_path(@course), :class => "subnav_num c_orange"%>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id), :class => "f14 c_blue02"%>
|
||||
<%= link_to l(:label_homework), homework_common_index_path(:course => @course.id,:is_new => 1), :class => "f14 c_blue02"%>
|
||||
<%= link_to "(#{@course.homework_commons.count})", homework_common_index_path(:course => @course.id), :class => "subnav_num c_orange"%>
|
||||
<%= link_to( "+#{l(:label_course_homework_new)}", "javascript:void(0)", :class => 'subnav_green c_white', :onclick => "new_homework_alert();") if is_teacher %>
|
||||
</div>
|
||||
|
|
|
@ -80,5 +80,11 @@
|
|||
</div><!----HomeWork end-->
|
||||
<% end%>
|
||||
<% if homework_commons.count == 10%>
|
||||
<%= link_to "加载更多",user_homeworks_user_path(User.current.id,:page => page),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
|
||||
<% if is_in_course == 1%>
|
||||
<!-- 在课程内 -->
|
||||
<%= link_to "加载更多",homework_common_index_path(:course => course_id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
|
||||
<% else%>
|
||||
<!-- 在个人主页 -->
|
||||
<%= link_to "加载更多",user_homeworks_user_path(User.current.id,:page => page,:is_in_course => is_in_course),:id => "user_show_more_homework",:remote => "true",:class => "loadMore f_grey"%>
|
||||
<% end%>
|
||||
<% end%>
|
|
@ -12,5 +12,5 @@
|
|||
'<div class="cl"></div>')
|
||||
|
||||
<% end %>
|
||||
hideModal();
|
||||
hideResource();
|
||||
<% end %>
|
|
@ -1,2 +1,2 @@
|
|||
$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homework_commons, :page => @page} )%>");
|
||||
$("#user_show_more_homework").replaceWith("<%= escape_javascript( render :partial => 'users/user_homework_list',:locals => {:homework_commons => @homework_commons, :page => @page,:is_in_course => 0} )%>");
|
||||
|
||||
|
|
Loading…
Reference in New Issue