activeadmin-blog 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +8 -178
- data/README.md +27 -9
- data/activeadmin-blog.gemspec +11 -14
- data/app/controllers/activeadmin_blog/posts_controller.rb +1 -1
- data/app/models/activeadmin_blog/blog_category.rb +16 -6
- data/app/models/activeadmin_blog/blog_post.rb +21 -10
- data/app/uploaders/activeadmin_blog/featured_image_uploader.rb +65 -0
- data/app/views/activeadmin_blog/posts/_footer.html.erb +0 -1
- data/app/views/activeadmin_blog/posts/_header.html.erb +2 -2
- data/app/views/activeadmin_blog/posts/_post.html.erb +4 -4
- data/app/views/activeadmin_blog/posts/feed.rss.builder +2 -2
- data/app/views/activeadmin_blog/posts/show.html.erb +1 -1
- data/app/views/admin/categories/_form.html.erb +1 -1
- data/app/views/admin/categories/_show.html.erb +11 -5
- data/app/views/admin/posts/_form.html.erb +1 -1
- data/app/views/admin/posts/_sidebar.html.erb +23 -0
- data/app/views/admin/posts/all.html.erb +11 -5
- data/lib/activeadmin-blog.rb +2 -3
- data/lib/activeadmin-blog/version.rb +1 -1
- data/lib/generators/activeadmin_blog/templates/admin/blog_categories.rb +2 -7
- data/lib/generators/activeadmin_blog/templates/admin/blog_posts.rb +3 -8
- data/vendor/assets/stylesheets/activeadmin_blog.css.scss +12 -1
- metadata +11 -42
- data/app/views/admin/posts/_categories.html.erb +0 -20
data/Gemfile.lock
CHANGED
@@ -1,139 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
activeadmin-blog (0.4.
|
5
|
-
activeadmin-mongoid
|
4
|
+
activeadmin-blog (0.4.4)
|
6
5
|
activeadmin-mongoid-reorder
|
7
6
|
activeadmin-settings
|
8
|
-
mongoid_search (~> 0.2.8)
|
9
|
-
mongoid_slug
|
10
7
|
nokogiri
|
8
|
+
stringex
|
11
9
|
|
12
10
|
GEM
|
13
11
|
remote: https://rubygems.org/
|
14
12
|
specs:
|
15
|
-
actionmailer (3.2.8)
|
16
|
-
actionpack (= 3.2.8)
|
17
|
-
mail (~> 2.4.4)
|
18
|
-
actionpack (3.2.8)
|
19
|
-
activemodel (= 3.2.8)
|
20
|
-
activesupport (= 3.2.8)
|
21
|
-
builder (~> 3.0.0)
|
22
|
-
erubis (~> 2.7.0)
|
23
|
-
journey (~> 1.0.4)
|
24
|
-
rack (~> 1.4.0)
|
25
|
-
rack-cache (~> 1.2)
|
26
|
-
rack-test (~> 0.6.1)
|
27
|
-
sprockets (~> 2.1.3)
|
28
|
-
activeadmin (0.4.4)
|
29
|
-
bourbon (>= 1.0.0)
|
30
|
-
devise (>= 1.1.2)
|
31
|
-
fastercsv
|
32
|
-
formtastic (~> 2.1.1)
|
33
|
-
inherited_resources (>= 1.3.1)
|
34
|
-
jquery-rails (>= 1.0.0)
|
35
|
-
kaminari (>= 0.13.0)
|
36
|
-
meta_search (>= 0.9.2)
|
37
|
-
rails (>= 3.0.0)
|
38
|
-
sass (>= 3.1.0)
|
39
|
-
activeadmin-mongoid (0.0.1)
|
40
|
-
activeadmin (~> 0.4)
|
41
|
-
meta_search (>= 1.1.0.pre)
|
42
|
-
mongoid (~> 2.0)
|
43
|
-
sass-rails (~> 3.1, >= 3.1.4)
|
44
13
|
activeadmin-mongoid-reorder (0.2.1)
|
45
|
-
activeadmin-settings (0.3.
|
46
|
-
aws-s3
|
47
|
-
carrierwave-mongoid
|
48
|
-
fog
|
49
|
-
heroku-mongo-backup
|
50
|
-
mini_magick
|
14
|
+
activeadmin-settings (0.3.4)
|
51
15
|
mongoid_globalize
|
52
|
-
select2-rails
|
53
16
|
activemodel (3.2.8)
|
54
17
|
activesupport (= 3.2.8)
|
55
18
|
builder (~> 3.0.0)
|
56
|
-
activerecord (3.2.8)
|
57
|
-
activemodel (= 3.2.8)
|
58
|
-
activesupport (= 3.2.8)
|
59
|
-
arel (~> 3.0.2)
|
60
|
-
tzinfo (~> 0.3.29)
|
61
|
-
activeresource (3.2.8)
|
62
|
-
activemodel (= 3.2.8)
|
63
|
-
activesupport (= 3.2.8)
|
64
19
|
activesupport (3.2.8)
|
65
20
|
i18n (~> 0.6)
|
66
21
|
multi_json (~> 1.0)
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
mime-types
|
71
|
-
xml-simple
|
72
|
-
bcrypt-ruby (3.0.1)
|
73
|
-
bourbon (2.1.1)
|
74
|
-
sass (>= 3.1)
|
75
|
-
bson (1.6.4)
|
76
|
-
bson_ext (1.6.4)
|
77
|
-
bson (~> 1.6.4)
|
22
|
+
bson (1.7.0)
|
23
|
+
bson_ext (1.7.0)
|
24
|
+
bson (~> 1.7.0)
|
78
25
|
builder (3.0.0)
|
79
|
-
carrierwave (0.6.2)
|
80
|
-
activemodel (>= 3.2.0)
|
81
|
-
activesupport (>= 3.2.0)
|
82
|
-
carrierwave-mongoid (0.2.1)
|
83
|
-
carrierwave (~> 0.6.1)
|
84
|
-
mongoid (~> 2.1)
|
85
|
-
devise (2.1.2)
|
86
|
-
bcrypt-ruby (~> 3.0)
|
87
|
-
orm_adapter (~> 0.1)
|
88
|
-
railties (~> 3.1)
|
89
|
-
warden (~> 1.2.1)
|
90
|
-
erubis (2.7.0)
|
91
|
-
excon (0.16.1)
|
92
|
-
fast-stemmer (1.0.1)
|
93
|
-
fastercsv (1.5.5)
|
94
|
-
fog (1.5.0)
|
95
|
-
builder
|
96
|
-
excon (~> 0.14)
|
97
|
-
formatador (~> 0.2.0)
|
98
|
-
mime-types
|
99
|
-
multi_json (~> 1.0)
|
100
|
-
net-scp (~> 1.0.4)
|
101
|
-
net-ssh (>= 2.1.3)
|
102
|
-
nokogiri (~> 1.5.0)
|
103
|
-
ruby-hmac
|
104
|
-
formatador (0.2.3)
|
105
|
-
formtastic (2.1.1)
|
106
|
-
actionpack (~> 3.0)
|
107
|
-
has_scope (0.5.1)
|
108
|
-
heroku-mongo-backup (0.3.9)
|
109
|
-
hike (1.2.1)
|
110
26
|
i18n (0.6.0)
|
111
|
-
|
112
|
-
|
113
|
-
responders (~> 0.6)
|
114
|
-
journey (1.0.4)
|
115
|
-
jquery-rails (2.1.1)
|
116
|
-
railties (>= 3.1.0, < 5.0)
|
117
|
-
thor (~> 0.14)
|
118
|
-
json (1.7.5)
|
119
|
-
kaminari (0.13.0)
|
120
|
-
actionpack (>= 3.0.0)
|
121
|
-
activesupport (>= 3.0.0)
|
122
|
-
railties (>= 3.0.0)
|
123
|
-
mail (2.4.4)
|
124
|
-
i18n (>= 0.4.0)
|
125
|
-
mime-types (~> 1.16)
|
126
|
-
treetop (~> 1.4.8)
|
127
|
-
meta_search (1.1.3)
|
128
|
-
actionpack (~> 3.1)
|
129
|
-
activerecord (~> 3.1)
|
130
|
-
activesupport (~> 3.1)
|
131
|
-
polyamorous (~> 0.5.0)
|
132
|
-
mime-types (1.19)
|
133
|
-
mini_magick (3.4)
|
134
|
-
subexec (~> 0.2.1)
|
135
|
-
mongo (1.6.2)
|
136
|
-
bson (~> 1.6.2)
|
27
|
+
mongo (1.3.1)
|
28
|
+
bson (>= 1.3.1)
|
137
29
|
mongoid (2.4.12)
|
138
30
|
activemodel (~> 3.1)
|
139
31
|
mongo (<= 1.6.2)
|
@@ -141,72 +33,10 @@ GEM
|
|
141
33
|
mongoid_globalize (0.2.1)
|
142
34
|
bson_ext (~> 1.5)
|
143
35
|
mongoid (~> 2.4)
|
144
|
-
mongoid_search (0.2.8)
|
145
|
-
bson_ext (>= 1.2)
|
146
|
-
fast-stemmer (~> 1.0.0)
|
147
|
-
mongoid (>= 2.0.0)
|
148
|
-
mongoid_slug (0.10.0)
|
149
|
-
mongoid (~> 2.0)
|
150
|
-
stringex (~> 1.3)
|
151
36
|
multi_json (1.3.6)
|
152
|
-
net-scp (1.0.4)
|
153
|
-
net-ssh (>= 1.99.1)
|
154
|
-
net-ssh (2.5.2)
|
155
37
|
nokogiri (1.5.5)
|
156
|
-
orm_adapter (0.4.0)
|
157
|
-
polyamorous (0.5.0)
|
158
|
-
activerecord (~> 3.0)
|
159
|
-
polyglot (0.3.3)
|
160
|
-
rack (1.4.1)
|
161
|
-
rack-cache (1.2)
|
162
|
-
rack (>= 0.4)
|
163
|
-
rack-ssl (1.3.2)
|
164
|
-
rack
|
165
|
-
rack-test (0.6.1)
|
166
|
-
rack (>= 1.0)
|
167
|
-
rails (3.2.8)
|
168
|
-
actionmailer (= 3.2.8)
|
169
|
-
actionpack (= 3.2.8)
|
170
|
-
activerecord (= 3.2.8)
|
171
|
-
activeresource (= 3.2.8)
|
172
|
-
activesupport (= 3.2.8)
|
173
|
-
bundler (~> 1.0)
|
174
|
-
railties (= 3.2.8)
|
175
|
-
railties (3.2.8)
|
176
|
-
actionpack (= 3.2.8)
|
177
|
-
activesupport (= 3.2.8)
|
178
|
-
rack-ssl (~> 1.3.2)
|
179
|
-
rake (>= 0.8.7)
|
180
|
-
rdoc (~> 3.4)
|
181
|
-
thor (>= 0.14.6, < 2.0)
|
182
|
-
rake (0.9.2.2)
|
183
|
-
rdoc (3.12)
|
184
|
-
json (~> 1.4)
|
185
|
-
responders (0.9.2)
|
186
|
-
railties (~> 3.1)
|
187
|
-
ruby-hmac (0.4.0)
|
188
|
-
sass (3.2.1)
|
189
|
-
sass-rails (3.2.5)
|
190
|
-
railties (~> 3.2.0)
|
191
|
-
sass (>= 3.1.10)
|
192
|
-
tilt (~> 1.3)
|
193
|
-
select2-rails (3.0.0)
|
194
|
-
thor (~> 0.14)
|
195
|
-
sprockets (2.1.3)
|
196
|
-
hike (~> 1.2)
|
197
|
-
rack (~> 1.0)
|
198
|
-
tilt (~> 1.1, != 1.3.0)
|
199
38
|
stringex (1.4.0)
|
200
|
-
subexec (0.2.2)
|
201
|
-
thor (0.16.0)
|
202
|
-
tilt (1.3.3)
|
203
|
-
treetop (1.4.10)
|
204
|
-
polyglot
|
205
|
-
polyglot (>= 0.3.1)
|
206
39
|
tzinfo (0.3.33)
|
207
|
-
warden (1.2.1)
|
208
|
-
rack (>= 1.0)
|
209
|
-
xml-simple (1.1.1)
|
210
40
|
|
211
41
|
PLATFORMS
|
212
42
|
ruby
|
data/README.md
CHANGED
@@ -22,25 +22,43 @@ This command creates new rails project fully configured and ready for Heroku dep
|
|
22
22
|
|
23
23
|
### Setup and configure ActiveAdmin
|
24
24
|
|
25
|
-
|
25
|
+
#### Mongoid 2.x gem set
|
26
26
|
|
27
|
-
# Activeadmin
|
28
27
|
gem "bson_ext"
|
29
|
-
gem "mongoid"
|
28
|
+
gem "mongoid", '~> 2.0'
|
29
|
+
gem 'mongoid_search', '~> 0.2.8'
|
30
30
|
gem "devise"
|
31
31
|
gem "activeadmin-mongoid"
|
32
|
-
|
33
|
-
# Activeadmin Mongoid Blog
|
34
|
-
gem "activeadmin-settings"
|
32
|
+
gem "carrierwave-mongoid"
|
35
33
|
gem "activeadmin-blog"
|
36
34
|
|
37
|
-
#
|
38
|
-
gem "
|
39
|
-
gem "
|
35
|
+
# Assets
|
36
|
+
gem "aws-s3"
|
37
|
+
gem "fog"
|
38
|
+
gem "mini_magick"
|
39
|
+
gem "asset_sync"
|
40
|
+
|
41
|
+
|
42
|
+
#### Mongoid 3.x gem set
|
43
|
+
|
44
|
+
# Mongoid 3.x
|
45
|
+
gem 'moped', git: 'git://github.com/mongoid/moped.git'
|
46
|
+
gem "mongoid", "~> 3.0.5"
|
47
|
+
gem "mongoid_search"
|
48
|
+
gem "devise", ">= 2.1.2"
|
49
|
+
gem "activeadmin-mongoid", git: "git://github.com/elia/activeadmin-mongoid.git"
|
50
|
+
gem "carrierwave-mongoid", git: "git://github.com/jnicklas/carrierwave-mongoid.git",
|
51
|
+
branch: "mongoid-3.0",
|
52
|
+
require: 'carrierwave/mongoid'
|
53
|
+
gem "activeadmin-blog"
|
40
54
|
|
41
55
|
# Assets
|
56
|
+
gem "aws-s3"
|
57
|
+
gem "fog"
|
58
|
+
gem "mini_magick"
|
42
59
|
gem "asset_sync"
|
43
60
|
|
61
|
+
|
44
62
|
Run following generators:
|
45
63
|
|
46
64
|
$ rails g mongoid:config
|
data/activeadmin-blog.gemspec
CHANGED
@@ -2,29 +2,26 @@
|
|
2
2
|
require File.expand_path('../lib/activeadmin-blog/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.name
|
6
|
-
gem.
|
7
|
-
gem.
|
8
|
-
gem.
|
5
|
+
gem.name = 'activeadmin-blog'
|
6
|
+
gem.version = ActiveadminBlog::VERSION
|
7
|
+
gem.summary = 'Blog app on the top of activeadmin and mongoid.'
|
8
|
+
gem.description = ''
|
9
|
+
gem.license = 'MIT'
|
9
10
|
|
10
|
-
gem.authors
|
11
|
-
gem.email
|
12
|
-
gem.homepage
|
11
|
+
gem.authors = ['Alex Kravets']
|
12
|
+
gem.email = 'santyor@gmail.com'
|
13
|
+
gem.homepage = 'https://github.com/slate-studio/activeadmin-blog'
|
13
14
|
|
15
|
+
gem.require_paths = ['lib']
|
14
16
|
gem.files = `git ls-files`.split($\)
|
15
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
|
-
gem.require_paths = ['lib']
|
18
|
-
gem.version = ActiveadminBlog::VERSION
|
19
19
|
|
20
20
|
# Supress the warning about no rubyforge project
|
21
21
|
gem.rubyforge_project = 'nowarning'
|
22
22
|
|
23
|
-
# Dependencies
|
24
|
-
gem.add_runtime_dependency "nokogiri"
|
25
|
-
gem.add_runtime_dependency "mongoid_slug"
|
26
|
-
gem.add_runtime_dependency "mongoid_search", "~> 0.2.8" # "mongoid_search" this uses mongoid 3.x
|
27
23
|
gem.add_runtime_dependency "activeadmin-mongoid-reorder"
|
28
|
-
gem.add_runtime_dependency "activeadmin-mongoid"
|
29
24
|
gem.add_runtime_dependency "activeadmin-settings"
|
25
|
+
gem.add_runtime_dependency "nokogiri"
|
26
|
+
gem.add_runtime_dependency "stringex"
|
30
27
|
end
|
@@ -1,23 +1,33 @@
|
|
1
1
|
class ActiveadminBlog::BlogCategory
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Timestamps
|
4
|
-
include Mongoid::Slug
|
5
4
|
include Mongoid::Reorder
|
6
5
|
|
7
6
|
# Fields
|
8
7
|
field :name
|
8
|
+
field :slug, default: ''
|
9
9
|
field :_position, :type => Float, :default => 0.0
|
10
10
|
|
11
|
+
# Callbacks
|
12
|
+
set_callback(:save, :before) do |doc|
|
13
|
+
doc.slug = doc.name.to_url if doc.slug.nil? or doc.slug.empty?
|
14
|
+
end
|
15
|
+
|
11
16
|
# Validations
|
12
|
-
|
13
|
-
validates_uniqueness_of :name
|
17
|
+
validates :name, presence: true, uniqueness: true
|
14
18
|
|
15
|
-
# Features
|
16
|
-
slug :name, :as => :permalink, :permanent => true
|
17
|
-
|
18
19
|
# Relations
|
19
20
|
has_and_belongs_to_many :blog_posts, :class_name => "ActiveadminBlog::BlogPost"
|
20
21
|
|
21
22
|
# Scope
|
22
23
|
default_scope order_by(:_position => :desc)
|
24
|
+
|
25
|
+
# Indexes
|
26
|
+
index :slug rescue index slug: 1
|
27
|
+
# Mongoid 3.x workaround
|
28
|
+
|
29
|
+
# Helpers
|
30
|
+
def new? # Mongoid 3.x
|
31
|
+
new_record?
|
32
|
+
end
|
23
33
|
end
|
@@ -1,26 +1,29 @@
|
|
1
1
|
class ActiveadminBlog::BlogPost
|
2
2
|
include Mongoid::Document
|
3
3
|
include Mongoid::Timestamps
|
4
|
-
include Mongoid::Slug
|
5
4
|
include Mongoid::Search
|
6
5
|
|
7
6
|
include ActionView::Helpers::TextHelper
|
8
7
|
|
9
8
|
# Fields
|
10
9
|
field :title
|
11
|
-
field :content
|
12
|
-
field :tags, :
|
13
|
-
field :published, :
|
14
|
-
field :date, :
|
10
|
+
field :content, default: ''
|
11
|
+
field :tags, default: ''
|
12
|
+
field :published, type: Boolean, default: false
|
13
|
+
field :date, type: Date
|
14
|
+
field :slug, default: ''
|
15
|
+
|
16
|
+
# Callbacks
|
17
|
+
set_callback(:save, :before) do |post|
|
18
|
+
post.slug = post.title.to_url if post.slug.nil? or post.slug.empty?
|
19
|
+
end
|
15
20
|
|
16
21
|
# Validations
|
17
|
-
|
18
|
-
validates_uniqueness_of :title
|
22
|
+
validates :title, presence: true, uniqueness: true
|
19
23
|
|
20
24
|
# Features
|
21
|
-
slug :title, :as => :permalink, :permanent => true
|
22
25
|
search_in :title, :content, :tags
|
23
|
-
mount_uploader :featured_image,
|
26
|
+
mount_uploader :featured_image, ActiveadminBlog::FeaturedImageUploader
|
24
27
|
paginates_per 6
|
25
28
|
|
26
29
|
# Relations
|
@@ -30,6 +33,10 @@ class ActiveadminBlog::BlogPost
|
|
30
33
|
default_scope order_by(:published => :asc).order_by({:date => :desc})
|
31
34
|
scope :published, where(published: true)
|
32
35
|
|
36
|
+
# Indexes
|
37
|
+
index :slug rescue index slug: 1
|
38
|
+
# Mongoid 3.x workaround
|
39
|
+
|
33
40
|
# Helpers
|
34
41
|
def has_featured_image?
|
35
42
|
not featured_image.to_s.empty?
|
@@ -48,9 +55,13 @@ class ActiveadminBlog::BlogPost
|
|
48
55
|
Nokogiri::HTML(excerpt).text
|
49
56
|
end
|
50
57
|
|
58
|
+
def new? # Mongoid 3.x
|
59
|
+
new_record?
|
60
|
+
end
|
61
|
+
|
51
62
|
# Class methods
|
52
63
|
def self.published_in_category(category_slug)
|
53
|
-
category = ActiveadminBlog::BlogCategory.
|
64
|
+
category = ActiveadminBlog::BlogCategory.find_by(slug: category_slug)
|
54
65
|
category.blog_posts.published
|
55
66
|
end
|
56
67
|
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
class ActiveadminBlog::FeaturedImageUploader < CarrierWave::Uploader::Base
|
3
|
+
|
4
|
+
# Include RMagick or ImageScience support:
|
5
|
+
# include CarrierWave::RMagick
|
6
|
+
include CarrierWave::MiniMagick
|
7
|
+
# include CarrierWave::ImageScience
|
8
|
+
|
9
|
+
# Instance
|
10
|
+
def strip
|
11
|
+
manipulate! do |img|
|
12
|
+
img.strip
|
13
|
+
img = yield(img) if block_given?
|
14
|
+
img
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# process :quality => 85
|
19
|
+
def quality(percentage)
|
20
|
+
manipulate! do |img|
|
21
|
+
img.quality(percentage)
|
22
|
+
img = yield(img) if block_given?
|
23
|
+
img
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Override the directory where uploaded files will be stored.
|
28
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
29
|
+
def store_dir
|
30
|
+
"system/blog/featured_images/#{model.id}"
|
31
|
+
end
|
32
|
+
|
33
|
+
# Provide a default URL as a default if there hasn't been a file uploaded:
|
34
|
+
# def default_url
|
35
|
+
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
|
36
|
+
# end
|
37
|
+
|
38
|
+
# Process files as they are uploaded:
|
39
|
+
# process :scale => [200, 300]
|
40
|
+
#
|
41
|
+
# def scale(width, height)
|
42
|
+
# # do something
|
43
|
+
# end
|
44
|
+
|
45
|
+
# Create different versions of your uploaded files:
|
46
|
+
version :thumb do
|
47
|
+
process :resize_to_fill => [118, 100]
|
48
|
+
end
|
49
|
+
|
50
|
+
#version :content do
|
51
|
+
# process :resize_to_limit => [800, 800]
|
52
|
+
#end
|
53
|
+
|
54
|
+
# Add a white list of extensions which are allowed to be uploaded.
|
55
|
+
# For images you might use something like this:
|
56
|
+
def extension_white_list
|
57
|
+
ActiveadminSettings.image_file_types
|
58
|
+
end
|
59
|
+
|
60
|
+
# Override the filename of the uploaded files:
|
61
|
+
# Avoid using model.id or version_name here, see uploader/store.rb for details.
|
62
|
+
# def filename
|
63
|
+
# "something.jpg" if original_filename
|
64
|
+
# end
|
65
|
+
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<header style="margin-bottom:2em;">
|
2
|
-
<h1><%=
|
2
|
+
<h1><%= Rails.application.class.parent_name %></h1>
|
3
3
|
<p>
|
4
4
|
<ul>
|
5
5
|
<li><a href="<%= blog_path %>" title="All Posts">All Posts</a></li>
|
6
6
|
<% @categories.all.each do |c| %>
|
7
|
-
<li><a href="<%= blog_category_path(c) %>" title="<%= c.name %>"><%= c.name %></a></li>
|
7
|
+
<li><a href="<%= blog_category_path(c.slug) %>" title="<%= c.name %>"><%= c.name %></a></li>
|
8
8
|
<% end %>
|
9
9
|
</ul>
|
10
10
|
</p>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div style="margin-bottom:2em;">
|
2
2
|
<!-- TITLE -->
|
3
|
-
<a href="<%= blog_post_path(post) %>" title="Read this post"><h2><%= post.title %></h2></a>
|
3
|
+
<a href="<%= blog_post_path(post.slug) %>" title="Read this post"><h2><%= post.title %></h2></a>
|
4
4
|
|
5
5
|
<!-- DATE & CATEGORIES -->
|
6
6
|
<p>
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<% if post.categories.size > 0 %>
|
9
9
|
<ul>
|
10
10
|
<% post.categories.each do |c| %>
|
11
|
-
<li><a href="<%= blog_category_path(c) %>" title="<%= c.name %>"><%= c.name %></a></li>
|
11
|
+
<li><a href="<%= blog_category_path(c.slug) %>" title="<%= c.name %>"><%= c.name %></a></li>
|
12
12
|
<% end %>
|
13
13
|
</ul>
|
14
14
|
<% end %>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
<!-- FEATURED IMAGE LINK -->
|
18
18
|
<% if post.has_featured_image? %>
|
19
19
|
<p>
|
20
|
-
<a href="<%= blog_post_path(post) %>" title="Read More">
|
20
|
+
<a href="<%= blog_post_path(post.slug) %>" title="Read More">
|
21
21
|
<%= image_tag post.featured_image_url, :alt=>post.title %>
|
22
22
|
</a>
|
23
23
|
</p>
|
@@ -27,5 +27,5 @@
|
|
27
27
|
<p><%= post.excerpt %></p>
|
28
28
|
|
29
29
|
<!-- READ MORE -->
|
30
|
-
<a href="<%= blog_post_path(post) %>" title="Read More">Read More</a>
|
30
|
+
<a href="<%= blog_post_path(post.slug) %>" title="Read More">Read More</a>
|
31
31
|
</div>
|
@@ -10,8 +10,8 @@ xml.rss :version => "2.0" do
|
|
10
10
|
xml.title post.title
|
11
11
|
xml.description post.excerpt
|
12
12
|
xml.pubDate post.date.to_s(:rfc822)
|
13
|
-
xml.link blog_post_url(post)
|
14
|
-
xml.guid blog_post_url(post)
|
13
|
+
xml.link blog_post_url(post.slug)
|
14
|
+
xml.guid blog_post_url(post.slug)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<% if @post.categories.size > 0 %>
|
12
12
|
<ul>
|
13
13
|
<% @post.categories.each do |c| %>
|
14
|
-
<li><a href="<%= blog_category_path(c) %>" title="<%= c.name %>"><%= c.name %></a></li>
|
14
|
+
<li><a href="<%= blog_category_path(c.slug) %>" title="<%= c.name %>"><%= c.name %></a></li>
|
15
15
|
<% end %>
|
16
16
|
</ul>
|
17
17
|
<% end %>
|
@@ -1,5 +1,11 @@
|
|
1
|
-
|
2
|
-
<%= render :
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<div class="panel blog-posts-sidebar">
|
2
|
+
<%= render partial: "admin/posts/sidebar", locals: { categories: categories } %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="blog-posts-table">
|
6
|
+
<% if category.blog_posts.size > 0 %>
|
7
|
+
<%= render :partial => "admin/posts/table", :locals => {:posts => category.blog_posts} %>
|
8
|
+
<% else %>
|
9
|
+
<p>No posts here yet.</p>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<h3>Categories</h3>
|
2
|
+
<div class="panel_contents">
|
3
|
+
<%= link_to "All Posts", all_admin_posts_path %><br/>
|
4
|
+
|
5
|
+
<% if categories.size > 0 %>
|
6
|
+
<ul id="blog_categories_list">
|
7
|
+
<% categories.each do |c| %>
|
8
|
+
<li id="category_<%= c.id %>">
|
9
|
+
<span>
|
10
|
+
<%= link_to c.name, admin_category_path(c) %>
|
11
|
+
<% if c.blog_posts.size > 0 %>(<%= c.blog_posts.size %>)<% end %>
|
12
|
+
</span>
|
13
|
+
<span class="action-buttons">
|
14
|
+
<%= link_to "Edit", edit_admin_category_path(c) %>
|
15
|
+
</span>
|
16
|
+
</li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
<br/>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<%= link_to "New Category", new_admin_category_path %>
|
23
|
+
</div>
|
@@ -1,5 +1,11 @@
|
|
1
|
-
|
2
|
-
<%= render :
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
<div class="panel blog-posts-sidebar">
|
2
|
+
<%= render partial: "sidebar", locals: { categories: @categories } %>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="blog-posts-table">
|
6
|
+
<% if @posts.size > 0 %>
|
7
|
+
<%= render :partial => "table", :locals => {:posts => @posts} %>
|
8
|
+
<% else %>
|
9
|
+
<p>No posts here yet.</p>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
data/lib/activeadmin-blog.rb
CHANGED
@@ -21,16 +21,11 @@ ActiveAdmin.register ActiveadminBlog::BlogCategory, :as => "Category" do
|
|
21
21
|
format.html { redirect_to admin_posts_path }
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
25
|
-
defaults :finder => :find_by_permalink
|
26
24
|
end
|
27
25
|
|
28
26
|
show :title => :name do
|
29
|
-
render :
|
30
|
-
|
31
|
-
|
32
|
-
sidebar :categories, :only => :show do
|
33
|
-
render :partial => "admin/posts/categories", :locals => { :categories => ActiveadminBlog::BlogCategory.all }
|
27
|
+
render partial: "show", locals: { category: category,
|
28
|
+
categories: ActiveadminBlog::BlogCategory.all }
|
34
29
|
end
|
35
30
|
|
36
31
|
form do |f|
|
@@ -7,8 +7,6 @@ ActiveAdmin.register ActiveadminBlog::BlogPost, :as => "Post" do
|
|
7
7
|
def index
|
8
8
|
redirect_to all_admin_posts_path
|
9
9
|
end
|
10
|
-
|
11
|
-
defaults :finder => :find_by_permalink
|
12
10
|
end
|
13
11
|
|
14
12
|
form do |f|
|
@@ -16,16 +14,13 @@ ActiveAdmin.register ActiveadminBlog::BlogPost, :as => "Post" do
|
|
16
14
|
end
|
17
15
|
|
18
16
|
collection_action :tags, :method => :get do
|
19
|
-
tags
|
17
|
+
tags = ActiveadminBlog::BlogPost.all.collect{ |p| p.tags }.join(",").split(',').uniq
|
20
18
|
render :json => tags
|
21
19
|
end
|
22
20
|
|
23
21
|
collection_action :all do
|
24
22
|
@page_title = "All Posts"
|
25
|
-
@posts
|
26
|
-
|
27
|
-
|
28
|
-
sidebar :categories, :only => :all do
|
29
|
-
render :partial => "categories", :locals => { :categories => ActiveadminBlog::BlogCategory.all }
|
23
|
+
@posts = ActiveadminBlog::BlogPost.all
|
24
|
+
@categories = ActiveadminBlog::BlogCategory.all
|
30
25
|
end
|
31
26
|
end
|
@@ -28,7 +28,10 @@
|
|
28
28
|
}
|
29
29
|
}
|
30
30
|
|
31
|
-
|
31
|
+
.blog-posts-sidebar {
|
32
|
+
float: right;
|
33
|
+
width: 270px;
|
34
|
+
|
32
35
|
ul {
|
33
36
|
margin:0px; padding:0px;
|
34
37
|
list-style:none;
|
@@ -38,6 +41,10 @@
|
|
38
41
|
}
|
39
42
|
}
|
40
43
|
|
44
|
+
.blog-posts-table {
|
45
|
+
margin-right:300px;
|
46
|
+
}
|
47
|
+
|
41
48
|
#category_posts_page {
|
42
49
|
margin:0px;
|
43
50
|
padding:0px;
|
@@ -70,3 +77,7 @@
|
|
70
77
|
display:none;
|
71
78
|
}
|
72
79
|
}
|
80
|
+
|
81
|
+
#main_content_wrapper {
|
82
|
+
overflow:hidden;
|
83
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin-blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,26 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: mongoid_slug
|
15
|
+
name: activeadmin-mongoid-reorder
|
32
16
|
requirement: !ruby/object:Gem::Requirement
|
33
17
|
none: false
|
34
18
|
requirements:
|
@@ -44,23 +28,7 @@ dependencies:
|
|
44
28
|
- !ruby/object:Gem::Version
|
45
29
|
version: '0'
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 0.2.8
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.2.8
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: activeadmin-mongoid-reorder
|
31
|
+
name: activeadmin-settings
|
64
32
|
requirement: !ruby/object:Gem::Requirement
|
65
33
|
none: false
|
66
34
|
requirements:
|
@@ -76,7 +44,7 @@ dependencies:
|
|
76
44
|
- !ruby/object:Gem::Version
|
77
45
|
version: '0'
|
78
46
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
47
|
+
name: nokogiri
|
80
48
|
requirement: !ruby/object:Gem::Requirement
|
81
49
|
none: false
|
82
50
|
requirements:
|
@@ -92,7 +60,7 @@ dependencies:
|
|
92
60
|
- !ruby/object:Gem::Version
|
93
61
|
version: '0'
|
94
62
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
63
|
+
name: stringex
|
96
64
|
requirement: !ruby/object:Gem::Requirement
|
97
65
|
none: false
|
98
66
|
requirements:
|
@@ -122,6 +90,7 @@ files:
|
|
122
90
|
- app/controllers/activeadmin_blog/posts_controller.rb
|
123
91
|
- app/models/activeadmin_blog/blog_category.rb
|
124
92
|
- app/models/activeadmin_blog/blog_post.rb
|
93
|
+
- app/uploaders/activeadmin_blog/featured_image_uploader.rb
|
125
94
|
- app/views/activeadmin_blog/posts/_footer.html.erb
|
126
95
|
- app/views/activeadmin_blog/posts/_header.html.erb
|
127
96
|
- app/views/activeadmin_blog/posts/_post.html.erb
|
@@ -134,8 +103,8 @@ files:
|
|
134
103
|
- app/views/activeadmin_blog/posts/tag.html.erb
|
135
104
|
- app/views/admin/categories/_form.html.erb
|
136
105
|
- app/views/admin/categories/_show.html.erb
|
137
|
-
- app/views/admin/posts/_categories.html.erb
|
138
106
|
- app/views/admin/posts/_form.html.erb
|
107
|
+
- app/views/admin/posts/_sidebar.html.erb
|
139
108
|
- app/views/admin/posts/_table.html.erb
|
140
109
|
- app/views/admin/posts/all.html.erb
|
141
110
|
- install.sh
|
@@ -150,7 +119,7 @@ files:
|
|
150
119
|
- lib/generators/activeadmin_blog/views_generator.rb
|
151
120
|
- vendor/assets/javascripts/activeadmin_blog.js.coffee
|
152
121
|
- vendor/assets/stylesheets/activeadmin_blog.css.scss
|
153
|
-
homepage: https://github.com/
|
122
|
+
homepage: https://github.com/slate-studio/activeadmin-blog
|
154
123
|
licenses:
|
155
124
|
- MIT
|
156
125
|
post_install_message:
|
@@ -165,7 +134,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
134
|
version: '0'
|
166
135
|
segments:
|
167
136
|
- 0
|
168
|
-
hash:
|
137
|
+
hash: -2824675411598608602
|
169
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
139
|
none: false
|
171
140
|
requirements:
|
@@ -174,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
143
|
version: '0'
|
175
144
|
segments:
|
176
145
|
- 0
|
177
|
-
hash:
|
146
|
+
hash: -2824675411598608602
|
178
147
|
requirements: []
|
179
148
|
rubyforge_project: nowarning
|
180
149
|
rubygems_version: 1.8.24
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<%= link_to "All Posts", all_admin_posts_path %>
|
2
|
-
|
3
|
-
<% if categories.size > 0 %>
|
4
|
-
<ul id="blog_categories_list">
|
5
|
-
<% categories.each do |c| %>
|
6
|
-
<li id="category_<%= c.id %>">
|
7
|
-
<span>
|
8
|
-
<%= link_to c.name, admin_category_path(c) %>
|
9
|
-
<% if c.blog_posts.size > 0 %>(<%= c.blog_posts.size %>)<% end %>
|
10
|
-
</span>
|
11
|
-
<span class="action-buttons">
|
12
|
-
<%= link_to "Edit", edit_admin_category_path(c) %>
|
13
|
-
</span>
|
14
|
-
</li>
|
15
|
-
<% end %>
|
16
|
-
</ul>
|
17
|
-
<br/>
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
<%= link_to "New Category", new_admin_category_path %>
|