proclaim 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +7 -0
- data/README.md +17 -11
- data/VERSION +1 -1
- data/app/assets/javascripts/proclaim.js +1 -1
- data/app/assets/javascripts/proclaim/editor.js.coffee +5 -3
- data/app/assets/stylesheets/proclaim.css.scss +1 -1
- data/app/assets/stylesheets/proclaim/posts.css.scss +28 -0
- data/app/controllers/proclaim/posts_controller.rb +1 -1
- data/app/views/proclaim/posts/_form.html.erb +4 -2
- data/app/views/proclaim/posts/index.html.erb +59 -20
- data/app/views/proclaim/posts/show.html.erb +13 -0
- data/lib/proclaim.rb +3 -0
- data/lib/proclaim/engine.rb +15 -1
- data/lib/proclaim/version.rb +1 -1
- data/proclaim.gemspec +1 -1
- data/test/controllers/proclaim/posts_controller_test.rb +33 -0
- data/test/integration/without_javascript/post_test.rb +30 -0
- data/vendor/assets/stylesheets/{medium-editor-insert-plugin-frontend.css → medium-editor-insert-plugin-frontend.css.scss} +0 -0
- data/vendor/assets/stylesheets/{medium-editor-insert-plugin.css → medium-editor-insert-plugin.css.scss} +5 -5
- metadata +58 -268
- data/test/dummy/log/test.log +0 -24299
- data/test/dummy/tmp/cache/assets/test/sass/0b69f7cc441d56def3a51688e6a7a8474dc476d1/proclaim.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/comments.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/images.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/posts.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sass/12a97df611d5fb0e395afda829edf8b9372acde7/subscriptions.css.scssc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/04adcece63bc645379e6de797e7998f8 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/06620fc450f0a9b4a482a7bc08387711 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/076dd0d567a92c34163b3b98af1d48ba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/09fc2eadf6d6062b2cc135a44e4e73db +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/09fe8c62e8ae706e01058b4b4d056c8e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1762aeeaf38da3b8d989a5b66b088004 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/194ac1a695334e303516614579b3926d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1d3be7eea3ff8c0146499017d648541a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/1f42c80faacb651f670ec2b0998e49dc +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2243230e778a749ecbf0415a52e75be0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/23ad87e715c70312aa61dde4fbb4bfe1 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/245b8735db4ea90bcaa91c011a1f447e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/26a42dac0cec64483f4126d2de4b0c9e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2720af7483e4bebed0013b683eb4e8be +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2a9fde362719df459202ce42a1a31d80 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2bfa6857b3481e2b089b1a50a9a08888 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/30151c8f6d93717f06fa12774612ddf4 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/33e9b92fe52b34555b7f189db369386f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/34e2219ac9bb25f2f390936a3470f4dd +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/38e638a80f2bd2897f1a9baa397baa2f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/3c623d200214a5334aaf170537db087f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/3d4caddf897a5f8c7ba4e8b9c53c0b17 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/40431cdcc10c75ba1f275ecfe42623d3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/437901953eb8707af6c27ca59cf65d91 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/461885b8ad31ef6a94c9a4f2e332b7eb +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4792f46317cda92ccd5b278ec61f9ac5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4998e169bba502eeb35bff4422101bc3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4af646e0ac7cadf5514772c74e47dad6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/4dcb3434b91b1c62f897a1741c6d398b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5101cda93cf70f0fc0837713be587780 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/52d8c61de0703e0d7cf97d0f7b0cca7a +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/57f3d19a9bd484ac68c46f962a8684b2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5934d5d0d1ac6657842708e85c73cf51 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5af081799d7da2f04ead6a516c6015ad +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/5fc08528499aa1e1a03f7a310e06b972 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/69ee5af8d9a655898a67bc538ca1c7e7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6d1c56259648b0383bc438c875a448c3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/6e7de35055967df848aa490830043e51 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/70bc59560ee544af7bb2f727247db307 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/728cb566999910549092ff0a98e2853b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/72b5f0d35e9d69b744a156edad98f983 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/749a8b0e45b11df748a256dd04ceb1f7 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/77fb9f62552d9b786f9407ef11cc9a09 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/819de31c63b704f9ddf4865587a91d41 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8604b464bf846e5223da37ef2f29b524 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/88af6aad07938a09e2561ee980dfb2c8 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/88fc815613b473e98e9307b1d423918d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8bc4341aa4060b8646e8134722cf3b11 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8cf8fd5ff8eae12211a88f971af30236 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8d58120d8a6e78812a54f7e9c7b8b863 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/8d85962a35678da84b1810399068ca36 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/920c1322be1212a54b7c4f2751d5e7bf +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/92205679a36afd387a2ba5c585a5a62c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/940566ebcae2d4e5c56a881ab66f2cf0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9451da0b94a96fb8342b62c81eb72a69 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/976967e07e2944a7ecc7403667f1f96b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9a8e402a7e32063e46647403b43553a5 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9b09ad72f8cc33503878b01c713d92d0 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/9e5dd44c55137d0d604724832120901e +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a20dbdfebf37fe50e832a6273c972553 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a8f95384a8f6b7a468b66073588444e9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/a92ef432055a7e3fab8af2147ede6feb +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ad18e3875541d4298b1df133d494b93f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/b9b7c575c22943d49734d52381c5ee16 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/bc7a0846b4881b0832d41de2b1724dba +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/be32d0a530ce861537d6abfa41333df9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c19d53fc90fcca0590f90f3a446949c1 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/c8270a6f07dccc5f00e6b2b43f10efd2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cd273fda133503a42b605362c765fd24 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cd3e3f5969094956602595c732a83b83 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cd82cd410a50bffcfb6e21e3c49a85c9 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ce4ccaa06bdee6426486224bc7e54187 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cea6cf0ee8476d3c8da46a12c7076fff +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d3efec4b938a7fd911d984ff04f08a11 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d4b784b16fa1b1dfcca6590689a8c157 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d5df62a80aed4498469dfc24aba67eb3 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/dd159a7799345d1a4e4ec2f5ae1d3035 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/de36ab6c3b1a9b62a586d98373dd569c +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e3aec457d5c753090d6521f2bb2d91b6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e53c71f50687f7048f1285f0205d2ec8 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e5bfb36aa9b224aa3b6b2c3d8efcef3f +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/e8d6158b1fed2f574242b55856a3953d +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ea82f6aececcf81eef3e2e15a9225e66 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/ed9f5c17f71ec75de10b1bb029ebd7a2 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f2984adaeaa5322e3a040705c6d40622 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f62fd0cf9f5e7e077ec9c4daeccb06ae +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fb0f641bfcbb0101c040da9ff736447b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fbb06f075e8e4ff33817a8a865ea641b +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/fe426a44cf23cf82032091cbffff898c +0 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.min.js +0 -10
- data/vendor/assets/javascripts/addons/medium-editor-insert-images.min.js +0 -10
- data/vendor/assets/javascripts/addons/medium-editor-insert-maps.min.js +0 -10
- data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.min.js +0 -10
- data/vendor/assets/javascripts/addons/medium-editor-insert-tables.min.js +0 -10
- data/vendor/assets/javascripts/medium-editor-insert-plugin.all.min.js +0 -10
- data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.min.css +0 -10
- data/vendor/assets/stylesheets/medium-editor-insert-plugin.min.css +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1e6549a58e1a47ce579008b2d534d4094dfe7fe
|
4
|
+
data.tar.gz: b4b007bbaffb2eb80fca51e5768900ba24bd3d3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c79facd228f95e64482ddfb9b0e425059b459f98d239971f03a3608865ba06e198d0dfd09903c3d3bc8481114eed977fe2fda6a70e11e4e7fdd13c6e90ccbdf
|
7
|
+
data.tar.gz: 1189d9a314ebe3a711bc98b1dd297ae57e25feaadba6722dd8fa1790a479ab8c46f93addc6b5061d33e2323b4dc941a29638af3393a4d864bcccd220ee6f9dc7
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
v 0.2.0
|
2
|
+
- Added ability to alter the buttons shown on editor toolbar
|
3
|
+
- Upgraded to Medium Editor 2.0.0
|
4
|
+
- Fix image toolbar's missing icons in production
|
5
|
+
- Edit/Delete buttons on post show page
|
6
|
+
- Posts ordered by publication date
|
7
|
+
|
1
8
|
v 0.1.3
|
2
9
|
- Fixed incorrect foreign keys
|
3
10
|
|
data/README.md
CHANGED
@@ -8,19 +8,15 @@ where you want it, configure it, and you have a blog. It otherwise stays out of
|
|
8
8
|
your way.
|
9
9
|
|
10
10
|
Proclaim stays minimal by making use of HTML5's contenteditable attribute. It
|
11
|
-
also uses the
|
12
|
-
[
|
13
|
-
Ferreira, in concert with Pavel Linkesch's
|
14
|
-
[Image Insert plugin](https://github.com/orthes/medium-editor-insert-plugin)
|
15
|
-
tied to CarrierWave for image uploads.
|
11
|
+
also uses the [Medium Editor clone][1] by Davi Ferreira, in concert with Pavel
|
12
|
+
Linkesch's [Image Insert plugin][2] tied to CarrierWave for image uploads.
|
16
13
|
|
17
14
|
Proclaim doesn't include any users or authentication. It was made to be able to
|
18
15
|
work with whatever setup you're using. All that it requires is that your
|
19
|
-
application _has_ users and authentication
|
20
|
-
|
21
|
-
|
22
|
-
can
|
23
|
-
logged in, it can only read posts and create comments.
|
16
|
+
application _has_ users and authentication ([Devise][3] is recommended). In
|
17
|
+
Proclaim 0.1, authentication is also used as authorization. If a user is logged
|
18
|
+
in, it can create/publish/edit/delete posts and edit/delete comments. If no user
|
19
|
+
is logged in, it can only read posts and create comments.
|
24
20
|
|
25
21
|
More information about configuring Proclaim for your specific authentication
|
26
22
|
scheme is given below.
|
@@ -32,7 +28,7 @@ scheme is given below.
|
|
32
28
|
Proclaim 0.1 works with Rails 4.2 and on. Add it to your Gemfile with:
|
33
29
|
|
34
30
|
```ruby
|
35
|
-
gem 'proclaim', "~> 0.
|
31
|
+
gem 'proclaim', "~> 0.2.0"
|
36
32
|
```
|
37
33
|
|
38
34
|
Run `bundle install` to install it.
|
@@ -108,6 +104,7 @@ Proclaim.author_name_method = :name
|
|
108
104
|
Proclaim.current_author_method = :current_user
|
109
105
|
Proclaim.authentication_method = :authenticate_user!
|
110
106
|
Proclaim.excerpt_length = 500
|
107
|
+
Proclaim.editor_toolbar_buttons = ['bold', 'italic', 'underline', 'anchor', 'header1', 'header2', 'quote']
|
111
108
|
```
|
112
109
|
|
113
110
|
- **Proclaim.author_class**
|
@@ -137,6 +134,11 @@ Proclaim.excerpt_length = 500
|
|
137
134
|
Maximum length for the excerpts shown on the posts index. The excerpts may be
|
138
135
|
less than this, but will never exceed it.
|
139
136
|
|
137
|
+
- **Proclaim.editor_toolbar_buttons**
|
138
|
+
|
139
|
+
The buttons to be displayed on the Medium Editor toolbar. For a full list of
|
140
|
+
options, see the README for [that project][1].
|
141
|
+
|
140
142
|
Astute readers may note that the defaults corresponds to defaults from Devise (on
|
141
143
|
the User class). If that's not your setup, all of these options can be changed
|
142
144
|
in the initializer installed by `rails generate proclaim:install`.
|
@@ -154,3 +156,7 @@ application and alter them by using the generator:
|
|
154
156
|
```ruby
|
155
157
|
rails generate proclaim:views
|
156
158
|
```
|
159
|
+
|
160
|
+
[1]: https://github.com/daviferreira/medium-editor "Medium Editor Clone"
|
161
|
+
[2]: https://github.com/orthes/medium-editor-insert-plugin "Image Insert plugin"
|
162
|
+
[3]: https://github.com/plataformatec/devise "Devise"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Editor
|
2
2
|
constructor: (@form, @titleFormField, @titleEditableItem,
|
3
|
-
@bodyFormField, @bodyEditableItem) ->
|
3
|
+
@bodyFormField, @bodyEditableItem, @toolbarButtons) ->
|
4
4
|
if (@form.length == 1) and (@titleFormField.length == 1) and
|
5
5
|
(@titleEditableItem.length == 1) and (@bodyFormField.length == 1) and
|
6
6
|
(@bodyEditableItem.length == 1)
|
@@ -8,8 +8,10 @@ class Editor
|
|
8
8
|
imageDeletePath = @bodyEditableItem.data("image-delete-path")
|
9
9
|
|
10
10
|
if (imageUploadPath.length > 0) and (imageDeletePath.length > 0)
|
11
|
-
@bodyEditor = new MediumEditor(@bodyEditableItem,
|
12
|
-
|
11
|
+
@bodyEditor = new MediumEditor(@bodyEditableItem, {
|
12
|
+
buttonLabels: 'fontawesome',
|
13
|
+
buttons: @toolbarButtons
|
14
|
+
})
|
13
15
|
|
14
16
|
@titleEditor = new MediumEditor(@titleEditableItem)
|
15
17
|
|
@@ -26,6 +26,34 @@ div.post_excerpt_information
|
|
26
26
|
margin-top: 10px;
|
27
27
|
}
|
28
28
|
|
29
|
+
td#draft_posts
|
30
|
+
{
|
31
|
+
width: 40%;
|
32
|
+
vertical-align: top;
|
33
|
+
|
34
|
+
h2
|
35
|
+
{
|
36
|
+
margin-top: 0;
|
37
|
+
}
|
38
|
+
|
39
|
+
h3
|
40
|
+
{
|
41
|
+
margin-bottom: 0;
|
42
|
+
}
|
43
|
+
|
44
|
+
div#draft_list
|
45
|
+
{
|
46
|
+
border: solid rgba(0, 0, 0, 0.3) 1px;
|
47
|
+
padding: 10px;
|
48
|
+
margin-left: 20px;
|
49
|
+
}
|
50
|
+
|
51
|
+
div.post_excerpt_information
|
52
|
+
{
|
53
|
+
margin-top: 0;
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
29
57
|
input.datetime_picker
|
30
58
|
{
|
31
59
|
cursor: pointer;
|
@@ -6,13 +6,15 @@
|
|
6
6
|
$(document).find("input#post_title"),
|
7
7
|
$(document).find("form.new_post h1.editable"),
|
8
8
|
$(document).find("input#post_body"),
|
9
|
-
$(document).find("form.new_post div.editable")
|
9
|
+
$(document).find("form.new_post div.editable"),
|
10
|
+
<%= raw Proclaim.editor_toolbar_buttons.to_json %>);
|
10
11
|
<% else %>
|
11
12
|
new Editor($(document).find("form.edit_post"),
|
12
13
|
$(document).find("input#post_title"),
|
13
14
|
$(document).find("form.edit_post h1.editable"),
|
14
15
|
$(document).find("input#post_body"),
|
15
|
-
$(document).find("form.edit_post div.editable")
|
16
|
+
$(document).find("form.edit_post div.editable"),
|
17
|
+
<%= raw Proclaim.editor_toolbar_buttons.to_json %>);
|
16
18
|
<% end %>
|
17
19
|
});
|
18
20
|
</script>
|
@@ -5,26 +5,65 @@
|
|
5
5
|
<% if @posts.empty? %>
|
6
6
|
<p>No posts have been made, yet.</p>
|
7
7
|
<% else %>
|
8
|
-
|
9
|
-
<
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
<table style = "width: 100%;">
|
9
|
+
<tr>
|
10
|
+
<td id = "published_posts">
|
11
|
+
<% @posts.published.each do |post| %>
|
12
|
+
<h1><%= link_to post.title, post %></h1>
|
13
|
+
<div id = "post_<%= post.id %>">
|
14
|
+
<% excerpt = post.excerpt %>
|
15
|
+
<span class = "excerpt"><%= excerpt %></span>
|
13
16
|
|
14
|
-
|
15
|
-
|
17
|
+
<% if excerpt.length < post.body.length %>
|
18
|
+
. . . <%= link_to "(more)", post %>
|
19
|
+
<% end %>
|
20
|
+
</div>
|
21
|
+
<div class = "post_excerpt_information">
|
22
|
+
<div style = "float: right;">
|
23
|
+
<% if policy(post).edit? %>
|
24
|
+
<%= link_to 'Edit', edit_post_path(post) %>
|
25
|
+
<% end %>
|
26
|
+
<% if policy(post).destroy? %>
|
27
|
+
<% if policy(post).edit? %>
|
28
|
+
|
|
29
|
+
<% end %>
|
30
|
+
<%= link_to 'Delete', post, method: :delete, data: { confirm: 'Are you sure?' } %>
|
31
|
+
<% end %>
|
32
|
+
</div>
|
33
|
+
<%= post.author.send(Proclaim.author_name_method) %><br />
|
34
|
+
<%= timeago_tag post.updated_at, format: "%B %d, %Y" %>
|
35
|
+
</div>
|
16
36
|
<% end %>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
37
|
+
</td>
|
38
|
+
|
39
|
+
<% drafts = @posts.draft %>
|
40
|
+
<% unless drafts.blank? %>
|
41
|
+
<td id = "draft_posts">
|
42
|
+
<div id = "draft_list">
|
43
|
+
<h2>Drafts</h2>
|
44
|
+
<% drafts.each do |post| %>
|
45
|
+
<h3 class = "draft_list_item">
|
46
|
+
<%= link_to post.title, post %>
|
47
|
+
</h3>
|
48
|
+
<div class = "post_excerpt_information">
|
49
|
+
<div style = "float: right;">
|
50
|
+
<% if policy(post).edit? %>
|
51
|
+
<%= link_to 'Edit', edit_post_path(post) %>
|
52
|
+
<% end %>
|
53
|
+
<% if policy(post).destroy? %>
|
54
|
+
<% if policy(post).edit? %>
|
55
|
+
|
|
56
|
+
<% end %>
|
57
|
+
<%= link_to 'Delete', post, method: :delete, data: { confirm: 'Are you sure?' } %>
|
58
|
+
<% end %>
|
59
|
+
</div>
|
60
|
+
<%= post.author.send(Proclaim.author_name_method) %><br />
|
61
|
+
<%= timeago_tag post.updated_at, format: "%B %d, %Y" %>
|
62
|
+
</div>
|
63
|
+
<% end %>
|
64
|
+
</div>
|
65
|
+
</td>
|
66
|
+
<% end %>
|
67
|
+
</tr>
|
68
|
+
</table>
|
30
69
|
<% end %>
|
@@ -14,6 +14,19 @@
|
|
14
14
|
});
|
15
15
|
</script>
|
16
16
|
|
17
|
+
<div style = "float: right;">
|
18
|
+
<% if policy(@post).edit? %>
|
19
|
+
<%= link_to 'Edit', edit_post_path(@post) %>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<% if policy(@post).destroy? %>
|
23
|
+
<% if policy(@post).edit? %>
|
24
|
+
|
|
25
|
+
<% end %>
|
26
|
+
<%= link_to 'Delete', @post, method: :delete, data: { confirm: 'Are you sure?' } %>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
|
17
30
|
<div class = "post">
|
18
31
|
<h1 class = "post_title"><%= @post.title %></h1>
|
19
32
|
|
data/lib/proclaim.rb
CHANGED
@@ -16,6 +16,9 @@ module Proclaim
|
|
16
16
|
mattr_accessor :excerpt_length
|
17
17
|
@@excerpt_length = 500 # 500 characters (won't interrupt words)
|
18
18
|
|
19
|
+
mattr_accessor :editor_toolbar_buttons
|
20
|
+
@@editor_toolbar_buttons = ['bold', 'italic', 'underline', 'anchor', 'header1', 'header2', 'quote']
|
21
|
+
|
19
22
|
def self.setup
|
20
23
|
yield self
|
21
24
|
end
|
data/lib/proclaim/engine.rb
CHANGED
@@ -16,7 +16,21 @@ module Proclaim
|
|
16
16
|
isolate_namespace Proclaim
|
17
17
|
|
18
18
|
initializer :assets do
|
19
|
-
Rails.application.config.assets.precompile += %w{
|
19
|
+
Rails.application.config.assets.precompile += %w{
|
20
|
+
link.png
|
21
|
+
remove.png
|
22
|
+
resize-bigger.png
|
23
|
+
resize-smaller.png
|
24
|
+
unlink.png
|
25
|
+
medium-editor-insert-plugin.css.scss
|
26
|
+
medium-editor-insert-plugin-frontend.css.scss
|
27
|
+
medium-editor-insert-plugin.all.js
|
28
|
+
addons/medium-editor-insert-embeds.js
|
29
|
+
addons/medium-editor-insert-maps.js
|
30
|
+
addons/medium-editor-insert-tables.js
|
31
|
+
addons/medium-editor-insert-images.js
|
32
|
+
addons/medium-editor-insert-plugin.js
|
33
|
+
}
|
20
34
|
end
|
21
35
|
|
22
36
|
initializer :append_migrations do |app|
|
data/lib/proclaim/version.rb
CHANGED
data/proclaim.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_dependency "premailer", "~> 1.8"
|
31
31
|
s.add_dependency "closure_tree", "~> 5.2"
|
32
32
|
s.add_dependency "font-awesome-rails", "~> 4.2"
|
33
|
-
s.add_dependency "medium-editor-rails", "~> 0
|
33
|
+
s.add_dependency "medium-editor-rails", "~> 1.0"
|
34
34
|
s.add_dependency "carrierwave", "~> 0.10"
|
35
35
|
s.add_dependency "aasm", "~> 4.0"
|
36
36
|
s.add_dependency "rails-timeago", "~> 2.11"
|
@@ -40,6 +40,39 @@ module Proclaim
|
|
40
40
|
assert_includes assigns(:posts), post2
|
41
41
|
end
|
42
42
|
|
43
|
+
test "posts should be ordered by publication date" do
|
44
|
+
post1 = FactoryGirl.create(:published_post)
|
45
|
+
post2 = FactoryGirl.create(:published_post)
|
46
|
+
|
47
|
+
get :index
|
48
|
+
assert_response :success
|
49
|
+
assert_not_nil assigns(:posts)
|
50
|
+
assert_equal 2, assigns(:posts).count
|
51
|
+
assert_equal post2, assigns(:posts).first
|
52
|
+
assert_equal post1, assigns(:posts).last
|
53
|
+
end
|
54
|
+
|
55
|
+
test "drafts should be ordered by updated date" do
|
56
|
+
user = FactoryGirl.create(:user)
|
57
|
+
sign_in user
|
58
|
+
|
59
|
+
post1 = FactoryGirl.create(:post)
|
60
|
+
post2 = FactoryGirl.create(:post)
|
61
|
+
post3 = FactoryGirl.create(:post)
|
62
|
+
|
63
|
+
# Update post1 so its updated_at is newest
|
64
|
+
post2.body = "Updated Body"
|
65
|
+
post2.save
|
66
|
+
|
67
|
+
get :index
|
68
|
+
assert_response :success
|
69
|
+
assert_not_nil assigns(:posts)
|
70
|
+
assert_equal 3, assigns(:posts).count
|
71
|
+
assert_equal post2, assigns(:posts).first
|
72
|
+
assert_equal post3, assigns(:posts).second
|
73
|
+
assert_equal post1, assigns(:posts).last
|
74
|
+
end
|
75
|
+
|
43
76
|
test "should get new if logged in" do
|
44
77
|
user = FactoryGirl.create(:user)
|
45
78
|
sign_in user
|
@@ -115,6 +115,36 @@ class PostTest < ActionDispatch::IntegrationTest
|
|
115
115
|
"Post 2 should not contain a link to see more"
|
116
116
|
end
|
117
117
|
|
118
|
+
test "index should show posts ordered by publication date" do
|
119
|
+
post1 = FactoryGirl.create(:published_post)
|
120
|
+
post2 = FactoryGirl.create(:published_post)
|
121
|
+
|
122
|
+
visit proclaim.posts_path
|
123
|
+
|
124
|
+
assert page.body.index(post2.title) < page.body.index(post1.title),
|
125
|
+
"Post 2 should be shown before post 1!"
|
126
|
+
end
|
127
|
+
|
128
|
+
test "index should show drafts ordered by modification date" do
|
129
|
+
user = FactoryGirl.create(:user)
|
130
|
+
sign_in user
|
131
|
+
|
132
|
+
post1 = FactoryGirl.create(:post)
|
133
|
+
post2 = FactoryGirl.create(:post)
|
134
|
+
post3 = FactoryGirl.create(:post)
|
135
|
+
|
136
|
+
# Update post1 so its updated_at is newest
|
137
|
+
post2.body = "Updated Body"
|
138
|
+
post2.save
|
139
|
+
|
140
|
+
visit proclaim.posts_path
|
141
|
+
|
142
|
+
assert page.body.index(post2.title) < page.body.index(post3.title),
|
143
|
+
"Post 2 draft should be shown before post 3 draft!"
|
144
|
+
assert page.body.index(post3.title) < page.body.index(post1.title),
|
145
|
+
"Post 3 draft should be shown before post 1 draft!"
|
146
|
+
end
|
147
|
+
|
118
148
|
test "show should show author name" do
|
119
149
|
post = FactoryGirl.create(:published_post)
|
120
150
|
|
File without changes
|
@@ -178,17 +178,17 @@
|
|
178
178
|
cursor: pointer; }
|
179
179
|
.mediumInsert .mediumInsert-imageRemove {
|
180
180
|
right: 0;
|
181
|
-
background-image:
|
181
|
+
background-image: image_url('remove.png'); }
|
182
182
|
.mediumInsert .mediumInsert-imageResizeSmaller, .mediumInsert .mediumInsert-imageResizeBigger, .mediumInsert .mediumInsert-imageResizeBigger {
|
183
183
|
right: 31px;
|
184
|
-
background-image:
|
184
|
+
background-image: image_url('resize-smaller.png'); }
|
185
185
|
.mediumInsert .mediumInsert-imageResizeBigger {
|
186
|
-
background-image:
|
186
|
+
background-image: image_url('resize-bigger.png'); }
|
187
187
|
.mediumInsert .mediumInsert-imageLink, .mediumInsert .mediumInsert-imageUnlink {
|
188
188
|
right: 62px;
|
189
|
-
background-image:
|
189
|
+
background-image: image_url('link.png'); }
|
190
190
|
.mediumInsert .mediumInsert-imageUnlink {
|
191
|
-
background-image:
|
191
|
+
background-image: image_url('unlink.png'); }
|
192
192
|
.mediumInsert .mediumInsert-error {
|
193
193
|
background-color: #f2dede;
|
194
194
|
border: 1px solid #ebccd1;
|