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,16 +1,16 @@
1
- $block-shadow: .2rem .2rem .4rem .2rem rgba(0, 0, 0, .125) !default;
2
1
  $border-primary: .1rem solid rgb(192, 192, 192) !default;
3
2
  $border-secondary: .1rem solid rgb(230, 230, 230) !default;
4
3
  $text-color-secondary: #777 !default;
5
- $font-size-large: 2rem !default;
6
4
  $font-size-decreased: 1.2rem !default;
7
5
  $font-family-heading: serif !default;
8
6
 
9
7
  $background-post-footer: rgb(248, 248, 248) !default;
10
8
  $background-post-preview-image: linear-gradient(to top, #f0f0f0, #fff) !default;
9
+ $background-post-tag: rgb(248, 248, 248) !default;
11
10
 
12
11
  .recent-posts {
13
- .list {
12
+ .list,
13
+ .posts-list {
14
14
  align-items: stretch;
15
15
  display: flex;
16
16
  flex-wrap: wrap;
@@ -19,8 +19,6 @@ $background-post-preview-image: linear-gradient(to top, #f0f0f0, #fff) !default;
19
19
  }
20
20
 
21
21
  .post-preview {
22
- border-radius: .2rem;
23
- box-shadow: $block-shadow;
24
22
  display: flex;
25
23
  flex: 1;
26
24
  flex-direction: column;
@@ -29,60 +27,97 @@ $background-post-preview-image: linear-gradient(to top, #f0f0f0, #fff) !default;
29
27
  max-width: 30rem;
30
28
  min-width: 28rem;
31
29
 
30
+ &:hover {
31
+ box-shadow: 0 0 .4rem rgba(0, 0, 0, .25);
32
+ }
33
+
34
+ > div {
35
+ width: 100%;
36
+ }
37
+
32
38
  .image {
33
39
  background: $background-post-preview-image;
34
- border-radius: .2rem .2rem 0 0;
35
- height: 20rem;
36
- overflow: hidden;
37
- width: 100%;
40
+
41
+ a {
42
+ display: block;
43
+ }
38
44
  }
39
45
 
40
- img {
41
- height: 100%;
42
- object-fit: cover;
43
- width: 100%;
46
+ .text {
47
+ padding: var(--spacer-xxs, .4rem);
44
48
  }
45
49
 
46
50
  .title {
47
- font: 500 $font-size-large $font-family-heading;
48
- min-height: 6.4rem;
49
- padding: .4rem;
51
+ font: 500 var(--font-size-large, 2.4rem) $font-family-heading;
50
52
  }
51
53
 
52
54
  .lead {
53
55
  color: $text-color-secondary;
54
- padding: .4rem;
56
+ font-weight: 400;
57
+ padding-top: var(--spacer-xs, .8rem);
58
+
59
+ a:link,
60
+ a:visited {
61
+ color: inherit;
62
+ }
55
63
  }
56
64
 
57
65
  .counters {
66
+ border-top: $border-secondary;
58
67
  margin-top: auto;
59
- padding: .4rem;
68
+ padding: var(--spacer-xxs, .4rem);
60
69
  text-align: right;
61
70
  }
62
71
 
63
72
  .category {
64
- padding: .4rem;
73
+ padding: var(--spacer-xxs, .4rem);
65
74
  }
66
75
 
67
- .info {
68
- align-items: center;
69
- -webkit-backdrop-filter: blur(.2rem);
70
- background: rgba(255, 255, 255, .75);
71
- border-radius: .2rem .2rem 0 0;
72
- display: flex;
73
- flex-wrap: wrap;
74
- left: 0;
75
- padding: .2rem .4rem;
76
- position: absolute;
77
- right: 0;
78
-
79
- time {
80
- font-size: $font-size-decreased;
81
- font-style: italic;
82
- line-height: 2rem;
83
- margin-left: auto;
76
+ .time-and-author {
77
+ font-size: var(--font-size-decreased, 1.3rem);
78
+ padding: var(--spacer-xxs, .4rem);
79
+
80
+ a,
81
+ span {
82
+ font-weight: 400;
83
+
84
+ + time {
85
+ &::before {
86
+ content: '|';
87
+ margin: 0 var(--spacer-xxs, .4rem);
88
+ }
89
+ }
84
90
  }
85
91
  }
92
+
93
+ time {
94
+ color: $text-color-secondary;
95
+ }
96
+
97
+ .counters {
98
+ color: $text-color-secondary;
99
+ font-size: var(--font-size-decreased, 1.3rem);
100
+ }
101
+ }
102
+
103
+ .post-tags {
104
+ margin: 0;
105
+ padding: var(--spacer-xxs, .4rem);
106
+
107
+ li {
108
+ display: inline-block;
109
+ font-size: var(--font-size-decreased, 1.3rem);
110
+ list-style: none;
111
+ margin: 0;
112
+ padding: 0;
113
+ }
114
+
115
+ a:link,
116
+ a:visited {
117
+ background: $background-post-tag;
118
+ display: inline-block;
119
+ padding: var(--spacer-xs, .8rem);
120
+ }
86
121
  }
87
122
 
88
123
  .view_count {
@@ -91,6 +126,12 @@ $background-post-preview-image: linear-gradient(to top, #f0f0f0, #fff) !default;
91
126
  padding-left: 1.8rem;
92
127
  }
93
128
 
129
+ .time_required {
130
+ background: image_url('biovision/post/icons/time.svg') no-repeat center left / 1.6rem auto;
131
+ display: inline-block;
132
+ padding-left: 1.8rem;
133
+ }
134
+
94
135
  article.post {
95
136
  figure {
96
137
  border-bottom: $border-secondary;
@@ -105,7 +146,7 @@ article.post {
105
146
  flex-wrap: wrap;
106
147
  }
107
148
 
108
- .image_author {
149
+ .image_source {
109
150
  color: $text-color-secondary;
110
151
  font-size: $font-size-decreased;
111
152
  margin-left: auto;
@@ -148,3 +189,13 @@ article.post {
148
189
  }
149
190
  }
150
191
  }
192
+
193
+ .posts-linked {
194
+ .list,
195
+ .posts-list {
196
+ align-items: stretch;
197
+ display: flex;
198
+ flex-wrap: wrap;
199
+ justify-content: space-around;
200
+ }
201
+ }
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Administrative part for managing editorial members
4
+ class Admin::EditorialMembersController < AdminController
5
+ include ToggleableEntity
6
+ include EntityPriority
7
+
8
+ before_action :set_entity, except: [:index]
9
+
10
+ # get /admin/editorial_members
11
+ def index
12
+ @collection = EditorialMember.list_for_administration
13
+ end
14
+
15
+ # get /admin/editorial_members/:id
16
+ def show
17
+ end
18
+
19
+ # put /admin/editorial_members/:id/post_types/:post_type_id
20
+ def add_post_type
21
+ @entity.add_post_type(PostType.find_by(id: params[:post_type_id]))
22
+
23
+ head :no_content
24
+ end
25
+
26
+ # delete /admin/editorial_members/:id/post_types/:post_type_id
27
+ def remove_post_type
28
+ @entity.remove_post_type(PostType.find_by(id: params[:post_type_id]))
29
+
30
+ head :no_content
31
+ end
32
+
33
+ private
34
+
35
+ def set_entity
36
+ @entity = EditorialMember.find_by(id: params[:id])
37
+ handle_http_404('Cannot find editorial_member') if @entity.nil?
38
+ end
39
+
40
+ def restrict_access
41
+ require_privilege :chief_editor
42
+ end
43
+ end
@@ -0,0 +1,23 @@
1
+ class Admin::FeaturedPostsController < AdminController
2
+ include EntityPriority
3
+
4
+ before_action :set_entity, except: :index
5
+
6
+ # get /admin/featured_posts
7
+ def index
8
+ @languages = Language.active.ordered_by_priority
9
+ end
10
+
11
+ private
12
+
13
+ def set_entity
14
+ @entity = FeaturedPost.find_by(id: params[:id])
15
+ if @entity.nil?
16
+ handle_http_404('Cannot find post_link')
17
+ end
18
+ end
19
+
20
+ def restrict_access
21
+ require_privilege :chief_editor
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Administrative part of post group categories list management
4
+ class Admin::PostGroupCategoriesController < AdminController
5
+ include EntityPriority
6
+
7
+ before_action :set_entity
8
+
9
+ private
10
+
11
+ def set_entity
12
+ @entity = PostGroupCategory.find_by(id: params[:id])
13
+ handle_http_404('Cannot find post_group_category') if @entity.nil?
14
+ end
15
+
16
+ def restrict_access
17
+ require_privilege :chief_editor
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Administrative part of post group tags list management
4
+ class Admin::PostGroupTagsController < AdminController
5
+ include EntityPriority
6
+
7
+ before_action :set_entity
8
+
9
+ private
10
+
11
+ def set_entity
12
+ @entity = PostGroupTag.find_by(id: params[:id])
13
+ handle_http_404('Cannot find post_group_tag') if @entity.nil?
14
+ end
15
+
16
+ def restrict_access
17
+ require_privilege :chief_editor
18
+ end
19
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Administrative part of post group management
4
+ class Admin::PostGroupsController < AdminController
5
+ include EntityPriority
6
+ include ToggleableEntity
7
+
8
+ before_action :set_entity, except: :index
9
+
10
+ # get /admin/post_groups
11
+ def index
12
+ @collection = PostGroup.list_for_administration
13
+ end
14
+
15
+ # get /admin/post_groups/:id
16
+ def show
17
+ end
18
+
19
+ # put /admin/post_groups/:id/categories/:category_id
20
+ def add_category
21
+ @entity.add_category(PostCategory.find_by(id: params[:category_id]))
22
+
23
+ head :no_content
24
+ end
25
+
26
+ # get /admin/post_groups/:id/tags?q=
27
+ def tags
28
+ @collection = PostTag.with_name_like(params[:q]).list_for_administration.first(50)
29
+ end
30
+
31
+ # delete /admin/post_groups/:id/categories/:category_id
32
+ def remove_category
33
+ @entity.remove_category(PostCategory.find_by(id: params[:category_id]))
34
+
35
+ head :no_content
36
+ end
37
+
38
+ # put /admin/post_groups/:id/tags/:tag_id
39
+ def add_tag
40
+ @entity.add_tag(PostTag.find_by(id: params[:tag_id]))
41
+
42
+ head :no_content
43
+ end
44
+
45
+ # delete /admin/post_groups/:id/tags/:tag_id
46
+ def remove_tag
47
+ @entity.remove_tag(PostTag.find_by(id: params[:tag_id]))
48
+
49
+ head :no_content
50
+ end
51
+
52
+ private
53
+
54
+ def set_entity
55
+ @entity = PostGroup.find_by(id: params[:id])
56
+ handle_http_404('Cannot find post_group') if @entity.nil?
57
+ end
58
+
59
+ def restrict_access
60
+ require_privilege :chief_editor
61
+ end
62
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Handling uploaded inline post images
4
+ class Admin::PostIllustrationsController < AdminController
5
+ before_action :set_entity, except: :index
6
+
7
+ # get /admin/post_illustrations
8
+ def index
9
+ @collection = PostIllustration.page_for_administration(current_page)
10
+ end
11
+
12
+ # get /admin/post_illustrations/:id
13
+ def show
14
+ end
15
+
16
+ private
17
+
18
+ def set_entity
19
+ @entity = PostIllustration.find_by(id: params[:id])
20
+ handle_http_404('Cannot find post_illustration') if @entity.nil?
21
+ end
22
+
23
+ def restrict_access
24
+ require_privilege_group :editors
25
+ end
26
+ end
@@ -0,0 +1,33 @@
1
+ class Admin::PostImagesController < AdminController
2
+ include ToggleableEntity
3
+ include EntityPriority
4
+
5
+ before_action :set_entity, except: [:index]
6
+
7
+ # get /admin/post_images
8
+ def index
9
+ @collection = PostImage.page_for_administration(current_page)
10
+ end
11
+
12
+ # get /admin/post_images/:id
13
+ def show
14
+ end
15
+
16
+ # get /admin/post_images/:id/posts
17
+ def posts
18
+ @collection = @entity.posts.page_for_administration(current_page)
19
+ end
20
+
21
+ private
22
+
23
+ def set_entity
24
+ @entity = PostImage.find_by(id: params[:id])
25
+ if @entity.nil?
26
+ handle_http_404('Cannot find post_image')
27
+ end
28
+ end
29
+
30
+ def restrict_access
31
+ require_privilege_group :editors
32
+ end
33
+ end
@@ -0,0 +1,19 @@
1
+ class Admin::PostLinksController < AdminController
2
+ include ToggleableEntity
3
+ include EntityPriority
4
+
5
+ before_action :set_entity
6
+
7
+ private
8
+
9
+ def set_entity
10
+ @entity = PostLink.find_by(id: params[:id])
11
+ if @entity.nil?
12
+ handle_http_404('Cannot find post_link')
13
+ end
14
+ end
15
+
16
+ def restrict_access
17
+ require_privilege_group :editors
18
+ end
19
+ end