filter by categories added

This commit is contained in:
Harry Bomrah 2017-07-07 11:47:16 +08:00
parent 5d72beeb80
commit 5afc74cb83
2 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@ class HpsLearningsController < ApplicationController
def index
table_fields = ["hps_learning.course_pic", "hps_learning.title", :category, "hps_learning.runtime", "hps_learning.lectures"].collect{|x| {"head" => t(x.to_sym)}}
classes = []
HpsClass.all.desc(:created_at).each do |hpsclass|
HpsClass.filter_by_categories.desc(:created_at).each do |hpsclass|
if hpsclass.hps_lectures.count > 0
thumb = hpsclass.course_pic.thumb.url.nil? ? "http://www.placehold.it/150x150/EFEFEF/AAAAAA" : hpsclass.course_pic.thumb.url
classes << {

View File

@ -12,7 +12,7 @@
<% if !clas.course_pic.url.nil? %>
<td><img width="150px" src="<%= clas.course_pic.thumb.url %>" /></td>
<% else %>
<td>&nbsp;</td>
<td><img src="http://www.placehold.it/150x150/EFEFEF/AAAAAA" width="150px"></td>
<% end %>
<td>
<a href="<%= admin_hps_learning_path(clas.id, :page => params[:page]) %>"> <%= clas.title %> </a>