sort and date fixed

This commit is contained in:
Harry Bomrah 2015-12-02 18:35:40 +08:00
parent ff3dd3f7af
commit 4193303093
2 changed files with 4 additions and 2 deletions

View File

@ -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|

View File

@ -163,7 +163,7 @@
<div class="control-group big-group">
<label class="control-label muted"><%= t("personal_research.publication_date") %></label>
<div class="controls">
<%= f.datetime_picker :publish_date, :no_label => true, :format=>"yyyy/MM" %>
<%= f.datetime_picker :publish_date, :no_label => true, :format=>"yyyy/MM", :value => @research.publish_date, :new_record => @research.new_record? %>
</div>
</div>