This commit is contained in:
Wen 2014-04-23 21:35:03 +08:00
parent 08e40c4a4e
commit cf762e6aa3
2 changed files with 19 additions and 11 deletions

View File

@ -179,11 +179,16 @@ class ProjectsController < ApplicationController
@project_type = params[:project_type]
@school_id = params[:school_id]
per_page_option = 10
@projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
joins(:course_extra).
where("#{Project.table_name}.project_type = ? AND #{Course.table_name}.school_id = ?", Project::ProjectType_course, @school_id)
if @school_id == "0" or @school.nil?
@projects_all = Project.active.visible.
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)
else
@projects_all = Project.active.visible.
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").
joins(:course_extra).
where("#{Project.table_name}.project_type = ? AND #{Course.table_name}.school_id = ?", Project::ProjectType_course, @school_id)
end
@project_count = @projects_all.count
@project_pages = Paginator.new @project_count, per_page_option, params['page']

View File

@ -100,13 +100,16 @@
<div class="welcome_left" >
<span class="font_welcome_trustie">
<% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
<% else %>
<% if params[:school_id].nil? %>
<%= School.find(User.current.user_extensions.school.id).name %>
<br />
<% else%>
<% if params[:school_id] == "0" %>
<% else %>
<%= School.find(params[:school_id]).name %>
<br />
<% if params[:school_id].nil? %>
<%= School.find(User.current.user_extensions.school.id).name %>
<br />
<% else %>
<%= School.find(params[:school_id]).name %>
<br />
<% end %>
<% end %>
<% end %>
<%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> </span><span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span>