biovision-post 0.1.180127 → 0.2.180325
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/articles_controller.rb +2 -2
- data/app/controllers/blog_posts_controller.rb +2 -2
- data/app/controllers/news_controller.rb +2 -2
- data/app/controllers/post_categories_controller.rb +4 -4
- data/app/controllers/posts_controller.rb +5 -15
- data/app/helpers/biovision_posts_helper.rb +4 -4
- data/app/models/concerns/post_child_with_priority.rb +49 -0
- data/app/models/post.rb +21 -15
- data/app/models/post_link.rb +15 -0
- data/app/models/post_note.rb +16 -0
- data/app/models/post_reference.rb +19 -0
- data/app/models/post_type.rb +3 -1
- data/app/services/post_manager.rb +9 -6
- data/app/services/post_manager/article_handler.rb +2 -2
- data/app/services/post_manager/blog_post_handler.rb +2 -2
- data/app/services/post_manager/news_handler.rb +2 -2
- data/app/views/admin/index/dashboard/_biovision_post.html.erb +1 -1
- data/app/views/admin/post_categories/entity/_in_list.html.erb +3 -3
- data/app/views/admin/post_categories/show.html.erb +3 -3
- data/app/views/admin/post_types/entity/_in_list.html.erb +1 -1
- data/app/views/admin/post_types/new_post.html.erb +1 -1
- data/app/views/admin/post_types/show.html.erb +2 -2
- data/app/views/admin/posts/entity/_in_list.html.erb +17 -3
- data/app/views/admin/posts/show.html.erb +4 -2
- data/app/views/articles/category.html.erb +1 -1
- data/app/views/blog_posts/category.html.erb +1 -1
- data/app/views/index/dashboard/_biovision_post.html.erb +5 -0
- data/app/views/news/category.html.erb +1 -1
- data/app/views/post_categories/edit.html.erb +1 -1
- data/app/views/posts/_form.html.erb +160 -22
- data/app/views/posts/_post.html.erb +1 -1
- data/app/views/posts/edit.html.erb +1 -1
- data/app/views/posts/entity/_metadata.html.erb +10 -6
- data/config/locales/posts-en.yml +4 -3
- data/config/locales/posts-ru.yml +3 -2
- data/config/routes.rb +39 -35
- data/db/migrate/20170930000001_create_post_types.rb +1 -0
- data/db/migrate/20170930000003_create_posts.rb +2 -0
- data/db/migrate/20171218111111_add_meta_fields_to_posts.rb +1 -1
- data/db/migrate/20171219111112_add_author_fields_to_posts.rb +1 -1
- data/db/migrate/20180124111113_add_language_to_posts.rb +1 -1
- data/db/migrate/20180318215555_add_active_to_post_types.rb +11 -0
- data/db/migrate/20180321100000_create_post_references.rb +21 -0
- data/db/migrate/20180321100001_create_post_notes.rb +18 -0
- data/db/migrate/20180321100002_create_post_links.rb +20 -0
- data/lib/biovision/post/engine.rb +2 -3
- data/lib/biovision/post/version.rb +1 -1
- metadata +11 -6
- data/app/views/index/index/_recent_posts.html.erb +0 -5
- data/app/views/posts/edit.js.erb +0 -1
- data/app/views/posts/form/_wysiwyg.html.erb +0 -14
- data/app/views/posts/new.js.erb +0 -1
@@ -7,10 +7,10 @@
|
|
7
7
|
|
8
8
|
<ul class="actions">
|
9
9
|
<li class="lockable <%= entity.locked? ? 'hidden' : '' %>">
|
10
|
-
<%= edit_icon edit_post_category_path(entity.id) %>
|
10
|
+
<%= edit_icon edit_post_category_path(id: entity.id) %>
|
11
11
|
</li>
|
12
|
-
<%= render partial: 'shared/actions/priority_changer', locals: { path: priority_admin_post_category_path(entity.id) } %>
|
13
|
-
<%= render partial: 'shared/actions/locks', locals: { entity: entity, path: lock_admin_post_category_path(entity.id) } %>
|
12
|
+
<%= render partial: 'shared/actions/priority_changer', locals: { path: priority_admin_post_category_path(id: entity.id) } %>
|
13
|
+
<%= render partial: 'shared/actions/locks', locals: { entity: entity, path: lock_admin_post_category_path(id: entity.id) } %>
|
14
14
|
</ul>
|
15
15
|
|
16
16
|
<% if entity.child_categories.any? %>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<% @entity.parents.each do |parent| %>
|
6
6
|
<%= admin_post_category_link(parent) %>
|
7
7
|
<% end %>
|
8
|
-
<%= link_to(t('admin.post_types.post_categories.heading'), post_categories_admin_post_type_path(@entity.post_type_id)) %>
|
8
|
+
<%= link_to(t('admin.post_types.post_categories.heading'), post_categories_admin_post_type_path(id: @entity.post_type_id)) %>
|
9
9
|
<span><%= @entity.name %></span>
|
10
10
|
<% end %>
|
11
11
|
|
@@ -13,9 +13,9 @@
|
|
13
13
|
<h1><%= @entity.name %></h1>
|
14
14
|
|
15
15
|
<ul class="actions">
|
16
|
-
<li><%= return_icon(admin_post_type_path(@entity.post_type_id)) %></li>
|
16
|
+
<li><%= return_icon(admin_post_type_path(id: @entity.post_type_id)) %></li>
|
17
17
|
<% unless @entity.locked? %>
|
18
|
-
<li><%= edit_icon(edit_post_category_path(@entity.id)) %></li>
|
18
|
+
<li><%= edit_icon(edit_post_category_path(id: @entity.id)) %></li>
|
19
19
|
<% end %>
|
20
20
|
</ul>
|
21
21
|
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<h1><%= t('.heading') %></h1>
|
10
10
|
|
11
11
|
<ul class="actions">
|
12
|
-
<li><%= return_icon(admin_post_type_path(@entity.id)) %></li>
|
12
|
+
<li><%= return_icon(admin_post_type_path(id: @entity.id)) %></li>
|
13
13
|
</ul>
|
14
14
|
|
15
15
|
<%= render partial: 'posts/form', locals: { entity: Post.new(post_type: @entity) } %>
|
@@ -9,12 +9,12 @@
|
|
9
9
|
|
10
10
|
<ul class="actions">
|
11
11
|
<li><%= back_icon(admin_post_types_path) %></li>
|
12
|
-
<li><%= create_icon(new_post_admin_post_type_path(@entity.id)) %></li>
|
12
|
+
<li><%= create_icon(new_post_admin_post_type_path(id: @entity.id)) %></li>
|
13
13
|
</ul>
|
14
14
|
|
15
15
|
<% if current_user_has_privilege?(:chief_editor) %>
|
16
16
|
<nav>
|
17
|
-
<%= link_to(t('admin.post_types.post_categories.heading'), post_categories_admin_post_type_path(@entity.id)) %>
|
17
|
+
<%= link_to(t('admin.post_types.post_categories.heading'), post_categories_admin_post_type_path(id: @entity.id)) %>
|
18
18
|
</nav>
|
19
19
|
<% end %>
|
20
20
|
|
@@ -9,6 +9,12 @@
|
|
9
9
|
<%= admin_user_link(entity.user) %>,
|
10
10
|
<%= time_tag(entity.created_at) %>
|
11
11
|
</div>
|
12
|
+
<% unless entity.language.nil? %>
|
13
|
+
<div class="secondary info">
|
14
|
+
<%= t('activerecord.attributes.post.language_id') %>:
|
15
|
+
<%= language_name(entity.language) %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
12
18
|
<div class="secondaty info">
|
13
19
|
<div><%= t(:created_at) %>: <%= time_tag(entity.created_at) %></div>
|
14
20
|
<div><%= t(:updated_at) %>: <%= time_tag(entity.updated_at) %></div>
|
@@ -24,7 +30,15 @@
|
|
24
30
|
<% end %>
|
25
31
|
</div>
|
26
32
|
|
27
|
-
<%=
|
33
|
+
<%=
|
34
|
+
render(
|
35
|
+
partial: 'shared/admin/toggleable',
|
36
|
+
locals: {
|
37
|
+
entity: entity,
|
38
|
+
url: toggle_admin_post_path(id: entity.id)
|
39
|
+
}
|
40
|
+
)
|
41
|
+
%>
|
28
42
|
|
29
43
|
<ul class="actions">
|
30
44
|
<%=
|
@@ -32,12 +46,12 @@
|
|
32
46
|
partial: 'shared/actions/locks',
|
33
47
|
locals: {
|
34
48
|
entity: entity,
|
35
|
-
path: (current_user_has_privilege?(:chief_editor) ? lock_admin_post_path(entity.id) : '')
|
49
|
+
path: (current_user_has_privilege?(:chief_editor) ? lock_admin_post_path(id: entity.id) : '')
|
36
50
|
}
|
37
51
|
)
|
38
52
|
%>
|
39
53
|
<li class="lockable <%= entity.editable_by?(current_user) ? '' : 'hidden' %>">
|
40
|
-
<%= edit_icon(edit_post_path(entity.id)) %>
|
54
|
+
<%= edit_icon(edit_post_path(id: entity.id)) %>
|
41
55
|
</li>
|
42
56
|
<li class="lockable <%= entity.editable_by?(current_user) ? '' : 'hidden' %> danger">
|
43
57
|
<%= destroy_icon(entity) %>
|
@@ -78,8 +78,10 @@
|
|
78
78
|
<dd><%= @entity.image_author_link %></dd>
|
79
79
|
<% end %>
|
80
80
|
|
81
|
-
|
82
|
-
|
81
|
+
<% unless @entity.lead.blank? %>
|
82
|
+
<dt><%= t('activerecord.attributes.post.lead') %></dt>
|
83
|
+
<dd><%= @entity.lead %></dd>
|
84
|
+
<% end %>
|
83
85
|
|
84
86
|
<dt><%= t('activerecord.attributes.post.body') %></dt>
|
85
87
|
<dd><%= simple_format(strip_tags(@entity.body)) %></dd>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% content_for :breadcrumbs do %>
|
3
3
|
<%= link_to(t('articles.index.nav_text'), articles_path) %>
|
4
4
|
<% @category.parents.each do |parent| %>
|
5
|
-
<%= link_to(parent.name, articles_category_path(parent.long_slug)) %>
|
5
|
+
<%= link_to(parent.name, articles_category_path(category_slug: parent.long_slug)) %>
|
6
6
|
<% end %>
|
7
7
|
<span><%= @category.name %></span>
|
8
8
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% content_for :breadcrumbs do %>
|
3
3
|
<%= link_to(t('blog_posts.index.nav_text'), blog_posts_path) %>
|
4
4
|
<% @category.parents.each do |parent| %>
|
5
|
-
<%= link_to(parent.name, blog_posts_category_path(parent.long_slug)) %>
|
5
|
+
<%= link_to(parent.name, blog_posts_category_path(category_slug: parent.long_slug)) %>
|
6
6
|
<% end %>
|
7
7
|
<span><%= @category.name %></span>
|
8
8
|
<% end %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<% content_for :breadcrumbs do %>
|
3
3
|
<%= link_to(t('news.index.nav_text'), news_index_path) %>
|
4
4
|
<% @category.parents.each do |parent| %>
|
5
|
-
<%= link_to(parent.name, articles_category_path(parent.long_slug)) %>
|
5
|
+
<%= link_to(parent.name, articles_category_path(category_slug: parent.long_slug)) %>
|
6
6
|
<% end %>
|
7
7
|
<span><%= @category.name %></span>
|
8
8
|
<% end %>
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<h1><%= t('.heading') %></h1>
|
14
14
|
|
15
15
|
<ul class="actions">
|
16
|
-
<li><%= return_icon(admin_post_category_path(@entity.id)) %></li>
|
16
|
+
<li><%= return_icon(admin_post_category_path(id: @entity.id)) %></li>
|
17
17
|
<% if @entity.can_be_deleted? %>
|
18
18
|
<li class="danger"><%= destroy_icon(@entity) %></li>
|
19
19
|
<% end %>
|
@@ -1,23 +1,50 @@
|
|
1
|
-
<%= form_with model: entity, html: { id:
|
1
|
+
<%= form_with model: entity, html: { id: "#{entity.class.to_s.underscore}-form" } do |f| %>
|
2
2
|
<%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
|
3
3
|
|
4
4
|
<dl>
|
5
|
+
<dt><%= f.label :language_id %></dt>
|
6
|
+
<dd><%= f.select :language_id, languages_for_select(false) %></dd>
|
7
|
+
|
5
8
|
<dt><%= f.label :title %></dt>
|
6
9
|
<dd>
|
7
|
-
<%=
|
10
|
+
<%=
|
11
|
+
f.text_field(
|
12
|
+
:title,
|
13
|
+
id: :post_title,
|
14
|
+
size: nil,
|
15
|
+
maxlength: Post::TITLE_LIMIT,
|
16
|
+
required: true,
|
17
|
+
data: { transliterate: :post_slug }
|
18
|
+
)
|
19
|
+
%>
|
8
20
|
<div class="guideline"><%= t('.guidelines.title') %></div>
|
9
21
|
</dd>
|
10
22
|
|
11
23
|
<dt><%= f.label :slug %></dt>
|
12
24
|
<dd>
|
13
|
-
<%=
|
25
|
+
<%=
|
26
|
+
f.text_field(
|
27
|
+
:slug,
|
28
|
+
id: :post_slug,
|
29
|
+
size: nil,
|
30
|
+
maxlength: Post::SLUG_LIMIT,
|
31
|
+
required: true,
|
32
|
+
pattern: Post::SLUG_PATTERN_HTML,
|
33
|
+
title: t('.guidelines.slug')
|
34
|
+
)
|
35
|
+
%>
|
14
36
|
<div class="guideline"><%= t('.guidelines.slug') %></div>
|
15
37
|
</dd>
|
16
38
|
|
17
39
|
<% if entity.post_type.post_categories.any? %>
|
18
40
|
<dt><%= f.label :post_category_id %></dt>
|
19
41
|
<dd>
|
20
|
-
<%=
|
42
|
+
<%=
|
43
|
+
f.select(
|
44
|
+
:post_category_id,
|
45
|
+
post_categories_for_select(entity.post_type_id)
|
46
|
+
)
|
47
|
+
%>
|
21
48
|
</dd>
|
22
49
|
<% end %>
|
23
50
|
|
@@ -37,43 +64,89 @@
|
|
37
64
|
|
38
65
|
<dt><%= f.label :lead %></dt>
|
39
66
|
<dd>
|
40
|
-
<%=
|
67
|
+
<%=
|
68
|
+
f.text_area(
|
69
|
+
:lead,
|
70
|
+
id: :post_lead,
|
71
|
+
cols: 80,
|
72
|
+
rows: 3,
|
73
|
+
maxlength: Post::LEAD_LIMIT
|
74
|
+
)
|
75
|
+
%>
|
41
76
|
<div class="guideline"><%= t('.guidelines.lead') %></div>
|
42
77
|
</dd>
|
43
78
|
|
44
79
|
<dt><%= f.label :body %></dt>
|
45
80
|
<dd>
|
46
|
-
<%=
|
81
|
+
<%=
|
82
|
+
f.text_area(
|
83
|
+
:body,
|
84
|
+
id: :post_body,
|
85
|
+
cols: 20,
|
86
|
+
rows: 25,
|
87
|
+
required: true,
|
88
|
+
data: { wysiwyg: 1 }
|
89
|
+
)
|
90
|
+
%>
|
47
91
|
</dd>
|
48
92
|
|
49
93
|
<dt><%= f.label :author_name %></dt>
|
50
94
|
<dd>
|
51
|
-
<%=
|
95
|
+
<%=
|
96
|
+
f.text_field(
|
97
|
+
:author_name,
|
98
|
+
id: :post_author_name,
|
99
|
+
size: nil,
|
100
|
+
maxlength: Post::META_LIMIT
|
101
|
+
)
|
102
|
+
%>
|
52
103
|
<div class="guideline"><%= t('.guidelines.author_name') %></div>
|
53
104
|
</dd>
|
54
105
|
|
55
106
|
<dt><%= f.label :author_title %></dt>
|
56
107
|
<dd>
|
57
|
-
<%=
|
108
|
+
<%=
|
109
|
+
f.text_field(
|
110
|
+
:author_title,
|
111
|
+
id: :post_author_title,
|
112
|
+
size: nil,
|
113
|
+
maxlength: Post::META_LIMIT
|
114
|
+
)
|
115
|
+
%>
|
58
116
|
<div class="guideline"><%= t('.guidelines.author_title') %></div>
|
59
117
|
</dd>
|
60
118
|
|
61
119
|
<dt><%= f.label :author_url %></dt>
|
62
120
|
<dd>
|
63
|
-
<%=
|
121
|
+
<%=
|
122
|
+
f.url_field(
|
123
|
+
:author_url,
|
124
|
+
id: :post_author_url,
|
125
|
+
size: nil,
|
126
|
+
maxlength: Post::META_LIMIT
|
127
|
+
)
|
128
|
+
%>
|
64
129
|
<div class="guideline"><%= t('.guidelines.author_url') %></div>
|
65
130
|
</dd>
|
66
131
|
|
67
132
|
<dt><%= f.label :image %></dt>
|
68
133
|
<dd>
|
69
|
-
|
134
|
+
<% figure_id = "#{entity.class.to_s.underscore}-image" %>
|
135
|
+
<figure role="group" class="preview" id="<%= figure_id %>">
|
70
136
|
<% if entity.image.blank? %>
|
71
137
|
<%= f.label :image, image_tag('biovision/base/placeholders/image.svg') %>
|
72
138
|
<% else %>
|
73
139
|
<%= f.label :image, image_tag(entity.image.big.url) %>
|
74
140
|
<% end %>
|
75
141
|
<figcaption>
|
76
|
-
<%=
|
142
|
+
<%=
|
143
|
+
f.file_field(
|
144
|
+
:image,
|
145
|
+
id: :post_image,
|
146
|
+
accept: 'image/jpeg,image/png',
|
147
|
+
data: { image: figure_id }
|
148
|
+
)
|
149
|
+
%>
|
77
150
|
</figcaption>
|
78
151
|
</figure>
|
79
152
|
<div class="guideline"><%= t('.guidelines.image') %></div>
|
@@ -81,55 +154,120 @@
|
|
81
154
|
|
82
155
|
<dt><%= f.label :image_name %></dt>
|
83
156
|
<dd>
|
84
|
-
<%=
|
157
|
+
<%=
|
158
|
+
f.text_field(
|
159
|
+
:image_name,
|
160
|
+
id: :post_image_name,
|
161
|
+
size: nil,
|
162
|
+
maxlength: Post::META_LIMIT
|
163
|
+
)
|
164
|
+
%>
|
85
165
|
<div class="guideline"><%= t('.guidelines.image_name') %></div>
|
86
166
|
</dd>
|
87
167
|
|
88
168
|
<dt><%= f.label :image_alt_text %></dt>
|
89
169
|
<dd>
|
90
|
-
<%=
|
170
|
+
<%=
|
171
|
+
f.text_field(
|
172
|
+
:image_alt_text,
|
173
|
+
id: :post_image_alt_text,
|
174
|
+
size: nil,
|
175
|
+
maxlength: Post::META_LIMIT
|
176
|
+
)
|
177
|
+
%>
|
91
178
|
<div class="guideline"><%= t('.guidelines.image_alt_text') %></div>
|
92
179
|
</dd>
|
93
180
|
|
94
181
|
<dt><%= f.label :image_author_name %></dt>
|
95
182
|
<dd>
|
96
|
-
<%=
|
183
|
+
<%=
|
184
|
+
f.text_field(
|
185
|
+
:image_author_name,
|
186
|
+
id: :post_image_author_name,
|
187
|
+
size: nil,
|
188
|
+
maxlength: Post::META_LIMIT
|
189
|
+
)
|
190
|
+
%>
|
97
191
|
<div class="guideline"><%= t('.guidelines.image_author_name') %></div>
|
98
192
|
</dd>
|
99
193
|
|
100
194
|
<dt><%= f.label :image_author_link %></dt>
|
101
195
|
<dd>
|
102
|
-
<%=
|
196
|
+
<%=
|
197
|
+
f.url_field(
|
198
|
+
:image_author_link,
|
199
|
+
id: :post_image_author_link,
|
200
|
+
size: nil,
|
201
|
+
maxlength: Post::META_LIMIT,
|
202
|
+
placeholder: t('.placeholders.image_author_link')
|
203
|
+
)
|
204
|
+
%>
|
103
205
|
<div class="guideline"><%= t('.guidelines.image_author_link') %></div>
|
104
206
|
</dd>
|
105
207
|
|
106
208
|
<dt><%= f.label :source_name %></dt>
|
107
209
|
<dd>
|
108
|
-
<%=
|
210
|
+
<%=
|
211
|
+
f.text_field(
|
212
|
+
:source_name,
|
213
|
+
id: :post_source_name,
|
214
|
+
size: nil,
|
215
|
+
maxlength: Post::META_LIMIT
|
216
|
+
)
|
217
|
+
%>
|
109
218
|
<div class="guideline"><%= t('.guidelines.source') %></div>
|
110
219
|
</dd>
|
111
220
|
|
112
221
|
<dt><%= f.label :source_link %></dt>
|
113
222
|
<dd>
|
114
|
-
<%=
|
223
|
+
<%=
|
224
|
+
f.url_field(
|
225
|
+
:source_link,
|
226
|
+
id: :post_source_link,
|
227
|
+
size: nil,
|
228
|
+
maxlength: Post::META_LIMIT,
|
229
|
+
placeholder: t('.placeholders.source_link')
|
230
|
+
)
|
231
|
+
%>
|
115
232
|
<div class="guideline"><%= t('.guidelines.source_link') %></div>
|
116
233
|
</dd>
|
117
234
|
|
118
235
|
<dt><%= f.label :meta_title %></dt>
|
119
236
|
<dd>
|
120
|
-
<%=
|
237
|
+
<%=
|
238
|
+
f.text_field(
|
239
|
+
:meta_title,
|
240
|
+
id: :post_meta_title,
|
241
|
+
size: nil,
|
242
|
+
maxlength: Post::META_LIMIT
|
243
|
+
)
|
244
|
+
%>
|
121
245
|
<div class="guideline"><%= t('.guidelines.meta_title') %></div>
|
122
246
|
</dd>
|
123
247
|
|
124
248
|
<dt><%= f.label :meta_description %></dt>
|
125
249
|
<dd>
|
126
|
-
<%=
|
250
|
+
<%=
|
251
|
+
f.text_field(
|
252
|
+
:meta_description,
|
253
|
+
id: :post_meta_description,
|
254
|
+
size: nil,
|
255
|
+
maxlength: Post::META_LIMIT
|
256
|
+
)
|
257
|
+
%>
|
127
258
|
<div class="guideline"><%= t('.guidelines.meta_description') %></div>
|
128
259
|
</dd>
|
129
260
|
|
130
261
|
<dt><%= f.label :meta_keywords %></dt>
|
131
262
|
<dd>
|
132
|
-
<%=
|
263
|
+
<%=
|
264
|
+
f.text_field(
|
265
|
+
:meta_keywords,
|
266
|
+
id: :post_meta_keywords,
|
267
|
+
size: nil,
|
268
|
+
maxlength: Post::META_LIMIT
|
269
|
+
)
|
270
|
+
%>
|
133
271
|
<div class="guideline"><%= t('.guidelines.meta_keywords') %></div>
|
134
272
|
</dd>
|
135
273
|
|
@@ -156,8 +294,8 @@
|
|
156
294
|
|
157
295
|
<div class="buttons">
|
158
296
|
<%= f.hidden_field :post_type_id if entity.id.nil? %>
|
159
|
-
<%= f.button t(:save), type: :submit %>
|
297
|
+
<%= f.button t(:save), type: :submit, class: 'button-save' %>
|
160
298
|
</div>
|
161
299
|
<% end %>
|
162
300
|
|
163
|
-
<%= render '
|
301
|
+
<%= render partial: 'shared/forms/wysiwyg' %>
|