journal-chr 0.3.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -12
- data/README.md +2 -2
- data/app/assets/javascripts/journal.coffee +1 -1
- data/app/assets/javascripts/journal/categories.coffee +16 -12
- data/app/assets/stylesheets/journal.scss +11 -0
- data/app/controllers/admin/journal_categories_controller.rb +1 -1
- data/app/controllers/journal_categories_controller.rb +27 -0
- data/app/controllers/journal_pages_controller.rb +2 -1
- data/app/controllers/journal_posts_controller.rb +5 -20
- data/app/models/journal_category.rb +8 -0
- data/app/models/journal_page.rb +8 -0
- data/app/models/journal_post.rb +3 -0
- data/app/views/journal_categories/_aside.html.erb +1 -0
- data/app/views/journal_categories/_content.html.erb +5 -0
- data/app/views/journal_categories/show.html.erb +6 -0
- data/app/views/journal_pages/_aside.html.erb +1 -0
- data/app/views/journal_pages/show.html.erb +2 -1
- data/app/views/journal_posts/_aside_index.html.erb +1 -0
- data/app/views/journal_posts/_aside_show.html.erb +1 -0
- data/app/views/journal_posts/index.html.erb +1 -0
- data/app/views/journal_posts/show.html.erb +2 -17
- data/journal-chr.gemspec +2 -3
- data/lib/constraints/categories.rb +5 -1
- data/lib/journal/routing.rb +4 -1
- data/lib/journal/version.rb +1 -1
- metadata +13 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f20361e316ff91793a6d95cb050a5dd7b02c8df
|
4
|
+
data.tar.gz: e7411a029fb14f0f78f57919932185d3522d12b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45ba95c370271890eae0ee874a4ea7b918d4a3dc128ca38138d45e726cdd78627ab50fc843d74bfc785b3a174446b753ef94f599eba05bf7b9c3bfcee8bdf0ce
|
7
|
+
data.tar.gz: 6046fe9876c1e051f10155ea19e625468f379739dbc8d728625ca56ce11a8e571f0ee86e5940d8d766918c35992f017da242aa25bb20ceb67b3a3cc80cfba86e
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
journal-chr (0.
|
5
|
-
|
6
|
-
|
7
|
-
loft (>= 0.3.1)
|
4
|
+
journal-chr (0.4.0)
|
5
|
+
chr (>= 0.5.8)
|
6
|
+
loft (>= 0.4.1)
|
8
7
|
mongosteen (>= 0.2.0)
|
9
8
|
|
10
9
|
GEM
|
@@ -45,7 +44,7 @@ GEM
|
|
45
44
|
minitest (~> 5.1)
|
46
45
|
thread_safe (~> 0.3, >= 0.3.4)
|
47
46
|
tzinfo (~> 1.1)
|
48
|
-
ants (0.3.
|
47
|
+
ants (0.3.14)
|
49
48
|
devise
|
50
49
|
meta-tags
|
51
50
|
mongoid (>= 4.0)
|
@@ -66,11 +65,11 @@ GEM
|
|
66
65
|
carrierwave (>= 0.8.0, < 0.11.0)
|
67
66
|
mongoid (>= 3.0, < 6.0)
|
68
67
|
mongoid-grid_fs (>= 1.3, < 3.0)
|
69
|
-
chr (0.5.
|
68
|
+
chr (0.5.8)
|
70
69
|
bourbon
|
71
70
|
coffee-rails (>= 4.0)
|
72
71
|
font-awesome-rails
|
73
|
-
formagic (>= 0.3.
|
72
|
+
formagic (>= 0.3.10)
|
74
73
|
jquery-rails
|
75
74
|
rails (~> 4.2.5)
|
76
75
|
sass-rails
|
@@ -95,7 +94,7 @@ GEM
|
|
95
94
|
fast-stemmer (1.0.2)
|
96
95
|
font-awesome-rails (4.5.0.0)
|
97
96
|
railties (>= 3.2, < 5.0)
|
98
|
-
formagic (0.3.
|
97
|
+
formagic (0.3.10)
|
99
98
|
bourbon (>= 3.2)
|
100
99
|
normalize-rails (>= 3.0)
|
101
100
|
globalid (0.3.6)
|
@@ -117,15 +116,15 @@ GEM
|
|
117
116
|
kaminari (0.16.3)
|
118
117
|
actionpack (>= 3.0.0)
|
119
118
|
activesupport (>= 3.0.0)
|
120
|
-
loft (0.
|
121
|
-
ants (>= 0.3.
|
119
|
+
loft (0.4.1)
|
120
|
+
ants (>= 0.3.14)
|
122
121
|
carrierwave-mongoid (>= 0.7.1)
|
123
|
-
chr (>= 0.5.
|
122
|
+
chr (>= 0.5.8)
|
124
123
|
mini_magick (>= 4.1.0)
|
125
124
|
mongoid-autoinc (>= 4.0.0)
|
126
125
|
mongoid-grid_fs (>= 2.1.0)
|
127
126
|
mongoid_search (>= 0.3)
|
128
|
-
mongosteen (>= 0.
|
127
|
+
mongosteen (>= 0.2.0)
|
129
128
|
loofah (2.0.3)
|
130
129
|
nokogiri (>= 1.5.9)
|
131
130
|
mail (2.6.3)
|
data/README.md
CHANGED
@@ -47,9 +47,9 @@ pages: new JournalPages()
|
|
47
47
|
## Journal family
|
48
48
|
|
49
49
|
- [Character](https://github.com/slate-studio/chr): Powerful javascript CMS for apps
|
50
|
-
- [Mongosteen](https://github.com/slate-studio/mongosteen):
|
51
|
-
- [Inverter](https://github.com/slate-studio/inverter): An easy way to connect Rails templates content to CMS
|
50
|
+
- [Mongosteen](https://github.com/slate-studio/mongosteen): Add CRUD actions for Mongoid models with one line
|
52
51
|
- [Loft](https://github.com/slate-studio/loft): Media assets manager for Character CMS
|
52
|
+
- [Inverter](https://github.com/slate-studio/inverter): An easy way to connect Rails templates content to CMS
|
53
53
|
|
54
54
|
|
55
55
|
## License
|
@@ -1,2 +1,2 @@
|
|
1
|
-
#= require formagic/inputs/markdown
|
1
|
+
#= require formagic/inputs/ace-markdown
|
2
2
|
#= require_tree ./journal
|
@@ -1,6 +1,8 @@
|
|
1
|
-
class @JournalCategories
|
2
|
-
constructor: (
|
3
|
-
|
1
|
+
class @JournalCategories extends AntsContent
|
2
|
+
constructor: (title="Categories", @apiPath="/admin") ->
|
3
|
+
super("Category")
|
4
|
+
|
5
|
+
@title = title
|
4
6
|
|
5
7
|
@arrayStore = new RailsArrayStore({
|
6
8
|
resource: "journal_category"
|
@@ -8,12 +10,14 @@ class @JournalCategories
|
|
8
10
|
reorderable: { positionFieldName: "_position" }
|
9
11
|
})
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
13
|
+
# PRIVATE =====================================================================
|
14
|
+
|
15
|
+
_path: (object) ->
|
16
|
+
"#{location.origin}/"
|
17
|
+
|
18
|
+
_preview_url: (object) ->
|
19
|
+
slug = object.slug
|
20
|
+
if object.hidden
|
21
|
+
"/#{slug}/preview"
|
22
|
+
else
|
23
|
+
"/#{slug}"
|
@@ -19,6 +19,17 @@
|
|
19
19
|
}
|
20
20
|
}
|
21
21
|
|
22
|
+
.categories .content_panel {
|
23
|
+
.input-markdown {
|
24
|
+
margin-top: -1px;
|
25
|
+
padding-top: 0;
|
26
|
+
padding-bottom: 0;
|
27
|
+
}
|
28
|
+
.input-markdown .label {
|
29
|
+
display: none;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
22
33
|
/* Tablet ----------------------------------------------------------------- */
|
23
34
|
@media #{$tablet} {
|
24
35
|
.list.posts,
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class JournalCategoriesController < ApplicationController
|
2
|
+
before_action :set_params
|
3
|
+
|
4
|
+
def show
|
5
|
+
@category = JournalCategory.not_hidden.find(@slug)
|
6
|
+
@posts = posts
|
7
|
+
render @category.template_name || "show"
|
8
|
+
end
|
9
|
+
|
10
|
+
def preview
|
11
|
+
@category = JournalCategory.find(@slug)
|
12
|
+
@posts = posts
|
13
|
+
render @category.template_name || "show"
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def posts
|
19
|
+
@category.posts.not_hidden.published.page(@page).per(@perPage)
|
20
|
+
end
|
21
|
+
|
22
|
+
def set_params
|
23
|
+
@slug = params[:slug]
|
24
|
+
@page = params[:page].try(:to_i) || 1
|
25
|
+
@perPage = 15
|
26
|
+
end
|
27
|
+
end
|
@@ -3,10 +3,11 @@ class JournalPagesController < ApplicationController
|
|
3
3
|
|
4
4
|
def show
|
5
5
|
@page = JournalPage.not_hidden.find(params[:slug])
|
6
|
+
render @page.template_name || "show"
|
6
7
|
end
|
7
8
|
|
8
9
|
def preview
|
9
10
|
@page = JournalPage.find(params[:slug])
|
10
|
-
render "
|
11
|
+
render @page.template_name || "show"
|
11
12
|
end
|
12
13
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
class JournalPostsController < ApplicationController
|
2
|
-
before_filter :set_all_posts, only: %w( index show )
|
3
2
|
before_action :authenticate_admin_user!, only: %w( preview )
|
4
3
|
|
5
4
|
def index
|
@@ -15,35 +14,21 @@ class JournalPostsController < ApplicationController
|
|
15
14
|
|
16
15
|
def show
|
17
16
|
@post = published_post_by_int_id
|
18
|
-
|
19
|
-
|
20
|
-
def redirect
|
21
|
-
@post = published_post_by_int_id
|
22
|
-
redirect_to show_journal_post_path(@post.hex, @post.slug)
|
17
|
+
render @post.template_name || "show"
|
23
18
|
end
|
24
19
|
|
25
20
|
def preview
|
26
21
|
@post = post_by_int_id
|
27
|
-
render "
|
22
|
+
render @post.template_name || "show"
|
28
23
|
end
|
29
24
|
|
30
|
-
def
|
31
|
-
@
|
32
|
-
@
|
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"
|
25
|
+
def redirect
|
26
|
+
@post = published_post_by_int_id
|
27
|
+
redirect_to show_journal_post_path(@post.hex, @post.slug)
|
39
28
|
end
|
40
29
|
|
41
30
|
private
|
42
31
|
|
43
|
-
def set_all_posts
|
44
|
-
@posts = JournalPost.not_hidden
|
45
|
-
end
|
46
|
-
|
47
32
|
def int_id
|
48
33
|
params[:hex].to_i(16)
|
49
34
|
end
|
@@ -1,6 +1,14 @@
|
|
1
1
|
class JournalCategory
|
2
2
|
include Ants::Content
|
3
3
|
include Ants::Orderable
|
4
|
+
include Mongoid::Autoinc
|
5
|
+
|
6
|
+
## Attributes
|
7
|
+
field :template_name, default: "show"
|
8
|
+
|
9
|
+
## Autoinc
|
10
|
+
field :int_id, type: Integer
|
11
|
+
increments :int_id
|
4
12
|
|
5
13
|
## Relations
|
6
14
|
has_and_belongs_to_many :posts, class_name: "JournalPost", inverse_of: :categories, index: true
|
data/app/models/journal_page.rb
CHANGED
data/app/models/journal_post.rb
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
<%# This is a placeholder to be overriden in the project%>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<% content_meta_tags @category %>
|
2
|
+
<% content_for :extra_body_classes do %>category-<%= @category.int_id %><% end %>
|
3
|
+
<%= render partial: 'aside' %>
|
4
|
+
<%= render partial: 'content' %>
|
5
|
+
<%= render partial: 'journal_posts/post', collection: @posts %>
|
6
|
+
<%= paginate @posts %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%# This is a placeholder to be overriden in the project%>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%# This is a placeholder to be overriden in the project%>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%# This is a placeholder to be overriden in the project%>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
<% content_meta_tags @post %>
|
2
|
-
|
2
|
+
<% content_for :extra_body_classes do %>post-<%= @post.hex %><% end %>
|
3
|
+
<%= render partial: 'aside_show' %>
|
3
4
|
<article class='journal-page'>
|
4
5
|
<header class='journal-page-header'>
|
5
6
|
<h1>
|
@@ -14,20 +15,4 @@
|
|
14
15
|
<section class='journal-page-body'>
|
15
16
|
<%= @post.body_html.html_safe %>
|
16
17
|
</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
18
|
</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
CHANGED
@@ -18,8 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.add_development_dependency "bundler", "~> 1.9"
|
19
19
|
s.add_development_dependency "rake", "~> 10.0"
|
20
20
|
|
21
|
-
s.add_dependency "chr", ">= 0.5.
|
22
|
-
s.add_dependency "
|
23
|
-
s.add_dependency "loft", ">= 0.3.1"
|
21
|
+
s.add_dependency "chr", ">= 0.5.8"
|
22
|
+
s.add_dependency "loft", ">= 0.4.1"
|
24
23
|
s.add_dependency "mongosteen", ">= 0.2.0"
|
25
24
|
end
|
@@ -2,7 +2,11 @@ module Constraints
|
|
2
2
|
class JournalCategories
|
3
3
|
def self.matches?(request)
|
4
4
|
begin
|
5
|
-
|
5
|
+
if request.path.end_with? "/preview"
|
6
|
+
JournalCategory.find(request.params[:slug])
|
7
|
+
else
|
8
|
+
JournalCategory.not_hidden.find(request.params[:slug])
|
9
|
+
end
|
6
10
|
rescue
|
7
11
|
false
|
8
12
|
end
|
data/lib/journal/routing.rb
CHANGED
@@ -33,7 +33,10 @@ module ActionDispatch::Routing
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def mount_journal_categories
|
36
|
-
get '/:slug' => '
|
36
|
+
get '/:slug/preview' => 'journal_categories#preview',
|
37
|
+
as: :preview_journal_category,
|
38
|
+
constraints: ::Constraints::JournalCategories
|
39
|
+
get '/:slug' => 'journal_categories#show',
|
37
40
|
as: :show_journal_category,
|
38
41
|
constraints: ::Constraints::JournalCategories
|
39
42
|
end
|
data/lib/journal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: journal-chr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexander Kravets
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,42 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.5.
|
47
|
+
version: 0.5.8
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.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.13
|
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.13
|
54
|
+
version: 0.5.8
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: loft
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
61
|
+
version: 0.4.1
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
68
|
+
version: 0.4.1
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: mongosteen
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,13 +100,20 @@ files:
|
|
114
100
|
- app/controllers/admin/journal_categories_controller.rb
|
115
101
|
- app/controllers/admin/journal_pages_controller.rb
|
116
102
|
- app/controllers/admin/journal_posts_controller.rb
|
103
|
+
- app/controllers/journal_categories_controller.rb
|
117
104
|
- app/controllers/journal_pages_controller.rb
|
118
105
|
- app/controllers/journal_posts_controller.rb
|
119
106
|
- app/helpers/journal_helper.rb
|
120
107
|
- app/models/journal_category.rb
|
121
108
|
- app/models/journal_page.rb
|
122
109
|
- app/models/journal_post.rb
|
110
|
+
- app/views/journal_categories/_aside.html.erb
|
111
|
+
- app/views/journal_categories/_content.html.erb
|
112
|
+
- app/views/journal_categories/show.html.erb
|
113
|
+
- app/views/journal_pages/_aside.html.erb
|
123
114
|
- app/views/journal_pages/show.html.erb
|
115
|
+
- app/views/journal_posts/_aside_index.html.erb
|
116
|
+
- app/views/journal_posts/_aside_show.html.erb
|
124
117
|
- app/views/journal_posts/_post.html.erb
|
125
118
|
- app/views/journal_posts/index.html.erb
|
126
119
|
- app/views/journal_posts/show.html.erb
|