Update sort.
This commit is contained in:
parent
2a6f623f3c
commit
b52281f30c
|
@ -1,7 +1,7 @@
|
||||||
class PersonalCertificatesController < ApplicationController
|
class PersonalCertificatesController < ApplicationController
|
||||||
def index
|
def index
|
||||||
params = OrbitHelper.params
|
params = OrbitHelper.params
|
||||||
certificates = Certificate.where(:is_hidden=>false).sort_for_frontend.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
certificates = Certificate.sort_for_frontend.page(OrbitHelper.params[:page_no]).per(OrbitHelper.page_data_count)
|
||||||
fields_to_show = Page.where(:page_id => params[:page_id]).first.custom_array_field rescue []
|
fields_to_show = Page.where(:page_id => params[:page_id]).first.custom_array_field rescue []
|
||||||
|
|
||||||
if fields_to_show.blank?
|
if fields_to_show.blank?
|
||||||
|
|
|
@ -9,7 +9,10 @@ class Certificate
|
||||||
field :title, as: :slug_title, type: String, localize: true
|
field :title, as: :slug_title, type: String, localize: true
|
||||||
|
|
||||||
belongs_to :member_profile
|
belongs_to :member_profile
|
||||||
scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:title =>'asc') }
|
|
||||||
|
index({title: 1, _id: -1}, { unique: false, background: false })
|
||||||
|
scope :sort_title, ->{ order_by(:title => "asc", :id=>"desc") }
|
||||||
|
scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:title =>'asc',:id =>'desc') }
|
||||||
|
|
||||||
def self.get_plugin_datas_to_member(datas)
|
def self.get_plugin_datas_to_member(datas)
|
||||||
page = Page.where(:module => "personal_certificate").first rescue nil
|
page = Page.where(:module => "personal_certificate").first rescue nil
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
<%
|
<%
|
||||||
if has_access?
|
if has_access?
|
||||||
@certificates = Certificate.where(member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
@certificates = Certificate.where(member_profile_id: @member.id).sort_title.page(params[:page]).per(10)
|
||||||
else
|
else
|
||||||
@certificates = Certificate.where(is_hidden: false, member_profile_id: @member.id).desc(:year).page(params[:page]).per(10)
|
@certificates = Certificate.where(is_hidden: false, member_profile_id: @member.id).sort_title.page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue