journal-chr 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +240 -0
- data/LICENSE.md +21 -0
- data/README.md +57 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/journal.coffee +2 -0
- data/app/assets/javascripts/journal/categories.coffee +17 -0
- data/app/assets/javascripts/journal/pages.coffee +25 -0
- data/app/assets/javascripts/journal/posts.coffee +77 -0
- data/app/assets/stylesheets/journal.scss +58 -0
- data/app/controllers/admin/journal_categories_controller.rb +13 -0
- data/app/controllers/admin/journal_pages_controller.rb +13 -0
- data/app/controllers/admin/journal_posts_controller.rb +17 -0
- data/app/controllers/journal_pages_controller.rb +12 -0
- data/app/controllers/journal_posts_controller.rb +58 -0
- data/app/helpers/journal_helper.rb +22 -0
- data/app/models/journal_category.rb +7 -0
- data/app/models/journal_page.rb +4 -0
- data/app/models/journal_post.rb +63 -0
- data/app/views/journal_pages/show.html.erb +11 -0
- data/app/views/journal_posts/_post.html.erb +25 -0
- data/app/views/journal_posts/index.html.erb +7 -0
- data/app/views/journal_posts/show.html.erb +33 -0
- data/journal-chr.gemspec +25 -0
- data/lib/constraints/categories.rb +11 -0
- data/lib/constraints/pages.rb +15 -0
- data/lib/constraints/posts.rb +8 -0
- data/lib/journal-chr.rb +1 -0
- data/lib/journal.rb +14 -0
- data/lib/journal/engine.rb +5 -0
- data/lib/journal/routing.rb +41 -0
- data/lib/journal/version.rb +3 -0
- metadata +160 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7723a3b06bae07ba8c14d303be9e6ab9382973f4
|
4
|
+
data.tar.gz: 788a7bdb26e5a99896255fb3a10ca0c0a0db812f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b4daae1e89b306fb43fd53cbd12c11d4a003883bdfa6406e059d35a84e49e0211e11c1edd30f73bec398335e2dda97a8950b5d1892dc268c0e538e7b2d9b4a13
|
7
|
+
data.tar.gz: 77ac5d04164de60612e4bf6affb46a99d5a16d494cca77b141b96113e1cbe3a09ade2694f655d1056eac0ee1b849da38a332caa67ff763a80f05bf51e3bcc017
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
.DS_Store
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,240 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
journal-chr (0.3.6)
|
5
|
+
ants (>= 0.3.12)
|
6
|
+
chr (>= 0.5.5)
|
7
|
+
loft (>= 0.3.1)
|
8
|
+
mongosteen (>= 0.2.0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: http://rubygems.org/
|
12
|
+
specs:
|
13
|
+
actionmailer (4.2.5)
|
14
|
+
actionpack (= 4.2.5)
|
15
|
+
actionview (= 4.2.5)
|
16
|
+
activejob (= 4.2.5)
|
17
|
+
mail (~> 2.5, >= 2.5.4)
|
18
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
19
|
+
actionpack (4.2.5)
|
20
|
+
actionview (= 4.2.5)
|
21
|
+
activesupport (= 4.2.5)
|
22
|
+
rack (~> 1.6)
|
23
|
+
rack-test (~> 0.6.2)
|
24
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
25
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
26
|
+
actionview (4.2.5)
|
27
|
+
activesupport (= 4.2.5)
|
28
|
+
builder (~> 3.1)
|
29
|
+
erubis (~> 2.7.0)
|
30
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
31
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
32
|
+
activejob (4.2.5)
|
33
|
+
activesupport (= 4.2.5)
|
34
|
+
globalid (>= 0.3.0)
|
35
|
+
activemodel (4.2.5)
|
36
|
+
activesupport (= 4.2.5)
|
37
|
+
builder (~> 3.1)
|
38
|
+
activerecord (4.2.5)
|
39
|
+
activemodel (= 4.2.5)
|
40
|
+
activesupport (= 4.2.5)
|
41
|
+
arel (~> 6.0)
|
42
|
+
activesupport (4.2.5)
|
43
|
+
i18n (~> 0.7)
|
44
|
+
json (~> 1.7, >= 1.7.7)
|
45
|
+
minitest (~> 5.1)
|
46
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
47
|
+
tzinfo (~> 1.1)
|
48
|
+
ants (0.3.12)
|
49
|
+
devise
|
50
|
+
meta-tags
|
51
|
+
mongoid (>= 4.0)
|
52
|
+
mongoid-slug (>= 4.0.0)
|
53
|
+
arel (6.0.3)
|
54
|
+
bcrypt (3.1.10)
|
55
|
+
bourbon (4.2.6)
|
56
|
+
sass (~> 3.4)
|
57
|
+
thor (~> 0.19)
|
58
|
+
bson (4.0.0)
|
59
|
+
builder (3.2.2)
|
60
|
+
carrierwave (0.10.0)
|
61
|
+
activemodel (>= 3.2.0)
|
62
|
+
activesupport (>= 3.2.0)
|
63
|
+
json (>= 1.7)
|
64
|
+
mime-types (>= 1.16)
|
65
|
+
carrierwave-mongoid (0.8.1)
|
66
|
+
carrierwave (>= 0.8.0, < 0.11.0)
|
67
|
+
mongoid (>= 3.0, < 6.0)
|
68
|
+
mongoid-grid_fs (>= 1.3, < 3.0)
|
69
|
+
chr (0.5.6)
|
70
|
+
bourbon
|
71
|
+
coffee-rails (>= 4.0)
|
72
|
+
font-awesome-rails
|
73
|
+
formagic (>= 0.3.8)
|
74
|
+
jquery-rails
|
75
|
+
rails (~> 4.2.5)
|
76
|
+
sass-rails
|
77
|
+
coffee-rails (4.1.1)
|
78
|
+
coffee-script (>= 2.2.0)
|
79
|
+
railties (>= 4.0.0, < 5.1.x)
|
80
|
+
coffee-script (2.4.1)
|
81
|
+
coffee-script-source
|
82
|
+
execjs
|
83
|
+
coffee-script-source (1.10.0)
|
84
|
+
concurrent-ruby (1.0.0)
|
85
|
+
devise (3.5.3)
|
86
|
+
bcrypt (~> 3.0)
|
87
|
+
orm_adapter (~> 0.1)
|
88
|
+
railties (>= 3.2.6, < 5)
|
89
|
+
responders
|
90
|
+
thread_safe (~> 0.1)
|
91
|
+
warden (~> 1.2.3)
|
92
|
+
easy_diff (0.0.6)
|
93
|
+
erubis (2.7.0)
|
94
|
+
execjs (2.6.0)
|
95
|
+
fast-stemmer (1.0.2)
|
96
|
+
font-awesome-rails (4.5.0.0)
|
97
|
+
railties (>= 3.2, < 5.0)
|
98
|
+
formagic (0.3.8)
|
99
|
+
bourbon (>= 3.2)
|
100
|
+
normalize-rails (>= 3.0)
|
101
|
+
globalid (0.3.6)
|
102
|
+
activesupport (>= 4.1.0)
|
103
|
+
has_scope (0.6.0)
|
104
|
+
actionpack (>= 3.2, < 5)
|
105
|
+
activesupport (>= 3.2, < 5)
|
106
|
+
i18n (0.7.0)
|
107
|
+
inherited_resources (1.6.0)
|
108
|
+
actionpack (>= 3.2, < 5)
|
109
|
+
has_scope (~> 0.6.0.rc)
|
110
|
+
railties (>= 3.2, < 5)
|
111
|
+
responders
|
112
|
+
jquery-rails (4.0.5)
|
113
|
+
rails-dom-testing (~> 1.0)
|
114
|
+
railties (>= 4.2.0)
|
115
|
+
thor (>= 0.14, < 2.0)
|
116
|
+
json (1.8.3)
|
117
|
+
kaminari (0.16.3)
|
118
|
+
actionpack (>= 3.0.0)
|
119
|
+
activesupport (>= 3.0.0)
|
120
|
+
loft (0.3.1)
|
121
|
+
ants (>= 0.3.10)
|
122
|
+
carrierwave-mongoid (>= 0.7.1)
|
123
|
+
chr (>= 0.5.4)
|
124
|
+
mini_magick (>= 4.1.0)
|
125
|
+
mongoid-autoinc (>= 4.0.0)
|
126
|
+
mongoid-grid_fs (>= 2.1.0)
|
127
|
+
mongoid_search (>= 0.3)
|
128
|
+
mongosteen (>= 0.1.8)
|
129
|
+
loofah (2.0.3)
|
130
|
+
nokogiri (>= 1.5.9)
|
131
|
+
mail (2.6.3)
|
132
|
+
mime-types (>= 1.16, < 3)
|
133
|
+
meta-tags (2.1.0)
|
134
|
+
actionpack (>= 3.0.0)
|
135
|
+
mime-types (2.99)
|
136
|
+
mini_magick (4.3.6)
|
137
|
+
mini_portile2 (2.0.0)
|
138
|
+
minitest (5.8.3)
|
139
|
+
mongo (2.2.1)
|
140
|
+
bson (~> 4.0)
|
141
|
+
mongoid (5.0.1)
|
142
|
+
activemodel (~> 4.0)
|
143
|
+
mongo (~> 2.1)
|
144
|
+
origin (~> 2.1)
|
145
|
+
tzinfo (>= 0.3.37)
|
146
|
+
mongoid-autoinc (5.0.1)
|
147
|
+
mongoid (~> 5.0.0)
|
148
|
+
mongoid-compatibility (0.3.1)
|
149
|
+
activesupport
|
150
|
+
mongoid (>= 2.0)
|
151
|
+
mongoid-grid_fs (2.2.1)
|
152
|
+
mime-types (>= 1.0, < 3.0)
|
153
|
+
mongoid (>= 3.0, < 6.0)
|
154
|
+
mongoid-history (0.5.0)
|
155
|
+
activesupport
|
156
|
+
easy_diff
|
157
|
+
mongoid (>= 3.0)
|
158
|
+
mongoid-compatibility
|
159
|
+
mongoid-slug (5.1.1)
|
160
|
+
mongoid (>= 3.0)
|
161
|
+
mongoid-compatibility
|
162
|
+
stringex (~> 2.0)
|
163
|
+
mongoid_search (0.3.2)
|
164
|
+
fast-stemmer (~> 1.0.0)
|
165
|
+
mongoid (>= 3.0.0)
|
166
|
+
mongosteen (0.2.0)
|
167
|
+
has_scope (>= 0.6)
|
168
|
+
inherited_resources (>= 1.6)
|
169
|
+
kaminari (>= 0.16)
|
170
|
+
mongoid (>= 5.0)
|
171
|
+
mongoid-history (>= 0.5.0)
|
172
|
+
mongoid_search (>= 0.3)
|
173
|
+
nokogiri (1.6.7.1)
|
174
|
+
mini_portile2 (~> 2.0.0.rc2)
|
175
|
+
normalize-rails (3.0.3)
|
176
|
+
origin (2.1.1)
|
177
|
+
orm_adapter (0.5.0)
|
178
|
+
rack (1.6.4)
|
179
|
+
rack-test (0.6.3)
|
180
|
+
rack (>= 1.0)
|
181
|
+
rails (4.2.5)
|
182
|
+
actionmailer (= 4.2.5)
|
183
|
+
actionpack (= 4.2.5)
|
184
|
+
actionview (= 4.2.5)
|
185
|
+
activejob (= 4.2.5)
|
186
|
+
activemodel (= 4.2.5)
|
187
|
+
activerecord (= 4.2.5)
|
188
|
+
activesupport (= 4.2.5)
|
189
|
+
bundler (>= 1.3.0, < 2.0)
|
190
|
+
railties (= 4.2.5)
|
191
|
+
sprockets-rails
|
192
|
+
rails-deprecated_sanitizer (1.0.3)
|
193
|
+
activesupport (>= 4.2.0.alpha)
|
194
|
+
rails-dom-testing (1.0.7)
|
195
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
196
|
+
nokogiri (~> 1.6.0)
|
197
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
198
|
+
rails-html-sanitizer (1.0.2)
|
199
|
+
loofah (~> 2.0)
|
200
|
+
railties (4.2.5)
|
201
|
+
actionpack (= 4.2.5)
|
202
|
+
activesupport (= 4.2.5)
|
203
|
+
rake (>= 0.8.7)
|
204
|
+
thor (>= 0.18.1, < 2.0)
|
205
|
+
rake (10.4.2)
|
206
|
+
responders (2.1.1)
|
207
|
+
railties (>= 4.2.0, < 5.1)
|
208
|
+
sass (3.4.20)
|
209
|
+
sass-rails (5.0.4)
|
210
|
+
railties (>= 4.0.0, < 5.0)
|
211
|
+
sass (~> 3.1)
|
212
|
+
sprockets (>= 2.8, < 4.0)
|
213
|
+
sprockets-rails (>= 2.0, < 4.0)
|
214
|
+
tilt (>= 1.1, < 3)
|
215
|
+
sprockets (3.5.2)
|
216
|
+
concurrent-ruby (~> 1.0)
|
217
|
+
rack (> 1, < 3)
|
218
|
+
sprockets-rails (3.0.0)
|
219
|
+
actionpack (>= 4.0)
|
220
|
+
activesupport (>= 4.0)
|
221
|
+
sprockets (>= 3.0.0)
|
222
|
+
stringex (2.5.2)
|
223
|
+
thor (0.19.1)
|
224
|
+
thread_safe (0.3.5)
|
225
|
+
tilt (2.0.1)
|
226
|
+
tzinfo (1.2.2)
|
227
|
+
thread_safe (~> 0.1)
|
228
|
+
warden (1.2.4)
|
229
|
+
rack (>= 1.0)
|
230
|
+
|
231
|
+
PLATFORMS
|
232
|
+
ruby
|
233
|
+
|
234
|
+
DEPENDENCIES
|
235
|
+
bundler (~> 1.9)
|
236
|
+
journal-chr!
|
237
|
+
rake (~> 10.0)
|
238
|
+
|
239
|
+
BUNDLED WITH
|
240
|
+
1.10.6
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright © 2015 [Alexander Kravets](https://github.com/alexkravets)
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the “Software”), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Journal
|
2
|
+
|
3
|
+
*Glutten-free foundation for editorial websites powered by [Character](https://github.com/slate-studio/chr) project.*
|
4
|
+
|
5
|
+
|
6
|
+
### Installation
|
7
|
+
|
8
|
+
Add to ```Gemfile```:
|
9
|
+
|
10
|
+
gem 'journal-chr'
|
11
|
+
|
12
|
+
Add tape resource controllers to ```routes.rb```, `admin` scope:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
mount_journal_posts_crud
|
16
|
+
mount_journal_pages_crud
|
17
|
+
mount_journal_categories_crud
|
18
|
+
```
|
19
|
+
|
20
|
+
Add tape resource controllers to ```routes.rb```, `website` scope:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
root 'journal_posts#index'
|
24
|
+
mount_journal_categories
|
25
|
+
mount_journal_pages
|
26
|
+
mount_journal_posts
|
27
|
+
```
|
28
|
+
|
29
|
+
Add to ```admin.scss``` and ```admin.coffee```:
|
30
|
+
|
31
|
+
```scss
|
32
|
+
@import "journal";
|
33
|
+
```
|
34
|
+
|
35
|
+
```coffee
|
36
|
+
#= require journal
|
37
|
+
```
|
38
|
+
|
39
|
+
Add to ```admin.coffee``` character configuration object:
|
40
|
+
|
41
|
+
```coffee
|
42
|
+
journal: new JournalPosts()
|
43
|
+
pages: new JournalPages()
|
44
|
+
```
|
45
|
+
|
46
|
+
|
47
|
+
## Journal family
|
48
|
+
|
49
|
+
- [Character](https://github.com/slate-studio/chr): Powerful javascript CMS for apps
|
50
|
+
- [Mongosteen](https://github.com/slate-studio/mongosteen): An easy way to add restful actions for mongoid models
|
51
|
+
- [Inverter](https://github.com/slate-studio/inverter): An easy way to connect Rails templates content to CMS
|
52
|
+
- [Loft](https://github.com/slate-studio/loft): Media assets manager for Character CMS
|
53
|
+
|
54
|
+
|
55
|
+
## License
|
56
|
+
|
57
|
+
Copyright © 2015 [Alexander Kravets](https://github.com/alexkravets). Loft is free software, and may be redistributed under the terms specified in the [license](LICENSE.md).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class @JournalCategories
|
2
|
+
constructor: (title="Categories", @apiPath="/admin") ->
|
3
|
+
config =
|
4
|
+
title: title
|
5
|
+
|
6
|
+
showWithParent: true
|
7
|
+
|
8
|
+
arrayStore: new RailsArrayStore({
|
9
|
+
resource: "journal_category"
|
10
|
+
path: "#{ @apiPath }/journal_categories"
|
11
|
+
reorderable: { positionFieldName: "_position" }
|
12
|
+
})
|
13
|
+
|
14
|
+
formSchema:
|
15
|
+
title: { type: "string" }
|
16
|
+
|
17
|
+
return config
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class @JournalPages extends AntsContent
|
2
|
+
constructor: (title="Pages", apiPath="/admin") ->
|
3
|
+
super("Page")
|
4
|
+
|
5
|
+
@title = title
|
6
|
+
@menuIcon = 'file-o'
|
7
|
+
@fullsizeView = true
|
8
|
+
|
9
|
+
@arrayStore = new RailsArrayStore({
|
10
|
+
resource: 'journal_page'
|
11
|
+
path: "#{ apiPath }/journal_pages"
|
12
|
+
reorderable: { positionFieldName: '_position' }
|
13
|
+
})
|
14
|
+
|
15
|
+
# PRIVATE =====================================================================
|
16
|
+
|
17
|
+
_path: (object) ->
|
18
|
+
"#{location.origin}/"
|
19
|
+
|
20
|
+
_preview_url: (object) ->
|
21
|
+
slug = object.slug
|
22
|
+
if object.hidden
|
23
|
+
"/#{slug}/preview"
|
24
|
+
else
|
25
|
+
"/#{slug}"
|
@@ -0,0 +1,77 @@
|
|
1
|
+
@timezoneOffset = -> (new Date()).getTimezoneOffset() * -1
|
2
|
+
|
3
|
+
class @JournalPosts extends AntsContent
|
4
|
+
constructor: (@title, @apiPath="/admin") ->
|
5
|
+
super("Post")
|
6
|
+
|
7
|
+
@menuTitle = @title
|
8
|
+
@menuIcon = "pencil"
|
9
|
+
|
10
|
+
@_add_featured()
|
11
|
+
@_add_published_at_input()
|
12
|
+
@_add_categories_input()
|
13
|
+
|
14
|
+
@arrayStore = new RailsArrayStore({
|
15
|
+
resource: "journal_post"
|
16
|
+
path: "#{ @apiPath }/journal_posts"
|
17
|
+
sortBy: "published_at"
|
18
|
+
sortReverse: true
|
19
|
+
searchable: true
|
20
|
+
})
|
21
|
+
|
22
|
+
@fullsizeView = true
|
23
|
+
@listTabs =
|
24
|
+
"Published": { not_hidden: true }
|
25
|
+
"Drafts": { hidden: true }
|
26
|
+
|
27
|
+
@onItemRender = (item) =>
|
28
|
+
@_render_list_item(item)
|
29
|
+
|
30
|
+
# PRIVATE =====================================================================
|
31
|
+
|
32
|
+
_add_featured: ->
|
33
|
+
$.extend @formSchema.settings.inputs.general_panel.inputs,
|
34
|
+
featured:
|
35
|
+
type: "switch"
|
36
|
+
label: "Stick to the front page"
|
37
|
+
|
38
|
+
_add_published_at_input: ->
|
39
|
+
$.extend @formSchema.settings.inputs.general_panel.inputs,
|
40
|
+
published_at:
|
41
|
+
type: "datetime"
|
42
|
+
label: "Published at"
|
43
|
+
disableClear: true
|
44
|
+
|
45
|
+
_add_categories_input: ->
|
46
|
+
@formSchema.settings.inputs['categories_panel'] =
|
47
|
+
type: "group"
|
48
|
+
groupClass: "group-panel"
|
49
|
+
title: "Categories & Tags"
|
50
|
+
inputs:
|
51
|
+
sorted_categories:
|
52
|
+
label: "Categories"
|
53
|
+
type: "selectMultiple"
|
54
|
+
target: "sorted_category_ids"
|
55
|
+
titleField: "title"
|
56
|
+
url: "/admin/journal_categories.json"
|
57
|
+
placeholder: "Use categories to group your posts by topic."
|
58
|
+
_meta_keywords:
|
59
|
+
type: 'string'
|
60
|
+
label: 'Tags'
|
61
|
+
placeholder: 'Use tags to associate more specific keywords with your posts.'
|
62
|
+
|
63
|
+
_path: (object) ->
|
64
|
+
hex = object.hex
|
65
|
+
"#{location.origin}/#{hex}/"
|
66
|
+
|
67
|
+
_preview_url: (object) ->
|
68
|
+
hex = object.hex
|
69
|
+
if object.hidden
|
70
|
+
"/#{hex}/preview"
|
71
|
+
else
|
72
|
+
"/#{hex}"
|
73
|
+
|
74
|
+
_render_list_item: (item) ->
|
75
|
+
m = moment(item.object.published_at).utcOffset(timezoneOffset())
|
76
|
+
published_at = m.format("MM/DD/YYYY")
|
77
|
+
item.$subtitle.html(published_at)
|
@@ -0,0 +1,58 @@
|
|
1
|
+
.posts.list .item-title {
|
2
|
+
font-size: .9em;
|
3
|
+
line-height: 1.5;
|
4
|
+
}
|
5
|
+
|
6
|
+
.posts.view-new {
|
7
|
+
.input-_slug {
|
8
|
+
display: none;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
.posts.view-content-draft {
|
13
|
+
.input-hidden {
|
14
|
+
@include no-bottom-border;
|
15
|
+
}
|
16
|
+
.input-featured,
|
17
|
+
.input-published_at {
|
18
|
+
display: none;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
/* Tablet ----------------------------------------------------------------- */
|
23
|
+
@media #{$tablet} {
|
24
|
+
.list.posts,
|
25
|
+
.list.pages {
|
26
|
+
width: initial;
|
27
|
+
background-color: $bg-color;
|
28
|
+
|
29
|
+
.header {
|
30
|
+
background-color: $bg-color;
|
31
|
+
}
|
32
|
+
|
33
|
+
.items {
|
34
|
+
padding-top: 1.5em;
|
35
|
+
}
|
36
|
+
|
37
|
+
.item {
|
38
|
+
@include no-bottom-border;
|
39
|
+
background-color: $white-color;
|
40
|
+
box-shadow: 0 0 1px rgba(0,0,0,0.15);
|
41
|
+
margin: 0 auto;
|
42
|
+
max-width: 44em;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
.view.pages,
|
47
|
+
.view.posts {
|
48
|
+
left: -9em;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
/* Desktop ----------------------------------------------------------------- */
|
53
|
+
@media #{$desktop} {
|
54
|
+
.view.pages,
|
55
|
+
.view.posts {
|
56
|
+
left: -10em;
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Admin
|
2
|
+
class JournalPagesController < Admin::BaseController
|
3
|
+
mongosteen
|
4
|
+
|
5
|
+
json_config methods: %w(slug opengraph_image_url meta_title meta_description),
|
6
|
+
actions: {
|
7
|
+
index: {
|
8
|
+
except: %w(body_markdown body_html),
|
9
|
+
methods: %w(slug)
|
10
|
+
}
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Admin
|
2
|
+
class JournalPostsController < Admin::BaseController
|
3
|
+
mongosteen
|
4
|
+
|
5
|
+
has_scope :by_category
|
6
|
+
has_scope :hidden, type: :boolean
|
7
|
+
has_scope :not_hidden, type: :boolean
|
8
|
+
|
9
|
+
json_config methods: %w(hex slug sorted_categories opengraph_image_url meta_title meta_description),
|
10
|
+
actions: {
|
11
|
+
index: {
|
12
|
+
except: %w(body_markdown body_html),
|
13
|
+
methods: %w(hex slug)
|
14
|
+
}
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class JournalPagesController < ApplicationController
|
2
|
+
before_action :authenticate_admin_user!, only: %w( preview )
|
3
|
+
|
4
|
+
def show
|
5
|
+
@page = JournalPage.not_hidden.find(params[:slug])
|
6
|
+
end
|
7
|
+
|
8
|
+
def preview
|
9
|
+
@page = JournalPage.find(params[:slug])
|
10
|
+
render "journal_pages/show"
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class JournalPostsController < ApplicationController
|
2
|
+
before_filter :set_all_posts, only: %w( index show )
|
3
|
+
before_action :authenticate_admin_user!, only: %w( preview )
|
4
|
+
|
5
|
+
def index
|
6
|
+
@page = params[:page].try(:to_i) || 1
|
7
|
+
@perPage = 15
|
8
|
+
|
9
|
+
if @page == 1
|
10
|
+
@featured = JournalPost.not_hidden.published.featured
|
11
|
+
end
|
12
|
+
|
13
|
+
@posts = JournalPost.not_hidden.published.not_featured.page(@page).per(@perPage)
|
14
|
+
end
|
15
|
+
|
16
|
+
def show
|
17
|
+
@post = published_post_by_int_id
|
18
|
+
end
|
19
|
+
|
20
|
+
def redirect
|
21
|
+
@post = published_post_by_int_id
|
22
|
+
redirect_to show_journal_post_path(@post.hex, @post.slug)
|
23
|
+
end
|
24
|
+
|
25
|
+
def preview
|
26
|
+
@post = post_by_int_id
|
27
|
+
render "journal_posts/show"
|
28
|
+
end
|
29
|
+
|
30
|
+
def category
|
31
|
+
@slug = params[:slug]
|
32
|
+
@page = params[:page].try(:to_i) || 1
|
33
|
+
@perPage = 15
|
34
|
+
|
35
|
+
category = JournalCategory.find(@slug)
|
36
|
+
@posts = category.posts.not_hidden.published.page(@page).per(@perPage)
|
37
|
+
|
38
|
+
render "journal_posts/index"
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def set_all_posts
|
44
|
+
@posts = JournalPost.not_hidden
|
45
|
+
end
|
46
|
+
|
47
|
+
def int_id
|
48
|
+
params[:hex].to_i(16)
|
49
|
+
end
|
50
|
+
|
51
|
+
def published_post_by_int_id
|
52
|
+
JournalPost.not_hidden.published.find_by(int_id: int_id)
|
53
|
+
end
|
54
|
+
|
55
|
+
def post_by_int_id
|
56
|
+
JournalPost.find_by(int_id: int_id)
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module JournalHelper
|
2
|
+
def journal_post_category_links(post)
|
3
|
+
html = ""
|
4
|
+
if post.categories.any?
|
5
|
+
html << "<span class='journal-post-header-categories'>"
|
6
|
+
html << post.categories.collect do |c|
|
7
|
+
link_to(c.title, show_journal_category_path(c.slug))
|
8
|
+
end.join(" ")
|
9
|
+
html << "</span>"
|
10
|
+
end
|
11
|
+
html.html_safe
|
12
|
+
end
|
13
|
+
|
14
|
+
def journal_post_time(post)
|
15
|
+
time = post.published_at.strftime("%m.%d.%Y")
|
16
|
+
html = """<time datetime='#{post.published_at}'
|
17
|
+
class='journal-post-header-time'>
|
18
|
+
#{time}
|
19
|
+
</time>"""
|
20
|
+
html.html_safe
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
class JournalPost
|
2
|
+
include Ants::Content
|
3
|
+
include Ants::SortedRelations
|
4
|
+
include Ants::Featurable
|
5
|
+
include Mongoid::Autoinc
|
6
|
+
|
7
|
+
## Autoinc
|
8
|
+
field :int_id, type: Integer
|
9
|
+
increments :int_id
|
10
|
+
|
11
|
+
## Relations
|
12
|
+
has_and_belongs_to_many :categories, class_name: "JournalCategory", inverse_of: :posts, index: true
|
13
|
+
sorted_relations_for :categories
|
14
|
+
|
15
|
+
## Scopes
|
16
|
+
scope :by_category, -> (id) { where(:category_ids.in => [id]) }
|
17
|
+
|
18
|
+
## Index
|
19
|
+
index int_id: 1
|
20
|
+
|
21
|
+
## Callbacks
|
22
|
+
after_validation :set_published_at_datetime
|
23
|
+
|
24
|
+
## Helpers
|
25
|
+
alias_attribute :_list_item_subtitle, :published_at
|
26
|
+
|
27
|
+
def hex
|
28
|
+
int_id.to_s(16)
|
29
|
+
end
|
30
|
+
|
31
|
+
def excerpt_html
|
32
|
+
body_html.split('<!-- -->').first || ''
|
33
|
+
end
|
34
|
+
|
35
|
+
def canonical_url
|
36
|
+
"#{protocole}#{host}#{path}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def meta_description
|
40
|
+
_meta_description.presence || excerpt_text
|
41
|
+
end
|
42
|
+
|
43
|
+
protected
|
44
|
+
|
45
|
+
def path
|
46
|
+
@path ||= Rails.application.routes.url_helpers.show_journal_post_path(hex, slug)
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def excerpt_text
|
52
|
+
text = ActionController::Base.helpers.strip_tags(excerpt_html).
|
53
|
+
gsub("\n", "").
|
54
|
+
gsub("\r", "")
|
55
|
+
ActionController::Base.helpers.truncate(text, length: 260, omission: '...')
|
56
|
+
end
|
57
|
+
|
58
|
+
def set_published_at_datetime
|
59
|
+
if self.published_at.nil?
|
60
|
+
self.published_at = Time.zone.now
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<div class="journal-page">
|
2
|
+
<header class="journal-page-header">
|
3
|
+
<h1>
|
4
|
+
<%= link_to show_journal_post_path(post.hex, post.slug) do %>
|
5
|
+
<%= post.title %>
|
6
|
+
<% end %>
|
7
|
+
</h1>
|
8
|
+
<%= journal_post_time(post) %>
|
9
|
+
<%= journal_post_category_links(post) %>
|
10
|
+
</header>
|
11
|
+
|
12
|
+
<section class="journal-page-body">
|
13
|
+
<% if post.excerpt_html.empty? %>
|
14
|
+
<%= post.body_html.html_safe %>
|
15
|
+
<% else %>
|
16
|
+
<%= post.excerpt_html.html_safe %>
|
17
|
+
<% end %>
|
18
|
+
|
19
|
+
<footer>
|
20
|
+
<%= link_to show_journal_post_path(post.hex, post.slug) do %>
|
21
|
+
<%= fa_icon("long-arrow-right") %>
|
22
|
+
<% end %>
|
23
|
+
</footer>
|
24
|
+
</section>
|
25
|
+
</div>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<% content_meta_tags @post %>
|
2
|
+
|
3
|
+
<article class='journal-page'>
|
4
|
+
<header class='journal-page-header'>
|
5
|
+
<h1>
|
6
|
+
<%= link_to show_journal_post_path(@post.hex, @post.slug) do %>
|
7
|
+
<%= @post.title %>
|
8
|
+
<% end %>
|
9
|
+
</h1>
|
10
|
+
<%= journal_post_time(@post) %>
|
11
|
+
<%= journal_post_category_links(@post) %>
|
12
|
+
</header>
|
13
|
+
|
14
|
+
<section class='journal-page-body'>
|
15
|
+
<%= @post.body_html.html_safe %>
|
16
|
+
</section>
|
17
|
+
|
18
|
+
<!--
|
19
|
+
<footer class='journal-page-footer'>
|
20
|
+
<% if @disqus_shortname %>
|
21
|
+
<%= link_to 'Show comments', '#', class: 'journal-show-comments' %>
|
22
|
+
<% end %>
|
23
|
+
</footer>
|
24
|
+
-->
|
25
|
+
</article>
|
26
|
+
|
27
|
+
<!--
|
28
|
+
<% if @disqus_shortname %>
|
29
|
+
<div class='journal-comments' style='display:none;'>
|
30
|
+
<div id='disqus_thread' class='journal-disqus' data-shortname='<%= @disqus_shortname %>'></div>
|
31
|
+
</div>
|
32
|
+
<% end %>
|
33
|
+
-->
|
data/journal-chr.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "journal/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "journal-chr"
|
7
|
+
s.version = Journal::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Alexander Kravets"]
|
10
|
+
s.email = "alex@slatestudio.com"
|
11
|
+
s.summary = "Glutten-free foundation for editorial Character based websites."
|
12
|
+
s.homepage = "https://github.com/alexkravets/journal"
|
13
|
+
s.license = "MIT"
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
|
18
|
+
s.add_development_dependency "bundler", "~> 1.9"
|
19
|
+
s.add_development_dependency "rake", "~> 10.0"
|
20
|
+
|
21
|
+
s.add_dependency "chr", ">= 0.5.5"
|
22
|
+
s.add_dependency "ants", ">= 0.3.12"
|
23
|
+
s.add_dependency "loft", ">= 0.3.1"
|
24
|
+
s.add_dependency "mongosteen", ">= 0.2.0"
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Constraints
|
2
|
+
class JournalPages
|
3
|
+
def self.matches?(request)
|
4
|
+
begin
|
5
|
+
if request.path.end_with? "/preview"
|
6
|
+
JournalPage.find(request.params[:slug])
|
7
|
+
else
|
8
|
+
JournalPage.not_hidden.find(request.params[:slug])
|
9
|
+
end
|
10
|
+
rescue
|
11
|
+
false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/journal-chr.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "journal"
|
data/lib/journal.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "chr"
|
2
|
+
require "loft"
|
3
|
+
require "mongosteen"
|
4
|
+
|
5
|
+
module Journal
|
6
|
+
require "constraints/posts"
|
7
|
+
require "constraints/pages"
|
8
|
+
require "constraints/categories"
|
9
|
+
|
10
|
+
class Engine < ::Rails::Engine
|
11
|
+
require "journal/engine"
|
12
|
+
require "journal/routing"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module ActionDispatch::Routing
|
2
|
+
class Mapper
|
3
|
+
def mount_journal_pages_crud
|
4
|
+
resources :journal_pages, controller: 'journal_pages'
|
5
|
+
end
|
6
|
+
|
7
|
+
def mount_journal_posts_crud
|
8
|
+
resources :journal_posts, controller: 'journal_posts'
|
9
|
+
end
|
10
|
+
|
11
|
+
def mount_journal_categories_crud
|
12
|
+
resources :journal_categories, controller: 'journal_categories'
|
13
|
+
end
|
14
|
+
|
15
|
+
def mount_journal_posts
|
16
|
+
get '/:hex/preview' => 'journal_posts#preview',
|
17
|
+
as: :preview_journal_post
|
18
|
+
get '/:hex/:slug' => 'journal_posts#show',
|
19
|
+
as: :show_journal_post,
|
20
|
+
constraints: ::Constraints::JournalPosts
|
21
|
+
get '/:hex' => 'journal_posts#redirect',
|
22
|
+
as: :journal_post_short,
|
23
|
+
constraints: ::Constraints::JournalPosts
|
24
|
+
end
|
25
|
+
|
26
|
+
def mount_journal_pages
|
27
|
+
get '/:slug/preview' => 'journal_pages#preview',
|
28
|
+
as: :preview_journal_page,
|
29
|
+
constraints: ::Constraints::JournalPages
|
30
|
+
get '/:slug' => 'journal_pages#show',
|
31
|
+
as: :show_journal_page,
|
32
|
+
constraints: ::Constraints::JournalPages
|
33
|
+
end
|
34
|
+
|
35
|
+
def mount_journal_categories
|
36
|
+
get '/:slug' => 'journal_posts#category',
|
37
|
+
as: :show_journal_category,
|
38
|
+
constraints: ::Constraints::JournalCategories
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: journal-chr
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Kravets
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: chr
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.5.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: ants
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.3.12
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.3.12
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: loft
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.3.1
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.3.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mongosteen
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.2.0
|
97
|
+
description:
|
98
|
+
email: alex@slatestudio.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- ".gitignore"
|
104
|
+
- Gemfile
|
105
|
+
- Gemfile.lock
|
106
|
+
- LICENSE.md
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- app/assets/javascripts/journal.coffee
|
110
|
+
- app/assets/javascripts/journal/categories.coffee
|
111
|
+
- app/assets/javascripts/journal/pages.coffee
|
112
|
+
- app/assets/javascripts/journal/posts.coffee
|
113
|
+
- app/assets/stylesheets/journal.scss
|
114
|
+
- app/controllers/admin/journal_categories_controller.rb
|
115
|
+
- app/controllers/admin/journal_pages_controller.rb
|
116
|
+
- app/controllers/admin/journal_posts_controller.rb
|
117
|
+
- app/controllers/journal_pages_controller.rb
|
118
|
+
- app/controllers/journal_posts_controller.rb
|
119
|
+
- app/helpers/journal_helper.rb
|
120
|
+
- app/models/journal_category.rb
|
121
|
+
- app/models/journal_page.rb
|
122
|
+
- app/models/journal_post.rb
|
123
|
+
- app/views/journal_pages/show.html.erb
|
124
|
+
- app/views/journal_posts/_post.html.erb
|
125
|
+
- app/views/journal_posts/index.html.erb
|
126
|
+
- app/views/journal_posts/show.html.erb
|
127
|
+
- journal-chr.gemspec
|
128
|
+
- lib/constraints/categories.rb
|
129
|
+
- lib/constraints/pages.rb
|
130
|
+
- lib/constraints/posts.rb
|
131
|
+
- lib/journal-chr.rb
|
132
|
+
- lib/journal.rb
|
133
|
+
- lib/journal/engine.rb
|
134
|
+
- lib/journal/routing.rb
|
135
|
+
- lib/journal/version.rb
|
136
|
+
homepage: https://github.com/alexkravets/journal
|
137
|
+
licenses:
|
138
|
+
- MIT
|
139
|
+
metadata: {}
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options: []
|
142
|
+
require_paths:
|
143
|
+
- lib
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
requirements: []
|
155
|
+
rubyforge_project:
|
156
|
+
rubygems_version: 2.4.5.1
|
157
|
+
signing_key:
|
158
|
+
specification_version: 4
|
159
|
+
summary: Glutten-free foundation for editorial Character based websites.
|
160
|
+
test_files: []
|