sort and date fixed

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

View File

@ -29,6 +29,8 @@ class Patent
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|
@ -55,7 +57,7 @@ class Patent
}
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

@ -180,7 +180,7 @@
<div class="control-group">
<label class="control-label muted"><%= t("personal_patent.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 => @patent.publish_date, :new_record => @patent.new_record? %>
</div>
</div>