k3cms_blog 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.rspec +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +136 -0
- data/License.txt +165 -0
- data/Rakefile +20 -0
- data/Readme.rdoc +13 -0
- data/app/cells/k3cms/blog/blog_posts/index.html.haml +46 -0
- data/app/cells/k3cms/blog/blog_posts/index.html.haml.haml +0 -0
- data/app/cells/k3cms/blog/blog_posts/metadata_drawer.html.haml +38 -0
- data/app/cells/k3cms/blog/blog_posts/published_status.html.haml +4 -0
- data/app/cells/k3cms/blog/blog_posts_cell.rb +36 -0
- data/app/controllers/k3cms/blog/base_controller.rb +29 -0
- data/app/controllers/k3cms/blog/blog_posts_controller.rb +82 -0
- data/app/models/k3cms/blog/ability.rb +37 -0
- data/app/models/k3cms/blog/blog_post.rb +75 -0
- data/app/models/user_decorator.rb +3 -0
- data/app/views/k3cms/blog/blog_posts/_form.html.erb +28 -0
- data/app/views/k3cms/blog/blog_posts/edit.html.erb +3 -0
- data/app/views/k3cms/blog/blog_posts/index.html.haml +3 -0
- data/app/views/k3cms/blog/blog_posts/new.html.erb +5 -0
- data/app/views/k3cms/blog/blog_posts/show.html.haml +41 -0
- data/app/views/k3cms/blog/init.html.haml +34 -0
- data/config/authorization.rb +37 -0
- data/config/locales/validates_timeliness.en.yml +16 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20110113015852_create_k3_blog_posts.rb +17 -0
- data/db/migrate/20110118015034_create_slugs.rb +18 -0
- data/db/migrate/20110118023300_add_cached_slug_to_blog_posts.rb +10 -0
- data/db/migrate/20110120172202_add_meta_description_to_blog_posts.rb +15 -0
- data/db/migrate/20110415180204_rename_to_k3cms_blog_posts.rb +9 -0
- data/image_source/famfamfam_silk_icons/information.png +0 -0
- data/image_source/famfamfam_silk_icons/page_add.png +0 -0
- data/image_source/famfamfam_silk_icons/page_delete.png +0 -0
- data/image_source/famfamfam_silk_icons/page_white_add.png +0 -0
- data/image_source/famfamfam_silk_icons/text_list_bullets.png +0 -0
- data/image_source/icons.xcf +0 -0
- data/k3cms_blog.gemspec +37 -0
- data/lib/form_tag_helper.rb +3 -0
- data/lib/k3cms/blog/railtie.rb +67 -0
- data/lib/k3cms/blog/version.rb +5 -0
- data/lib/k3cms_blog.rb +8 -0
- data/lib/tasks/tasks.rake +17 -0
- data/public/images/k3cms/blog/icons.png +0 -0
- data/public/images/k3cms/blog/new.png +0 -0
- data/public/javascripts/k3cms/blog.js +13 -0
- data/public/stylesheets/k3cms/blog.css +53 -0
- data/spec/connection_and_schema.rb +12 -0
- data/spec/models/blog_post_spec.rb +254 -0
- data/spec/spec_helper.rb +49 -0
- metadata +340 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color --format d
|
data/Gemfile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gemspec
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
k3cms_blog (0.1.0)
|
5
|
+
actionpack (~> 3.0.0)
|
6
|
+
activerecord (~> 3.0.0)
|
7
|
+
attribute_normalizer
|
8
|
+
cells
|
9
|
+
facets
|
10
|
+
friendly_id
|
11
|
+
k3cms_core
|
12
|
+
rails (~> 3.0.0)
|
13
|
+
stringex
|
14
|
+
validates_timeliness
|
15
|
+
|
16
|
+
GEM
|
17
|
+
specs:
|
18
|
+
abstract (1.0.0)
|
19
|
+
actionmailer (3.0.5)
|
20
|
+
actionpack (= 3.0.5)
|
21
|
+
mail (~> 2.2.15)
|
22
|
+
actionpack (3.0.5)
|
23
|
+
activemodel (= 3.0.5)
|
24
|
+
activesupport (= 3.0.5)
|
25
|
+
builder (~> 2.1.2)
|
26
|
+
erubis (~> 2.6.6)
|
27
|
+
i18n (~> 0.4)
|
28
|
+
rack (~> 1.2.1)
|
29
|
+
rack-mount (~> 0.6.13)
|
30
|
+
rack-test (~> 0.5.7)
|
31
|
+
tzinfo (~> 0.3.23)
|
32
|
+
activemodel (3.0.5)
|
33
|
+
activesupport (= 3.0.5)
|
34
|
+
builder (~> 2.1.2)
|
35
|
+
i18n (~> 0.4)
|
36
|
+
activerecord (3.0.5)
|
37
|
+
activemodel (= 3.0.5)
|
38
|
+
activesupport (= 3.0.5)
|
39
|
+
arel (~> 2.0.2)
|
40
|
+
tzinfo (~> 0.3.23)
|
41
|
+
activeresource (3.0.5)
|
42
|
+
activemodel (= 3.0.5)
|
43
|
+
activesupport (= 3.0.5)
|
44
|
+
activesupport (3.0.5)
|
45
|
+
archive-tar-minitar (0.5.2)
|
46
|
+
arel (2.0.9)
|
47
|
+
attribute_normalizer (0.3.1)
|
48
|
+
babosa (0.3.3)
|
49
|
+
builder (2.1.2)
|
50
|
+
cells (3.5.6)
|
51
|
+
actionpack (~> 3.0.0)
|
52
|
+
railties (~> 3.0.0)
|
53
|
+
columnize (0.3.2)
|
54
|
+
diff-lcs (1.1.2)
|
55
|
+
erubis (2.6.6)
|
56
|
+
abstract (>= 1.0.0)
|
57
|
+
facets (2.9.1)
|
58
|
+
friendly_id (3.2.1.1)
|
59
|
+
babosa (~> 0.3.0)
|
60
|
+
i18n (0.5.0)
|
61
|
+
k3cms_core (0.1.1)
|
62
|
+
activerecord (~> 3.0.0)
|
63
|
+
cells
|
64
|
+
rails (~> 3.0.0)
|
65
|
+
linecache19 (0.5.12)
|
66
|
+
ruby_core_source (>= 0.1.4)
|
67
|
+
mail (2.2.15)
|
68
|
+
activesupport (>= 2.3.6)
|
69
|
+
i18n (>= 0.4.0)
|
70
|
+
mime-types (~> 1.16)
|
71
|
+
treetop (~> 1.4.8)
|
72
|
+
mime-types (1.16)
|
73
|
+
polyglot (0.3.1)
|
74
|
+
rack (1.2.2)
|
75
|
+
rack-mount (0.6.14)
|
76
|
+
rack (>= 1.0.0)
|
77
|
+
rack-test (0.5.7)
|
78
|
+
rack (>= 1.0)
|
79
|
+
rails (3.0.5)
|
80
|
+
actionmailer (= 3.0.5)
|
81
|
+
actionpack (= 3.0.5)
|
82
|
+
activerecord (= 3.0.5)
|
83
|
+
activeresource (= 3.0.5)
|
84
|
+
activesupport (= 3.0.5)
|
85
|
+
bundler (~> 1.0)
|
86
|
+
railties (= 3.0.5)
|
87
|
+
railties (3.0.5)
|
88
|
+
actionpack (= 3.0.5)
|
89
|
+
activesupport (= 3.0.5)
|
90
|
+
rake (>= 0.8.7)
|
91
|
+
thor (~> 0.14.4)
|
92
|
+
rake (0.8.7)
|
93
|
+
rspec (2.5.0)
|
94
|
+
rspec-core (~> 2.5.0)
|
95
|
+
rspec-expectations (~> 2.5.0)
|
96
|
+
rspec-mocks (~> 2.5.0)
|
97
|
+
rspec-core (2.5.1)
|
98
|
+
rspec-expectations (2.5.0)
|
99
|
+
diff-lcs (~> 1.1.2)
|
100
|
+
rspec-mocks (2.5.0)
|
101
|
+
rspec-rails (2.5.0)
|
102
|
+
actionpack (~> 3.0)
|
103
|
+
activesupport (~> 3.0)
|
104
|
+
railties (~> 3.0)
|
105
|
+
rspec (~> 2.5.0)
|
106
|
+
ruby-debug-base19 (0.11.25)
|
107
|
+
columnize (>= 0.3.1)
|
108
|
+
linecache19 (>= 0.5.11)
|
109
|
+
ruby_core_source (>= 0.1.4)
|
110
|
+
ruby-debug19 (0.11.6)
|
111
|
+
columnize (>= 0.3.1)
|
112
|
+
linecache19 (>= 0.5.11)
|
113
|
+
ruby-debug-base19 (>= 0.11.19)
|
114
|
+
ruby_core_source (0.1.5)
|
115
|
+
archive-tar-minitar (>= 0.5.2)
|
116
|
+
sqlite3 (1.3.3)
|
117
|
+
sqlite3-ruby (1.3.3)
|
118
|
+
sqlite3 (>= 1.3.3)
|
119
|
+
stringex (1.2.1)
|
120
|
+
thor (0.14.6)
|
121
|
+
timeliness (0.3.3)
|
122
|
+
treetop (1.4.9)
|
123
|
+
polyglot (>= 0.3.1)
|
124
|
+
tzinfo (0.3.26)
|
125
|
+
validates_timeliness (3.0.5)
|
126
|
+
timeliness (~> 0.3.2)
|
127
|
+
|
128
|
+
PLATFORMS
|
129
|
+
ruby
|
130
|
+
|
131
|
+
DEPENDENCIES
|
132
|
+
k3cms_blog!
|
133
|
+
rspec
|
134
|
+
rspec-rails
|
135
|
+
ruby-debug19
|
136
|
+
sqlite3-ruby
|
data/License.txt
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
#---------------------------------------------------------------------------------------------------
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
desc 'Default: Run specs'
|
8
|
+
task :default => :spec
|
9
|
+
|
10
|
+
desc 'Run specdoc'
|
11
|
+
RSpec::Core::RakeTask.new('specdoc') do |t|
|
12
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Run specs'
|
16
|
+
RSpec::Core::RakeTask.new('spec') do |t|
|
17
|
+
t.pattern = FileList['spec/**/*_spec.rb']
|
18
|
+
end
|
19
|
+
|
20
|
+
|
data/Readme.rdoc
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
= K3cms Blog
|
2
|
+
|
3
|
+
Provides simple blog functionality for the K3cms.
|
4
|
+
|
5
|
+
== License
|
6
|
+
|
7
|
+
Copyright 2010 K3 Integrations, LLC
|
8
|
+
|
9
|
+
Licensed under the GNU Lesser General Public License, Version 3 (see License.txt).
|
10
|
+
|
11
|
+
== Credits
|
12
|
+
|
13
|
+
Some icons were taken from the Silk icon set (http://www.famfamfam.com/lab/icons/silk/), copyright Mark James. This work is licensed under a Creative Commons Attribution 2.5 License [http://creativecommons.org/licenses/by/2.5/].
|
@@ -0,0 +1,46 @@
|
|
1
|
+
.k3cms_blog_blog_posts_index
|
2
|
+
%h1 News
|
3
|
+
|
4
|
+
- if edit_mode? and can?(:create, K3cms::Blog::BlogPost)
|
5
|
+
%p
|
6
|
+
= form_for blog_post=K3cms::Blog::BlogPost.new do |f|
|
7
|
+
= f.submit 'Create new post'
|
8
|
+
|
9
|
+
- @blog_posts.each do |blog_post|
|
10
|
+
%div{:class => dom_class(blog_post), :id => dom_id(blog_post)}
|
11
|
+
%h3.title
|
12
|
+
- if edit_mode? and can?(:edit, K3cms::Blog::BlogPost)
|
13
|
+
= inline_editable('span', blog_post, :title) do
|
14
|
+
= raw blog_post.title
|
15
|
+
- else
|
16
|
+
= link_to raw(blog_post.title), k3cms_blog_blog_post_path(blog_post)
|
17
|
+
|
18
|
+
= render_cell('k3cms/blog/blog_posts', :published_status, :blog_post => blog_post)
|
19
|
+
|
20
|
+
.date
|
21
|
+
- if edit_mode? and can?(:edit, K3cms::Blog::BlogPost)
|
22
|
+
= inline_editable('span', blog_post, :date) do
|
23
|
+
= raw blog_post.date
|
24
|
+
- else
|
25
|
+
= blog_post.date && blog_post.date.to_s(:long)
|
26
|
+
|
27
|
+
.summary
|
28
|
+
- if edit_mode? and can?(:edit, K3cms::Blog::BlogPost)
|
29
|
+
= inline_editable('div', blog_post, :summary) do
|
30
|
+
= raw blog_post.summary
|
31
|
+
- else
|
32
|
+
= raw blog_post.summary
|
33
|
+
|
34
|
+
.below_summary
|
35
|
+
- if edit_mode? and can?(:edit, K3cms::Blog::BlogPost)
|
36
|
+
- if can?(:edit, K3cms::Blog::BlogPost)
|
37
|
+
= link_to 'Continue »'.html_safe, polymorphic_url(blog_post, :focus => "##{dom_id(blog_post)} .editable[data-attribute=body]", :only_path => true)
|
38
|
+
- if can?(:destroy, K3cms::Blog::BlogPost)
|
39
|
+
= button_to 'Delete', polymorphic_url(blog_post, :only_path => true), :confirm => 'Are you sure?', :method => :delete
|
40
|
+
|
41
|
+
- else
|
42
|
+
.view_more
|
43
|
+
= link_to 'View more', url_for(blog_post)
|
44
|
+
|
45
|
+
.post_bottom
|
46
|
+
-# Comments, etc. go here
|
File without changes
|
@@ -0,0 +1,38 @@
|
|
1
|
+
%h2 Post Information
|
2
|
+
%div{:class => dom_class(@blog_post), :id => dom_id(@blog_post)}
|
3
|
+
.title
|
4
|
+
%label Title:
|
5
|
+
= inline_editable('span', @blog_post, :title, 'data-idle-save-time' => '1000') do
|
6
|
+
= raw @blog_post.title
|
7
|
+
|
8
|
+
.url
|
9
|
+
%label URL:
|
10
|
+
= inline_editable('span', @blog_post, :url) do
|
11
|
+
= raw @blog_post.url
|
12
|
+
|
13
|
+
.date
|
14
|
+
%label Date:
|
15
|
+
- if edit_mode? and can?(:edit, K3cms::Blog::BlogPost)
|
16
|
+
= inline_editable('span', @blog_post, :date) do
|
17
|
+
= raw @blog_post.date
|
18
|
+
- else
|
19
|
+
= raw @blog_post.date
|
20
|
+
|
21
|
+
.summary
|
22
|
+
%label Summary:
|
23
|
+
= inline_editable('div', @blog_post, :summary) do
|
24
|
+
= raw @blog_post.summary
|
25
|
+
|
26
|
+
|
27
|
+
= link_to_function 'Extended Information', "jQuery('.k3cms_blog_blog_post_extended_metadata.drawer').slideToggle()"
|
28
|
+
- k3cms_ribbon_render_drawer :k3cms_page_extended_metadata do
|
29
|
+
.title
|
30
|
+
%label Meta Description:
|
31
|
+
= inline_editable('span', @blog_post, :meta_description) do
|
32
|
+
= @blog_post.meta_description
|
33
|
+
|
34
|
+
.url
|
35
|
+
%label Meta Keywords:
|
36
|
+
= inline_editable('span', @blog_post, :meta_keywords) do
|
37
|
+
= @blog_post.meta_keywords
|
38
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module K3cms
|
2
|
+
module Blog
|
3
|
+
class BlogPostsCell < Cell::Rails
|
4
|
+
helper K3cms::Ribbon::RibbonHelper # for edit_mode?
|
5
|
+
helper K3cms::InlineEditor::InlineEditorHelper
|
6
|
+
|
7
|
+
# Sorry this is duplicated between here and app/controllers/k3cms/blog/base_controller.rb
|
8
|
+
# I tried refactoring the common code out to a BaseControllerModule module that got mixed in both places, but for whatever reason that I couldn't figure out, it would use the current_ability defined in cancan/lib/cancan/controller_additions.rb:277:
|
9
|
+
# def current_ability
|
10
|
+
# @current_ability ||= ::Ability.new(current_user)
|
11
|
+
# end
|
12
|
+
# which references non-existent Ability class.
|
13
|
+
#
|
14
|
+
def current_ability
|
15
|
+
@current_ability ||= K3cms::Blog::Ability.new(k3cms_user)
|
16
|
+
end
|
17
|
+
|
18
|
+
def published_status
|
19
|
+
render
|
20
|
+
end
|
21
|
+
|
22
|
+
def index
|
23
|
+
@blog_posts = BlogPost.accessible_by(current_ability).order('id desc')
|
24
|
+
# This is to enforce the blog_post.published? condition specified in a block. accessible_by doesn't automatically check the block conditions when fetching records.
|
25
|
+
@blog_posts.select! {|blog_post| can?(:read, blog_post)}
|
26
|
+
render
|
27
|
+
end
|
28
|
+
|
29
|
+
def metadata_drawer
|
30
|
+
@blog_post = options[:blog_post]
|
31
|
+
render
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|