filter by categories added
This commit is contained in:
parent
5d72beeb80
commit
5afc74cb83
|
@ -2,7 +2,7 @@ class HpsLearningsController < ApplicationController
|
||||||
def index
|
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)}}
|
table_fields = ["hps_learning.course_pic", "hps_learning.title", :category, "hps_learning.runtime", "hps_learning.lectures"].collect{|x| {"head" => t(x.to_sym)}}
|
||||||
classes = []
|
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
|
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
|
thumb = hpsclass.course_pic.thumb.url.nil? ? "http://www.placehold.it/150x150/EFEFEF/AAAAAA" : hpsclass.course_pic.thumb.url
|
||||||
classes << {
|
classes << {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<% if !clas.course_pic.url.nil? %>
|
<% if !clas.course_pic.url.nil? %>
|
||||||
<td><img width="150px" src="<%= clas.course_pic.thumb.url %>" /></td>
|
<td><img width="150px" src="<%= clas.course_pic.thumb.url %>" /></td>
|
||||||
<% else %>
|
<% else %>
|
||||||
<td> </td>
|
<td><img src="http://www.placehold.it/150x150/EFEFEF/AAAAAA" width="150px"></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td>
|
<td>
|
||||||
<a href="<%= admin_hps_learning_path(clas.id, :page => params[:page]) %>"> <%= clas.title %> </a>
|
<a href="<%= admin_hps_learning_path(clas.id, :page => params[:page]) %>"> <%= clas.title %> </a>
|
||||||
|
|
Loading…
Reference in New Issue