biovision-post 0.2.180325 → 0.21.190513.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +79 -13
  3. data/app/assets/images/biovision/post/icons/time.svg +6 -0
  4. data/app/assets/images/biovision/post/publisher_logo.png +0 -0
  5. data/app/assets/javascripts/biovision/post/biovision-posts.js +258 -0
  6. data/app/assets/stylesheets/biovision/post/admin/posts.scss +93 -0
  7. data/app/assets/stylesheets/biovision/post/posts.scss +88 -37
  8. data/app/controllers/admin/editorial_members_controller.rb +43 -0
  9. data/app/controllers/admin/featured_posts_controller.rb +23 -0
  10. data/app/controllers/admin/post_group_categories_controller.rb +19 -0
  11. data/app/controllers/admin/post_group_tags_controller.rb +19 -0
  12. data/app/controllers/admin/post_groups_controller.rb +62 -0
  13. data/app/controllers/admin/post_illustrations_controller.rb +26 -0
  14. data/app/controllers/admin/post_images_controller.rb +33 -0
  15. data/app/controllers/admin/post_links_controller.rb +19 -0
  16. data/app/controllers/admin/post_tags_controller.rb +30 -0
  17. data/app/controllers/admin/post_types_controller.rb +16 -4
  18. data/app/controllers/admin/posts_controller.rb +26 -2
  19. data/app/controllers/articles_controller.rb +23 -11
  20. data/app/controllers/authors_controller.rb +27 -0
  21. data/app/controllers/blog_posts_controller.rb +23 -11
  22. data/app/controllers/editorial_members_controller.rb +65 -0
  23. data/app/controllers/featured_posts_controller.rb +59 -0
  24. data/app/controllers/my/posts_controller.rb +124 -0
  25. data/app/controllers/news_controller.rb +23 -11
  26. data/app/controllers/post_categories_controller.rb +4 -14
  27. data/app/controllers/post_groups_controller.rb +76 -0
  28. data/app/controllers/post_illustrations_controller.rb +22 -0
  29. data/app/controllers/post_images_controller.rb +62 -0
  30. data/app/controllers/post_links_controller.rb +37 -0
  31. data/app/controllers/post_tags_controller.rb +41 -0
  32. data/app/controllers/posts_controller.rb +119 -14
  33. data/app/helpers/biovision_posts_helper.rb +114 -5
  34. data/app/jobs/application_job.rb +7 -0
  35. data/app/jobs/post_body_parser_job.rb +15 -0
  36. data/app/models/editorial_member.rb +92 -0
  37. data/app/models/editorial_member_post_type.rb +15 -0
  38. data/app/models/featured_post.rb +25 -0
  39. data/app/models/post.rb +203 -38
  40. data/app/models/post_category.rb +76 -54
  41. data/app/models/post_group.rb +84 -0
  42. data/app/models/post_group_category.rb +36 -0
  43. data/app/models/post_group_tag.rb +32 -0
  44. data/app/models/post_illustration.rb +62 -0
  45. data/app/models/post_image.rb +88 -0
  46. data/app/models/post_layout.rb +14 -0
  47. data/app/models/post_link.rb +2 -0
  48. data/app/models/post_post_category.rb +24 -0
  49. data/app/models/post_post_tag.rb +21 -0
  50. data/app/models/post_tag.rb +70 -0
  51. data/app/models/post_translation.rb +7 -0
  52. data/app/models/post_type.rb +18 -2
  53. data/app/models/post_zen_category.rb +6 -0
  54. data/app/models/zen_category.rb +21 -0
  55. data/app/services/post_manager.rb +52 -15
  56. data/app/services/post_parser.rb +80 -0
  57. data/app/uploaders/post_image_uploader.rb +9 -9
  58. data/app/views/admin/editorial_members/_nav_item.html.erb +2 -0
  59. data/app/views/admin/editorial_members/entity/_in_list.html.erb +37 -0
  60. data/app/views/admin/editorial_members/index.html.erb +15 -0
  61. data/app/views/admin/editorial_members/show.html.erb +71 -0
  62. data/app/views/admin/featured_posts/_add.html.erb +140 -0
  63. data/app/views/admin/featured_posts/_language.html.erb +14 -0
  64. data/app/views/admin/featured_posts/_nav_item.html.erb +2 -0
  65. data/app/views/admin/featured_posts/entity/_in_list.html.erb +26 -0
  66. data/app/views/admin/featured_posts/index.html.erb +18 -0
  67. data/app/views/admin/index/dashboard/_biovision_post.html.erb +32 -25
  68. data/app/views/admin/post_categories/entity/_in_list.html.erb +22 -6
  69. data/app/views/admin/post_categories/show.html.erb +6 -1
  70. data/app/views/admin/post_group_categories/entity/_in_list.html.erb +18 -0
  71. data/app/views/admin/post_group_tags/entity/_in_list.html.erb +18 -0
  72. data/app/views/admin/post_groups/_nav_item.html.erb +6 -0
  73. data/app/views/admin/post_groups/entity/_categories.html.erb +33 -0
  74. data/app/views/admin/post_groups/entity/_in_list.html.erb +25 -0
  75. data/app/views/admin/post_groups/index.html.erb +22 -0
  76. data/app/views/admin/post_groups/show.html.erb +65 -0
  77. data/app/views/admin/post_groups/tags.jbuilder +12 -0
  78. data/app/views/admin/post_illustrations/_nav_item.html.erb +6 -0
  79. data/app/views/admin/post_illustrations/entity/_in_list.html.erb +19 -0
  80. data/app/views/admin/post_illustrations/index.html.erb +23 -0
  81. data/app/views/admin/post_illustrations/show.html.erb +32 -0
  82. data/app/views/admin/post_images/_nav_item.html.erb +2 -0
  83. data/app/views/admin/post_images/entity/_in_list.html.erb +30 -0
  84. data/app/views/admin/post_images/index.html.erb +16 -0
  85. data/app/views/admin/post_images/show.html.erb +49 -0
  86. data/app/views/admin/post_links/entity/_in_list.html.erb +43 -0
  87. data/app/views/admin/post_tags/_nav_item.html.erb +2 -0
  88. data/app/views/admin/post_tags/entity/_in_list.html.erb +23 -0
  89. data/app/views/admin/post_tags/index.html.erb +16 -0
  90. data/app/views/admin/post_tags/posts.html.erb +18 -0
  91. data/app/views/admin/post_tags/show.html.erb +37 -0
  92. data/app/views/admin/post_types/authors.html.erb +23 -0
  93. data/app/views/admin/post_types/post_categories.html.erb +15 -4
  94. data/app/views/admin/post_types/post_tags.html.erb +18 -0
  95. data/app/views/admin/post_types/show.html.erb +28 -5
  96. data/app/views/admin/posts/_filter.html.erb +19 -0
  97. data/app/views/admin/posts/_nav_item.html.erb +3 -0
  98. data/app/views/admin/posts/_search_form.html.erb +13 -0
  99. data/app/views/admin/posts/entity/_in_list.html.erb +31 -7
  100. data/app/views/admin/posts/entity/_in_search.html.erb +8 -0
  101. data/app/views/admin/posts/entity/_links.html.erb +125 -0
  102. data/app/views/admin/posts/images.html.erb +22 -0
  103. data/app/views/admin/posts/index.html.erb +4 -0
  104. data/app/views/admin/posts/search.html.erb +21 -0
  105. data/app/views/admin/posts/search.jbuilder +26 -0
  106. data/app/views/admin/posts/show.html.erb +118 -18
  107. data/app/views/articles/category.html.erb +9 -9
  108. data/app/views/articles/index.html.erb +12 -9
  109. data/app/views/articles/show.html.erb +2 -4
  110. data/app/views/articles/tagged.html.erb +14 -0
  111. data/app/views/authors/_list.html.erb +18 -0
  112. data/app/views/authors/entity/_in_list.html.erb +9 -0
  113. data/app/views/authors/index.html.erb +10 -0
  114. data/app/views/authors/show.html.erb +31 -0
  115. data/app/views/blog_posts/category.html.erb +9 -9
  116. data/app/views/blog_posts/index.html.erb +12 -9
  117. data/app/views/blog_posts/show.html.erb +2 -4
  118. data/app/views/blog_posts/tagged.html.erb +14 -0
  119. data/app/views/editorial_members/_form.html.erb +107 -0
  120. data/app/views/editorial_members/edit.html.erb +17 -0
  121. data/app/views/editorial_members/new.html.erb +15 -0
  122. data/app/views/featured_posts/create.jbuilder +10 -0
  123. data/app/views/index/dashboard/_biovision_post.html.erb +18 -2
  124. data/app/views/my/index/dashboard/_biovision_post.html.erb +43 -0
  125. data/app/views/my/posts/_form.html.erb +357 -0
  126. data/app/views/my/posts/_list.html.erb +9 -0
  127. data/app/views/my/posts/_post.html.erb +80 -0
  128. data/app/views/my/posts/_preview.html.erb +35 -0
  129. data/app/views/my/posts/articles.html.erb +24 -0
  130. data/app/views/my/posts/blog_posts.html.erb +24 -0
  131. data/app/views/my/posts/edit.html.erb +19 -0
  132. data/app/views/my/posts/index.html.erb +14 -0
  133. data/app/views/my/posts/index/_navigation.html.erb +29 -0
  134. data/app/views/my/posts/new.html.erb +14 -0
  135. data/app/views/my/posts/news_index.html.erb +24 -0
  136. data/app/views/my/posts/show.html.erb +7 -0
  137. data/app/views/news/category.html.erb +9 -9
  138. data/app/views/news/index.html.erb +12 -9
  139. data/app/views/news/show.html.erb +2 -4
  140. data/app/views/news/tagged.html.erb +14 -0
  141. data/app/views/post_categories/_form.html.erb +82 -43
  142. data/app/views/post_groups/_form.html.erb +79 -0
  143. data/app/views/post_groups/edit.html.erb +17 -0
  144. data/app/views/post_groups/new.html.erb +15 -0
  145. data/app/views/post_groups/show.html.erb +10 -0
  146. data/app/views/post_images/_form.html.erb +121 -0
  147. data/app/views/post_images/edit.html.erb +19 -0
  148. data/app/views/post_images/new.html.erb +18 -0
  149. data/app/views/post_links/create.jbuilder +20 -0
  150. data/app/views/post_tags/_form.html.erb +26 -0
  151. data/app/views/post_tags/edit.html.erb +18 -0
  152. data/app/views/post_tags/new.html.erb +18 -0
  153. data/app/views/posts/_archive_dates.jbuilder +13 -0
  154. data/app/views/posts/_breadcrumbs.html.erb +4 -8
  155. data/app/views/posts/_calendar.html.erb +9 -0
  156. data/app/views/posts/_collection.html.erb +5 -0
  157. data/app/views/posts/_form.html.erb +204 -64
  158. data/app/views/posts/_list.html.erb +1 -1
  159. data/app/views/{articles/index.jbuilder → posts/_list.jbuilder} +3 -3
  160. data/app/views/posts/_post.html.erb +43 -16
  161. data/app/views/posts/_preview.html.erb +32 -21
  162. data/app/views/posts/_search.html.erb +6 -0
  163. data/app/views/posts/_wysiwyg.html.erb +25 -0
  164. data/app/views/posts/archive.jbuilder +3 -0
  165. data/app/views/posts/archive_day.html.erb +12 -0
  166. data/app/views/posts/category.html.erb +18 -0
  167. data/app/views/posts/entity/_gallery.html.erb +54 -0
  168. data/app/views/posts/entity/_linked_posts.html.erb +7 -0
  169. data/app/views/posts/entity/_metadata.html.erb +35 -12
  170. data/app/views/posts/entity/_publisher.html.erb +3 -1
  171. data/app/views/posts/form/_category_links.html.erb +32 -0
  172. data/app/views/posts/form/_gallery.html.erb +163 -0
  173. data/app/views/posts/index.html.erb +13 -0
  174. data/app/views/posts/index.jbuilder +1 -0
  175. data/app/views/posts/post_type/_category.html.erb +7 -0
  176. data/app/views/posts/post_type/_post_page.html.erb +9 -0
  177. data/app/views/posts/post_type/_posts.html.erb +5 -0
  178. data/app/views/posts/post_type/_tagged.html.erb +7 -0
  179. data/app/views/posts/rss.xml.erb +47 -0
  180. data/app/views/posts/search.html.erb +15 -0
  181. data/app/views/posts/show.html.erb +5 -3
  182. data/app/views/posts/tagged.html.erb +10 -0
  183. data/app/views/posts/tagged.jbuilder +1 -0
  184. data/app/views/posts/zen.xml.erb +42 -0
  185. data/config/locales/posts-en.yml +257 -19
  186. data/config/locales/posts-ru.yml +380 -14
  187. data/config/locales/posts-sv.yml +416 -0
  188. data/config/routes.rb +111 -15
  189. data/db/{migrate → amends}/20180124111113_add_language_to_posts.rb +0 -0
  190. data/db/{migrate → amends}/20180318215555_add_active_to_post_types.rb +0 -0
  191. data/db/amends/20180606120000_add_original_title_to_posts.rb +9 -0
  192. data/db/amends/20180606120001_add_time_required_to_posts.rb +11 -0
  193. data/db/amends/20180611111111_add_pubdate_and_translator_to_posts.rb +19 -0
  194. data/db/amends/20180618111111_add_default_category_name_to_post_types.rb +15 -0
  195. data/db/amends/20180703191919_add_rating_to_posts.rb +14 -0
  196. data/db/amends/20180810111111_add_explicit_to_posts.rb +11 -0
  197. data/db/amends/20180825111111_add_meta_description_to_post_categories.rb +11 -0
  198. data/db/amends/20180927111111_amend_editorial_member_about.rb +13 -0
  199. data/db/migrate/20170930000001_create_post_types.rb +98 -20
  200. data/db/migrate/20170930000010_create_posts.rb +194 -0
  201. data/db/migrate/20180706000000_create_editorial_members.rb +37 -0
  202. data/db/migrate/20180808000000_create_zen_categories.rb +42 -0
  203. data/db/migrate/20190202232323_add_spam_to_posts.rb +11 -0
  204. data/db/migrate/20190224212121_add_data_to_posts.rb +13 -0
  205. data/db/migrate/20190224212122_rename_post_image_source.rb +26 -0
  206. data/db/migrate/20190224212123_add_uuid_to_post_images.rb +10 -0
  207. data/db/migrate/20190313141414_convert_json_post_columns.rb +25 -0
  208. data/db/migrate/20190401101010_create_post_illustrations.rb +20 -0
  209. data/db/migrate/20190407101010_create_editorial_member_post_types.rb +18 -0
  210. data/db/migrate/20190410101010_add_avoid_parsing_to_posts.rb +14 -0
  211. data/db/migrate/20190410120000_create_post_groups.rb +47 -0
  212. data/db/migrate/20190412191919_add_nav_text_to_post_categories.rb +14 -0
  213. data/db/migrate/20190412212121_add_url_part_to_post_types.rb +26 -0
  214. data/db/migrate/20190420212121_create_post_layouts.rb +27 -0
  215. data/db/migrate/20190424161616_create_post_post_categories.rb +31 -0
  216. data/lib/biovision/post/version.rb +3 -1
  217. data/lib/tasks/posts.rake +6 -0
  218. metadata +170 -25
  219. data/app/assets/images/biovision/post/publisher_logo.svg +0 -3
  220. data/app/services/post_manager/article_handler.rb +0 -10
  221. data/app/services/post_manager/blog_post_handler.rb +0 -10
  222. data/app/services/post_manager/news_handler.rb +0 -10
  223. data/app/views/admin/index/dashboard/biovision_post/_additional_items.html.erb +0 -0
  224. data/app/views/blog_posts/index.jbuilder +0 -11
  225. data/app/views/news/index.jbuilder +0 -11
  226. data/app/views/post_categories/edit.jbuilder +0 -3
  227. data/app/views/post_categories/edit.js.erb +0 -1
  228. data/app/views/post_categories/new.jbuilder +0 -3
  229. data/app/views/post_categories/new.js.erb +0 -1
  230. data/db/migrate/20170930000002_create_post_categories.rb +0 -29
  231. data/db/migrate/20170930000003_create_posts.rb +0 -60
  232. data/db/migrate/20171218111111_add_meta_fields_to_posts.rb +0 -15
  233. data/db/migrate/20171219111112_add_author_fields_to_posts.rb +0 -11
  234. data/db/migrate/20180321100000_create_post_references.rb +0 -21
  235. data/db/migrate/20180321100001_create_post_notes.rb +0 -18
  236. data/db/migrate/20180321100002_create_post_links.rb +0 -20
@@ -0,0 +1,9 @@
1
+ <% if collection.any? %>
2
+ <div class="list-of-posts">
3
+ <% collection.each do |entity| %>
4
+ <%= render partial: 'my/posts/preview', locals: { entity: entity } %>
5
+ <% end %>
6
+ </div>
7
+ <% else %>
8
+ <%= render 'shared/nothing_found' %>
9
+ <% end %>
@@ -0,0 +1,80 @@
1
+ <% handler = PostManager.new(post) %>
2
+ <article class="post" itemscope itemtype="http://schema.org/Article" itemprop="mainEntityOfPage">
3
+ <h1 itemprop="headline"><%= post.title %></h1>
4
+ <ul class="actions">
5
+ <li><%= back_icon(my_posts_path) %></li>
6
+ <% if post.visible? %>
7
+ <li><%= world_icon(handler.post_path) %></li>
8
+ <% end %>
9
+ <% unless post.locked? %>
10
+ <li><%= edit_icon(edit_my_post_path(id: post.id)) %></li>
11
+ <% end %>
12
+ </ul>
13
+
14
+ <% unless post.image.blank? %>
15
+ <figure itemprop="image" itemscope itemtype="http://schema.org/ImageObject" role="group">
16
+ <%= post_image_medium(post, { itemprop: 'about' }) %>
17
+ <meta itemprop="url" content="<%= request.protocol + request.host_with_port + post.image.url %>"/>
18
+ <% if post.has_image_data? %>
19
+ <figcaption>
20
+ <% unless post.image_name.blank? %>
21
+ <div class="image_name" itemprop="caption">
22
+ <%= post.image_name %>
23
+ </div>
24
+ <% end %>
25
+ <% unless post.image_source_name.blank? %>
26
+ <div class="image_source" itemprop="author">
27
+ <span><%= t('activerecord.attributes.post.image_source_name') %></span>
28
+ <% if post.image_source_link.blank? %>
29
+ <%= post.image_source_name %>
30
+ <% else %>
31
+ <%= link_to(post.image_source_name, post.image_source_link, rel: 'external nofollow noopener noreferrer', itemprop: 'url', target: '_blank') %>
32
+ <% end %>
33
+ </div>
34
+ <% end %>
35
+ </figcaption>
36
+ <% end %>
37
+ </figure>
38
+ <% end %>
39
+
40
+ <div class="body" itemprop="articleBody mainEntityOfPage">
41
+ <%= raw(post.parsed_body || post.body) %>
42
+ </div>
43
+
44
+ <% if post.tags_cache.any? %>
45
+ <div class="post-tags" aria-label="<%= t('activerecord.attributes.post.tags_cache') %>">
46
+ <%= post.tags_cache.join(', ') %>
47
+ </div>
48
+ <% end %>
49
+
50
+ <footer>
51
+ <% if post.show_owner? %>
52
+ <div class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
53
+ <span itemprop="name" aria-label="<%= t('activerecord.attributes.post.user') %>">
54
+ <% if post.author_name.blank? %>
55
+ <%= user_link(post.user) %>
56
+ <% else %>
57
+ <%= post_author_link(post) %>
58
+ <% unless post.author_title.blank? %>
59
+ <span class="author-title"><%= post.author_title %></span>
60
+ <% end %>
61
+ <% end %>
62
+ </span>
63
+ </div>
64
+ <% end %>
65
+ <% if post.has_source_data? %>
66
+ <div class="source">
67
+ <span><%= t('.source') %>:</span>
68
+ <% if post.source_link.blank? %>
69
+ <span itemprop="isBasedOn"><%= post.source_name %></span>
70
+ <% else %>
71
+ <%= link_to(post.source_name, post.source_link, rel: 'external nofollow noopener noreferrer', itemprop: 'isBasedOn', target: '_blank') %>
72
+ <% end %>
73
+ </div>
74
+ <% end %>
75
+
76
+ <div class="time">
77
+ <%= time_tag post.publication_time, itemProp: 'datePublished', aria: { label: t('activerecord.attributes.post.created_at') } %>
78
+ </div>
79
+ </footer>
80
+ </article>
@@ -0,0 +1,35 @@
1
+ <div class="post-preview" role="group">
2
+ <div class="image">
3
+ <%= post_image_small(entity) %>
4
+ </div>
5
+ <div class="title">
6
+ <%= my_post_link(entity) %>
7
+ </div>
8
+ <div class="info">
9
+ <% if entity.show_owner? %>
10
+ <% if entity.author_name.blank? %>
11
+ <%= user_link(entity.user) %>
12
+ <% else %>
13
+ <%= post_author_link(entity) %>
14
+ <% unless entity.author_title.blank? %>
15
+ <div class="author-title"><%= entity.author_title %></div>
16
+ <% end %>
17
+ <% end %>
18
+ <% end %>
19
+ <%= time_tag(entity.created_at) %>
20
+ </div>
21
+ <div class="lead"><%= entity.lead %></div>
22
+ <% if entity.post_categories.any? %>
23
+ <div class="category" aria-label="<%= t('activerecord.attributes.post.post_categories') %>">
24
+ <%= entity.post_categories.map(&:name).join(', ') %>
25
+ </div>
26
+ <% end %>
27
+ <div class="counters">
28
+ <% if entity.allow_comments? && 'CommentableItem'.safe_constantize %>
29
+ <span class="comment_count"><%= entity.comments_count %></span>
30
+ <% end %>
31
+ <span class="view_count" aria-label="<%= t('activerecord.attributes.post.view_count') %>">
32
+ <%= entity.view_count %>
33
+ </span>
34
+ </div>
35
+ </div>
@@ -0,0 +1,24 @@
1
+ <% content_for :meta_title, t('.title', page: current_page) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <span><%= t('.nav_text') %></span>
4
+ <% end %>
5
+
6
+ <article>
7
+ <h1><%= t('.heading') %></h1>
8
+
9
+ <% if current_user_has_privilege?(:editor) %>
10
+ <nav>
11
+ <%=
12
+ link_to(
13
+ t('my.posts.new_article.nav_text'),
14
+ my_new_article_path,
15
+ class: 'button-nav'
16
+ )
17
+ %>
18
+ </nav>
19
+ <% end %>
20
+
21
+ <%= paginate @collection %>
22
+ <%= render partial: 'my/posts/list', locals: { collection: @collection } %>
23
+ <%= paginate @collection %>
24
+ </article>
@@ -0,0 +1,24 @@
1
+ <% content_for :meta_title, t('.title', page: current_page) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <span><%= t('.nav_text') %></span>
4
+ <% end %>
5
+
6
+ <article>
7
+ <h1><%= t('.heading') %></h1>
8
+
9
+ <% if current_user_has_privilege?(:blogger) %>
10
+ <nav>
11
+ <%=
12
+ link_to(
13
+ t('my.posts.new_blog_post.nav_text'),
14
+ my_new_blog_post_path,
15
+ class: 'button-nav'
16
+ )
17
+ %>
18
+ </nav>
19
+ <% end %>
20
+
21
+ <%= paginate @collection %>
22
+ <%= render partial: 'my/posts/list', locals: { collection: @collection } %>
23
+ <%= paginate @collection %>
24
+ </article>
@@ -0,0 +1,19 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('my.posts.index.nav_text'), my_posts_path) %>
4
+ <%= my_post_link(@entity) %>
5
+ <span><%= t('.nav_text') %></span>
6
+ <% end %>
7
+
8
+ <article>
9
+ <h1><%= t('.heading') %></h1>
10
+
11
+ <% unless @entity.locked? %>
12
+ <ul class="actions">
13
+ <li><%= return_icon(my_post_path(id: @entity.id)) %></li>
14
+ <li class="danger"><%= destroy_path_icon(my_post_path(id: @entity.id)) %></li>
15
+ </ul>
16
+ <% end %>
17
+
18
+ <%= render partial: 'form', locals: { entity: @entity } %>
19
+ </article>
@@ -0,0 +1,14 @@
1
+ <% content_for :meta_title, t('.title', page: current_page) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <span><%= t('.nav_text') %></span>
4
+ <% end %>
5
+
6
+ <article>
7
+ <h1><%= t('.heading') %></h1>
8
+
9
+ <%= render 'my/posts/index/navigation' %>
10
+
11
+ <%= paginate @collection %>
12
+ <%= render partial: 'my/posts/list', locals: { collection: @collection } %>
13
+ <%= paginate @collection %>
14
+ </article>
@@ -0,0 +1,29 @@
1
+ <nav>
2
+ <% if current_user_has_privilege?(:editor) %>
3
+ <%=
4
+ link_to(
5
+ t('my.posts.new_article.nav_text'),
6
+ my_new_article_path,
7
+ class: 'button-nav'
8
+ )
9
+ %>
10
+ <% end %>
11
+ <% if current_user_has_privilege?(:reporter) %>
12
+ <%=
13
+ link_to(
14
+ t('my.posts.new_news.nav_text'),
15
+ my_new_news_path,
16
+ class: 'button-nav'
17
+ )
18
+ %>
19
+ <% end %>
20
+ <% if current_user_has_privilege?(:blogger) %>
21
+ <%=
22
+ link_to(
23
+ t('my.posts.new_blog_post.nav_text'),
24
+ my_new_blog_post_path,
25
+ class: 'button-nav'
26
+ )
27
+ %>
28
+ <% end %>
29
+ </nav>
@@ -0,0 +1,14 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <span><%= t('.heading') %></span>
4
+ <% end %>
5
+
6
+ <article>
7
+ <h1><%= t('.heading') %></h1>
8
+
9
+ <ul class="actions">
10
+ <li><%= return_icon(my_posts_path) %></li>
11
+ </ul>
12
+
13
+ <%= render partial: 'form', locals: { entity: @entity } %>
14
+ </article>
@@ -0,0 +1,24 @@
1
+ <% content_for :meta_title, t('.title', page: current_page) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <span><%= t('.nav_text') %></span>
4
+ <% end %>
5
+
6
+ <article>
7
+ <h1><%= t('.heading') %></h1>
8
+
9
+ <% if current_user_has_privilege?(:reporter) %>
10
+ <nav>
11
+ <%=
12
+ link_to(
13
+ t('my.posts.new_news.nav_text'),
14
+ my_new_news_path,
15
+ class: 'button-nav'
16
+ )
17
+ %>
18
+ </nav>
19
+ <% end %>
20
+
21
+ <%= paginate @collection %>
22
+ <%= render partial: 'my/posts/list', locals: { collection: @collection } %>
23
+ <%= paginate @collection %>
24
+ </article>
@@ -0,0 +1,7 @@
1
+ <% content_for :meta_title, @entity.title %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('my.posts.index.nav_text'), my_posts_path) %>
4
+ <span><%= @entity.title %></span>
5
+ <% end %>
6
+
7
+ <%= render @entity %>
@@ -7,12 +7,12 @@
7
7
  <span><%= @category.name %></span>
8
8
  <% end %>
9
9
 
10
- <article>
11
- <h1><%= @category.name %></h1>
12
-
13
- <section class="recent-posts">
14
- <%= paginate @collection %>
15
- <%= render partial: 'posts/list', locals: { collection: @collection } %>
16
- <%= paginate @collection %>
17
- </section>
18
- </article>
10
+ <%=
11
+ render(
12
+ partial: 'posts/post_type/category',
13
+ locals: {
14
+ category: @category,
15
+ collection: @collection
16
+ }
17
+ )
18
+ %>
@@ -1,14 +1,17 @@
1
1
  <% content_for :meta_title, t('.title', page: current_page) %>
2
+ <% content_for :alternate_links do %>
3
+ <link rel="alternate" type="application/rss+xml" href="<%= rss_posts_path %>" />
4
+ <% end %>
2
5
  <% content_for :breadcrumbs do %>
3
6
  <span><%= t('news.index.nav_text') %></span>
4
7
  <% end %>
5
8
 
6
- <article>
7
- <h1><%= t('.heading') %></h1>
8
-
9
- <section class="recent-posts">
10
- <%= paginate @collection %>
11
- <%= render partial: 'posts/list', locals: { collection: @collection } %>
12
- <%= paginate @collection %>
13
- </section>
14
- </article>
9
+ <%=
10
+ render(
11
+ partial: 'posts/post_type/posts',
12
+ locals: {
13
+ heading: t('.heading'),
14
+ collection: @collection
15
+ }
16
+ )
17
+ %>
@@ -1,8 +1,6 @@
1
- <% content_for :meta_title, @entity.title %>
2
1
  <% content_for :breadcrumbs do %>
3
2
  <%= link_to(t('news.index.nav_text'), news_index_path) %>
4
3
  <%= render partial: 'posts/breadcrumbs', locals: { entity: @entity } %>
5
4
  <% end %>
6
- <%= render partial: 'posts/entity/metadata', locals: { entity: @entity } %>
7
- <%= render partial: 'posts/post', locals: { post: @entity } %>
8
- <%# render partial: 'comments/list', locals: { commentable: @entity, comments: @entity.comments } %>
5
+
6
+ <%= render partial: 'posts/post_type/post_page', locals: { entity: @entity } %>
@@ -0,0 +1,14 @@
1
+ <% content_for :meta_title, t('.title', tag_name: params[:tag_name], page: current_page) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <span><%= t('news.index.nav_text') %></span>
4
+ <% end %>
5
+
6
+ <%=
7
+ render(
8
+ partial: 'posts/post_type/tagged',
9
+ locals: {
10
+ heading: params[:tag_name],
11
+ collection: @collection
12
+ }
13
+ )
14
+ %>
@@ -1,51 +1,90 @@
1
- <%= form_with model: entity, html: { id: 'post-category-form' } do |f| %>
2
- <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
3
-
4
- <dl>
5
- <% unless entity.id.nil? %>
6
- <dt><%= t('activerecord.attributes.post_category.post_type_id') %></dt>
7
- <dd>
8
- <%= admin_post_type_link(entity.post_type) %>
9
- </dd>
10
- <% unless entity.parent_id.nil? %>
11
- <dt><%= t('activerecord.attributes.post_category.parent_id') %></dt>
12
- <dd>
13
- <%= admin_post_category_link(entity.parent) %>
14
- </dd>
15
- <% end %>
16
- <% end %>
1
+ <% model_name = entity.class.to_s.underscore %>
2
+ <%= form_with(model: entity, html: { id: "#{model_name}-form" }) do |f| %>
3
+ <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
17
4
 
18
- <dt><%= f.label :name %></dt>
5
+ <dl>
6
+ <% unless entity.id.nil? %>
7
+ <dt><%= t('activerecord.attributes.post_category.post_type_id') %></dt>
19
8
  <dd>
20
- <%= f.text_field :name, id: :post_category_name, size: nil, maxlength: PostCategory::NAME_LIMIT, required: true, data: { transliterate: 'post_category_slug' } %>
21
- <div class="guideline"><%= t('.guidelines.name') %></div>
9
+ <%= admin_post_type_link(entity.post_type) %>
22
10
  </dd>
11
+ <% unless entity.parent_id.nil? %>
12
+ <dt><%= t('activerecord.attributes.post_category.parent_id') %></dt>
13
+ <dd>
14
+ <%= admin_post_category_link(entity.parent) %>
15
+ </dd>
16
+ <% end %>
17
+ <% end %>
23
18
 
24
- <dt><%= f.label :slug %></dt>
25
- <dd>
26
- <%= f.text_field :slug, id: :post_category_slug, size: nil, maxlength: PostCategory::SLUG_LIMIT, required: true %>
27
- <div class="guideline"><%= t('.guidelines.slug') %></div>
28
- </dd>
19
+ <%= render partial: 'shared/forms/priority', locals: { f: f } %>
29
20
 
30
- <dt><%= f.label :priority %></dt>
31
- <dd><%= f.number_field :priority, id: :post_category_priority, in: PostCategory::PRIORITY_RANGE, required: true %></dd>
21
+ <dt><%= f.label :name %></dt>
22
+ <dd>
23
+ <%=
24
+ f.text_field(
25
+ :name,
26
+ id: "#{model_name}_name",
27
+ size: nil,
28
+ maxlength: PostCategory::NAME_LIMIT,
29
+ required: true,
30
+ data: {
31
+ transliterate: "#{model_name}_slug"
32
+ }
33
+ )
34
+ %>
35
+ <div class="guideline"><%= t('.guidelines.name') %></div>
36
+ </dd>
32
37
 
33
- <dt><%= t(:flags) %></dt>
34
- <dd>
35
- <ul class="flags">
36
- <li>
37
- <%= f.check_box :visible, id: :post_category_visible %>
38
- <%= f.label :visible %>
39
- </li>
40
- </ul>
41
- </dd>
42
- </dl>
38
+ <dt><%= f.label :slug %></dt>
39
+ <dd>
40
+ <%=
41
+ f.text_field(
42
+ :slug,
43
+ id: "#{model_name}_slug",
44
+ size: nil,
45
+ maxlength: PostCategory::SLUG_LIMIT,
46
+ required: true
47
+ )
48
+ %>
49
+ <div class="guideline"><%= t('.guidelines.slug') %></div>
50
+ </dd>
43
51
 
44
- <div class="buttons">
45
- <% if entity.id.nil? %>
46
- <%= f.hidden_field :post_type_id %>
47
- <%= f.hidden_field :parent_id %>
48
- <% end %>
49
- <%= f.button t(:save), type: :submit %>
50
- </div>
52
+ <dt><%= f.label :nav_text %></dt>
53
+ <dd>
54
+ <%=
55
+ f.text_field(
56
+ :nav_text,
57
+ id: "#{model_name}_nav_text",
58
+ size: nil,
59
+ maxlength: PostCategory::NAME_LIMIT,
60
+ )
61
+ %>
62
+ <div class="guideline"><%= t('.guidelines.name') %></div>
63
+ </dd>
64
+
65
+ <dt><%= f.label :meta_description %></dt>
66
+ <dd>
67
+ <%=
68
+ f.text_field(
69
+ :meta_description,
70
+ id: "#{model_name}_meta_description",
71
+ size: nil,
72
+ maxlength: PostCategory::META_LIMIT
73
+ )
74
+ %>
75
+ <div class="guideline"><%= t('.guidelines.meta_description') %></div>
76
+ </dd>
77
+
78
+ <%= render partial: 'shared/forms/entity_flags', locals: { f: f } %>
79
+ </dl>
80
+
81
+ <%= render 'shared/forms/state_container' %>
82
+
83
+ <div class="buttons">
84
+ <% if entity.id.nil? %>
85
+ <%= f.hidden_field :post_type_id %>
86
+ <%= f.hidden_field :parent_id %>
87
+ <% end %>
88
+ <%= f.button t(:save), type: :submit, class: 'button-save' %>
89
+ </div>
51
90
  <% end %>