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
@@ -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('blog_posts.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('blog_posts.index.nav_text'), blog_posts_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('blog_posts.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
+ %>
@@ -0,0 +1,107 @@
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 } %>
4
+
5
+ <dl>
6
+ <% if entity.id.nil? %>
7
+ <dt><%= f.label :user_id %></dt>
8
+ <dd>
9
+ <%=
10
+ f.number_field(
11
+ :user_id,
12
+ id: "#{model_name}_user_id",
13
+ in: User.ids_range
14
+ )
15
+ %>
16
+ <%=
17
+ render(
18
+ partial: 'admin/users/search',
19
+ locals: { target_id: "#{model_name}_user_id" }
20
+ )
21
+ %>
22
+ </dd>
23
+ <% else %>
24
+ <dt><%= t('activerecord.attributes.editorial_member.user_id') %></dt>
25
+ <dd>
26
+ <%= admin_user_link(entity.user) %>
27
+ </dd>
28
+ <% end %>
29
+
30
+ <%= render partial: 'shared/forms/priority', locals: { f: f } %>
31
+
32
+ <dt><%= f.label :title %></dt>
33
+ <dd>
34
+ <%=
35
+ f.text_field(
36
+ :title,
37
+ id: "#{model_name}_title",
38
+ size: nil,
39
+ maxlength: EditorialMember::TITLE_LIMIT,
40
+ required: true
41
+ )
42
+ %>
43
+ <div class="guideline"><%= t('.guidelines.title') %></div>
44
+ </dd>
45
+
46
+ <dt><%= f.label :lead %></dt>
47
+ <dd>
48
+ <%=
49
+ f.text_field(
50
+ :lead,
51
+ id: "#{model_name}_lead",
52
+ size: nil,
53
+ maxlength: EditorialMember::LEAD_LIMIT
54
+ )
55
+ %>
56
+ <div class="guideline"><%= t('.guidelines.lead') %></div>
57
+ </dd>
58
+
59
+ <dt><%= f.label :about %></dt>
60
+ <dd>
61
+ <%=
62
+ f.text_area(
63
+ :about,
64
+ id: "#{model_name}_about",
65
+ cols: 80,
66
+ rows: 10,
67
+ data: {
68
+ wysiwyg: '1'
69
+ }
70
+ )
71
+ %>
72
+ <div class="guideline"><%= t('.guidelines.about') %></div>
73
+ </dd>
74
+
75
+ <%= render partial: 'shared/forms/entity_flags', locals: { f: f } %>
76
+ </dl>
77
+
78
+ <section>
79
+ <h2><%= t('.post_types') %></h2>
80
+
81
+ <ul class="flags">
82
+ <% PostType.list_for_administration.each do |post_type| %>
83
+ <li>
84
+ <% field_id = "post_type_#{post_type.id}" %>
85
+ <%=
86
+ check_box_tag(
87
+ 'post_type_ids[]',
88
+ post_type.id,
89
+ entity.post_type?(post_type),
90
+ id: field_id
91
+ )
92
+ %>
93
+ <%= label_tag(field_id, post_type.name) %>
94
+ </li>
95
+ <% end %>
96
+ </ul>
97
+ </section>
98
+
99
+ <%= render 'shared/forms/state_container' %>
100
+
101
+ <div class="buttons">
102
+ <%= hidden_field_tag :entity_id, entity.id %>
103
+ <%= f.button t(:save), type: :submit, class: 'button-save' %>
104
+ </div>
105
+ <% end %>
106
+
107
+ <%= render 'shared/forms/wysiwyg' %>
@@ -0,0 +1,17 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('admin.editorial_members.nav_item.text'), admin_editorial_members_path) %>
4
+ <%= admin_editorial_member_link(@entity) %>
5
+ <span><%= t('.nav_text') %></span>
6
+ <% end %>
7
+
8
+ <article>
9
+ <h1><%= t('.heading') %></h1>
10
+
11
+ <ul class="actions">
12
+ <li><%= return_icon(admin_editorial_member_path(id: @entity.id)) %></li>
13
+ <li class="danger"><%= destroy_icon(@entity) %></li>
14
+ </ul>
15
+
16
+ <%= render partial: 'form', locals: { entity: @entity } %>
17
+ </article>
@@ -0,0 +1,15 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('admin.editorial_members.nav_item.text'), admin_editorial_members_path) %>
4
+ <span><%= t('.nav_text') %></span>
5
+ <% end %>
6
+
7
+ <article>
8
+ <h1><%= t('.title') %></h1>
9
+
10
+ <ul class="actions">
11
+ <li><%= back_icon(admin_editorial_members_path) %></li>
12
+ </ul>
13
+
14
+ <%= render partial: 'form', locals: { entity: @entity } %>
15
+ </article>
@@ -0,0 +1,10 @@
1
+ json.data do
2
+ json.id @entity.id
3
+ json.type @entity.class.table_name
4
+ json.attributes do
5
+ json.(@entity, :post_id, :language_id, :priority)
6
+ end
7
+ json.meta do
8
+ json.html render(partial: 'admin/featured_posts/entity/in_list', formats: [:html], locals: { entity: @entity })
9
+ end
10
+ end
@@ -1,5 +1,21 @@
1
- <section class="recent-posts">
1
+ <% content_for :alternate_links do %>
2
+ <link rel="alternate" type="application/rss+xml" href="<%= rss_posts_path %>" />
3
+ <% end %>
4
+ <section class="recent-posts" id="recent-posts-container">
2
5
  <h2><%= t('.heading') %></h2>
3
6
 
4
- <%= render partial: 'posts/list', locals: { collection: Post.visible.page_for_visitors(1) } %>
7
+ <%= render partial: 'posts/list', locals: { collection: Post.page_for_visitors(1) } %>
8
+
9
+ <div class="more-posts">
10
+ <%=
11
+ link_to(
12
+ t('.more'),
13
+ posts_path(page: 2, format: :json),
14
+ class: 'button-nav posts-loader',
15
+ data: {
16
+ container: 'recent-posts-container'
17
+ }
18
+ )
19
+ %>
20
+ </div>
5
21
  </section>
@@ -0,0 +1,43 @@
1
+ <% if current_user_in_group?(:editors) %>
2
+ <section class="dashboard" id="biovision-post-my-dashboard">
3
+ <h2><%= t('.heading') %></h2>
4
+
5
+ <nav>
6
+ <% if current_user_has_privilege?(:editor) %>
7
+ <div>
8
+ <%= link_to(t('my.posts.new_article.nav_text'), my_new_article_path) %>
9
+ </div>
10
+ <% end %>
11
+ <% if current_user_has_privilege?(:reporter) %>
12
+ <div>
13
+ <%= link_to(t('my.posts.new_news.nav_text'), my_new_news_path) %>
14
+ </div>
15
+ <% end %>
16
+ <% if current_user_has_privilege?(:blogger) %>
17
+ <div>
18
+ <%= link_to(t('my.posts.new_blog_post.nav_text'), my_new_blog_post_path) %>
19
+ </div>
20
+ <% end %>
21
+ <% if Post.owned_by(current_user).exists? %>
22
+ <div>
23
+ <%= link_to(t('my.posts.index.nav_text'), my_posts_path) %>
24
+ </div>
25
+ <% end %>
26
+ <% if Post.of_type(:article).owned_by(current_user).exists? %>
27
+ <div>
28
+ <%= link_to(t('my.posts.articles.nav_text'), my_articles_path) %>
29
+ </div>
30
+ <% end %>
31
+ <% if Post.of_type(:news).owned_by(current_user).exists? %>
32
+ <div>
33
+ <%= link_to(t('my.posts.news_index.nav_text'), my_news_path) %>
34
+ </div>
35
+ <% end %>
36
+ <% if Post.of_type(:blog_post).owned_by(current_user).exists? %>
37
+ <div>
38
+ <%= link_to(t('my.posts.blog_posts.nav_text'), my_blog_path) %>
39
+ </div>
40
+ <% end %>
41
+ </nav>
42
+ </section>
43
+ <% end %>
@@ -0,0 +1,357 @@
1
+ <% model_name = entity.class.to_s.underscore %>
2
+ <%=
3
+ form_with(
4
+ model: entity,
5
+ url: entity.id.nil? ? my_posts_path : my_post_path(id: entity.id),
6
+ html: {
7
+ id: "#{model_name}-form"
8
+ }
9
+ ) do |f|
10
+ %>
11
+ <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
12
+
13
+ <dl>
14
+ <dt><%= f.label :language_id %></dt>
15
+ <dd><%= f.select :language_id, languages_for_select(false) %></dd>
16
+
17
+ <dt><%= f.label :publication_time %></dt>
18
+ <dd>
19
+ <%=
20
+ f.datetime_local_field(
21
+ :publication_time,
22
+ id: "#{model_name}_publication_time",
23
+ required: true
24
+ )
25
+ %>
26
+ </dd>
27
+
28
+ <dt><%= f.label :title %></dt>
29
+ <dd>
30
+ <%=
31
+ f.text_field(
32
+ :title,
33
+ id: "#{model_name}_title",
34
+ size: nil,
35
+ maxlength: Post::TITLE_LIMIT,
36
+ required: true,
37
+ data: { transliterate: "#{model_name}_slug" }
38
+ )
39
+ %>
40
+ <div class="guideline"><%= t('posts.form.guidelines.title') %></div>
41
+ </dd>
42
+
43
+ <dt><%= f.label :slug %></dt>
44
+ <dd>
45
+ <%=
46
+ f.text_field(
47
+ :slug,
48
+ id: "#{model_name}_slug",
49
+ size: nil,
50
+ maxlength: Post::SLUG_LIMIT,
51
+ required: true,
52
+ pattern: Post::SLUG_PATTERN_HTML,
53
+ title: t('posts.form.guidelines.slug')
54
+ )
55
+ %>
56
+ <div class="guideline"><%= t('posts.form.guidelines.slug') %></div>
57
+ </dd>
58
+
59
+ <% if entity.post_type.post_categories.any? %>
60
+ <dt><%= f.label :post_category_id %></dt>
61
+ <dd>
62
+ <%=
63
+ f.select(
64
+ :post_category_id,
65
+ post_categories_for_select(entity.post_type_id)
66
+ )
67
+ %>
68
+ </dd>
69
+ <% end %>
70
+
71
+ <dt><%= f.label :lead %></dt>
72
+ <dd>
73
+ <%=
74
+ f.text_area(
75
+ :lead,
76
+ id: "#{model_name}_lead",
77
+ cols: 80,
78
+ rows: 3,
79
+ maxlength: Post::LEAD_LIMIT
80
+ )
81
+ %>
82
+ <div class="guideline"><%= t('posts.form.guidelines.lead') %></div>
83
+ </dd>
84
+
85
+ <dt><%= f.label :body %></dt>
86
+ <dd>
87
+ <%=
88
+ f.text_area(
89
+ :body,
90
+ id: "#{model_name}_body",
91
+ cols: 20,
92
+ rows: 25,
93
+ required: true,
94
+ data: { wysiwyg: 1 }
95
+ )
96
+ %>
97
+ </dd>
98
+
99
+ <dt><%= label_tag(:tags_string, t('posts.form.tags')) %></dt>
100
+ <dd>
101
+ <%=
102
+ text_field_tag(:tags_string, entity.tags_string)
103
+ %>
104
+ </dd>
105
+
106
+ <dt><%= f.label :time_required %></dt>
107
+ <dd>
108
+ <%=
109
+ f.number_field(
110
+ :time_required,
111
+ id: "#{model_name}_time_required",
112
+ size: nil,
113
+ in: Post::TIME_RANGE
114
+ )
115
+ %>
116
+ <div class="guideline"><%= t('posts.form.guidelines.time_required') %></div>
117
+ </dd>
118
+
119
+ <dt><%= f.label :author_name %></dt>
120
+ <dd>
121
+ <%=
122
+ f.text_field(
123
+ :author_name,
124
+ id: "#{model_name}_author_name",
125
+ size: nil,
126
+ maxlength: Post::META_LIMIT
127
+ )
128
+ %>
129
+ <div class="guideline"><%= t('posts.form.guidelines.author_name') %></div>
130
+ </dd>
131
+
132
+ <dt><%= f.label :author_title %></dt>
133
+ <dd>
134
+ <%=
135
+ f.text_field(
136
+ :author_title,
137
+ id: "#{model_name}_author_title",
138
+ size: nil,
139
+ maxlength: Post::META_LIMIT
140
+ )
141
+ %>
142
+ <div class="guideline"><%= t('posts.form.guidelines.author_title') %></div>
143
+ </dd>
144
+
145
+ <dt><%= f.label :author_url %></dt>
146
+ <dd>
147
+ <%=
148
+ f.url_field(
149
+ :author_url,
150
+ id: "#{model_name}_author_url",
151
+ size: nil,
152
+ maxlength: Post::META_LIMIT
153
+ )
154
+ %>
155
+ <div class="guideline"><%= t('posts.form.guidelines.author_url') %></div>
156
+ </dd>
157
+
158
+ <dt><%= f.label :image %></dt>
159
+ <dd>
160
+ <% figure_id = "#{model_name}-image" %>
161
+ <figure role="group" class="preview" id="<%= figure_id %>">
162
+ <% if entity.image.blank? %>
163
+ <%= f.label :image, image_tag('biovision/base/placeholders/image.svg') %>
164
+ <% else %>
165
+ <%= f.label :image, image_tag(entity.image.big.url) %>
166
+ <% end %>
167
+ <figcaption>
168
+ <%=
169
+ f.file_field(
170
+ :image,
171
+ id: "#{model_name}_image",
172
+ accept: 'image/jpeg,image/png',
173
+ data: { image: figure_id }
174
+ )
175
+ %>
176
+ </figcaption>
177
+ </figure>
178
+ <div class="guideline"><%= t('posts.form.guidelines.image') %></div>
179
+ </dd>
180
+
181
+ <dt><%= f.label :image_alt_text %></dt>
182
+ <dd>
183
+ <%=
184
+ f.text_field(
185
+ :image_alt_text,
186
+ id: "#{model_name}_image_alt_text",
187
+ size: nil,
188
+ maxlength: Post::META_LIMIT
189
+ )
190
+ %>
191
+ <div class="guideline"><%= t('posts.form.guidelines.image_alt_text') %></div>
192
+ </dd>
193
+
194
+ <dt><%= f.label :image_name %></dt>
195
+ <dd>
196
+ <%=
197
+ f.text_field(
198
+ :image_name,
199
+ id: "#{model_name}_image_name",
200
+ size: nil,
201
+ maxlength: Post::IMAGE_NAME_LIMIT
202
+ )
203
+ %>
204
+ <div class="guideline"><%= t('posts.form.guidelines.image_name') %></div>
205
+ </dd>
206
+
207
+ <dt><%= f.label :image_source_name %></dt>
208
+ <dd>
209
+ <%=
210
+ f.text_field(
211
+ :image_source_name,
212
+ id: "#{model_name}_image_source_name",
213
+ size: nil,
214
+ maxlength: Post::META_LIMIT
215
+ )
216
+ %>
217
+ <div class="guideline"><%= t('posts.form.guidelines.image_source_name') %></div>
218
+ </dd>
219
+
220
+ <dt><%= f.label :image_source_link %></dt>
221
+ <dd>
222
+ <%=
223
+ f.url_field(
224
+ :image_source_link,
225
+ id: "#{model_name}_image_source_link",
226
+ size: nil,
227
+ maxlength: Post::META_LIMIT,
228
+ placeholder: t('posts.form.placeholders.image_source_link')
229
+ )
230
+ %>
231
+ <div class="guideline"><%= t('posts.form.guidelines.image_source_link') %></div>
232
+ </dd>
233
+
234
+ <dt><%= f.label :source_name %></dt>
235
+ <dd>
236
+ <%=
237
+ f.text_field(
238
+ :source_name,
239
+ id: "#{model_name}_source_name",
240
+ size: nil,
241
+ maxlength: Post::META_LIMIT
242
+ )
243
+ %>
244
+ <div class="guideline"><%= t('posts.form.guidelines.source') %></div>
245
+ </dd>
246
+
247
+ <dt><%= f.label :original_title %></dt>
248
+ <dd>
249
+ <%=
250
+ f.text_field(
251
+ :original_title,
252
+ id: "#{model_name}_original_title",
253
+ size: nil,
254
+ maxlength: Post::META_LIMIT
255
+ )
256
+ %>
257
+ <div class="guideline"><%= t('posts.form.guidelines.original_title') %></div>
258
+ </dd>
259
+
260
+ <dt><%= f.label :source_link %></dt>
261
+ <dd>
262
+ <%=
263
+ f.url_field(
264
+ :source_link,
265
+ id: "#{model_name}_source_link",
266
+ size: nil,
267
+ maxlength: Post::META_LIMIT,
268
+ placeholder: t('posts.form.placeholders.source_link')
269
+ )
270
+ %>
271
+ <div class="guideline"><%= t('posts.form.guidelines.source_link') %></div>
272
+ </dd>
273
+
274
+ <dt><%= f.label :meta_title %></dt>
275
+ <dd>
276
+ <%=
277
+ f.text_field(
278
+ :meta_title,
279
+ id: "#{model_name}_meta_title",
280
+ size: nil,
281
+ maxlength: Post::META_LIMIT
282
+ )
283
+ %>
284
+ <div class="guideline"><%= t('posts.form.guidelines.meta_title') %></div>
285
+ </dd>
286
+
287
+ <dt><%= f.label :meta_description %></dt>
288
+ <dd>
289
+ <%=
290
+ f.text_field(
291
+ :meta_description,
292
+ id: "#{model_name}_meta_description",
293
+ size: nil,
294
+ maxlength: Post::META_LIMIT
295
+ )
296
+ %>
297
+ <div class="guideline"><%= t('posts.form.guidelines.meta_description') %></div>
298
+ </dd>
299
+
300
+ <dt><%= f.label :meta_keywords %></dt>
301
+ <dd>
302
+ <%=
303
+ f.text_field(
304
+ :meta_keywords,
305
+ id: "#{model_name}_meta_keywords",
306
+ size: nil,
307
+ maxlength: Post::META_LIMIT
308
+ )
309
+ %>
310
+ <div class="guideline"><%= t('posts.form.guidelines.meta_keywords') %></div>
311
+ </dd>
312
+
313
+ <dt><%= t(:flags) %></dt>
314
+ <dd>
315
+ <ul class="flags">
316
+ <li>
317
+ <%= f.check_box :visible, id: "#{model_name}_visible" %>
318
+ <%= f.label :visible %>
319
+ </li>
320
+ <li>
321
+ <%= f.check_box :show_owner, id: "#{model_name}_show_owner" %>
322
+ <%= f.label :show_owner %>
323
+ </li>
324
+ <li>
325
+ <%= f.check_box :translation, id: "#{model_name}_translation" %>
326
+ <%= f.label :translation %>
327
+ <div>
328
+ <%= f.label :translator_name %><br/>
329
+ <%=
330
+ f.text_field(
331
+ :translator_name,
332
+ id: "#{model_name}_translator_name",
333
+ size: nil,
334
+ maxlength: Post::META_LIMIT
335
+ )
336
+ %>
337
+ </div>
338
+ </li>
339
+ <% if Gem.loaded_specs.key?('biovision-comment') %>
340
+ <li>
341
+ <%= f.check_box :allow_comments, id: :post_allow_comments %>
342
+ <%= f.label :allow_comments %>
343
+ </li>
344
+ <% end %>
345
+ </ul>
346
+ </dd>
347
+ </dl>
348
+
349
+ <%= render 'shared/forms/state_container' %>
350
+
351
+ <div class="buttons">
352
+ <%= f.hidden_field :post_type_id if entity.id.nil? %>
353
+ <%= f.button t(:save), type: :submit, class: 'button-save' %>
354
+ </div>
355
+ <% end %>
356
+
357
+ <%= render partial: 'posts/wysiwyg' %>