Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
c59ee4b35c
|
@ -103,11 +103,10 @@ class StudentWorkController < ApplicationController
|
||||||
if result["status"].to_i != -2
|
if result["status"].to_i != -2
|
||||||
#result["results"].first['output'] = result["results"].first['output'].gsub(" ","□")
|
#result["results"].first['output'] = result["results"].first['output'].gsub(" ","□")
|
||||||
#result["results"].first['result'] = result["results"].first['result'].gsub(" ","□")
|
#result["results"].first['result'] = result["results"].first['result'].gsub(" ","□")
|
||||||
|
space_replace_1(result["results"].first['output'])
|
||||||
|
space_replace_1(result["results"].first['result'])
|
||||||
end
|
end
|
||||||
|
|
||||||
space_replace_1(result["results"].first['output'])
|
|
||||||
space_replace_1(result["results"].first['result'])
|
|
||||||
|
|
||||||
logger.debug result
|
logger.debug result
|
||||||
|
|
||||||
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
|
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
|
||||||
|
|
|
@ -1820,9 +1820,38 @@ class UsersController < ApplicationController
|
||||||
else
|
else
|
||||||
@flag = false
|
@flag = false
|
||||||
end
|
end
|
||||||
|
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
|
||||||
|
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||||
|
user_project_ids = User.current.projects.map {|p| p.id}
|
||||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||||
|
if params[:status] == "2"
|
||||||
|
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
|
||||||
|
elsif params[:status] == "3"
|
||||||
|
@attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
|
||||||
|
elsif params[:status] == "4"
|
||||||
|
@attachments = get_attch_resources(params[:id], @order, @score)
|
||||||
|
elsif params[:status] == "5"
|
||||||
|
@attachments = get_principal_resources(params[:id], @order, @score)
|
||||||
|
else
|
||||||
|
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||||
|
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
|
||||||
|
end
|
||||||
|
elsif params[:type] == "6" # 公共资源
|
||||||
|
if params[:status] == "2"
|
||||||
|
@attachments = get_course_resources_public( user_course_ids, @order, @score)
|
||||||
|
elsif params[:status] == "3"
|
||||||
|
@attachments = get_project_resources_public(user_project_ids, @order, @score)
|
||||||
|
elsif params[:status] == "4"
|
||||||
|
@attachments = get_attch_resources_public(@order, @score)
|
||||||
|
elsif params[:status] == "5"
|
||||||
|
@attachments = get_principal_resources_public(@order, @score)
|
||||||
|
else
|
||||||
|
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||||
|
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
|
||||||
|
end
|
||||||
|
end
|
||||||
@type = params[:type]
|
@type = params[:type]
|
||||||
@limit = 25
|
@limit = 25
|
||||||
@path = user_resource_user_path(User.current, :type => @type)
|
@path = user_resource_user_path(User.current, :type => @type)
|
||||||
|
@ -1932,9 +1961,39 @@ class UsersController < ApplicationController
|
||||||
else
|
else
|
||||||
@flag=true
|
@flag=true
|
||||||
end
|
end
|
||||||
|
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
|
||||||
|
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||||
|
user_project_ids = User.current.projects.map {|p| p.id}
|
||||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||||
|
if params[:status] == "2"
|
||||||
|
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
|
||||||
|
elsif params[:status] == "3"
|
||||||
|
@attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
|
||||||
|
elsif params[:status] == "4"
|
||||||
|
@attachments = get_attch_resources(params[:id], @order, @score)
|
||||||
|
elsif params[:status] == "5"
|
||||||
|
@attachments = get_principal_resources(params[:id], @order, @score)
|
||||||
|
else
|
||||||
|
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||||
|
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
|
||||||
|
end
|
||||||
|
elsif params[:type] == "6" # 公共资源
|
||||||
|
if params[:status] == "2"
|
||||||
|
@attachments = get_course_resources_public( user_course_ids, @order, @score)
|
||||||
|
elsif params[:status] == "3"
|
||||||
|
@attachments = get_project_resources_public(user_project_ids, @order, @score)
|
||||||
|
elsif params[:status] == "4"
|
||||||
|
@attachments = get_attch_resources_public(@order, @score)
|
||||||
|
elsif params[:status] == "5"
|
||||||
|
@attachments = get_principal_resources_public(@order, @score)
|
||||||
|
else
|
||||||
|
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||||
|
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@status = params[:status]
|
||||||
@type = params[:type]
|
@type = params[:type]
|
||||||
@limit = 25
|
@limit = 25
|
||||||
@path = user_resource_user_path(User.current, :type => @type)
|
@path = user_resource_user_path(User.current, :type => @type)
|
||||||
|
@ -2031,9 +2090,38 @@ class UsersController < ApplicationController
|
||||||
else
|
else
|
||||||
@flag=true
|
@flag=true
|
||||||
end
|
end
|
||||||
|
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
|
||||||
|
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||||
|
user_project_ids = User.current.projects.map {|p| p.id}
|
||||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||||
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||||
|
if params[:status] == "2"
|
||||||
|
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
|
||||||
|
elsif params[:status] == "3"
|
||||||
|
@attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
|
||||||
|
elsif params[:status] == "4"
|
||||||
|
@attachments = get_attch_resources(params[:id], @order, @score)
|
||||||
|
elsif params[:status] == "5"
|
||||||
|
@attachments = get_principal_resources(params[:id], @order, @score)
|
||||||
|
else
|
||||||
|
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||||
|
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
|
||||||
|
end
|
||||||
|
elsif params[:type] == "6" # 公共资源
|
||||||
|
if params[:status] == "2"
|
||||||
|
@attachments = get_course_resources_public( user_course_ids, @order, @score)
|
||||||
|
elsif params[:status] == "3"
|
||||||
|
@attachments = get_project_resources_public(user_project_ids, @order, @score)
|
||||||
|
elsif params[:status] == "4"
|
||||||
|
@attachments = get_attch_resources_public(@order, @score)
|
||||||
|
elsif params[:status] == "5"
|
||||||
|
@attachments = get_principal_resources_public(@order, @score)
|
||||||
|
else
|
||||||
|
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||||
|
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
|
||||||
|
end
|
||||||
|
end
|
||||||
@type = params[:type]
|
@type = params[:type]
|
||||||
@limit = 25
|
@limit = 25
|
||||||
@path = user_resource_user_path(User.current, :type => @type)
|
@path = user_resource_user_path(User.current, :type => @type)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<%= form_tag add_exist_file_to_course_user_path(user, :type => defined? type ? "6" : type ),:remote=>true,:id=>'course_list_form' do %>
|
|
||||||
|
<%= form_tag add_exist_file_to_course_user_path(user, :type => defined?(type) ? type : "6" ),:remote=>true,:id=>'course_list_form' do %>
|
||||||
<div>
|
<div>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||||
|
@ -15,6 +16,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
<div class="courseSendSubmit">
|
<div class="courseSendSubmit">
|
||||||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
<div class="courseSendSubmit">
|
<div class="courseSendSubmit">
|
||||||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
<div class="courseSendSubmit">
|
<div class="courseSendSubmit">
|
||||||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<%= form_tag add_exist_file_to_org_user_path(user, :type => defined? type ? "6" : type),:remote=>true,:id=>'orgs_list_form' do %>
|
<%= form_tag add_exist_file_to_org_user_path(user, :type => defined?(type) ? type : "6" ),:remote=>true,:id=>'orgs_list_form' do %>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||||
<div class="sectionWrap fl mr15">
|
<div class="sectionWrap fl mr15">
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<%= form_tag add_exist_file_to_project_user_path(user, :type => defined? type ? "6" : type), :remote => true, :id => 'projects_list_form' %>
|
<%= form_tag add_exist_file_to_project_user_path(user, :type => defined?(type) ? type : "6" ), :remote => true, :id => 'projects_list_form' %>
|
||||||
<div>
|
<div>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||||
|
@ -15,6 +15,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
<div class="courseSendSubmit">
|
<div class="courseSendSubmit">
|
||||||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
<%= form_tag share_message_to_project_user_path(user), :remote => true, :id=>'projects_list_form' %>
|
<%= form_tag share_message_to_project_user_path(user), :remote => true, :id => 'projects_list_form' %>
|
||||||
<div>
|
<div>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
<%= hidden_field_tag(:send_ids, send_ids) %>
|
<%= hidden_field_tag(:send_ids, send_ids) %>
|
||||||
<div class="courseReferContainer">
|
<div class="courseReferContainer">
|
||||||
<% if !projects.empty? %>
|
<% if !projects.empty? %>
|
||||||
<% projects.each do |project| %>
|
<% projects.each do |project| %>
|
||||||
<ul class="courseSend">
|
<ul class="courseSend">
|
||||||
<li class="" style="display:inline-block">
|
<li class="" style="display:inline-block">
|
||||||
<input name="project_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
|
<input name="project_ids[]" type="checkbox" value="<%= project.id %>" class="courseSendCheckbox"/>
|
||||||
</li>
|
</li>
|
||||||
<li class="sendCourseName"><%= project.name%></li>
|
<li class="sendCourseName"><%= project.name %></li>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
</div>
|
||||||
<div class="courseSendSubmit">
|
<div class="cl"></div>
|
||||||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
<div>
|
||||||
<%= submit_tag '确定',:class=>'sendSourceText',:onfocus=>'this.blur();' %>
|
<div class="courseSendSubmit">
|
||||||
</div>
|
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||||
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
|
<%= submit_tag '确定', :class => 'sendSourceText', :onfocus => 'this.blur();' %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="courseSendCancel">
|
||||||
<% end %>
|
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a></div>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
|
@ -15,6 +15,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
<div class="courseSendSubmit">
|
<div class="courseSendSubmit">
|
||||||
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
<!--<a href="javascript:void(0);" class="sendSourceText">确定</a>-->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="boxContainer">
|
<div class="boxContainer" style="height: auto;">
|
||||||
<div>
|
<div>
|
||||||
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
<div class="sendText fl mr10" style="width: auto">发送到</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
@ -8,33 +8,9 @@
|
||||||
<!--<input type="text" name="search" placeholder="输入课程ID或者名称搜索" class="subjectSearch fr" />-->
|
<!--<input type="text" name="search" placeholder="输入课程ID或者名称搜索" class="subjectSearch fr" />-->
|
||||||
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="mt10 mb10 course-search" />
|
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="mt10 mb10 course-search" />
|
||||||
</div>
|
</div>
|
||||||
<%= form_tag send_homework_to_course_user_path(user),:remote=>true,:id=>'choose_course_list_form' %>
|
<div id="send_homework_to_course_form">
|
||||||
<div>
|
<%= render :partial => "users/send_homework_to_course_form", :locals => {:user => user, :courses => courses, :send_id => send_id} %>
|
||||||
<%= hidden_field_tag(:send_id, send_id) %>
|
|
||||||
<div class="courseReferContainer">
|
|
||||||
<% if !courses.empty? %>
|
|
||||||
<% courses.each do |course| %>
|
|
||||||
<ul class="courseSend">
|
|
||||||
<li class="" style="display:inline-block">
|
|
||||||
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
|
|
||||||
</li>
|
|
||||||
<li class="sendCourseName"><%= truncate(course.name,:lendght=>25) + '['+current_time_and_term(course) + ']'%></li>
|
|
||||||
</ul>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
|
||||||
<span id="choose_courses_notice" class="c_red"></span>
|
|
||||||
<div>
|
|
||||||
<div class="courseSendSubmit">
|
|
||||||
<a href="javascript:void(0);" onfocus='this.blur();' onclick="send_submit();" class="sendSourceText">确定</a>
|
|
||||||
</div>
|
|
||||||
<div class="courseSendCancel">
|
|
||||||
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function send_submit() {
|
function send_submit() {
|
||||||
|
@ -58,6 +34,7 @@
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<%= url_for(:controller => 'users', :action => 'choose_user_course') %>'+'?search='+ e.target.value+'&send_id=<%=send_id %>',
|
url: '<%= url_for(:controller => 'users', :action => 'choose_user_course') %>'+'?search='+ e.target.value+'&send_id=<%=send_id %>',
|
||||||
type:'get',
|
type:'get',
|
||||||
|
data: {is_observe:true},
|
||||||
success: function(data){ },
|
success: function(data){ },
|
||||||
beforeSend: function(){ $(this).addClass('ajax-loading'); },
|
beforeSend: function(){ $(this).addClass('ajax-loading'); },
|
||||||
complete: function(){ $(this).removeClass('ajax-loading'); }
|
complete: function(){ $(this).removeClass('ajax-loading'); }
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<%= form_tag send_homework_to_course_user_path(user), :remote => true, :id => 'choose_course_list_form' %>
|
||||||
|
<div>
|
||||||
|
<%= hidden_field_tag(:send_id, send_id) %>
|
||||||
|
<div class="courseReferContainer">
|
||||||
|
<% if !courses.empty? %>
|
||||||
|
<% courses.each do |course| %>
|
||||||
|
<ul class="courseSend">
|
||||||
|
<li class="" style="display:inline-block">
|
||||||
|
<input name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
|
||||||
|
</li>
|
||||||
|
<li class="sendCourseName"><%= truncate(course.name, :lendght => 25) + '['+current_time_and_term(course) + ']' %></li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<span id="choose_courses_notice" class="c_red"></span>
|
||||||
|
<div>
|
||||||
|
<div class="courseSendSubmit">
|
||||||
|
<a href="javascript:void(0);" onfocus='this.blur();' onclick="send_submit();" class="sendSourceText">确定</a>
|
||||||
|
</div>
|
||||||
|
<div class="courseSendCancel">
|
||||||
|
<a href="javascript:void(0);" class="sendSourceText" onclick="hideModal();">取消</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
|
@ -64,36 +64,36 @@
|
||||||
<% when 'Course' %>
|
<% when 'Course' %>
|
||||||
<% case user_activity.act_type.to_s %>
|
<% case user_activity.act_type.to_s %>
|
||||||
<% when 'HomeworkCommon' %>
|
<% when 'HomeworkCommon' %>
|
||||||
<% cache (act) do %>
|
<%# cache (act) do %>
|
||||||
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %>
|
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:course_activity => 0} %>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<% when 'News' %>
|
<% when 'News' %>
|
||||||
<% cache [act, act.comments.count] do %>
|
<%# cache [act, act.comments.count] do %>
|
||||||
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<% when 'Message'%>
|
<% when 'Message'%>
|
||||||
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
|
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
|
||||||
<% when 'Poll' %>
|
<% when 'Poll' %>
|
||||||
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
||||||
<% when 'Course'%>
|
<% when 'Course'%>
|
||||||
<% cache (act) do %>
|
<%# cache (act) do %>
|
||||||
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %>
|
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %>
|
||||||
<%end%>
|
<%# end%>
|
||||||
<% when 'JournalsForMessage'%>
|
<% when 'JournalsForMessage'%>
|
||||||
<%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
<%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% when 'Project' %>
|
<% when 'Project' %>
|
||||||
<% case user_activity.act_type.to_s %>
|
<% case user_activity.act_type.to_s %>
|
||||||
<% when 'Issue' %>
|
<% when 'Issue' %>
|
||||||
<% cache [act, act.journals.count, act.attachments.count] do%>
|
<%# cache [act, act.journals.count, act.attachments.count] do%>
|
||||||
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %>
|
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<% when 'Message' %>
|
<% when 'Message' %>
|
||||||
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
|
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
|
||||||
<% when 'ProjectCreateInfo'%>
|
<% when 'ProjectCreateInfo'%>
|
||||||
<% cache (act) do %>
|
<%# cache (act) do %>
|
||||||
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% when 'Principal' %>
|
<% when 'Principal' %>
|
||||||
<% case user_activity.act_type.to_s %>
|
<% case user_activity.act_type.to_s %>
|
||||||
|
@ -103,12 +103,12 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% when 'Blog'%>
|
<% when 'Blog'%>
|
||||||
<% cache (act) do %>
|
<%# cache (act) do %>
|
||||||
<% case user_activity.act_type.to_s %>
|
<% case user_activity.act_type.to_s %>
|
||||||
<% when 'BlogComment' %>
|
<% when 'BlogComment' %>
|
||||||
<%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
<%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<%# end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
<% if params[:is_observe].nil? %>
|
||||||
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>');
|
$("#ajax-modal").html('<%= escape_javascript( render :partial => 'users/send_homework_to_course', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>');
|
||||||
showModal('ajax-modal', '452px');
|
showModal('ajax-modal', '452px');
|
||||||
$('#ajax-modal').siblings().remove();
|
$('#ajax-modal').siblings().remove();
|
||||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal();' style='margin-left: 435px;' class='resourceClose'></a>");
|
||||||
$('#ajax-modal').parent().css("top","50%").css("left","50%");
|
$('#ajax-modal').parent().css("top","50%").css("left","50%");
|
||||||
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
|
$('#ajax-modal').parent().addClass("popbox").addClass("resourceUploadPopup");
|
||||||
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
|
||||||
|
<% else %>
|
||||||
|
$("#send_homework_to_course_form").html("<%= escape_javascript(render :partial => 'users/send_homework_to_course_form', :locals => {:courses => @course, :user => @user, :send_id => @send_id}) %>");
|
||||||
|
<% end %>
|
|
@ -133,7 +133,6 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="ProResultTable " >
|
<div class="ProResultTable " >
|
||||||
<ul class="ProResultUl " >
|
<ul class="ProResultUl " >
|
||||||
<% logger.error("################################################{test.results}") %>
|
|
||||||
<% test.results.reverse.each_with_index do |x, i| %>
|
<% test.results.reverse.each_with_index do |x, i| %>
|
||||||
<% unless x.nil? %>
|
<% unless x.nil? %>
|
||||||
<li ><span class="w60 T_C">测试<%=test.results.size-i%></span>
|
<li ><span class="w60 T_C">测试<%=test.results.size-i%></span>
|
||||||
|
|
|
@ -1,342 +1,342 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
#
|
#
|
||||||
# Redmine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or
|
# This program is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU General Public License
|
# modify it under the terms of the GNU General Public License
|
||||||
# as published by the Free Software Foundation; either version 2
|
# as published by the Free Software Foundation; either version 2
|
||||||
# of the License, or (at your option) any later version.
|
# of the License, or (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
module Redmine
|
module Redmine
|
||||||
module Pagination
|
module Pagination
|
||||||
class Paginator
|
class Paginator
|
||||||
attr_reader :item_count, :per_page, :page, :page_param
|
attr_reader :item_count, :per_page, :page, :page_param
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
if args.first.is_a?(ActionController::Base)
|
if args.first.is_a?(ActionController::Base)
|
||||||
args.shift
|
args.shift
|
||||||
ActiveSupport::Deprecation.warn "Paginator no longer takes a controller instance as the first argument. Remove it from #new arguments."
|
ActiveSupport::Deprecation.warn "Paginator no longer takes a controller instance as the first argument. Remove it from #new arguments."
|
||||||
end
|
end
|
||||||
item_count, per_page, page, page_param = *args
|
item_count, per_page, page, page_param = *args
|
||||||
|
|
||||||
@item_count = item_count
|
@item_count = item_count
|
||||||
@per_page = per_page
|
@per_page = per_page
|
||||||
page = (page || 1).to_i
|
page = (page || 1).to_i
|
||||||
if page < 1
|
if page < 1
|
||||||
page = 1
|
page = 1
|
||||||
end
|
end
|
||||||
@page = page
|
@page = page
|
||||||
@page_param = page_param || :page
|
@page_param = page_param || :page
|
||||||
end
|
end
|
||||||
|
|
||||||
def offset
|
def offset
|
||||||
(page - 1) * per_page
|
(page - 1) * per_page
|
||||||
end
|
end
|
||||||
|
|
||||||
## fq
|
## fq
|
||||||
def reverse_offset
|
def reverse_offset
|
||||||
offset = @item_count-@per_page*page
|
offset = @item_count-@per_page*page
|
||||||
if offset < 0
|
if offset < 0
|
||||||
offset = 0
|
offset = 0
|
||||||
end
|
end
|
||||||
offset
|
offset
|
||||||
end
|
end
|
||||||
## end
|
## end
|
||||||
|
|
||||||
|
|
||||||
def first_page
|
def first_page
|
||||||
if item_count > 0
|
if item_count > 0
|
||||||
1
|
1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def previous_page
|
def previous_page
|
||||||
if page > 1
|
if page > 1
|
||||||
page - 1
|
page - 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def next_page
|
def next_page
|
||||||
if last_item < item_count
|
if last_item < item_count
|
||||||
page + 1
|
page + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_page
|
def last_page
|
||||||
if item_count > 0
|
if item_count > 0
|
||||||
(item_count - 1) / per_page + 1
|
(item_count - 1) / per_page + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def first_item
|
def first_item
|
||||||
item_count == 0 ? 0 : (offset + 1)
|
item_count == 0 ? 0 : (offset + 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_item
|
def last_item
|
||||||
l = first_item + per_page - 1
|
l = first_item + per_page - 1
|
||||||
l > item_count ? item_count : l
|
l > item_count ? item_count : l
|
||||||
end
|
end
|
||||||
|
|
||||||
def linked_pages
|
def linked_pages
|
||||||
pages = []
|
pages = []
|
||||||
if item_count > 0
|
if item_count > 0
|
||||||
pages += [first_page, page, last_page]
|
pages += [first_page, page, last_page]
|
||||||
pages += ((page-2)..(page+2)).to_a.select {|p| p > first_page && p < last_page}
|
pages += ((page-2)..(page+2)).to_a.select {|p| p > first_page && p < last_page}
|
||||||
end
|
end
|
||||||
pages = pages.compact.uniq.sort
|
pages = pages.compact.uniq.sort
|
||||||
if pages.size > 1
|
if pages.size > 1
|
||||||
pages
|
pages
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def items_per_page
|
def items_per_page
|
||||||
ActiveSupport::Deprecation.warn "Paginator#items_per_page will be removed. Use #per_page instead."
|
ActiveSupport::Deprecation.warn "Paginator#items_per_page will be removed. Use #per_page instead."
|
||||||
per_page
|
per_page
|
||||||
end
|
end
|
||||||
|
|
||||||
def current
|
def current
|
||||||
ActiveSupport::Deprecation.warn "Paginator#current will be removed. Use .offset instead of .current.offset."
|
ActiveSupport::Deprecation.warn "Paginator#current will be removed. Use .offset instead of .current.offset."
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Paginates the given scope or model. Returns a Paginator instance and
|
# Paginates the given scope or model. Returns a Paginator instance and
|
||||||
# the collection of objects for the current page.
|
# the collection of objects for the current page.
|
||||||
#
|
#
|
||||||
# Options:
|
# Options:
|
||||||
# :parameter name of the page parameter
|
# :parameter name of the page parameter
|
||||||
#
|
#
|
||||||
# Examples:
|
# Examples:
|
||||||
# @user_pages, @users = paginate User.where(:status => 1)
|
# @user_pages, @users = paginate User.where(:status => 1)
|
||||||
#
|
#
|
||||||
def paginate(scope, options={})
|
def paginate(scope, options={})
|
||||||
options = options.dup
|
options = options.dup
|
||||||
finder_options = options.extract!(
|
finder_options = options.extract!(
|
||||||
:conditions,
|
:conditions,
|
||||||
:order,
|
:order,
|
||||||
:joins,
|
:joins,
|
||||||
:include,
|
:include,
|
||||||
:select
|
:select
|
||||||
)
|
)
|
||||||
if scope.is_a?(Symbol) || finder_options.values.compact.any?
|
if scope.is_a?(Symbol) || finder_options.values.compact.any?
|
||||||
return deprecated_paginate(scope, finder_options, options)
|
return deprecated_paginate(scope, finder_options, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
paginator = paginator(scope.count, options)
|
paginator = paginator(scope.count, options)
|
||||||
collection = scope.limit(paginator.per_page).offset(paginator.offset).to_a
|
collection = scope.limit(paginator.per_page).offset(paginator.offset).to_a
|
||||||
|
|
||||||
return paginator, collection
|
return paginator, collection
|
||||||
end
|
end
|
||||||
|
|
||||||
def deprecated_paginate(arg, finder_options, options={})
|
def deprecated_paginate(arg, finder_options, options={})
|
||||||
ActiveSupport::Deprecation.warn "#paginate with a Symbol and/or find options is depreceted and will be removed. Use a scope instead."
|
ActiveSupport::Deprecation.warn "#paginate with a Symbol and/or find options is depreceted and will be removed. Use a scope instead."
|
||||||
klass = arg.is_a?(Symbol) ? arg.to_s.classify.constantize : arg
|
klass = arg.is_a?(Symbol) ? arg.to_s.classify.constantize : arg
|
||||||
scope = klass.scoped(finder_options)
|
scope = klass.scoped(finder_options)
|
||||||
paginate(scope, options)
|
paginate(scope, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def paginator(item_count, options={})
|
def paginator(item_count, options={})
|
||||||
options.assert_valid_keys :parameter, :per_page
|
options.assert_valid_keys :parameter, :per_page
|
||||||
|
|
||||||
page_param = options[:parameter] || :page
|
page_param = options[:parameter] || :page
|
||||||
page = (params[page_param] || 1).to_i
|
page = (params[page_param] || 1).to_i
|
||||||
per_page = options[:per_page] || per_page_option
|
per_page = options[:per_page] || per_page_option
|
||||||
Paginator.new(item_count, per_page, page, page_param)
|
Paginator.new(item_count, per_page, page, page_param)
|
||||||
end
|
end
|
||||||
|
|
||||||
module Helper
|
module Helper
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
# Renders the pagination links for the given paginator.
|
# Renders the pagination links for the given paginator.
|
||||||
#
|
#
|
||||||
# Options:
|
# Options:
|
||||||
# :per_page_links if set to false, the "Per page" links are not rendered
|
# :per_page_links if set to false, the "Per page" links are not rendered
|
||||||
#
|
#
|
||||||
def pagination_links_full(*args)
|
def pagination_links_full(*args)
|
||||||
page = ""
|
page = ""
|
||||||
pagination_links_each(*args) do |text, parameters, options|
|
pagination_links_each(*args) do |text, parameters, options|
|
||||||
if block_given?
|
if block_given?
|
||||||
yield text, parameters, options
|
yield text, parameters, options
|
||||||
else
|
else
|
||||||
if args[2][:path].nil?
|
if args[2][:path].nil?
|
||||||
link_to text, params.merge(parameters), options
|
link_to text, params.merge(parameters), options
|
||||||
else
|
else
|
||||||
page = "&page" + parameters[:page].to_s unless parameters[:page].nil?
|
page = "&page=" + parameters[:page].to_s unless parameters[:page].nil?
|
||||||
link_to text, args[2][:path].to_s + page, options
|
link_to text, args[2][:path].to_s + page, options
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Yields the given block with the text and parameters
|
# Yields the given block with the text and parameters
|
||||||
# for each pagination link and returns a string that represents the links
|
# for each pagination link and returns a string that represents the links
|
||||||
# def pagination_links_each(paginator, count=nil, options={}, &block)
|
# def pagination_links_each(paginator, count=nil, options={}, &block)
|
||||||
# options.assert_valid_keys :per_page_links
|
# options.assert_valid_keys :per_page_links
|
||||||
#
|
#
|
||||||
# per_page_links = options.delete(:per_page_links)
|
# per_page_links = options.delete(:per_page_links)
|
||||||
# per_page_links = false if count.nil?
|
# per_page_links = false if count.nil?
|
||||||
# page_param = paginator.page_param
|
# page_param = paginator.page_param
|
||||||
#
|
#
|
||||||
# html = ''
|
# html = ''
|
||||||
# if paginator.previous_page
|
# if paginator.previous_page
|
||||||
# # \xc2\xab(utf-8) = «
|
# # \xc2\xab(utf-8) = «
|
||||||
# text = "\xc2\xab " + l(:label_previous)
|
# text = "\xc2\xab " + l(:label_previous)
|
||||||
# html << yield(text, {page_param => paginator.previous_page}, :class => 'previous') + ' '
|
# html << yield(text, {page_param => paginator.previous_page}, :class => 'previous') + ' '
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# previous = nil
|
# previous = nil
|
||||||
# paginator.linked_pages.each do |page|
|
# paginator.linked_pages.each do |page|
|
||||||
# if previous && previous != page - 1
|
# if previous && previous != page - 1
|
||||||
# html << content_tag('span', '...', :class => 'spacer') + ' '
|
# html << content_tag('span', '...', :class => 'spacer') + ' '
|
||||||
# end
|
# end
|
||||||
# if page == paginator.page
|
# if page == paginator.page
|
||||||
# html << content_tag('span', page.to_s, :class => 'current page')
|
# html << content_tag('span', page.to_s, :class => 'current page')
|
||||||
# else
|
# else
|
||||||
# html << yield(page.to_s, {page_param => page}, :class => 'page')
|
# html << yield(page.to_s, {page_param => page}, :class => 'page')
|
||||||
# end
|
# end
|
||||||
# html << ' '
|
# html << ' '
|
||||||
# previous = page
|
# previous = page
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# if paginator.next_page
|
# if paginator.next_page
|
||||||
# # \xc2\xbb(utf-8) = »
|
# # \xc2\xbb(utf-8) = »
|
||||||
# text = l(:label_next) + " \xc2\xbb"
|
# text = l(:label_next) + " \xc2\xbb"
|
||||||
# html << yield(text, {page_param => paginator.next_page}, :class => 'next') + ' '
|
# html << yield(text, {page_param => paginator.next_page}, :class => 'next') + ' '
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' '
|
# html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' '
|
||||||
#
|
#
|
||||||
# if per_page_links != false && links = per_page_links(paginator, &block)
|
# if per_page_links != false && links = per_page_links(paginator, &block)
|
||||||
# html << content_tag('span', links.to_s, :class => 'per-page')
|
# html << content_tag('span', links.to_s, :class => 'per-page')
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# html.html_safe
|
# html.html_safe
|
||||||
# end
|
# end
|
||||||
#Added by Nie guanghui
|
#Added by Nie guanghui
|
||||||
#Designed for pagination.
|
#Designed for pagination.
|
||||||
def pagination_links_each(paginator, count=nil, options={}, &block)
|
def pagination_links_each(paginator, count=nil, options={}, &block)
|
||||||
#options.assert_valid_keys :per_page_links
|
#options.assert_valid_keys :per_page_links
|
||||||
|
|
||||||
#per_page_links = options.delete(:per_page_links)
|
#per_page_links = options.delete(:per_page_links)
|
||||||
per_page_links = options[:per_page_links]
|
per_page_links = options[:per_page_links]
|
||||||
remote = options[:remote] ? options[:remote] : false
|
remote = options[:remote] ? options[:remote] : false
|
||||||
flag = options[:flag] ? options[:flag] : false
|
flag = options[:flag] ? options[:flag] : false
|
||||||
per_page_links = false if count.nil?
|
per_page_links = false if count.nil?
|
||||||
page_param = paginator.page_param
|
page_param = paginator.page_param
|
||||||
|
|
||||||
html = ''
|
html = ''
|
||||||
if paginator.previous_page
|
if paginator.previous_page
|
||||||
# \xc2\xab(utf-8) = «
|
# \xc2\xab(utf-8) = «
|
||||||
if flag
|
if flag
|
||||||
text = l(:label_previous)
|
text = l(:label_previous)
|
||||||
else
|
else
|
||||||
text = "\xc2\xab " + l(:label_previous)
|
text = "\xc2\xab " + l(:label_previous)
|
||||||
end
|
end
|
||||||
html << '<li>' << yield(text, {page_param => paginator.previous_page}, :class => 'previous c_blue', :remote => remote) << '</li>' + ' '
|
html << '<li>' << yield(text, {page_param => paginator.previous_page}, :class => 'previous c_blue', :remote => remote) << '</li>' + ' '
|
||||||
end
|
end
|
||||||
unless paginator.previous_page
|
unless paginator.previous_page
|
||||||
if paginator.next_page
|
if paginator.next_page
|
||||||
if flag
|
if flag
|
||||||
text = l(:label_previous)
|
text = l(:label_previous)
|
||||||
else
|
else
|
||||||
text = "\xc2\xab " + l(:label_previous)
|
text = "\xc2\xab " + l(:label_previous)
|
||||||
end
|
end
|
||||||
html << '<li>' << yield(text, {page_param => paginator.previous_page}, :class => 'previous c_blue', :remote => remote) << '</li>' + ' '
|
html << '<li>' << yield(text, {page_param => paginator.previous_page}, :class => 'previous c_blue', :remote => remote) << '</li>' + ' '
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
previous = nil
|
previous = nil
|
||||||
paginator.linked_pages.each do |page|
|
paginator.linked_pages.each do |page|
|
||||||
if previous && previous != page - 1
|
if previous && previous != page - 1
|
||||||
if flag
|
if flag
|
||||||
html << '<li>' << content_tag('a', '...', :class => 'c_blue') << '</li>' + ' '
|
html << '<li>' << content_tag('a', '...', :class => 'c_blue') << '</li>' + ' '
|
||||||
else
|
else
|
||||||
html << '<li>' << content_tag('span', '...', :class => 'spacer ') << '</li>' + ' '
|
html << '<li>' << content_tag('span', '...', :class => 'spacer ') << '</li>' + ' '
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if page == paginator.page
|
if page == paginator.page
|
||||||
if flag
|
if flag
|
||||||
html << '<li class = "wlist_select">' << content_tag('a', page.to_s, :class => 'current-page c_white') << '</li>'
|
html << '<li class = "wlist_select">' << content_tag('a', page.to_s, :class => 'current-page c_white') << '</li>'
|
||||||
else
|
else
|
||||||
html << '<li>' << content_tag('span', page.to_s, :class => 'current-page') << '</li>'
|
html << '<li>' << content_tag('span', page.to_s, :class => 'current-page') << '</li>'
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
html << '<li>' << yield(page.to_s, {page_param => page}, :class => 'page c_blue', :remote => remote) << '</li>'
|
html << '<li>' << yield(page.to_s, {page_param => page}, :class => 'page c_blue', :remote => remote) << '</li>'
|
||||||
end
|
end
|
||||||
html << ' '
|
html << ' '
|
||||||
previous = page
|
previous = page
|
||||||
end
|
end
|
||||||
|
|
||||||
if paginator.next_page
|
if paginator.next_page
|
||||||
if flag
|
if flag
|
||||||
text = l(:label_next)
|
text = l(:label_next)
|
||||||
else
|
else
|
||||||
text = l(:label_next) + " \xc2\xbb"
|
text = l(:label_next) + " \xc2\xbb"
|
||||||
end
|
end
|
||||||
html << '<li>' << yield(text, {page_param => paginator.next_page}, :class => 'next c_blue', :remote => remote) << '</li>' + ' '
|
html << '<li>' << yield(text, {page_param => paginator.next_page}, :class => 'next c_blue', :remote => remote) << '</li>' + ' '
|
||||||
end
|
end
|
||||||
|
|
||||||
unless paginator.next_page
|
unless paginator.next_page
|
||||||
if paginator.previous_page
|
if paginator.previous_page
|
||||||
if flag
|
if flag
|
||||||
text = l(:label_next)
|
text = l(:label_next)
|
||||||
else
|
else
|
||||||
text = l(:label_next) + " \xc2\xbb"
|
text = l(:label_next) + " \xc2\xbb"
|
||||||
end
|
end
|
||||||
html << "<li>" << yield(text, {page_param => paginator.next_page}, :class => 'next c_blue', :remote => remote) << "</li>" + ' '
|
html << "<li>" << yield(text, {page_param => paginator.next_page}, :class => 'next c_blue', :remote => remote) << "</li>" + ' '
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' '
|
# html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' '
|
||||||
#
|
#
|
||||||
# if per_page_links != false && links = per_page_links(paginator, &block)
|
# if per_page_links != false && links = per_page_links(paginator, &block)
|
||||||
# html << content_tag('span', links.to_s, :class => 'per-page')
|
# html << content_tag('span', links.to_s, :class => 'per-page')
|
||||||
# end
|
# end
|
||||||
|
|
||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
# Renders the "Per page" links.
|
# Renders the "Per page" links.
|
||||||
def per_page_links(paginator, &block)
|
def per_page_links(paginator, &block)
|
||||||
values = per_page_options(paginator.per_page, paginator.item_count)
|
values = per_page_options(paginator.per_page, paginator.item_count)
|
||||||
if values.any?
|
if values.any?
|
||||||
links = values.collect do |n|
|
links = values.collect do |n|
|
||||||
if n == paginator.per_page
|
if n == paginator.per_page
|
||||||
content_tag('span', n.to_s)
|
content_tag('span', n.to_s)
|
||||||
else
|
else
|
||||||
yield(n, :per_page => n, paginator.page_param => nil)
|
yield(n, :per_page => n, paginator.page_param => nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
l(:label_display_per_page, links.join(', ')).html_safe
|
l(:label_display_per_page, links.join(', ')).html_safe
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def per_page_options(selected=nil, item_count=nil)
|
def per_page_options(selected=nil, item_count=nil)
|
||||||
options = Setting.per_page_options_array
|
options = Setting.per_page_options_array
|
||||||
if item_count && options.any?
|
if item_count && options.any?
|
||||||
if item_count > options.first
|
if item_count > options.first
|
||||||
max = options.detect {|value| value >= item_count} || item_count
|
max = options.detect {|value| value >= item_count} || item_count
|
||||||
else
|
else
|
||||||
max = item_count
|
max = item_count
|
||||||
end
|
end
|
||||||
options = options.select {|value| value <= max || value == selected}
|
options = options.select {|value| value <= max || value == selected}
|
||||||
end
|
end
|
||||||
if options.empty? || (options.size == 1 && options.first == selected)
|
if options.empty? || (options.size == 1 && options.first == selected)
|
||||||
[]
|
[]
|
||||||
else
|
else
|
||||||
options
|
options
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1221,3 +1221,20 @@ function clear_data(k,mdu){
|
||||||
$("#e_tip").html("");
|
$("#e_tip").html("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function expand_reply(container,btnid){
|
||||||
|
var target = $(container);
|
||||||
|
var btn = $(btnid);
|
||||||
|
if(btn.data('init')=='0'){
|
||||||
|
btn.data('init',1);
|
||||||
|
btn.html('收起回复');
|
||||||
|
target.show();
|
||||||
|
}else{
|
||||||
|
btn.data('init',0);
|
||||||
|
btn.html('展开更多');
|
||||||
|
target.hide();
|
||||||
|
target.eq(0).show();
|
||||||
|
target.eq(1).show();
|
||||||
|
target.eq(2).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -497,7 +497,7 @@ a.uploadIcon {background:url(images/resource_icon_list.png) 8px -60px no-repeat;
|
||||||
.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
|
.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
|
||||||
.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;}
|
.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;}
|
||||||
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
|
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
|
||||||
.boxContainer {height:33px; line-height:33px; position:relative}
|
.boxContainer {height:auto; line-height:33px; position:relative}
|
||||||
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
|
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
|
||||||
.resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;}
|
.resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;}
|
||||||
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
|
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
|
||||||
|
@ -1482,7 +1482,7 @@ a.choose-active {background-color:#269ac9; color:#ffffff;}
|
||||||
.subject-list-count {width:60px; text-align:center;}
|
.subject-list-count {width:60px; text-align:center;}
|
||||||
.subject-list-from {width:145px; text-align:center;}
|
.subject-list-from {width:145px; text-align:center;}
|
||||||
|
|
||||||
/*视频播放默认图标*/
|
/*视频播放默认图标*/
|
||||||
.mediaIco{margin: 30px 0 30px 20px;width: 200px;}
|
.mediaIco{margin: 30px 0 30px 20px;width: 200px;}
|
||||||
a.st_up{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;}
|
a.st_up{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 0 no-repeat; margin-top:5px; margin-left:3px;}
|
||||||
a.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;}
|
a.st_down{ display: block; width:8px; float:left; height:13px; background:url(../images/pic_up.png) 0 -22px no-repeat; margin-top:5px; margin-left:3px;}
|
||||||
|
|
|
@ -450,7 +450,7 @@ a:hover.search_btn{ background: #0fa9bb;}
|
||||||
.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
|
.resourceSharePopup {width:300px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-150px; z-index:1000;}
|
||||||
.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;}
|
.sendText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; width:110px; display:inline-block; font-weight: bold;}
|
||||||
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
|
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
|
||||||
.boxContainer {height:33px; line-height:33px; position:relative}
|
.boxContainer {height:auto; line-height:33px; position:relative}
|
||||||
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
|
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
|
||||||
.resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;}
|
.resourcePopupClose {width:20px; height:20px; display:inline-block; float:right;}
|
||||||
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
|
.resourceClose {background:url(images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000;}
|
||||||
|
|
Loading…
Reference in New Issue