active_blog 0.0.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. data/README.markdown +11 -1
  2. data/app/assets/javascripts/active_blog/active_admin.js +23 -0
  3. data/app/assets/stylesheets/active_blog/active_admin.css.scss +21 -0
  4. data/app/assets/stylesheets/active_blog/application.css +2 -1
  5. data/app/assets/stylesheets/active_blog/blog_posts.css +8 -0
  6. data/app/controllers/active_blog/blog_posts_controller.rb +33 -2
  7. data/app/helpers/active_blog/application_helper.rb +27 -4
  8. data/app/helpers/active_blog/blog_posts_helper.rb +27 -1
  9. data/app/models/active_blog/blog_post.rb +30 -38
  10. data/app/views/active_blog/active_admin/_blog_post_form.html.erb +16 -0
  11. data/app/views/active_blog/active_admin/_blog_post_show.html.erb +18 -0
  12. data/app/views/active_blog/active_admin/_show.html.erb +2 -0
  13. data/app/views/active_blog/blog_posts/_blog_post.html.erb +32 -0
  14. data/app/views/active_blog/blog_posts/_blog_post_schema.html.erb +5 -0
  15. data/app/views/active_blog/blog_posts/_sidebar.html.erb +11 -0
  16. data/app/views/active_blog/blog_posts/archives.html.erb +12 -0
  17. data/app/views/active_blog/blog_posts/atom.xml.builder +21 -0
  18. data/app/views/active_blog/blog_posts/index.html.erb +18 -13
  19. data/app/views/active_blog/blog_posts/preview.js.erb +1 -0
  20. data/app/views/active_blog/blog_posts/show.html.erb +7 -10
  21. data/db/migrate/20111116040223_create_active_blog_blog_posts.rb +3 -2
  22. data/lib/active_blog/ext/string.rb +39 -0
  23. data/lib/active_blog/mapper.rb +13 -2
  24. data/lib/active_blog/version.rb +1 -1
  25. data/lib/active_blog.rb +25 -4
  26. data/lib/generators/active_blog/install/install_generator.rb +4 -0
  27. data/lib/generators/active_blog/install/templates/README +17 -0
  28. data/lib/generators/active_blog/install/templates/active_blog.rb +18 -3
  29. data/lib/generators/active_blog/install/templates/blog_posts.rb +3 -8
  30. data/test/dummy/config/application.rb +1 -0
  31. data/test/dummy/config/routes.rb +2 -0
  32. data/test/dummy/db/development.sqlite3 +0 -0
  33. data/test/dummy/db/schema.rb +5 -1
  34. data/test/dummy/db/test.sqlite3 +0 -0
  35. data/test/dummy/log/development.log +74 -0
  36. data/test/dummy/log/test.log +1252 -0
  37. data/test/functional/active_blog/blog_posts_controller_test.rb +9 -9
  38. data/test/functional/active_blog/routing_test.rb +25 -0
  39. data/test/unit/active_blog/blog_post_test.rb +32 -3
  40. data/test/unit/active_blog/sample_renderer_test.rb +22 -0
  41. metadata +40 -14
@@ -1,7 +1,22 @@
1
1
  ActiveBlog.setup do |config|
2
- # Name of your blog.
3
- # config.blog_title = "Your Blog Title"
2
+ # Title of your blog.
3
+ # config.title = "Your Blog Title"
4
+
5
+ # Description
6
+ # config.description = "Your Blog Description"
7
+
8
+ # Blog author's name
9
+ # config.author_name = "John Doe"
10
+
11
+ # Blog author's URI
12
+ # config.author_name = "http://example.com"
13
+
14
+ # Blog author's email
15
+ # config.author_email = "mchung@example.com"
4
16
 
5
17
  # Assuming your layout has a sidebar, active_blog will yield via content_for.
6
- # config.blog_content_for_sidebar = :sidebar
18
+ # config.content_for_sidebar = :sidebar
19
+
20
+ # Blog posts per page
21
+ # config.paginates_per = 10
7
22
  end
@@ -1,11 +1,6 @@
1
1
  ActiveAdmin.register ActiveBlog::BlogPost do
2
- form do |f|
3
- f.inputs "New Blog" do
4
- f.input :title
5
- f.input :body, :as => :text
6
- f.input :draft, :as => :boolean
7
- f.input :published_at, :label => "Publish post at"
8
- end
9
- f.buttons
2
+ form :partial => 'active_blog/active_admin/blog_post_form'
3
+ show :title => :title do
4
+ render 'active_blog/active_admin/show'
10
5
  end
11
6
  end
@@ -4,6 +4,7 @@ require 'rails/all'
4
4
 
5
5
  Bundler.require
6
6
  require "active_blog"
7
+ require "kaminari" # Load this manually.
7
8
 
8
9
  module Dummy
9
10
  class Application < Rails::Application
@@ -1,4 +1,6 @@
1
1
  Dummy::Application.routes.draw do
2
+ active_blog_at '/blog'
3
+
2
4
  # The priority is based upon order of creation:
3
5
  # first created -> highest priority.
4
6
 
Binary file
@@ -15,13 +15,17 @@ ActiveRecord::Schema.define(:version => 20111116040223) do
15
15
 
16
16
  create_table "active_blog_blog_posts", :force => true do |t|
17
17
  t.string "title"
18
- t.string "body"
18
+ t.text "body"
19
19
  t.boolean "draft"
20
20
  t.datetime "published_at"
21
21
  t.string "cached_slug"
22
22
  t.string "custom_url"
23
+ t.integer "user_id"
23
24
  t.datetime "created_at"
24
25
  t.datetime "updated_at"
25
26
  end
26
27
 
28
+ add_index "active_blog_blog_posts", ["cached_slug"], :name => "index_active_blog_blog_posts_on_cached_slug", :unique => true
29
+ add_index "active_blog_blog_posts", ["id"], :name => "index_active_blog_blog_posts_on_id"
30
+
27
31
  end
Binary file
@@ -22,3 +22,77 @@ Migrating to CreateActiveBlogBlogPosts (20111116040223)
22
22
   (0.2ms) select sqlite_version(*)
23
23
   (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
24
24
   (0.0ms) PRAGMA index_list("active_blog_blog_posts")
25
+  (0.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
26
+ Migrating to CreateActiveBlogBlogPosts (20111116040223)
27
+  (0.2ms) select sqlite_version(*)
28
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
29
+  (0.0ms) PRAGMA index_list("active_blog_blog_posts")
30
+  (0.4ms) select sqlite_version(*)
31
+  (1.8ms) DROP TABLE "active_blog_blog_posts"
32
+  (0.8ms) CREATE TABLE "active_blog_blog_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "draft" boolean, "published_at" datetime, "cached_slug" varchar(255), "custom_url" varchar(255), "created_at" datetime, "updated_at" datetime) 
33
+  (0.1ms) SELECT version FROM "schema_migrations"
34
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
35
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
36
+ Migrating to CreateActiveBlogBlogPosts (20111116040223)
37
+  (0.2ms) select sqlite_version(*)
38
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
39
+  (0.0ms) PRAGMA index_list("active_blog_blog_posts")
40
+  (0.4ms) select sqlite_version(*)
41
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
42
+  (0.0ms) PRAGMA index_list("active_blog_blog_posts")
43
+  (0.2ms) select sqlite_version(*)
44
+  (1.2ms) CREATE TABLE "active_blog_blog_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" varchar(255), "draft" boolean, "published_at" datetime, "cached_slug" varchar(255), "custom_url" varchar(255), "created_at" datetime, "updated_at" datetime) 
45
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
46
+  (0.0ms) PRAGMA index_list("schema_migrations")
47
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
48
+  (0.1ms) SELECT version FROM "schema_migrations"
49
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20111116040223')
50
+  (0.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
51
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
52
+ Migrating to CreateActiveBlogBlogPosts (20111116040223)
53
+  (0.0ms) select sqlite_version(*)
54
+  (0.1ms) PRAGMA index_list("active_blog_blog_posts")
55
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
56
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
57
+ Migrating to CreateActiveBlogBlogPosts (20111116040223)
58
+  (0.0ms) select sqlite_version(*)
59
+  (0.1ms) PRAGMA index_list("active_blog_blog_posts")
60
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
61
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
62
+ Migrating to CreateActiveBlogBlogPosts (20111116040223)
63
+  (0.0ms) select sqlite_version(*)
64
+  (0.1ms) PRAGMA index_list("active_blog_blog_posts")
65
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
66
+  (0.1ms) PRAGMA index_list("active_blog_blog_posts")
67
+  (0.1ms) select sqlite_version(*)
68
+  (2.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
69
+  (0.0ms) PRAGMA index_list("schema_migrations")
70
+  (1.7ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
71
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
72
+ Migrating to CreateActiveBlogBlogPosts (20111116040223)
73
+  (0.5ms) CREATE TABLE "active_blog_blog_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "draft" boolean, "published_at" datetime, "cached_slug" varchar(255), "custom_url" varchar(255), "user_id" integer, "created_at" datetime, "updated_at" datetime)
74
+  (0.0ms) PRAGMA index_list("active_blog_blog_posts")
75
+  (0.1ms) CREATE INDEX "index_active_blog_blog_posts_on_id" ON "active_blog_blog_posts" ("id")
76
+  (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111116040223')
77
+  (0.3ms) select sqlite_version(*)
78
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
79
+  (0.1ms) PRAGMA index_list("active_blog_blog_posts")
80
+  (0.0ms) PRAGMA index_info('index_active_blog_blog_posts_on_id')
81
+  (0.1ms) select sqlite_version(*)
82
+  (2.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
83
+  (0.1ms) PRAGMA index_list("schema_migrations")
84
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
85
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
86
+ Migrating to CreateActiveBlogBlogPosts (20111116040223)
87
+  (0.8ms) CREATE TABLE "active_blog_blog_posts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "title" varchar(255), "body" text, "draft" boolean, "published_at" datetime, "cached_slug" varchar(255), "custom_url" varchar(255), "user_id" integer, "created_at" datetime, "updated_at" datetime)
88
+  (0.1ms) PRAGMA index_list("active_blog_blog_posts")
89
+  (0.2ms) CREATE INDEX "index_active_blog_blog_posts_on_id" ON "active_blog_blog_posts" ("id")
90
+  (0.1ms) PRAGMA index_list("active_blog_blog_posts")
91
+  (0.1ms) PRAGMA index_info('index_active_blog_blog_posts_on_id')
92
+  (0.5ms) CREATE UNIQUE INDEX "index_active_blog_blog_posts_on_cached_slug" ON "active_blog_blog_posts" ("cached_slug")
93
+  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20111116040223')
94
+  (0.3ms) select sqlite_version(*)
95
+  (0.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
96
+  (0.1ms) PRAGMA index_list("active_blog_blog_posts")
97
+  (0.1ms) PRAGMA index_info('index_active_blog_blog_posts_on_cached_slug')
98
+  (0.0ms) PRAGMA index_info('index_active_blog_blog_posts_on_id')