diff options
23 files changed, 140 insertions, 42 deletions
diff --git a/.travis.yml b/.travis.yml index e21a57e..8af9a9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: ruby +sudo: false +cache: bundler bundler_args: --without development before_script: - "sh -e /etc/init.d/xvfb start" @@ -12,7 +12,8 @@ gem 'mime-types', '1.25.1' group :test do gem 'refinerycms-testing', github: 'refinery/refinerycms' - gem 'poltergeist' + gem 'pry' + gem 'launchy' end # Database Configuration diff --git a/app/assets/stylesheets/refinery/blog/frontend.css.scss b/app/assets/stylesheets/refinery/blog/frontend.css.scss index 59a1180..f520f0c 100644 --- a/app/assets/stylesheets/refinery/blog/frontend.css.scss +++ b/app/assets/stylesheets/refinery/blog/frontend.css.scss @@ -65,7 +65,7 @@ &.flash_notice, &.flash_message { border: 1px solid #00A017; color: #00A017; - background: 7px 7px no-repeat image_url('refinery/blog/icons/accept.png') #E0F5E0; + background: 7px 7px no-repeat image_url('refinery/icons/accept.png') #E0F5E0; } &.flash_notice #flash_close, &.flash_error #flash_close { text-transform: lowercase; @@ -88,7 +88,7 @@ &.flash_error { border: 1px solid #A00027; color: #A00027; - background: 7px 7px no-repeat image_url('refinery/blog/icons/cancel.png') #FFB1B1; + background: 7px 7px no-repeat image_url('refinery/icons/cancel.png') #FFB1B1; a { &, &:hover { display: none; diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 63d6f34..da5b86e 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -36,7 +36,17 @@ zh-CN: posts: form: toggle_advanced_options: 点击进入标签详解设置和菜单选项 - published_at: 发布日期 + published_at: 公布日期 + custom_url: 自设网址 + custom_url_help: 由此字句生成网志发帖,而非从标题 + source_url: 来源网站 + source_url_help: 记录发帖来源 + source_url_title: 网址来源标题 + source_url_title_help: 发帖的来源网址标题 + author: 作者 + author_help: 设定此用者成为作者 + copy_body: 复制发帖内容至前言 + copy_body_help: '复制发帖内容至前言,前言留白让系统自动生成前言。' index: no_items_yet: '目前尚未发博。 点击 "%{create}" 添加您的第一篇博文。' uncategorized: @@ -74,6 +84,7 @@ zh-CN: moderation: 等待审核 update_notified: 更新获得通知的人 comments: 评论 + teasers: 前言 comment_mailer: notification: greeting: 您好 @@ -99,6 +110,8 @@ zh-CN: singular: 评论 none: 没有评论 archives: 档案 + tags: + title: "标签" categories: show: no_posts: 此处没有文章。 @@ -124,3 +137,21 @@ zh-CN: archive: blog_archive_for: '博客存档 %{date}' no_blog_articles_posted: '没有发布文章 %{date}。敬请关注。' + + activerecord: + models: + refinery/blog/category: 分类 + refinery/blog/comment: 评论 + refinery/blog/post: 博文发帖 + attributes: + refinery/blog/category: + title: 标题 + refinery/blog/comment: + name: 姓名 + email: 电邮 + message: 信息 + refinery/blog/post: + title: Title + body: 标题 + teaser: 前言 +
\ No newline at end of file diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 6ae1da7..e174a03 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -35,8 +35,18 @@ zh-TW: approve: 批准此評論 posts: form: - toggle_advanced_options: 點擊進入標籤詳解設置和菜單選項 - published_at: 發佈日期 + toggle_advanced_options: 按此存取關鍵字標簽及菜單選項 + published_at: 公佈日期 + custom_url: 自設網址 + custom_url_help: 由此字句生成網誌發帖,而非從標題 + source_url: 來源網站 + source_url_help: 記錄發帖來源 + source_url_title: 網址來源標題 + source_url_title_help: 發帖的來源網址標題 + author: 作者 + author_help: 設定此用者成為作者 + copy_body: 複製發帖內容至前言 + copy_body_help: '複製發帖內容至前言。前言留白讓系統自動生成前言。' index: no_items_yet: '目前尚未發博客。點擊 "%{create}" 添加您的第一篇博客。' uncategorized: @@ -74,6 +84,7 @@ zh-TW: moderation: 等待審核 update_notified: 更新獲得通知的人 comments: 評論 + teasers: 前言 comment_mailer: notification: greeting: 您好 @@ -99,9 +110,11 @@ zh-TW: singular: 評論 none: 没有評論 archives: 檔案 + tags: + title: "標簽" categories: show: - no_posts: 此處沒有文章。 + no_posts: 此處沒有文章。 posts: post: filled_in: 用戶體驗 @@ -115,7 +128,7 @@ zh-TW: no_blog_articles_yet: 尚未發布文章。敬請關注。 show: blog_home: 博客首頁 - by: 作者 + by: 作者 categories: 標簽 category: 標簽 comments: @@ -129,4 +142,19 @@ zh-TW: archive: blog_archive_for: '博客存檔 %{date}' no_blog_articles_posted: '沒有發布文章 %{date}。敬請關注。' -
\ No newline at end of file + activerecord: + models: + refinery/blog/category: 分類 + refinery/blog/comment: 評論 + refinery/blog/post: 博文發帖 + attributes: + refinery/blog/category: + title: 標題 + refinery/blog/comment: + name: 姓名 + email: 電郵 + message: 信息 + refinery/blog/post: + title: Title + body: 標題 + teaser: 前言 diff --git a/db/migrate/20140622132537_add_missing_unique_indices.acts_as_taggable_on_engine.rb b/db/migrate/20140622132537_add_missing_unique_indices.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..4ca676f --- /dev/null +++ b/db/migrate/20140622132537_add_missing_unique_indices.acts_as_taggable_on_engine.rb @@ -0,0 +1,20 @@ +# This migration comes from acts_as_taggable_on_engine (originally 2) +class AddMissingUniqueIndices < ActiveRecord::Migration + def self.up + add_index :tags, :name, unique: true + + remove_index :taggings, :tag_id + remove_index :taggings, [:taggable_id, :taggable_type, :context] + add_index :taggings, + [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type], + unique: true, name: 'taggings_idx' + end + + def self.down + remove_index :tags, :name + + remove_index :taggings, name: 'taggings_idx' + add_index :taggings, :tag_id + add_index :taggings, [:taggable_id, :taggable_type, :context] + end +end diff --git a/db/migrate/20140622132538_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb b/db/migrate/20140622132538_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb new file mode 100644 index 0000000..8edb508 --- /dev/null +++ b/db/migrate/20140622132538_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb @@ -0,0 +1,15 @@ +# This migration comes from acts_as_taggable_on_engine (originally 3) +class AddTaggingsCounterCacheToTags < ActiveRecord::Migration + def self.up + add_column :tags, :taggings_count, :integer, default: 0 + + ActsAsTaggableOn::Tag.reset_column_information + ActsAsTaggableOn::Tag.find_each do |tag| + ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) + end + end + + def self.down + remove_column :tags, :taggings_count + end +end diff --git a/lib/refinery/blog.rb b/lib/refinery/blog.rb index c86f43b..40ecdd6 100644 --- a/lib/refinery/blog.rb +++ b/lib/refinery/blog.rb @@ -1,5 +1,6 @@ require 'refinerycms-core' require 'refinerycms-settings' +require 'refinerycms-wymeditor' require 'filters_spam' require 'rails_autolink' require 'friendly_id' diff --git a/refinerycms-blog.gemspec b/refinerycms-blog.gemspec index 088c549..135ae4a 100644 --- a/refinerycms-blog.gemspec +++ b/refinerycms-blog.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| s.name = %q{refinerycms-blog} - s.version = %q{3.0.0.dev} + s.version = %q{3.0.0} s.description = %q{A really straightforward open source Ruby on Rails blog engine designed for integration with Refinery CMS.} s.summary = %q{Ruby on Rails blogging engine for Refinery CMS.} s.email = %q{info@refinerycms.com} @@ -15,12 +15,13 @@ Gem::Specification.new do |s| s.test_files = `git ls-files -- spec/*`.split("\n") # Runtime dependencies - s.add_dependency 'refinerycms-core', '~> 3.0.0.dev' - s.add_dependency 'refinerycms-settings', '~> 3.0.0.dev' - s.add_dependency 'filters_spam', '~> 0.2' + s.add_dependency 'refinerycms-core', '~> 3.0.0' + s.add_dependency 'refinerycms-settings', '~> 3.0.0' + s.add_dependency 'refinerycms-wymeditor', '~> 1.0.1' + s.add_dependency 'filters_spam', '~> 0.2' s.add_dependency 'acts-as-taggable-on' - s.add_dependency 'seo_meta', '~> 2.0.0.rc.1' - s.add_dependency 'rails_autolink', '~> 1.1.3' - s.add_dependency 'friendly_id', '~> 5.0.0' - s.add_dependency 'globalize', '~> 4.0.0' + s.add_dependency 'seo_meta', '~> 2.0.0.rc.1' + s.add_dependency 'rails_autolink', '~> 1.1.3' + s.add_dependency 'friendly_id', '~> 5.0.0' + s.add_dependency 'globalize', '~> 4.0.0' end diff --git a/spec/controllers/refinery/blog/admin/comments_controller_spec.rb b/spec/controllers/refinery/blog/admin/comments_controller_spec.rb index dc7aef8..9346ff5 100644 --- a/spec/controllers/refinery/blog/admin/comments_controller_spec.rb +++ b/spec/controllers/refinery/blog/admin/comments_controller_spec.rb @@ -3,12 +3,12 @@ require "spec_helper" module Refinery module Blog module Admin - describe CommentsController do + describe CommentsController, type: :controller do refinery_login_with :refinery_user describe "#index" do let!(:comment) { FactoryGirl.create(:blog_comment) } - + it "succeeds" do get :index response.should be_success @@ -43,13 +43,13 @@ module Refinery post :approve, :id => comment.id response.should be_redirect end - + it "approves the comment" do post :approve, :id => comment.id Refinery::Blog::Comment.approved.count.should eq(1) end end - + describe "#rejected" do let!(:comment) { FactoryGirl.create(:rejected_comment) } @@ -72,7 +72,7 @@ module Refinery post :reject, :id => comment.id response.should be_redirect end - + it "rejects the comment" do post :reject, :id => comment.id Refinery::Blog::Comment.rejected.count.should eq(1) diff --git a/spec/controllers/refinery/blog/posts_controller_spec.rb b/spec/controllers/refinery/blog/posts_controller_spec.rb index ee948a5..4b62d53 100644 --- a/spec/controllers/refinery/blog/posts_controller_spec.rb +++ b/spec/controllers/refinery/blog/posts_controller_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" module Refinery module Blog - describe PostsController do + describe PostsController, type: :controller do before do FactoryGirl.create(:blog_post, :title => "blogpost_one") FactoryGirl.create(:blog_post, :title => "blogpost_two") diff --git a/spec/features/refinery/blog/admin/categories_spec.rb b/spec/features/refinery/blog/admin/categories_spec.rb index f3cdc5a..f322562 100644 --- a/spec/features/refinery/blog/admin/categories_spec.rb +++ b/spec/features/refinery/blog/admin/categories_spec.rb @@ -1,7 +1,7 @@ # encoding: utf-8 require 'spec_helper' -describe "Categories admin" do +describe "Categories admin", type: :feature do refinery_login_with :refinery_user let(:title) { "lol" } diff --git a/spec/features/refinery/blog/admin/comments_spec.rb b/spec/features/refinery/blog/admin/comments_spec.rb index 08fe9df..0eb5108 100644 --- a/spec/features/refinery/blog/admin/comments_spec.rb +++ b/spec/features/refinery/blog/admin/comments_spec.rb @@ -3,7 +3,7 @@ require "spec_helper" module Refinery module Blog module Admin - describe Comment do + describe Comment, type: :feature do refinery_login_with :refinery_user describe "#index" do diff --git a/spec/features/refinery/blog/admin/menu_spec.rb b/spec/features/refinery/blog/admin/menu_spec.rb index ba10ffe..3411c6c 100644 --- a/spec/features/refinery/blog/admin/menu_spec.rb +++ b/spec/features/refinery/blog/admin/menu_spec.rb @@ -1,8 +1,8 @@ require 'spec_helper' -describe "Blog menu entry" do +describe "Blog menu entry", type: :feature do refinery_login_with :refinery_user - + it "is highlighted when managing the blog" do visit refinery.admin_root_path diff --git a/spec/features/refinery/blog/admin/posts_spec.rb b/spec/features/refinery/blog/admin/posts_spec.rb index 5dca929..2333ea0 100644 --- a/spec/features/refinery/blog/admin/posts_spec.rb +++ b/spec/features/refinery/blog/admin/posts_spec.rb @@ -4,7 +4,7 @@ require "spec_helper" module Refinery module Blog module Admin - describe Post do + describe Post, type: :feature do refinery_login_with :refinery_user let!(:blog_category) do @@ -49,7 +49,7 @@ module Refinery page.should have_css '.blog_categories' page.should have_css "#post_category_ids_#{blog_category.id}" check blog_category.title - find_field("post_category_ids_#{blog_category.id}").should be_checked + find(:css, "#post_category_ids_#{blog_category.id}").checked?.should be_truthy click_button "Save" page.should have_content("was successfully added.") end diff --git a/spec/features/refinery/blog/categories_spec.rb b/spec/features/refinery/blog/categories_spec.rb index 021dd94..efcf388 100644 --- a/spec/features/refinery/blog/categories_spec.rb +++ b/spec/features/refinery/blog/categories_spec.rb @@ -1,7 +1,7 @@ require "spec_helper" module Refinery - describe "BlogCategories" do + describe "BlogCategories", type: :feature do refinery_login_with :refinery_user context "has one category and post" do diff --git a/spec/features/refinery/blog/posts_spec.rb b/spec/features/refinery/blog/posts_spec.rb index 1fe56bc..daba07e 100644 --- a/spec/features/refinery/blog/posts_spec.rb +++ b/spec/features/refinery/blog/posts_spec.rb @@ -1,7 +1,7 @@ require "spec_helper" module Refinery - describe "Blog::Posts" do + describe "Blog::Posts", type: :feature do refinery_login_with :refinery_user context "when has blog posts" do diff --git a/spec/helpers/refinery/blog/controller_helper_spec.rb b/spec/helpers/refinery/blog/controller_helper_spec.rb index 732f2bd..b9aa6a7 100644 --- a/spec/helpers/refinery/blog/controller_helper_spec.rb +++ b/spec/helpers/refinery/blog/controller_helper_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' module Refinery module Blog - describe ControllerHelper do + describe ControllerHelper, type: :helper do describe "#find_tags" do let(:tags) { helper.find_tags } diff --git a/spec/helpers/refinery/blog/posts_helper_spec.rb b/spec/helpers/refinery/blog/posts_helper_spec.rb index 7087bff..4a791d9 100644 --- a/spec/helpers/refinery/blog/posts_helper_spec.rb +++ b/spec/helpers/refinery/blog/posts_helper_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' module Refinery module Blog describe PostsHelper do - describe "#blog_archive_widget" do + describe "#blog_archive_widget", type: :helper do let(:html) { helper.blog_archive_widget(dates) } let(:links) { Capybara.string(html).find("#blog_archive_widget ul") } diff --git a/spec/models/refinery/blog/category_spec.rb b/spec/models/refinery/blog/category_spec.rb index 9cd5d97..0292991 100644 --- a/spec/models/refinery/blog/category_spec.rb +++ b/spec/models/refinery/blog/category_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' module Refinery module Blog - describe Category do + describe Category, type: :model do let(:category) { FactoryGirl.create(:blog_category) } let(:refinery_user) { FactoryGirl.create(:refinery_user) } diff --git a/spec/models/refinery/blog/comment_spec.rb b/spec/models/refinery/blog/comment_spec.rb index 3a77100..7a35a59 100644 --- a/spec/models/refinery/blog/comment_spec.rb +++ b/spec/models/refinery/blog/comment_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' module Refinery module Blog - describe Comment do + describe Comment, type: :model do context "wiring up" do let(:comment) { FactoryGirl.create(:blog_comment) } diff --git a/spec/models/refinery/blog/post_spec.rb b/spec/models/refinery/blog/post_spec.rb index 99946b8..73668e4 100644 --- a/spec/models/refinery/blog/post_spec.rb +++ b/spec/models/refinery/blog/post_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' module Refinery module Blog - describe Post do + describe Post, type: :model do let(:post) { FactoryGirl.create(:blog_post) } describe "validations" do @@ -159,7 +159,7 @@ module Refinery end it "should be true" do - described_class.comments_allowed?.should be_true + described_class.comments_allowed?.should be_truthy end end @@ -169,7 +169,7 @@ module Refinery end it "should be false" do - described_class.comments_allowed?.should be_false + described_class.comments_allowed?.should be_falsey end end end @@ -187,7 +187,7 @@ module Refinery end it "should be true" do - described_class.teasers_enabled?.should be_true + described_class.teasers_enabled?.should be_truthy end end @@ -197,7 +197,7 @@ module Refinery end it "should be false" do - described_class.teasers_enabled?.should be_false + described_class.teasers_enabled?.should be_falsey end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bc10eff..4b29712 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,8 +19,7 @@ RSpec.configure do |config| end # set javascript driver for capybara -require 'capybara/poltergeist' -Capybara.javascript_driver = :poltergeist +Capybara.javascript_driver = :selenium # Requires supporting files with custom matchers and macros, etc, # in ./support/ and its subdirectories including factories. |