blogelator 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d14ce517e1d29110676f14ec8b3a9fba4ebb7fb9
4
- data.tar.gz: c8e3828ba05e7bf8f27a590c776e520d172cdfbb
3
+ metadata.gz: a1d100843ab1b8029fd3c2ec08e1944c2cdf20d0
4
+ data.tar.gz: 5a823a7958fd4f61619864752a20a4bd35033e03
5
5
  SHA512:
6
- metadata.gz: 8f83782553256422ff42d93579ead7b6b238d705ac950879b94fc6abe67963d2b392a4b374e79fc6b1309164e059c245a909c52dbe8e7a9bb37e7396b5b14496
7
- data.tar.gz: eb023adff7c6932cc531e857ad2fe6c76ad13a44704f87573b43eb722617c32366998ff45c6bee346ffea6c76c15cd339dfa11c493be1e708684584bcae54684
6
+ metadata.gz: 1977694839c3540e7e89f24ee662c35e2f616175f082c3cd276322b0438d17e9841841c7cf61961dc756b3ab6cd439e7bf2459236867aba4ba4eae0532f403ad
7
+ data.tar.gz: 7417e667e3124cd562f65c85a4ffe9c8b6a18b0d0dd59d0a71589c1010e4ae91d73409aafe5bded446cd14fdb9ef208abb6ebceddc823bd8c5853ea608b64d58
@@ -0,0 +1,79 @@
1
+ ActiveAdmin.register Blogelator::Author, as: "Author" do
2
+ permit_params [
3
+ :bio_markdown,
4
+ :cover_photo,
5
+ :location,
6
+ :meta_description,
7
+ :meta_keywords,
8
+ :name,
9
+ :profile_photo,
10
+ :slug,
11
+ :website
12
+ ]
13
+
14
+ controller do
15
+ defaults finder: :find_by_slug!
16
+ end
17
+
18
+ filter :name
19
+ filter :bio_html
20
+ filter :location
21
+ filter :website
22
+
23
+ index do
24
+ selectable_column
25
+ column :id
26
+ column :title do |author|
27
+ link_to author.name, admin_author_path(author)
28
+ end
29
+ column :created_at
30
+ column :updated_at
31
+ end
32
+
33
+ form do |f|
34
+ inputs "#{t('activerecord.models.author', count: 1)} Details" do
35
+ input :name, input_html: { class: "title-to-slug-title" }
36
+ input :bio_markdown, as: :codemirror, codemirror: { mode: "gfm" }
37
+ input :profile_photo, as: :file
38
+ input :cover_photo, as: :file
39
+ input :location
40
+ input :website
41
+ end
42
+
43
+ inputs "Search Engine Optimization" do
44
+ input :meta_keywords
45
+ input :meta_description
46
+ input :slug, input_html: { class: "title-to-slug-slug" }
47
+ end
48
+
49
+ actions
50
+ end
51
+
52
+ show do
53
+ attributes_table do
54
+ row :name
55
+ row :bio do
56
+ raw author.bio_html
57
+ end
58
+ row :profile_photo do
59
+ if author.profile_photo.exists?
60
+ img src: author.profile_photo.url(:small)
61
+ else
62
+ "No Profile Photo"
63
+ end
64
+ end
65
+ row :cover_photo do
66
+ if author.cover_photo.exists?
67
+ img src: author.cover_photo.url(:small)
68
+ else
69
+ "No Cover Photo"
70
+ end
71
+ end
72
+ row :location
73
+ row :website
74
+ row :created_at
75
+ row :updated_at
76
+ end
77
+ active_admin_comments
78
+ end
79
+ end
@@ -0,0 +1,125 @@
1
+ ActiveAdmin.register Blogelator::Post, as: "Post" do
2
+ permit_params [
3
+ :author_id,
4
+ :body_markdown,
5
+ :featured,
6
+ :image,
7
+ :meta_description,
8
+ :meta_keywords,
9
+ :published_at,
10
+ :slug,
11
+ :status,
12
+ :summary_markdown,
13
+ :title,
14
+ related_post_ids: [],
15
+ tag_ids: []
16
+ ]
17
+
18
+ controller do
19
+ defaults finder: :find_by_slug!
20
+ end
21
+
22
+ filter :title
23
+ filter :body_html
24
+ filter :published_at
25
+ filter :tags
26
+
27
+ index do
28
+ selectable_column
29
+ column :id
30
+ column :title do |post|
31
+ link_to post.title, admin_post_path(post)
32
+ end
33
+ column :published_at
34
+ column :status do |post|
35
+ post.status.titleize
36
+ end
37
+ end
38
+
39
+ form do |f|
40
+ inputs "#{t('activerecord.models.post', count: 1)} Details" do
41
+ input :title, input_html: { class: "title-to-slug-title" }
42
+ input :image, as: :file
43
+ input :body_markdown, as: :codemirror, codemirror: { lineWrapping: true, mode: "gfm" }
44
+ input :summary_markdown, as: :codemirror, codemirror: { lineWrapping: true, mode: "gfm" }
45
+ end
46
+
47
+ inputs "Publish Settings" do
48
+ input :status, as: :select, collection: Blogelator::Post.statuses.map {|status| [status[0].titleize, status[0]] }, include_blank: false
49
+ input :author, as: :select
50
+ input :featured
51
+ input :published_at, as: :datepicker
52
+ end
53
+
54
+ inputs "Tags" do
55
+ input :tags, as: :check_boxes, label: false
56
+ end
57
+
58
+ inputs "Related Posts" do
59
+ input :related_posts, as: :check_boxes, label: false
60
+ end
61
+
62
+ inputs "Search Engine Optimization" do
63
+ input :meta_keywords
64
+ input :meta_description
65
+ input :slug, input_html: { class: "title-to-slug-slug" }
66
+ end
67
+
68
+ actions
69
+ end
70
+
71
+ show do
72
+ attributes_table do
73
+ row :title
74
+ row :author
75
+ row :status do
76
+ post.status.titleize
77
+ end
78
+ row :url do
79
+ a href: post.url, target: "_blank" do
80
+ post.url
81
+ end
82
+ end
83
+ row :published_at
84
+ row :image do
85
+ if post.image.exists?
86
+ img src: post.image.url(:small)
87
+ else
88
+ "No Image"
89
+ end
90
+ end
91
+ row :created_at
92
+ row :updated_at
93
+ row :tags do
94
+ post.tags.each do |tag|
95
+ a href: admin_tag_path(tag) do
96
+ tag.name
97
+ end
98
+ end
99
+ end
100
+ row :summary do
101
+ raw post.summary_html
102
+ end
103
+ row :content do
104
+ raw post.body_html
105
+ end
106
+ end
107
+
108
+ panel "Related Posts" do
109
+ if post.related_posts.length > 0
110
+ ul do
111
+ post.related_posts.each do |post|
112
+ li do
113
+ a href: admin_post_path(post) do
114
+ post.title
115
+ end
116
+ end
117
+ end
118
+ end
119
+ else
120
+ para "No related posts"
121
+ end
122
+ end
123
+ active_admin_comments
124
+ end
125
+ end
@@ -0,0 +1,41 @@
1
+ ActiveAdmin.register Blogelator::Tag, as: "Tag" do
2
+ permit_params [
3
+ :name,
4
+ :slug
5
+ ]
6
+
7
+ controller do
8
+ defaults finder: :find_by_slug!
9
+ end
10
+
11
+ filter :name
12
+
13
+ index do
14
+ selectable_column
15
+ column :id
16
+ column :name do |tag|
17
+ link_to tag.name, admin_tag_path(tag)
18
+ end
19
+ column :created_at
20
+ column :updated_at
21
+ end
22
+
23
+ form do |f|
24
+ inputs "#{t('activerecord.models.tag', count: 1)} Details" do
25
+ input :name, input_html: { class: "title-to-slug-title" }
26
+ input :slug, input_html: { class: "title-to-slug-slug" }
27
+ end
28
+
29
+ actions
30
+ end
31
+
32
+ show do
33
+ attributes_table do
34
+ row :name
35
+ row :slug
36
+ row :created_at
37
+ row :updated_at
38
+ end
39
+ active_admin_comments
40
+ end
41
+ end
@@ -0,0 +1,6 @@
1
+ # Blogelator allows you to add a blog to a Rails app.
2
+ module Blogelator
3
+ def self.table_name_prefix
4
+ "blogelator_"
5
+ end
6
+ end
@@ -1,3 +1,3 @@
1
1
  module Blogelator
2
- VERSION = "1.0.7".freeze
2
+ VERSION = "1.0.9".freeze
3
3
  end
@@ -1,11 +1,21 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/migration'
3
+
1
4
  module Blogelator
2
5
  class InstallGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
3
7
  source_root File.expand_path("../../../..", __FILE__)
4
8
 
5
9
  def copy_controller
6
10
  posts_controller_path = "app/controllers/blogelator/posts_controller.rb"
7
11
  copy_file posts_controller_path, posts_controller_path
8
12
  end
13
+ def copy_models
14
+ blogelator_module = "app/models/blogelator.rb"
15
+ blogelator_directory = "app/models/blogelator"
16
+ copy_file blogelator_module, blogelator_module
17
+ directory blogelator_directory, blogelator_directory
18
+ end
9
19
 
10
20
  def copy_javascripts
11
21
  blog_js_path = "app/assets/javascripts/blog.js"
@@ -33,9 +43,51 @@ module Blogelator
33
43
  directory blogelator_views_path, blogelator_views_path
34
44
  end
35
45
 
46
+ def copy_files
47
+ # Add interface for Active Admin (Pro)
48
+ # @see http://activeadmin.info
49
+ # @see http://github.com/codelation/activeadmin_pro
50
+ if defined?(ActiveAdmin)
51
+ admin_path = "app/admin/blogelator"
52
+ directory admin_path, admin_path
53
+ end
54
+ end
55
+
56
+ def self.next_migration_number(path)
57
+ if ActiveRecord::Base.timestamped_migrations
58
+ sleep 1 # make sure each time we get a different timestamp
59
+ Time.new.utc.strftime("%Y%m%d%H%M%S")
60
+ else
61
+ "%.3d" % (current_migration_number(path) + 1)
62
+ end
63
+ end
64
+
65
+ def setup_routes
66
+ route = '
67
+ namespace :blogelator, path: "blog" do
68
+ resources :posts, path: "/"
69
+ resources :tags do
70
+ resources :posts, path: "/"
71
+ end
72
+ end
73
+
74
+ '
75
+ inject_into_file "config/routes.rb", route, :before => /^end/
76
+ end
77
+
36
78
  # Install the database migrations required for Blogelator's posts
37
79
  def install_migrations
38
- rake "blogelator:install:migrations"
80
+ migrations = [
81
+ "create_blogelator_posts.rb",
82
+ "create_blogelator_authors.rb",
83
+ "create_blogelator_tags.rb",
84
+ "create_blogelator_posts_tags.rb",
85
+ "create_blogelator_posts_posts.rb"
86
+ ]
87
+ migration_path = "db/migrate"
88
+ migrations.each do |file|
89
+ migration_template "#{migration_path}/#{file}", "#{migration_path}/#{file}"
90
+ end
39
91
  end
40
92
  end
41
93
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blogelator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pattison
8
+ - Jake Humphrey
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
12
+ date: 2016-10-24 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: codelation_assets
@@ -86,14 +87,14 @@ dependencies:
86
87
  requirements:
87
88
  - - "~>"
88
89
  - !ruby/object:Gem::Version
89
- version: '2.5'
90
+ version: '5.0'
90
91
  type: :runtime
91
92
  prerelease: false
92
93
  version_requirements: !ruby/object:Gem::Requirement
93
94
  requirements:
94
95
  - - "~>"
95
96
  - !ruby/object:Gem::Version
96
- version: '2.5'
97
+ version: '5.0'
97
98
  - !ruby/object:Gem::Dependency
98
99
  name: rake
99
100
  requirement: !ruby/object:Gem::Requirement
@@ -111,6 +112,7 @@ dependencies:
111
112
  description: Blogelator is an easy way to add a blog to your Rails app.
112
113
  email:
113
114
  - brian@brianpattison.com
115
+ - jake@codelation.com
114
116
  executables: []
115
117
  extensions: []
116
118
  extra_rdoc_files: []
@@ -118,6 +120,9 @@ files:
118
120
  - LICENSE
119
121
  - README.md
120
122
  - Rakefile
123
+ - app/admin/blogelator/author.rb
124
+ - app/admin/blogelator/post.rb
125
+ - app/admin/blogelator/tag.rb
121
126
  - app/assets/javascripts/blog.js
122
127
  - app/assets/javascripts/blog/components/link.js
123
128
  - app/assets/javascripts/blog/layout/progress_bar.js
@@ -138,6 +143,7 @@ files:
138
143
  - app/assets/stylesheets/blog/views/blogelator/posts/index.scss
139
144
  - app/assets/stylesheets/blog/views/blogelator/posts/show.scss
140
145
  - app/controllers/blogelator/posts_controller.rb
146
+ - app/models/blogelator.rb
141
147
  - app/models/blogelator/author.rb
142
148
  - app/models/blogelator/html_renderer.rb
143
149
  - app/models/blogelator/post.rb
@@ -153,15 +159,12 @@ files:
153
159
  - app/views/layouts/blog/_footer.html.erb
154
160
  - app/views/layouts/blog/_header.html.erb
155
161
  - config/locales/en.yml
156
- - db/migrate/20151018150314_create_blogelator_posts.rb
157
- - db/migrate/20151018151022_create_blogelator_authors.rb
158
- - db/migrate/20160201151022_create_blogelator_tags.rb
159
- - db/migrate/20160201151122_create_blogelator_posts_tags.rb
160
- - db/migrate/20160209213141_create_blogelator_posts_posts.rb
162
+ - db/migrate/create_blogelator_authors.rb
163
+ - db/migrate/create_blogelator_posts.rb
164
+ - db/migrate/create_blogelator_posts_posts.rb
165
+ - db/migrate/create_blogelator_posts_tags.rb
166
+ - db/migrate/create_blogelator_tags.rb
161
167
  - lib/blogelator.rb
162
- - lib/blogelator/admin/author.rb
163
- - lib/blogelator/admin/post.rb
164
- - lib/blogelator/admin/tag.rb
165
168
  - lib/blogelator/engine.rb
166
169
  - lib/blogelator/version.rb
167
170
  - lib/generators/blogelator/install_generator.rb
@@ -191,4 +194,3 @@ signing_key:
191
194
  specification_version: 4
192
195
  summary: Simple blog for Rails apps.
193
196
  test_files: []
194
- has_rdoc:
@@ -1,81 +0,0 @@
1
- if defined?(ActiveAdmin)
2
- ActiveAdmin.register Blogelator::Author, as: "Author" do
3
- permit_params [
4
- :bio_markdown,
5
- :cover_photo,
6
- :location,
7
- :meta_description,
8
- :meta_keywords,
9
- :name,
10
- :profile_photo,
11
- :slug,
12
- :website
13
- ]
14
-
15
- controller do
16
- defaults finder: :find_by_slug!
17
- end
18
-
19
- filter :name
20
- filter :bio_html
21
- filter :location
22
- filter :website
23
-
24
- index do
25
- selectable_column
26
- column :id
27
- column :title do |author|
28
- link_to author.name, admin_author_path(author)
29
- end
30
- column :created_at
31
- column :updated_at
32
- end
33
-
34
- form do |f|
35
- inputs "#{t('activerecord.models.author', count: 1)} Details" do
36
- input :name, input_html: { class: "title-to-slug-title" }
37
- input :bio_markdown, as: :codemirror, codemirror: { mode: "gfm" }
38
- input :profile_photo, as: :file
39
- input :cover_photo, as: :file
40
- input :location
41
- input :website
42
- end
43
-
44
- inputs "Search Engine Optimization" do
45
- input :meta_keywords
46
- input :meta_description
47
- input :slug, input_html: { class: "title-to-slug-slug" }
48
- end
49
-
50
- actions
51
- end
52
-
53
- show do
54
- attributes_table do
55
- row :name
56
- row :bio do
57
- raw author.bio_html
58
- end
59
- row :profile_photo do
60
- if author.profile_photo.exists?
61
- img src: author.profile_photo.url(:small)
62
- else
63
- "No Profile Photo"
64
- end
65
- end
66
- row :cover_photo do
67
- if author.cover_photo.exists?
68
- img src: author.cover_photo.url(:small)
69
- else
70
- "No Cover Photo"
71
- end
72
- end
73
- row :location
74
- row :website
75
- row :created_at
76
- row :updated_at
77
- end
78
- active_admin_comments
79
- end
80
- end
81
- end
@@ -1,127 +0,0 @@
1
- if defined?(ActiveAdmin)
2
- ActiveAdmin.register Blogelator::Post, as: "Post" do
3
- permit_params [
4
- :author_id,
5
- :body_markdown,
6
- :featured,
7
- :image,
8
- :meta_description,
9
- :meta_keywords,
10
- :published_at,
11
- :slug,
12
- :status,
13
- :summary_markdown,
14
- :title,
15
- related_post_ids: [],
16
- tag_ids: []
17
- ]
18
-
19
- controller do
20
- defaults finder: :find_by_slug!
21
- end
22
-
23
- filter :title
24
- filter :body_html
25
- filter :published_at
26
- filter :tags
27
-
28
- index do
29
- selectable_column
30
- column :id
31
- column :title do |post|
32
- link_to post.title, admin_post_path(post)
33
- end
34
- column :published_at
35
- column :status do |post|
36
- post.status.titleize
37
- end
38
- end
39
-
40
- form do |f|
41
- inputs "#{t('activerecord.models.post', count: 1)} Details" do
42
- input :title, input_html: { class: "title-to-slug-title" }
43
- input :image, as: :file
44
- input :body_markdown, as: :codemirror, codemirror: { lineWrapping: true, mode: "gfm" }
45
- input :summary_markdown, as: :codemirror, codemirror: { lineWrapping: true, mode: "gfm" }
46
- end
47
-
48
- inputs "Publish Settings" do
49
- input :status, as: :select, collection: Blogelator::Post.statuses.map {|status| [status[0].titleize, status[0]] }, include_blank: false
50
- input :author, as: :select
51
- input :featured
52
- input :published_at, as: :datepicker
53
- end
54
-
55
- inputs "Tags" do
56
- input :tags, as: :check_boxes, label: false
57
- end
58
-
59
- inputs "Related Posts" do
60
- input :related_posts, as: :check_boxes, label: false
61
- end
62
-
63
- inputs "Search Engine Optimization" do
64
- input :meta_keywords
65
- input :meta_description
66
- input :slug, input_html: { class: "title-to-slug-slug" }
67
- end
68
-
69
- actions
70
- end
71
-
72
- show do
73
- attributes_table do
74
- row :title
75
- row :author
76
- row :status do
77
- post.status.titleize
78
- end
79
- row :url do
80
- a href: post.url, target: "_blank" do
81
- post.url
82
- end
83
- end
84
- row :published_at
85
- row :image do
86
- if post.image.exists?
87
- img src: post.image.url(:small)
88
- else
89
- "No Image"
90
- end
91
- end
92
- row :created_at
93
- row :updated_at
94
- row :tags do
95
- post.tags.each do |tag|
96
- a href: admin_tag_path(tag) do
97
- tag.name
98
- end
99
- end
100
- end
101
- row :summary do
102
- raw post.summary_html
103
- end
104
- row :content do
105
- raw post.body_html
106
- end
107
- end
108
-
109
- panel "Related Posts" do
110
- if post.related_posts.length > 0
111
- ul do
112
- post.related_posts.each do |post|
113
- li do
114
- a href: admin_post_path(post) do
115
- post.title
116
- end
117
- end
118
- end
119
- end
120
- else
121
- para "No related posts"
122
- end
123
- end
124
- active_admin_comments
125
- end
126
- end
127
- end
@@ -1,43 +0,0 @@
1
- if defined?(ActiveAdmin)
2
- ActiveAdmin.register Blogelator::Tag, as: "Tag" do
3
- permit_params [
4
- :name,
5
- :slug
6
- ]
7
-
8
- controller do
9
- defaults finder: :find_by_slug!
10
- end
11
-
12
- filter :name
13
-
14
- index do
15
- selectable_column
16
- column :id
17
- column :name do |tag|
18
- link_to tag.name, admin_tag_path(tag)
19
- end
20
- column :created_at
21
- column :updated_at
22
- end
23
-
24
- form do |f|
25
- inputs "#{t('activerecord.models.tag', count: 1)} Details" do
26
- input :name, input_html: { class: "title-to-slug-title" }
27
- input :slug, input_html: { class: "title-to-slug-slug" }
28
- end
29
-
30
- actions
31
- end
32
-
33
- show do
34
- attributes_table do
35
- row :name
36
- row :slug
37
- row :created_at
38
- row :updated_at
39
- end
40
- active_admin_comments
41
- end
42
- end
43
- end