refinerycms-blog 1.6.2 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -0
- data/Gemfile.lock +293 -0
- data/app/controllers/admin/blog/categories_controller.rb +8 -4
- data/app/controllers/admin/blog/comments_controller.rb +34 -30
- data/app/controllers/admin/blog/posts_controller.rb +81 -70
- data/app/controllers/admin/blog/settings_controller.rb +46 -32
- data/app/controllers/blog/categories_controller.rb +11 -9
- data/app/controllers/blog/posts_controller.rb +84 -76
- data/app/helpers/blog_posts_helper.rb +8 -4
- data/app/mailers/blog/comment_mailer.rb +11 -9
- data/app/models/blog_category.rb +1 -1
- data/app/models/blog_post.rb +15 -4
- data/app/views/admin/blog/_submenu.html.erb +4 -0
- data/app/views/admin/blog/categories/_category.html.erb +1 -1
- data/app/views/admin/blog/categories/_form.html.erb +1 -1
- data/app/views/admin/blog/categories/index.html.erb +3 -3
- data/app/views/admin/blog/comments/index.html.erb +3 -3
- data/app/views/admin/blog/posts/_form.css.erb +7 -2
- data/app/views/admin/blog/posts/_form.html.erb +5 -5
- data/app/views/admin/blog/posts/_post.html.erb +5 -2
- data/app/views/admin/blog/posts/_teaser_part.html.erb +2 -2
- data/app/views/admin/blog/posts/index.html.erb +3 -3
- data/app/views/admin/blog/posts/uncategorized.html.erb +3 -3
- data/app/views/blog/comment_mailer/notification.html.erb +11 -11
- data/app/views/blog/posts/_comment.html.erb +2 -2
- data/app/views/blog/posts/_nav.html.erb +1 -1
- data/app/views/blog/posts/_post.html.erb +4 -3
- data/app/views/blog/posts/show.html.erb +1 -1
- data/app/views/blog/shared/_post.html.erb +11 -6
- data/changelog.md +17 -4
- data/config/locales/bg.yml +158 -0
- data/config/locales/en.yml +3 -1
- data/config/locales/es.yml +31 -0
- data/config/locales/it.yml +68 -17
- data/config/locales/ja.yml +159 -0
- data/config/locales/nl.yml +1 -0
- data/config/locales/sk.yml +8 -8
- data/config/routes.rb +3 -2
- data/db/migrate/8_add_primary_key_to_categorizations.rb +12 -0
- data/lib/refinery/blog/version.rb +3 -3
- data/lib/refinerycms-blog.rb +6 -16
- data/public/stylesheets/ui-lightness/jquery-ui-1.8.13.custom.css +1 -8
- data/readme.md +3 -2
- data/refinerycms-blog.gemspec +8 -2
- data/spec/models/blog_post_spec.rb +25 -1
- data/todo.md +5 -0
- metadata +62 -96
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,293 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/collectiveidea/awesome_nested_set.git
|
3
|
+
revision: 7f43579770dd42d00e34c0f09ed9a49f8a524bdc
|
4
|
+
specs:
|
5
|
+
awesome_nested_set (2.1.0)
|
6
|
+
activerecord (>= 3.0.0)
|
7
|
+
|
8
|
+
GIT
|
9
|
+
remote: git://github.com/resolve/refinerycms.git
|
10
|
+
revision: 25162b585b9c4023d39fd1a9796140bfa4ecb909
|
11
|
+
specs:
|
12
|
+
refinerycms (2.0.0)
|
13
|
+
bundler (~> 1.0)
|
14
|
+
refinerycms-authentication (= 2.0.0)
|
15
|
+
refinerycms-core (= 2.0.0)
|
16
|
+
refinerycms-dashboard (= 2.0.0)
|
17
|
+
refinerycms-images (= 2.0.0)
|
18
|
+
refinerycms-pages (= 2.0.0)
|
19
|
+
refinerycms-resources (= 2.0.0)
|
20
|
+
refinerycms-settings (= 2.0.0)
|
21
|
+
refinerycms-authentication (2.0.0)
|
22
|
+
devise (~> 1.4.0)
|
23
|
+
friendly_id_globalize3 (~> 3.2.1)
|
24
|
+
refinerycms-core (= 2.0.0)
|
25
|
+
refinerycms-core (2.0.0)
|
26
|
+
acts_as_indexed (~> 0.7)
|
27
|
+
awesome_nested_set (~> 2.0)
|
28
|
+
coffee-rails (~> 3.1.0)
|
29
|
+
friendly_id_globalize3 (~> 3.2.1)
|
30
|
+
globalize3 (~> 0.2.0.beta3)
|
31
|
+
jquery-rails
|
32
|
+
rails (>= 3.1.1)
|
33
|
+
refinerycms-settings (= 2.0.0)
|
34
|
+
sass-rails (~> 3.1.0)
|
35
|
+
truncate_html (~> 0.5)
|
36
|
+
uglifier
|
37
|
+
will_paginate (~> 3.0.1)
|
38
|
+
refinerycms-dashboard (2.0.0)
|
39
|
+
refinerycms-core (= 2.0.0)
|
40
|
+
refinerycms-images (2.0.0)
|
41
|
+
dragonfly (~> 0.9.8)
|
42
|
+
rack-cache (>= 0.5.3)
|
43
|
+
refinerycms-core (= 2.0.0)
|
44
|
+
refinerycms-pages (2.0.0)
|
45
|
+
awesome_nested_set (~> 2.0)
|
46
|
+
friendly_id_globalize3 (~> 3.2.1)
|
47
|
+
refinerycms-core (= 2.0.0)
|
48
|
+
seo_meta (>= 1.2.0.rc2)
|
49
|
+
refinerycms-resources (2.0.0)
|
50
|
+
dragonfly (~> 0.9.8)
|
51
|
+
rack-cache (>= 0.5.3)
|
52
|
+
refinerycms-core (= 2.0.0)
|
53
|
+
refinerycms-settings (2.0.0)
|
54
|
+
refinerycms-testing (2.0.0)
|
55
|
+
capybara (~> 1.1.0)
|
56
|
+
database_cleaner
|
57
|
+
factory_girl_rails (~> 1.3.0)
|
58
|
+
fuubar
|
59
|
+
guard-rspec (~> 0.5.0)
|
60
|
+
json_pure
|
61
|
+
launchy
|
62
|
+
rack-test (~> 0.6.0)
|
63
|
+
refinerycms-core (= 2.0.0)
|
64
|
+
rspec-instafail
|
65
|
+
rspec-rails (~> 2.7.0)
|
66
|
+
|
67
|
+
PATH
|
68
|
+
remote: .
|
69
|
+
specs:
|
70
|
+
refinerycms-blog (2.0.0)
|
71
|
+
acts-as-taggable-on
|
72
|
+
filters_spam (~> 0.2)
|
73
|
+
rails_autolink
|
74
|
+
refinerycms-core (~> 2.0.0)
|
75
|
+
seo_meta (~> 1.2.0.rc1)
|
76
|
+
|
77
|
+
GEM
|
78
|
+
remote: http://rubygems.org/
|
79
|
+
specs:
|
80
|
+
actionmailer (3.1.1)
|
81
|
+
actionpack (= 3.1.1)
|
82
|
+
mail (~> 2.3.0)
|
83
|
+
actionpack (3.1.1)
|
84
|
+
activemodel (= 3.1.1)
|
85
|
+
activesupport (= 3.1.1)
|
86
|
+
builder (~> 3.0.0)
|
87
|
+
erubis (~> 2.7.0)
|
88
|
+
i18n (~> 0.6)
|
89
|
+
rack (~> 1.3.2)
|
90
|
+
rack-cache (~> 1.1)
|
91
|
+
rack-mount (~> 0.8.2)
|
92
|
+
rack-test (~> 0.6.1)
|
93
|
+
sprockets (~> 2.0.2)
|
94
|
+
activemodel (3.1.1)
|
95
|
+
activesupport (= 3.1.1)
|
96
|
+
builder (~> 3.0.0)
|
97
|
+
i18n (~> 0.6)
|
98
|
+
activerecord (3.1.1)
|
99
|
+
activemodel (= 3.1.1)
|
100
|
+
activesupport (= 3.1.1)
|
101
|
+
arel (~> 2.2.1)
|
102
|
+
tzinfo (~> 0.3.29)
|
103
|
+
activeresource (3.1.1)
|
104
|
+
activemodel (= 3.1.1)
|
105
|
+
activesupport (= 3.1.1)
|
106
|
+
activesupport (3.1.1)
|
107
|
+
multi_json (~> 1.0)
|
108
|
+
acts-as-taggable-on (2.1.1)
|
109
|
+
rails
|
110
|
+
acts_as_indexed (0.7.6)
|
111
|
+
addressable (2.2.6)
|
112
|
+
arel (2.2.1)
|
113
|
+
babosa (0.3.5)
|
114
|
+
bcrypt-ruby (3.0.1)
|
115
|
+
builder (3.0.0)
|
116
|
+
capybara (1.1.1)
|
117
|
+
mime-types (>= 1.16)
|
118
|
+
nokogiri (>= 1.3.3)
|
119
|
+
rack (>= 1.0.0)
|
120
|
+
rack-test (>= 0.5.4)
|
121
|
+
selenium-webdriver (~> 2.0)
|
122
|
+
xpath (~> 0.1.4)
|
123
|
+
childprocess (0.2.2)
|
124
|
+
ffi (~> 1.0.6)
|
125
|
+
coffee-rails (3.1.1)
|
126
|
+
coffee-script (>= 2.2.0)
|
127
|
+
railties (~> 3.1.0)
|
128
|
+
coffee-script (2.2.0)
|
129
|
+
coffee-script-source
|
130
|
+
execjs
|
131
|
+
coffee-script-source (1.1.3)
|
132
|
+
database_cleaner (0.6.7)
|
133
|
+
devise (1.4.9)
|
134
|
+
bcrypt-ruby (~> 3.0)
|
135
|
+
orm_adapter (~> 0.0.3)
|
136
|
+
warden (~> 1.0.3)
|
137
|
+
diff-lcs (1.1.3)
|
138
|
+
dragonfly (0.9.8)
|
139
|
+
rack
|
140
|
+
erubis (2.7.0)
|
141
|
+
execjs (1.2.9)
|
142
|
+
multi_json (~> 1.0)
|
143
|
+
factory_girl (2.2.0)
|
144
|
+
activesupport
|
145
|
+
factory_girl_rails (1.3.0)
|
146
|
+
factory_girl (~> 2.2.0)
|
147
|
+
railties (>= 3.0.0)
|
148
|
+
ffi (1.0.9)
|
149
|
+
filters_spam (0.3)
|
150
|
+
friendly_id_globalize3 (3.2.1.5)
|
151
|
+
babosa (~> 0.3.0)
|
152
|
+
fuubar (0.0.6)
|
153
|
+
rspec (~> 2.0)
|
154
|
+
rspec-instafail (~> 0.1.8)
|
155
|
+
ruby-progressbar (~> 0.0.10)
|
156
|
+
globalize3 (0.2.0.beta4)
|
157
|
+
activemodel (>= 3.0.0)
|
158
|
+
activerecord (>= 3.0.0)
|
159
|
+
paper_trail (~> 2)
|
160
|
+
growl (1.0.3)
|
161
|
+
guard (0.8.8)
|
162
|
+
thor (~> 0.14.6)
|
163
|
+
guard-rspec (0.5.2)
|
164
|
+
guard (>= 0.8.4)
|
165
|
+
guard-spork (0.3.1)
|
166
|
+
guard (>= 0.8.4)
|
167
|
+
spork (>= 0.8.4)
|
168
|
+
hike (1.2.1)
|
169
|
+
i18n (0.6.0)
|
170
|
+
jquery-rails (1.0.16)
|
171
|
+
railties (~> 3.0)
|
172
|
+
thor (~> 0.14)
|
173
|
+
json (1.6.1)
|
174
|
+
json_pure (1.6.1)
|
175
|
+
launchy (2.0.5)
|
176
|
+
addressable (~> 2.2.6)
|
177
|
+
mail (2.3.0)
|
178
|
+
i18n (>= 0.4.0)
|
179
|
+
mime-types (~> 1.16)
|
180
|
+
treetop (~> 1.4.8)
|
181
|
+
mime-types (1.17.2)
|
182
|
+
multi_json (1.0.3)
|
183
|
+
mysql2 (0.3.7)
|
184
|
+
nokogiri (1.5.0)
|
185
|
+
orm_adapter (0.0.5)
|
186
|
+
paper_trail (2.4.0)
|
187
|
+
rails (~> 3)
|
188
|
+
pg (0.11.0)
|
189
|
+
polyglot (0.3.3)
|
190
|
+
rack (1.3.5)
|
191
|
+
rack-cache (1.1)
|
192
|
+
rack (>= 0.4)
|
193
|
+
rack-mount (0.8.3)
|
194
|
+
rack (>= 1.0.0)
|
195
|
+
rack-ssl (1.3.2)
|
196
|
+
rack
|
197
|
+
rack-test (0.6.1)
|
198
|
+
rack (>= 1.0)
|
199
|
+
rails (3.1.1)
|
200
|
+
actionmailer (= 3.1.1)
|
201
|
+
actionpack (= 3.1.1)
|
202
|
+
activerecord (= 3.1.1)
|
203
|
+
activeresource (= 3.1.1)
|
204
|
+
activesupport (= 3.1.1)
|
205
|
+
bundler (~> 1.0)
|
206
|
+
railties (= 3.1.1)
|
207
|
+
rails_autolink (1.0.4)
|
208
|
+
rails (>= 3.1.0)
|
209
|
+
railties (3.1.1)
|
210
|
+
actionpack (= 3.1.1)
|
211
|
+
activesupport (= 3.1.1)
|
212
|
+
rack-ssl (~> 1.3.2)
|
213
|
+
rake (>= 0.8.7)
|
214
|
+
rdoc (~> 3.4)
|
215
|
+
thor (~> 0.14.6)
|
216
|
+
rake (0.9.2.2)
|
217
|
+
rb-fsevent (0.4.3.1)
|
218
|
+
rdoc (3.11)
|
219
|
+
json (~> 1.4)
|
220
|
+
rspec (2.7.0)
|
221
|
+
rspec-core (~> 2.7.0)
|
222
|
+
rspec-expectations (~> 2.7.0)
|
223
|
+
rspec-mocks (~> 2.7.0)
|
224
|
+
rspec-core (2.7.1)
|
225
|
+
rspec-expectations (2.7.0)
|
226
|
+
diff-lcs (~> 1.1.2)
|
227
|
+
rspec-instafail (0.1.9)
|
228
|
+
rspec-mocks (2.7.0)
|
229
|
+
rspec-rails (2.7.0)
|
230
|
+
actionpack (~> 3.0)
|
231
|
+
activesupport (~> 3.0)
|
232
|
+
railties (~> 3.0)
|
233
|
+
rspec (~> 2.7.0)
|
234
|
+
ruby-progressbar (0.0.10)
|
235
|
+
rubyzip (0.9.4)
|
236
|
+
sass (3.1.10)
|
237
|
+
sass-rails (3.1.4)
|
238
|
+
actionpack (~> 3.1.0)
|
239
|
+
railties (~> 3.1.0)
|
240
|
+
sass (>= 3.1.4)
|
241
|
+
sprockets (~> 2.0.0)
|
242
|
+
tilt (~> 1.3.2)
|
243
|
+
selenium-webdriver (2.10.0)
|
244
|
+
childprocess (>= 0.2.1)
|
245
|
+
ffi (= 1.0.9)
|
246
|
+
json_pure
|
247
|
+
rubyzip
|
248
|
+
seo_meta (1.2.0.rc2)
|
249
|
+
rails (>= 3.0.0)
|
250
|
+
spork (0.9.0.rc9)
|
251
|
+
sprockets (2.0.3)
|
252
|
+
hike (~> 1.2)
|
253
|
+
rack (~> 1.0)
|
254
|
+
tilt (~> 1.1, != 1.3.0)
|
255
|
+
sqlite3 (1.3.4)
|
256
|
+
thor (0.14.6)
|
257
|
+
tilt (1.3.3)
|
258
|
+
treetop (1.4.10)
|
259
|
+
polyglot
|
260
|
+
polyglot (>= 0.3.1)
|
261
|
+
truncate_html (0.5.1)
|
262
|
+
tzinfo (0.3.31)
|
263
|
+
uglifier (1.0.4)
|
264
|
+
execjs (>= 0.3.0)
|
265
|
+
multi_json (>= 1.0.2)
|
266
|
+
warden (1.0.6)
|
267
|
+
rack (>= 1.0)
|
268
|
+
will_paginate (3.0.2)
|
269
|
+
xpath (0.1.4)
|
270
|
+
nokogiri (~> 1.3)
|
271
|
+
|
272
|
+
PLATFORMS
|
273
|
+
ruby
|
274
|
+
|
275
|
+
DEPENDENCIES
|
276
|
+
awesome_nested_set!
|
277
|
+
coffee-rails (~> 3.1.0)
|
278
|
+
growl (~> 1.0.3)
|
279
|
+
guard-spork
|
280
|
+
jquery-rails
|
281
|
+
mysql2
|
282
|
+
pg
|
283
|
+
rb-fchange (~> 0.0.5)
|
284
|
+
rb-fsevent (>= 0.3.9)
|
285
|
+
rb-notifu (~> 0.0.4)
|
286
|
+
refinerycms!
|
287
|
+
refinerycms-blog!
|
288
|
+
refinerycms-testing (~> 2.0.0)
|
289
|
+
sass-rails (~> 3.1.0)
|
290
|
+
spork (= 0.9.0.rc9)
|
291
|
+
sqlite3
|
292
|
+
uglifier
|
293
|
+
win32console
|
@@ -1,7 +1,11 @@
|
|
1
|
-
|
1
|
+
module Admin
|
2
|
+
module Blog
|
3
|
+
class CategoriesController < Admin::BaseController
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
5
|
+
crudify :blog_category,
|
6
|
+
:title_attribute => :title,
|
7
|
+
:order => 'title ASC'
|
6
8
|
|
9
|
+
end
|
10
|
+
end
|
7
11
|
end
|
@@ -1,36 +1,40 @@
|
|
1
|
-
|
1
|
+
module Admin
|
2
|
+
module Blog
|
3
|
+
class CommentsController < Admin::BaseController
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
5
|
+
crudify :blog_comment,
|
6
|
+
:title_attribute => :name,
|
7
|
+
:order => 'published_at DESC'
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
def index
|
10
|
+
@blog_comments = BlogComment.unmoderated
|
11
|
+
render :action => 'index'
|
12
|
+
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
def approved
|
15
|
+
unless params[:id].present?
|
16
|
+
@blog_comments = BlogComment.approved
|
17
|
+
render :action => 'index'
|
18
|
+
else
|
19
|
+
@blog_comment = BlogComment.find(params[:id])
|
20
|
+
@blog_comment.approve!
|
21
|
+
flash[:notice] = t('approved', :scope => 'admin.blog.comments', :author => @blog_comment.name)
|
22
|
+
redirect_to :action => params[:return_to] || 'index'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def rejected
|
27
|
+
unless params[:id].present?
|
28
|
+
@blog_comments = BlogComment.rejected
|
29
|
+
render :action => 'index'
|
30
|
+
else
|
31
|
+
@blog_comment = BlogComment.find(params[:id])
|
32
|
+
@blog_comment.reject!
|
33
|
+
flash[:notice] = t('rejected', :scope => 'admin.blog.comments', :author => @blog_comment.name)
|
34
|
+
redirect_to :action => params[:return_to] || 'index'
|
35
|
+
end
|
36
|
+
end
|
23
37
|
|
24
|
-
def rejected
|
25
|
-
unless params[:id].present?
|
26
|
-
@blog_comments = BlogComment.rejected
|
27
|
-
render :action => 'index'
|
28
|
-
else
|
29
|
-
@blog_comment = BlogComment.find(params[:id])
|
30
|
-
@blog_comment.reject!
|
31
|
-
flash[:notice] = t('admin.blog.comments.rejected', :author => @blog_comment.name)
|
32
|
-
redirect_to :action => params[:return_to] || 'index'
|
33
38
|
end
|
34
39
|
end
|
35
|
-
|
36
|
-
end
|
40
|
+
end
|
@@ -1,86 +1,97 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
module Admin
|
2
|
+
module Blog
|
3
|
+
class PostsController < Admin::BaseController
|
4
|
+
require 'will_paginate/array'
|
5
|
+
|
6
|
+
crudify :blog_post,
|
7
|
+
:title_attribute => :title,
|
8
|
+
:order => 'published_at DESC'
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
def uncategorized
|
11
|
+
@blog_posts = BlogPost.uncategorized.paginate({
|
12
|
+
:page => params[:page],
|
13
|
+
:per_page => BlogPost.per_page
|
14
|
+
})
|
15
|
+
end
|
13
16
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
17
|
+
def tags
|
18
|
+
op = case ActiveRecord::Base.connection.adapter_name.downcase
|
19
|
+
when 'postgresql'
|
20
|
+
'~*'
|
21
|
+
else
|
22
|
+
'LIKE'
|
23
|
+
end
|
24
|
+
wildcard = case ActiveRecord::Base.connection.adapter_name.downcase
|
25
|
+
when 'postgresql'
|
26
|
+
'.*'
|
27
|
+
else
|
28
|
+
'%'
|
29
|
+
end
|
30
|
+
@tags = BlogPost.tag_counts_on(:tags).where(
|
31
|
+
["tags.name #{op} ?", "#{wildcard}#{params[:term].to_s.downcase}#{wildcard}"]
|
32
|
+
).map { |tag| {:id => tag.id, :value => tag.name}}
|
33
|
+
render :json => @tags.flatten
|
34
|
+
end
|
32
35
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
def create
|
37
|
+
# if the position field exists, set this object as last object, given the conditions of this class.
|
38
|
+
if BlogPost.column_names.include?("position")
|
39
|
+
params[:blog_post].merge!({
|
40
|
+
:position => ((BlogPost.maximum(:position, :conditions => "")||-1) + 1)
|
41
|
+
})
|
42
|
+
end
|
40
43
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
if BlogPost.column_names.include?("user_id")
|
45
|
+
params[:blog_post].merge!({
|
46
|
+
:user_id => current_user.id
|
47
|
+
})
|
48
|
+
end
|
46
49
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
50
|
+
if (@blog_post = BlogPost.create(params[:blog_post])).valid?
|
51
|
+
(request.xhr? ? flash.now : flash).notice = t(
|
52
|
+
'refinery.crudify.created',
|
53
|
+
:what => "'#{@blog_post.title}'"
|
54
|
+
)
|
52
55
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
+
unless from_dialog?
|
57
|
+
unless params[:continue_editing] =~ /true|on|1/
|
58
|
+
redirect_back_or_default(admin_blog_posts_url)
|
59
|
+
else
|
60
|
+
unless request.xhr?
|
61
|
+
redirect_to :back
|
62
|
+
else
|
63
|
+
render :partial => "/shared/message"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
else
|
67
|
+
render :text => "<script>parent.window.location = '#{admin_blog_posts_url}';</script>"
|
68
|
+
end
|
56
69
|
else
|
57
70
|
unless request.xhr?
|
58
|
-
|
71
|
+
render :action => 'new'
|
59
72
|
else
|
60
|
-
render :partial => "/shared/
|
73
|
+
render :partial => "/shared/admin/error_messages",
|
74
|
+
:locals => {
|
75
|
+
:object => @blog_post,
|
76
|
+
:include_object_name => true
|
77
|
+
}
|
61
78
|
end
|
62
79
|
end
|
63
|
-
else
|
64
|
-
render :text => "<script>parent.window.location = '#{admin_blog_posts_url}';</script>"
|
65
|
-
end
|
66
|
-
else
|
67
|
-
unless request.xhr?
|
68
|
-
render :action => 'new'
|
69
|
-
else
|
70
|
-
render :partial => "/shared/admin/error_messages",
|
71
|
-
:locals => {
|
72
|
-
:object => @blog_post,
|
73
|
-
:include_object_name => true
|
74
|
-
}
|
75
80
|
end
|
76
|
-
end
|
77
|
-
end
|
78
81
|
|
79
|
-
|
80
|
-
|
82
|
+
before_filter :find_all_categories,
|
83
|
+
:only => [:new, :edit, :create, :update]
|
81
84
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
+
before_filter :check_category_ids, :only => :update
|
86
|
+
|
87
|
+
protected
|
88
|
+
def find_all_categories
|
89
|
+
@blog_categories = BlogCategory.find(:all)
|
90
|
+
end
|
91
|
+
|
92
|
+
def check_category_ids
|
93
|
+
params[:blog_post][:category_ids] ||= []
|
94
|
+
end
|
95
|
+
end
|
85
96
|
end
|
86
97
|
end
|