Permalink
Browse files

change published_on to published_at

  • Loading branch information...
1 parent a0dd726 commit 30a9461faaf50495ab3ddf5cbf0510c8b2c25623 @ck3g committed Mar 11, 2013
@@ -33,5 +33,9 @@ $baseLineHeight: 18px;
}
}
+.select-datetime {
+ width: 70px;
+}
+
@import "twitter/bootstrap";
@import "twitter/bootstrap-responsive";
View
@@ -1,7 +1,7 @@
class Article < ActiveRecord::Base
CUTTER = "&lt;cut&gt;"
- attr_accessible :title, :body, :views_count, :tag_list, :published, :published_on
+ attr_accessible :title, :body, :views_count, :tag_list, :published, :published_at
acts_as_commentable
acts_as_taggable
@@ -21,6 +21,6 @@ def self.top_tags(count)
private
def init_defaults
- self.published_on ||= created_at.presence.try(:to_date) || Date.current
+ self.published_at ||= created_at.presence || DateTime.current
end
end
@@ -4,6 +4,6 @@ def initialize(relation = Article)
end
def list
- @relation.order("published_on DESC").scoped
+ @relation.order("published_at DESC").scoped
end
end
@@ -16,7 +16,7 @@ def self.import(legacy_id)
article.user_id = user.id
article.views_count = legacy.hits or 0
article.created_at = legacy.created_at or DateTime.current
- article.published_on = legacy.created_at or DateTime.current
+ article.published_at = legacy.created_at or DateTime.current
article.updated_at = legacy.modified_at or DateTime.current
article.ip_address = legacy.ip_address
@@ -16,7 +16,7 @@
= link_to user_path(article.user) do
= article.user_name || article.user_email
= " @"
- = l article.published_on, format: :long
+ = l article.published_at, format: :long
.article-body
= raw formatted(article.body, params[:action] == "index")
@@ -33,8 +33,4 @@
= "|"
= t("articles.meta.views_count", :views_count => article.views_count)
.spacer
- %br
- -# .fb-like(data-href="#{article_url(article)}" data-send="false" data-layout="button_count" data-width="20" data-show-faces="false")
- -# %a.twitter-share-button(href="https://twitter.com/share" data-url="#{article_url(article)}" data-text="#{article.title}")
- -# Tweet
%hr
@@ -3,7 +3,7 @@
= f.input :title
= f.input :body, as: :ckeditor
= f.input :tag_list, hint: t(:tags_hint)
- = f.input :published_on, input_html: { class: "span2" }, label: Article.human_attribute_name(:published_on)
+ = f.input :published_at, input_html: { class: "select-datetime" }, label: Article.human_attribute_name(:published_at)
= f.input :published, inline_label: true
= render 'hint'
@@ -7,5 +7,5 @@ ru:
article:
title: Заголовок
body: Содержимое новости
- published_on: Дата публикации
+ published_at: Дата публикации
published: Опубликована
@@ -2,6 +2,6 @@ class AddPublishedToArticles < ActiveRecord::Migration
def change
add_column :articles, :published, :boolean, default: true
add_index :articles, :published
- add_column :articles, :published_on, :date
+ add_column :articles, :published_at, :datetime
end
end
View
@@ -23,7 +23,7 @@
t.string "ip_address"
t.integer "legacy_id"
t.boolean "published", :default => true
- t.date "published_on"
+ t.datetime "published_at"
end
add_index "articles", ["ip_address"], :name => "index_articles_on_ip_address"
@@ -17,11 +17,11 @@
end
factory :old_article do
- published_on { 10.days.ago }
+ published_at { 10.days.ago }
end
factory :very_old_article do
- published_on { 20.days.ago }
+ published_at { 20.days.ago }
end
factory :unpublished_article, traits: [:unpublished]

0 comments on commit 30a9461

Please sign in to comment.