diff --git a/app/models/book.rb b/app/models/book.rb index e7c987f..6ce36cf 100644 --- a/app/models/book.rb +++ b/app/models/book.rb @@ -39,6 +39,8 @@ class Book before_validation :add_http + scope :sort_for_frontend, ->{ where(:is_hidden=>false).order_by(:year => "desc", :publish_date => "desc") } + def create_link title = [] # title << self.member_profile.name if self.member_profile.present? diff --git a/app/views/admin/books/_form.html.erb b/app/views/admin/books/_form.html.erb index 19adeb5..347bbb7 100644 --- a/app/views/admin/books/_form.html.erb +++ b/app/views/admin/books/_form.html.erb @@ -223,7 +223,7 @@
- <%= f.datetime_picker :publish_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %> + <%= f.datetime_picker :publish_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD", :value => @book.publish_date, :new_record => @book.new_record? %>
@@ -231,7 +231,7 @@
- <%= f.datetime_picker :publication_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD" %> + <%= f.datetime_picker :publication_date, :no_label => true,:format=>"yyyy/MM/dd", :placeholder=>"YYYY/MM/DD", :value => @book.publication_date, :new_record => @book.new_record? %>