diff --git a/app/models/research.rb b/app/models/research.rb index bc49717..0a72f9a 100644 --- a/app/models/research.rb +++ b/app/models/research.rb @@ -28,6 +28,8 @@ class Research before_validation :add_http + scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:year => "desc", :publish_date => "desc") } + def get_plugin_data(fields_to_show) plugin_datas = [] fields_to_show.each do |field| @@ -53,7 +55,7 @@ class Research } end - plugin_datas = datas.where(:is_hidden=>false).order_by(:year=>'desc').collect do |p| + plugin_datas = datas.sort_for_frontend.collect do |p| pd_data = [] fields_to_show.collect do |t| diff --git a/app/views/admin/researchs/_form.html.erb b/app/views/admin/researchs/_form.html.erb index 1482054..ad2febb 100644 --- a/app/views/admin/researchs/_form.html.erb +++ b/app/views/admin/researchs/_form.html.erb @@ -163,7 +163,7 @@