Merge branch 'szzh' of http://git.trustie.net/jacknudt/trustieforge into szzh
This commit is contained in:
commit
28c3dca099
|
@ -39,17 +39,17 @@ class CoursesController < ApplicationController
|
||||||
end
|
end
|
||||||
limit = 15
|
limit = 15
|
||||||
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id)
|
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id)
|
||||||
@orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit)
|
#@orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit)
|
||||||
@org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count
|
#@org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count
|
||||||
# if course_org_ids.empty?
|
if course_org_ids.empty?
|
||||||
# @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
|
@orgs_not_in_course = User.current.organizations.where("name like ?",condition).page((params[:page].to_i || 1)).per(limit)
|
||||||
# @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count
|
@org_count = @orgs_not_in_course.count
|
||||||
# else
|
else
|
||||||
# course_org_ids = "(" + course_org_ids.join(',') + ")"
|
course_org_ids = "(" + course_org_ids.join(',') + ")"
|
||||||
# @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit)
|
@orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids} and organizations.name like ?", condition).page((params[:page].to_i || 1)).per(limit)
|
||||||
# @org_count = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count
|
@org_count = @orgs_not_in_course.empty? ? 0 : @orgs_not_in_course.count
|
||||||
# end
|
end
|
||||||
# @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count
|
@course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count
|
||||||
@orgs_page = Paginator.new @org_count, limit,params[:page]
|
@orgs_page = Paginator.new @org_count, limit,params[:page]
|
||||||
@hint_flag = params[:hint_flag]
|
@hint_flag = params[:hint_flag]
|
||||||
#render :json => {:orgs => @orgs_not_in_course, :count => @org_count}.to_json
|
#render :json => {:orgs => @orgs_not_in_course, :count => @org_count}.to_json
|
||||||
|
|
|
@ -37,7 +37,10 @@
|
||||||
<ul class="mt10">
|
<ul class="mt10">
|
||||||
<%=labelled_form_for @new_course do |f| %>
|
<%=labelled_form_for @new_course do |f| %>
|
||||||
<input name="copy_course" value="<%=@course.id %>" style="display: none"/>
|
<input name="copy_course" value="<%=@course.id %>" style="display: none"/>
|
||||||
<li class="ml45 mb10"> <a href="javascript:void(0)" class="upimg fl"> <img alt="上传图片" id="avatar_image" src="images/courses/pic_courses.jpg" height="60" width="60"> </a> <!--<a href="javascript:void(0)" class="upbtn fl ml30" onclick="$('#upload_course_logo').click();">上传图片</a>-->
|
<li class="ml45 mb10">
|
||||||
|
<a href="javascript:void(0)" class="upimg fl">
|
||||||
|
<%= image_tag(url_to_avatar(@new_course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
|
||||||
|
</a> <!--<a href="javascript:void(0)" class="upbtn fl ml30" onclick="$('#upload_course_logo').click();">上传图片</a>-->
|
||||||
<!--</span>-->
|
<!--</span>-->
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
destroyedItem.fadeOut(600,function(){
|
destroyedItem.fadeOut(600,function(){
|
||||||
destroyedItem.remove();
|
destroyedItem.remove();
|
||||||
});
|
});
|
||||||
|
<% if @jours_count && @jours_count == 0 %>
|
||||||
|
$("#user_jour_list").css("padding","0px");
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<% if @bid && @jours_count %>
|
<% if @bid && @jours_count %>
|
||||||
$('#jours_count').html("<%= @jours_count %>");
|
$('#jours_count').html("<%= @jours_count %>");
|
||||||
|
|
Loading…
Reference in New Issue