Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
0772e04510
|
@ -198,7 +198,7 @@ class ProjectsController < ApplicationController
|
||||||
@project_type = params[:project_type]
|
@project_type = params[:project_type]
|
||||||
@school_id = params[:school_id]
|
@school_id = params[:school_id]
|
||||||
per_page_option = 10
|
per_page_option = 10
|
||||||
if @school_id == "0" or @school.nil?
|
if @school_id == "0" or @school_id.nil?
|
||||||
@projects_all = Project.active.visible.
|
@projects_all = Project.active.visible.
|
||||||
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
|
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
|
||||||
where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course)
|
where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course)
|
||||||
|
|
|
@ -62,33 +62,33 @@ module ProjectsHelper
|
||||||
content_tag('div', content, :class => "tabs_enterprise")
|
content_tag('div', content, :class => "tabs_enterprise")
|
||||||
end
|
end
|
||||||
|
|
||||||
def sort_course(state, project_type)
|
def sort_course(state, project_type, school_id)
|
||||||
content = ''.html_safe
|
content = ''.html_safe
|
||||||
case state
|
case state
|
||||||
when 0
|
when 0
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :school_id => school_id, :class=>"selected"), :class=>"selected")
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
|
||||||
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
|
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
|
||||||
|
|
||||||
when 1
|
when 1
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected")
|
||||||
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
|
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
|
||||||
|
|
||||||
when 2
|
when 2
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
|
||||||
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id)))
|
||||||
|
|
||||||
#gcm
|
#gcm
|
||||||
when 3
|
when 3
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type, :school_id => school_id)))
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
|
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id)))
|
||||||
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
|
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
|
||||||
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type), :class=>"selected"), :class=>"selected")
|
content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected")
|
||||||
end
|
end
|
||||||
#gcmend
|
#gcmend
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,12 @@ module WelcomeHelper
|
||||||
sort_course_by_hot limit
|
sort_course_by_hot limit
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_all_new_hot_course limit = 9
|
||||||
|
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
|
||||||
|
time_now = Time.new.strftime("%Y");
|
||||||
|
Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%'", 1).order("course_ac_para DESC").limit(limit).all
|
||||||
|
end
|
||||||
|
|
||||||
def find_all_hot_bid
|
def find_all_hot_bid
|
||||||
sort_bid_by_hot
|
sort_bid_by_hot
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</table>
|
</table>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<%= sort_course(@s_type, @project_type)%>
|
<%= sort_course(@s_type, @project_type, @school_id)%>
|
||||||
|
|
||||||
<div id="projects-index">
|
<div id="projects-index">
|
||||||
<%= render_project_hierarchy(@projects)%>
|
<%= render_project_hierarchy(@projects)%>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<%= stylesheet_link_tag 'welcome' %>
|
<%= stylesheet_link_tag 'welcome' %>
|
||||||
<%= javascript_include_tag 'welcome' %>
|
<%= javascript_include_tag 'welcome' %>
|
||||||
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html"
|
<script type="text/javascript" language="javascript" xmlns="http://www.w3.org/1999/html"
|
||||||
xmlns="http://www.w3.org/1999/html">
|
xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
$("#main").find("a").attr("target", "_blank");
|
$("#main").find("a").attr("target", "_blank");
|
||||||
|
@ -60,32 +60,24 @@
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
||||||
<h3><strong>新开课程</strong></h3>
|
<h3><strong>新开课程</strong></h3>
|
||||||
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %></span>
|
<% if(find_miracle_course(10, 7,params[:school_id]).map.count == 0) %>
|
||||||
|
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %></span>
|
||||||
<div class="d-p-projectlist-box">
|
<div class="d-p-projectlist-box">
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
<% if(find_miracle_course(10, 7,params[:school_id]).map.count == 0) %>
|
|
||||||
<h1></h1>
|
<h1></h1>
|
||||||
<p id="errorExplanation">
|
<p id="errorExplanation">
|
||||||
该学校未开设任何课程,您可以查看其他学校课程
|
该学校未开设任何课程,您可以查看其他学校课程
|
||||||
</p>
|
</p>
|
||||||
<h1></h1>
|
<h1></h1>
|
||||||
<% find_all_hot_course(9).map do |project| %>
|
<% find_all_new_hot_course(9).map do |project| %>
|
||||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||||
<div class='avatar'>
|
<div class='avatar'>
|
||||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||||
</div>
|
</div>
|
||||||
<!-- 上左下右 -->
|
<!-- 上左下右 -->
|
||||||
<div class='desc_item text_nowrap' >
|
|
||||||
[<%= get_course_term project %>]
|
|
||||||
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
|
||||||
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
|
|
||||||
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
|
||||||
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
|
|
||||||
</div>
|
|
||||||
<div class='desc_item' >
|
<div class='desc_item' >
|
||||||
<span class=''>
|
<span class=''>
|
||||||
<% course = Course.find_by_extra(project.identifier)%>
|
<% course = Course.find_by_extra(project.identifier)%>
|
||||||
|
@ -100,32 +92,40 @@
|
||||||
<%#=course.try(:teacher).try(:name)%>
|
<%#=course.try(:teacher).try(:name)%>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class='desc_item' style="">
|
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||||
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
|
|
||||||
</div> -->
|
|
||||||
<div class='join_course_link'>
|
|
||||||
<% if !course_endTime_timeout?(project)%>
|
|
||||||
<div >
|
|
||||||
<%= join_in_course(project, User.current)%>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
<% else %>
|
|
||||||
<% find_miracle_course(10, 7,params[:school_id]).map do |project| %>
|
|
||||||
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
|
||||||
<div class='avatar'>
|
|
||||||
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
|
||||||
</div>
|
|
||||||
<!-- 上左下右 -->
|
|
||||||
<div class='desc_item text_nowrap' >
|
|
||||||
[<%= get_course_term project %>]
|
[<%= get_course_term project %>]
|
||||||
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||||
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
|
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
|
||||||
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
||||||
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
|
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
|
||||||
</div>
|
</div>
|
||||||
|
<!-- <div class='desc_item' style="">
|
||||||
|
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
|
||||||
|
</div> -->
|
||||||
|
<div>
|
||||||
|
<% if !course_endTime_timeout?(project)%>
|
||||||
|
<div >
|
||||||
|
<%= new_watcher_link(project, User.current)%>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% else %>
|
||||||
|
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %></span>
|
||||||
|
<div class="d-p-projectlist-box">
|
||||||
|
<ul class="d-p-projectlist">
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
<ul class="d-p-projectlist">
|
||||||
|
<% find_miracle_course(10, 7,params[:school_id]).map do |project| %>
|
||||||
|
<li class='<%= cycle("odd", "even") %>' title=<%=project.description.to_s%>>
|
||||||
|
<div class='avatar'>
|
||||||
|
<%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
|
||||||
|
</div>
|
||||||
|
<!-- 上左下右 -->
|
||||||
<div class='desc_item' >
|
<div class='desc_item' >
|
||||||
<span class=''>
|
<span class=''>
|
||||||
<% course = Course.find_by_extra(project.identifier) %>
|
<% course = Course.find_by_extra(project.identifier) %>
|
||||||
|
@ -136,6 +136,13 @@
|
||||||
<%#=course.try(:teacher).try(:name)%>
|
<%#=course.try(:teacher).try(:name)%>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='desc_item text_nowrap' style="width: 310px;">
|
||||||
|
[<%= get_course_term project %>]
|
||||||
|
<%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
|
||||||
|
(<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
|
||||||
|
<% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
|
||||||
|
(<%=link_to "#{files_count}份", project_files_path(project) %>资料)
|
||||||
|
</div>
|
||||||
<!-- <div class='desc_item' style="">
|
<!-- <div class='desc_item' style="">
|
||||||
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
|
<span class='font_lighter' title=<%#=project.description.to_s%>><%#=project.description.truncate(25, omission: '...')%></span>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
@ -148,9 +155,9 @@
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end; reset_cycle %>
|
<% end; reset_cycle %>
|
||||||
<% end %>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject" style="float: right;">
|
||||||
|
|
Loading…
Reference in New Issue