elabs 4.0.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +9 -0
  3. data/.node-version +1 -1
  4. data/.rubocop.yml +4 -0
  5. data/.stylelintrc.yml +12 -2
  6. data/CHANGELOG.md +81 -12
  7. data/Gemfile +1 -1
  8. data/Gemfile.lock +96 -94
  9. data/README.md +2 -0
  10. data/ROADMAP.md +4 -2
  11. data/app/assets/config/elabs_manifest.js +2 -1
  12. data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.eot +0 -0
  13. data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.svg +1148 -0
  14. data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.ttf +0 -0
  15. data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.woff +0 -0
  16. data/app/assets/fonts/elabs/FontAwesome/fa-brands-400.woff2 +0 -0
  17. data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.eot +0 -0
  18. data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.svg +467 -0
  19. data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.ttf +0 -0
  20. data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.woff +0 -0
  21. data/app/assets/fonts/elabs/FontAwesome/fa-regular-400.woff2 +0 -0
  22. data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.eot +0 -0
  23. data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.svg +2231 -0
  24. data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.ttf +0 -0
  25. data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.woff +0 -0
  26. data/app/assets/fonts/elabs/FontAwesome/fa-solid-900.woff2 +0 -0
  27. data/app/assets/fonts/elabs/OpenSans/Apache License.txt +201 -0
  28. data/app/assets/fonts/elabs/OpenSans/OpenSans-Bold.ttf +0 -0
  29. data/app/assets/fonts/elabs/OpenSans/OpenSans-Light.ttf +0 -0
  30. data/app/assets/fonts/elabs/OpenSans/OpenSans-Regular.ttf +0 -0
  31. data/app/assets/fonts/elabs/OpenSans/OpenSans-Semibold.ttf +0 -0
  32. data/app/assets/fonts/elabs/license-icons/license-icons.eot +0 -0
  33. data/app/assets/fonts/elabs/license-icons/license-icons.svg +51 -0
  34. data/app/assets/fonts/elabs/license-icons/license-icons.ttf +0 -0
  35. data/app/assets/fonts/elabs/license-icons/license-icons.woff +0 -0
  36. data/app/assets/fonts/elabs/license-icons/license-icons.woff2 +0 -0
  37. data/app/assets/images/elabs/preview_placeholder.png +0 -0
  38. data/app/assets/images/elabs/preview_placeholder_nsfw.png +0 -0
  39. data/app/assets/javascripts/elabs/announcements.js +33 -0
  40. data/app/assets/javascripts/elabs/application.js.erb +17 -14
  41. data/app/assets/javascripts/elabs/forms.js +0 -1
  42. data/app/assets/javascripts/elabs/helpers-markdown.js +2 -2
  43. data/app/assets/javascripts/elabs/helpers.js +17 -0
  44. data/app/assets/javascripts/elabs/menu.js +5 -0
  45. data/app/assets/stylesheets/elabs/_fonts.scss +32 -0
  46. data/app/assets/stylesheets/elabs/_variables.scss +286 -5
  47. data/app/assets/stylesheets/elabs/app/components/_act.scss +83 -0
  48. data/app/assets/stylesheets/elabs/app/components/_announcement.scss +41 -0
  49. data/app/assets/stylesheets/elabs/app/components/_classifier_types.scss +43 -0
  50. data/app/assets/stylesheets/elabs/app/components/_comment.scss +29 -0
  51. data/app/assets/stylesheets/elabs/app/components/_content_relations.scss +53 -0
  52. data/app/assets/stylesheets/elabs/app/components/_content_statuses.scss +39 -0
  53. data/app/assets/stylesheets/elabs/app/components/_content_types.scss +41 -0
  54. data/app/assets/stylesheets/elabs/app/components/_git_cards.scss +122 -0
  55. data/app/assets/stylesheets/elabs/app/elements/_alerts.scss +3 -0
  56. data/app/assets/stylesheets/elabs/app/elements/_badges.scss +17 -0
  57. data/app/assets/stylesheets/elabs/app/elements/_buttons.scss +34 -0
  58. data/app/assets/stylesheets/elabs/app/elements/_dropdowns.scss +78 -0
  59. data/app/assets/stylesheets/elabs/app/elements/_empty.scss +31 -0
  60. data/app/assets/stylesheets/elabs/app/elements/_errors.scss +15 -0
  61. data/app/assets/stylesheets/elabs/app/elements/_filter_link.scss +23 -0
  62. data/app/assets/stylesheets/elabs/app/elements/_fixed_links.scss +19 -0
  63. data/app/assets/stylesheets/elabs/app/elements/_forms.scss +123 -0
  64. data/app/assets/stylesheets/elabs/app/elements/_icons.scss +74 -0
  65. data/app/assets/stylesheets/elabs/app/{_medias.scss → elements/_medias.scss} +2 -0
  66. data/app/assets/stylesheets/elabs/app/{_modals.scss → elements/_modals.scss} +8 -4
  67. data/app/assets/stylesheets/elabs/app/elements/_nsfw.scss +41 -0
  68. data/app/assets/stylesheets/elabs/app/{_pagination.scss → elements/_pagination.scss} +0 -0
  69. data/app/assets/stylesheets/elabs/app/{_tables.scss → elements/_tables.scss} +2 -2
  70. data/app/assets/stylesheets/elabs/app/elements/_tabs.scss +73 -0
  71. data/app/assets/stylesheets/elabs/app/helpers/_cards.scss +80 -0
  72. data/app/assets/stylesheets/elabs/app/helpers/_containers.scss +7 -0
  73. data/app/assets/stylesheets/elabs/app/helpers/_states.scss +3 -0
  74. data/app/assets/stylesheets/elabs/app/{_helpers.scss → helpers/_typo.scss} +6 -4
  75. data/app/assets/stylesheets/elabs/app/layouts/_acts.scss +25 -0
  76. data/app/assets/stylesheets/elabs/app/layouts/_classifiers.scss +32 -0
  77. data/app/assets/stylesheets/elabs/app/{_comments.scss → layouts/_comments.scss} +0 -2
  78. data/app/assets/stylesheets/elabs/app/layouts/_devise.scss +65 -0
  79. data/app/assets/stylesheets/elabs/app/layouts/_layout.scss +40 -0
  80. data/app/assets/stylesheets/elabs/app/layouts/_page.scss +14 -0
  81. data/app/assets/stylesheets/elabs/app/layouts/_page_content.scss +13 -0
  82. data/app/assets/stylesheets/elabs/app/layouts/_page_footer.scss +20 -0
  83. data/app/assets/stylesheets/elabs/app/layouts/_page_header.scss +146 -0
  84. data/app/assets/stylesheets/elabs/app/layouts/_page_menu.scss +232 -0
  85. data/app/assets/stylesheets/elabs/app/layouts/_page_messages.scss +4 -0
  86. data/app/assets/stylesheets/elabs/app/layouts/_private_layout.scss +78 -0
  87. data/app/assets/stylesheets/elabs/app/{_typo.scss → layouts/_typo.scss} +3 -0
  88. data/app/assets/stylesheets/elabs/app/mixins/_classifier_card.scss +43 -0
  89. data/app/assets/stylesheets/elabs/app/mixins/_content_card.scss +103 -0
  90. data/app/assets/stylesheets/elabs/app/mixins/_content_full.scss +158 -0
  91. data/app/assets/stylesheets/elabs/app/mixins/{_content-inline.scss → _content_inline.scss} +0 -0
  92. data/app/assets/stylesheets/elabs/lib/_codemirror.scss +2 -2
  93. data/app/assets/stylesheets/elabs/{_colors.scss → lib/_colors_reference.scss} +0 -52
  94. data/app/assets/stylesheets/elabs/lib/_license_icons.scss +121 -0
  95. data/app/assets/stylesheets/elabs/lib/fontawesome/_fontawesome.scss +1 -1
  96. data/app/assets/stylesheets/elabs/lib/fontawesome/_fonts.scss +18 -18
  97. data/app/assets/stylesheets/elabs/lib/knacss/_knacss.scss +1 -1
  98. data/app/assets/stylesheets/elabs/lib/knacss/_knacss_variables.scss +227 -0
  99. data/app/assets/stylesheets/elabs/style.scss +62 -57
  100. data/app/controllers/elabs/admin/admin_application_controller.rb +1 -1
  101. data/app/controllers/elabs/admin/announcements_controller.rb +71 -0
  102. data/app/controllers/elabs/concerns/elabs_controller.rb +3 -0
  103. data/app/controllers/elabs/content_application_controller.rb +4 -0
  104. data/app/controllers/elabs/elabs_public_controller.rb +15 -0
  105. data/app/controllers/elabs/languages_controller.rb +1 -5
  106. data/app/controllers/elabs/member/comments_controller.rb +42 -0
  107. data/app/controllers/elabs/member/member_application_controller.rb +1 -1
  108. data/app/controllers/elabs/reports_controller.rb +2 -0
  109. data/app/helpers/elabs/acts_helper.rb +7 -2
  110. data/app/helpers/elabs/application_helper.rb +8 -50
  111. data/app/helpers/elabs/content_filters_helper.rb +17 -24
  112. data/app/helpers/elabs/content_helper.rb +8 -35
  113. data/app/helpers/elabs/content_renderer_helper.rb +4 -112
  114. data/app/helpers/elabs/form_helper.rb +11 -11
  115. data/app/helpers/elabs/icons_helper.rb +63 -0
  116. data/app/helpers/elabs/{admin_content_helper.rb → links_admin_helper.rb} +1 -1
  117. data/app/helpers/elabs/links_helper.rb +58 -0
  118. data/app/helpers/elabs/{member_content_helper.rb → links_member_helper.rb} +2 -2
  119. data/app/helpers/elabs/notification_helper.rb +17 -3
  120. data/app/helpers/elabs/shortcodes_helper.rb +108 -0
  121. data/app/helpers/elabs/thumbnails_helper.rb +1 -1
  122. data/app/models/elabs/album.rb +14 -0
  123. data/app/models/elabs/announcement.rb +33 -0
  124. data/app/models/elabs/article.rb +14 -0
  125. data/app/models/elabs/comment.rb +10 -4
  126. data/app/models/elabs/note.rb +14 -0
  127. data/app/models/elabs/project.rb +12 -0
  128. data/app/models/elabs/report.rb +1 -0
  129. data/app/models/elabs/upload.rb +16 -0
  130. data/app/models/elabs/user.rb +2 -1
  131. data/app/views/elabs/acts/_filters.html.haml +3 -2
  132. data/app/views/elabs/acts/index.html.haml +2 -13
  133. data/app/views/elabs/admin/announcements/_announcement.json.jbuilder +10 -0
  134. data/app/views/elabs/admin/announcements/_form.html.haml +52 -0
  135. data/app/views/elabs/admin/announcements/edit.html.haml +3 -0
  136. data/app/views/elabs/admin/announcements/index.html.haml +28 -0
  137. data/app/views/elabs/admin/announcements/index.json.jbuilder +1 -0
  138. data/app/views/elabs/admin/announcements/new.html.haml +3 -0
  139. data/app/views/elabs/admin/licenses/index.html.haml +2 -2
  140. data/app/views/elabs/admin/uploads/_upload.json.jbuilder +3 -3
  141. data/app/views/elabs/albums/_card_content.html.haml +8 -0
  142. data/app/views/elabs/albums/_filters.html.haml +5 -3
  143. data/app/views/elabs/albums/index.html.haml +1 -1
  144. data/app/views/elabs/albums/show.html.haml +38 -29
  145. data/app/views/elabs/articles/_filters.html.haml +5 -3
  146. data/app/views/elabs/articles/index.html.haml +1 -1
  147. data/app/views/elabs/articles/show.html.haml +33 -25
  148. data/app/views/elabs/auth/confirmations/new.html.haml +1 -1
  149. data/app/views/elabs/auth/passwords/edit.html.haml +1 -1
  150. data/app/views/elabs/auth/passwords/new.html.haml +1 -1
  151. data/app/views/elabs/auth/registrations/new.html.haml +7 -2
  152. data/app/views/elabs/auth/sessions/_new.html.haml +1 -1
  153. data/app/views/elabs/auth/unlocks/new.html.haml +1 -1
  154. data/app/views/elabs/comments/_comments.html.haml +29 -20
  155. data/app/views/elabs/comments/_form.html.haml +40 -36
  156. data/app/views/elabs/languages/_filters.html.haml +3 -5
  157. data/app/views/elabs/languages/index.html.haml +12 -13
  158. data/app/views/elabs/languages/show.html.haml +36 -31
  159. data/app/views/elabs/layouts/_announcements.html.haml +9 -0
  160. data/app/views/elabs/layouts/_content_associations.html.haml +89 -0
  161. data/app/views/elabs/layouts/_content_card.html.haml +41 -0
  162. data/app/views/elabs/layouts/_flash_messages.html.haml +4 -0
  163. data/app/views/elabs/layouts/_footer.html.haml +18 -10
  164. data/app/views/elabs/layouts/_form_honeypot.html.haml +12 -0
  165. data/app/views/elabs/layouts/_hidden_entry.html.haml +1 -1
  166. data/app/views/elabs/layouts/_hidden_entry_full.html.haml +4 -2
  167. data/app/views/elabs/layouts/_hidden_entry_inline.html.haml +1 -1
  168. data/app/views/elabs/layouts/_language_menu.html.haml +2 -2
  169. data/app/views/elabs/layouts/_menu.html.haml +58 -75
  170. data/app/views/elabs/layouts/_menu_admin.html.haml +40 -0
  171. data/app/views/elabs/layouts/_menu_member.html.haml +57 -0
  172. data/app/views/elabs/layouts/application.html.haml +24 -13
  173. data/app/views/elabs/layouts/application_admin.html.haml +33 -0
  174. data/app/views/elabs/layouts/application_member.html.haml +36 -0
  175. data/app/views/elabs/layouts/{lists → content_classifiers_lists}/_albums.html.haml +0 -0
  176. data/app/views/elabs/layouts/{lists → content_classifiers_lists}/_projects.html.haml +0 -0
  177. data/app/views/elabs/layouts/{lists → content_classifiers_lists}/_tags.html.haml +0 -0
  178. data/app/views/elabs/layouts/{_shortcode_infinite_loop.html.haml → shortcodes/_infinite_loop.html.haml} +1 -1
  179. data/app/views/elabs/layouts/{_shortcode_infinite_loop_inline.html.haml → shortcodes/_infinite_loop_inline.html.haml} +0 -0
  180. data/app/views/elabs/layouts/{_shortcode_missing_content.html.haml → shortcodes/_missing_content.html.haml} +1 -1
  181. data/app/views/elabs/layouts/{_shortcode_missing_content_inline.html.haml → shortcodes/_missing_content_inline.html.haml} +0 -0
  182. data/app/views/elabs/layouts/shortcodes/_open_to_see.html.haml +2 -0
  183. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_github_repo_card.html.haml +1 -1
  184. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_github_repo_inline.html.haml +0 -0
  185. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_github_user_card.html.haml +0 -0
  186. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_gitlab_group_card.html.haml +1 -1
  187. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_gitlab_repo_card.html.haml +1 -1
  188. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_gitlab_repo_inline.html.haml +0 -0
  189. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/_gitlab_user_card.html.haml +1 -1
  190. data/app/views/elabs/layouts/shortcodes/widgets/vue/_all_widgets.html.haml +5 -0
  191. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_github_repo_card_vue.html.haml +8 -8
  192. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_github_user_card_vue.html.haml +5 -5
  193. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_gitlab_group_card_vue.html.haml +5 -5
  194. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_gitlab_repo_card_vue.html.haml +8 -8
  195. data/app/views/elabs/layouts/{widgets → shortcodes/widgets}/vue/_gitlab_user_card_vue.html.haml +4 -4
  196. data/app/views/elabs/licenses/_filters.html.haml +3 -2
  197. data/app/views/elabs/licenses/index.html.haml +14 -12
  198. data/app/views/elabs/licenses/show.html.haml +40 -34
  199. data/app/views/elabs/member/albums/_form.html.haml +1 -43
  200. data/app/views/elabs/member/articles/_form.html.haml +1 -39
  201. data/app/views/elabs/member/layouts/_form_commons.html.haml +55 -0
  202. data/app/views/elabs/member/notes/_form.html.haml +1 -39
  203. data/app/views/elabs/member/preferences/edit.html.haml +1 -2
  204. data/app/views/elabs/member/projects/_form.html.haml +3 -38
  205. data/app/views/elabs/member/uploads/_form.html.haml +1 -42
  206. data/app/views/elabs/member/uploads/_upload.json.jbuilder +3 -3
  207. data/app/views/elabs/member/users/edit.html.haml +3 -4
  208. data/app/views/elabs/notes/_filters.html.haml +5 -3
  209. data/app/views/elabs/notes/index.html.haml +1 -1
  210. data/app/views/elabs/notes/show.html.haml +33 -25
  211. data/app/views/elabs/projects/_filters.html.haml +5 -3
  212. data/app/views/elabs/projects/index.html.haml +1 -1
  213. data/app/views/elabs/projects/show.html.haml +68 -62
  214. data/app/views/elabs/reports/_form.html.haml +2 -0
  215. data/app/views/elabs/tags/_filters.html.haml +3 -2
  216. data/app/views/elabs/tags/index.html.haml +11 -11
  217. data/app/views/elabs/tags/show.html.haml +31 -28
  218. data/app/views/elabs/uploads/_filters.html.haml +5 -3
  219. data/app/views/elabs/uploads/_preview.html.haml +5 -4
  220. data/app/views/elabs/uploads/_thumbnail.html.haml +9 -0
  221. data/app/views/elabs/uploads/_upload.json.jbuilder +3 -3
  222. data/app/views/elabs/uploads/index.html.haml +1 -1
  223. data/app/views/elabs/uploads/show.html.haml +45 -39
  224. data/app/views/elabs/users/_filters.html.haml +3 -2
  225. data/app/views/elabs/users/_user.html.haml +3 -3
  226. data/app/views/elabs/users/show.html.haml +48 -43
  227. data/config/routes.rb +13 -8
  228. data/db/migrate/20181025084232_add_archived_field_to_comments.rb +5 -0
  229. data/db/migrate/20181026071743_delete_comment_notifications.rb +5 -0
  230. data/db/migrate/20181030063505_create_announcements.rb +14 -0
  231. data/docs/CODEOWNERS +10 -0
  232. data/docs/migrating.md +16 -1
  233. data/docs/shortcodes_guide.md +51 -0
  234. data/lib/assets/javascripts/README-highlight.js.md +5 -5
  235. data/lib/assets/javascripts/highlight.js-9.13.1/highlight.pack.js +2 -0
  236. data/lib/assets/stylesheets/{highlight.js-9.12.0 → highlight.js-9.13.1}/styles/atelier-sulphurpool-light.css +0 -0
  237. data/lib/elabs.rb +8 -0
  238. data/lib/elabs/version.rb +1 -1
  239. data/lib/generators/elabs/{devise_views_generator.rb → devise_mailer_views_generator.rb} +2 -2
  240. data/lib/generators/elabs/images_generator.rb +24 -0
  241. data/lib/generators/elabs/required_assets_generator.rb +0 -2
  242. data/lib/generators/templates/elabs.rb +3 -0
  243. data/locale/app.pot +132 -19
  244. data/locale/en/app.edit.po +130 -17
  245. data/locale/en/app.po +130 -17
  246. data/locale/fr/app.edit.po +145 -28
  247. data/locale/fr/app.po +141 -27
  248. data/package.json +10 -12
  249. data/yarn.lock +885 -668
  250. metadata +136 -97
  251. data/app/assets/stylesheets/elabs/_icons.scss +0 -17
  252. data/app/assets/stylesheets/elabs/app/_acts.scss +0 -69
  253. data/app/assets/stylesheets/elabs/app/_alerts.scss +0 -3
  254. data/app/assets/stylesheets/elabs/app/_badges.scss +0 -11
  255. data/app/assets/stylesheets/elabs/app/_buttons.scss +0 -29
  256. data/app/assets/stylesheets/elabs/app/_content.scss +0 -25
  257. data/app/assets/stylesheets/elabs/app/_content_statuses.scss +0 -32
  258. data/app/assets/stylesheets/elabs/app/_content_uploads.scss +0 -39
  259. data/app/assets/stylesheets/elabs/app/_empty.scss +0 -19
  260. data/app/assets/stylesheets/elabs/app/_errors.scss +0 -9
  261. data/app/assets/stylesheets/elabs/app/_filter_links.scss +0 -27
  262. data/app/assets/stylesheets/elabs/app/_forms.scss +0 -74
  263. data/app/assets/stylesheets/elabs/app/_languages.scss +0 -6
  264. data/app/assets/stylesheets/elabs/app/_layout.scss +0 -206
  265. data/app/assets/stylesheets/elabs/app/_licenses.scss +0 -6
  266. data/app/assets/stylesheets/elabs/app/_link-to-top.scss +0 -8
  267. data/app/assets/stylesheets/elabs/app/_tabs.scss +0 -54
  268. data/app/assets/stylesheets/elabs/app/_tags.scss +0 -6
  269. data/app/assets/stylesheets/elabs/app/_toolbars.scss +0 -3
  270. data/app/assets/stylesheets/elabs/app/_users.scss +0 -21
  271. data/app/assets/stylesheets/elabs/app/admin-members/_forms.scss +0 -13
  272. data/app/assets/stylesheets/elabs/app/admin-members/_indexes.scss +0 -46
  273. data/app/assets/stylesheets/elabs/app/admin-members/_layout.scss +0 -17
  274. data/app/assets/stylesheets/elabs/app/areas/_devise.scss +0 -31
  275. data/app/assets/stylesheets/elabs/app/components/_cards.scss +0 -16
  276. data/app/assets/stylesheets/elabs/app/components/_container.scss +0 -4
  277. data/app/assets/stylesheets/elabs/app/mixins/_classifier-card.scss +0 -16
  278. data/app/assets/stylesheets/elabs/app/mixins/_content-card.scss +0 -72
  279. data/app/assets/stylesheets/elabs/app/mixins/_content-full.scss +0 -77
  280. data/app/assets/stylesheets/elabs/app/widgets/_git-cards.scss +0 -88
  281. data/app/assets/stylesheets/elabs/lib/fontawesome/_icons.scss +0 -1118
  282. data/app/assets/stylesheets/elabs/lib/knacss/_knacss-variables.scss +0 -239
  283. data/app/views/elabs/albums/_album.html.haml +0 -38
  284. data/app/views/elabs/articles/_article.html.haml +0 -30
  285. data/app/views/elabs/languages/_associations.html.haml +0 -61
  286. data/app/views/elabs/layouts/_shortcode_open_to_see.html.haml +0 -2
  287. data/app/views/elabs/layouts/admin_application.html.haml +0 -21
  288. data/app/views/elabs/layouts/member_application.html.haml +0 -24
  289. data/app/views/elabs/layouts/widgets/vue/_all_widgets.html.haml +0 -5
  290. data/app/views/elabs/licenses/_associations.html.haml +0 -61
  291. data/app/views/elabs/notes/_note.html.haml +0 -31
  292. data/app/views/elabs/projects/_associations.html.haml +0 -54
  293. data/app/views/elabs/projects/_project.html.haml +0 -29
  294. data/app/views/elabs/tags/_associations.html.haml +0 -61
  295. data/app/views/elabs/uploads/_upload.html.haml +0 -41
  296. data/app/views/elabs/users/_associations.html.haml +0 -61
  297. data/db/seeds.rb +0 -10
  298. data/db/seeds_development.rb +0 -21
  299. data/db/seeds_production.rb +0 -0
  300. data/lib/assets/javascripts/codemirror-5.39.2/addon/mode/overlay.js +0 -90
  301. data/lib/assets/javascripts/codemirror-5.39.2/lib/codemirror.js +0 -9684
  302. data/lib/assets/javascripts/codemirror-5.39.2/mode/clike/clike.js +0 -834
  303. data/lib/assets/javascripts/codemirror-5.39.2/mode/css/css.js +0 -832
  304. data/lib/assets/javascripts/codemirror-5.39.2/mode/gfm/gfm.js +0 -129
  305. data/lib/assets/javascripts/codemirror-5.39.2/mode/htmlmixed/htmlmixed.js +0 -152
  306. data/lib/assets/javascripts/codemirror-5.39.2/mode/javascript/javascript.js +0 -896
  307. data/lib/assets/javascripts/codemirror-5.39.2/mode/markdown/markdown.js +0 -882
  308. data/lib/assets/javascripts/codemirror-5.39.2/mode/meta.js +0 -217
  309. data/lib/assets/javascripts/codemirror-5.39.2/mode/xml/xml.js +0 -402
  310. data/lib/assets/javascripts/highlight.js-9.12.0/highlight.pack.js +0 -2
  311. data/lib/assets/stylesheets/codemirror-5.39.2/lib/codemirror.css +0 -346
  312. data/lib/assets/stylesheets/codemirror-5.39.2/theme/base16-dark.css +0 -38
  313. data/lib/assets/stylesheets/codemirror-5.39.2/theme/base16-light.css +0 -38
@@ -1,28 +1,28 @@
1
1
  module Elabs
2
2
  module FormHelper
3
3
  def album_selector(form, field = :album_ids, multiple: true)
4
- form.select field, Elabs::Album.by_member(current_user).for_list, {},
5
- multiple: multiple, id: selector_id(form, field)
4
+ relation_selector(form, field, Elabs::Album.by_member(current_user).for_list, multiple)
6
5
  end
7
6
 
8
7
  def language_selector(form, field = :language_id, multiple: false)
9
- form.select field, Elabs::Language.for_list, {},
10
- multiple: multiple, id: selector_id(form, field)
8
+ relation_selector(form, field, Elabs::Language.for_list, multiple)
11
9
  end
12
10
 
13
11
  def license_selector(form, field = :license_id, multiple: false)
14
- form.select field, Elabs::License.for_list, {},
15
- multiple: multiple, id: selector_id(form, field)
12
+ relation_selector(form, field, Elabs::License.for_list, multiple)
16
13
  end
17
14
 
18
- def project_selector(form, field = :project_ids, multiple: true)
19
- form.select field, Elabs::Project.by_member(current_user).for_list, {},
20
- multiple: multiple, id: selector_id(form, field)
15
+ def projects_selector(form, field = :project_ids, multiple: true)
16
+ relation_selector(form, field, Elabs::Project.by_member(current_user).for_list, multiple)
21
17
  end
22
18
 
23
19
  def uploads_selector(form, field = :upload_ids, multiple: true)
24
- form.select field, Elabs::Upload.by_member(current_user).for_list, {},
25
- multiple: multiple, id: selector_id(form, field)
20
+ relation_selector(form, field, Elabs::Upload.by_member(current_user).for_list, multiple)
21
+ end
22
+
23
+ def relation_selector(form, field, values, multiple = false)
24
+ input_class = multiple ? 'is-multiple' : ''
25
+ form.select field, values, {}, multiple: multiple, id: selector_id(form, field), class: input_class
26
26
  end
27
27
 
28
28
  private
@@ -0,0 +1,63 @@
1
+ module Elabs
2
+ module IconsHelper
3
+ CONTENT_TYPE_ICONS = {
4
+ 'Elabs::Album': 'book',
5
+ 'Elabs::Article': 'font',
6
+ 'Elabs::Note': 'sticky-note',
7
+ 'Elabs::Project': 'cog',
8
+ 'Elabs::Upload': 'file'
9
+ }.freeze
10
+
11
+ def icon_text(icon, text, icon_options = [], reverse = false)
12
+ format(
13
+ reverse ? _('%<text>s %<icon>s') : _('%<icon>s %<text>s'),
14
+ icon: icon(icon, icon_options), text: text
15
+ ).html_safe
16
+ end
17
+
18
+ def boolean_icon_tag(value, true_icon = 'check', false_icon = 'times', false_class = '', true_class = '')
19
+ icon_class = [
20
+ "fas fa-#{value ? true_icon : false_icon} fa-fw #{value ? true_class : false_class}"
21
+ ]
22
+ content_tag(:i, nil, class: icon_class)
23
+ end
24
+
25
+ def colored_good_or_bad_icon_tag(value, true_icon = 'check', false_icon = 'times', false_is_good = false)
26
+ if false_is_good
27
+ false_class = 'is-success'
28
+ true_class = 'is-danger'
29
+ else
30
+ false_class = 'is-danger'
31
+ true_class = 'is-success'
32
+ end
33
+ boolean_icon_tag value, true_icon, false_icon, false_class, true_class
34
+ end
35
+
36
+ def icon(name, classes = [], base = 'fas', pack = 'fa')
37
+ icon_class = ["#{base} #{pack || base}-#{name}"]
38
+ icon_class += classes.map do |c|
39
+ if %w[2x 3x 4x fw pulse spin].include? c
40
+ "#{pack || base}-#{c}"
41
+ else
42
+ c
43
+ end
44
+ end
45
+
46
+ content_tag(:i, nil, class: icon_class)
47
+ end
48
+
49
+ def license_icon(license, classes = ['fw'])
50
+ icon license.icon, classes, 'li', 'li'
51
+ end
52
+
53
+ def content_type_icon(type, options)
54
+ type_icon = CONTENT_TYPE_ICONS.key?(type) ? CONTENT_TYPE_ICONS[type] : 'question'
55
+ icon type_icon, options
56
+ end
57
+
58
+ def content_type_icon_from_entity(entity, options)
59
+ type = entity.class.name.to_sym
60
+ content_type_icon type, options
61
+ end
62
+ end
63
+ end
@@ -1,5 +1,5 @@
1
1
  module Elabs
2
- module AdminContentHelper
2
+ module LinksAdminHelper
3
3
  def admin_action_links(singular_model, entity)
4
4
  out = []
5
5
  out.push(show_online_link(entity))
@@ -0,0 +1,58 @@
1
+ module Elabs
2
+ module LinksHelper
3
+ def show_online_link(entity)
4
+ options = {
5
+ title: _('View online'),
6
+ class: 'btn btn--small btn--show'
7
+ }
8
+ if entity.respond_to?(:publicly_visible?) && !entity.publicly_visible?
9
+ options[:disabled] = true
10
+ return content_tag 'a', icon('eye', ['fw']), options
11
+ end
12
+ link_to entity, options do
13
+ icon('eye', ['fw'])
14
+ end
15
+ end
16
+
17
+ def namespace_show_link(namespace, singular_model, entity)
18
+ link_to send("#{namespace}_#{singular_model}_path", entity),
19
+ title: _('View'),
20
+ class: 'btn btn--small btn--warning' do
21
+ icon('eye', ['fw'])
22
+ end
23
+ end
24
+
25
+ def namespace_edit_link(namespace, singular_model, entity)
26
+ link_to send("edit_#{namespace}_#{singular_model}_path", entity),
27
+ title: _('Edit'),
28
+ class: 'btn btn--small btn--edit' do
29
+ icon('pencil-alt', ['fw'])
30
+ end
31
+ end
32
+
33
+ def namespace_destroy_link(namespace, singular_model, entity, confirm = true)
34
+ link_params = {
35
+ title: _('Destroy'),
36
+ method: :delete,
37
+ class: 'btn btn--small btn--destroy'
38
+ }
39
+ link_params[:data] = { confirm: _('Are you sure?') } if confirm
40
+ link_to send("#{namespace}_#{singular_model}_path".to_sym, entity), link_params do
41
+ icon('trash', ['fw'])
42
+ end
43
+ end
44
+
45
+ def entity_nested_resource_url(entity, nested_type)
46
+ entity_type = singular_type_name entity
47
+ send "#{entity_type}_#{nested_type}_url", entity
48
+ end
49
+
50
+ def related_content_show_all_link(amount, link)
51
+ if amount.positive?
52
+ link_to(_('Show all'), link, class: 'btn btn--small btn--link btn--primary')
53
+ else
54
+ content_tag('a', _('Show all'), disabled: true, class: 'btn btn--small btn--link')
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,5 +1,5 @@
1
1
  module Elabs
2
- module MemberContentHelper
2
+ module LinksMemberHelper
3
3
  def member_action_links(singular_model, entity)
4
4
  out = []
5
5
  out.push show_online_link(entity)
@@ -22,7 +22,7 @@ module Elabs
22
22
  link_to send("member_#{singular_model}_toggle_publication_path", entity),
23
23
  title: entity.published? ? _('Unpublish') : _('Publish'),
24
24
  method: :put,
25
- class: 'btn btn--small btn--' do
25
+ class: 'btn btn--small' do
26
26
  icon(entity.published? ? 'calendar-times' : 'calendar-check', ['fw'])
27
27
  end
28
28
  end
@@ -48,20 +48,34 @@ module Elabs
48
48
  link = case notification.content_type
49
49
  when 'Elabs::Report'
50
50
  admin_reports_path
51
+ when 'Elabs::Comment'
52
+ url_for notification.content.content
51
53
  else
52
54
  notification.content
53
55
  end
54
- link_to("##{notification.content_id}", link).html_safe
56
+ title = notification_link_title notification
57
+
58
+ link_to(title, link).html_safe
59
+ end
60
+
61
+ def notification_link_title(notification)
62
+ case notification.content_type
63
+ when 'Elabs::Comment'
64
+ notification.content.content.title_to_display
65
+ else
66
+ "##{notification.content_id}"
67
+ end
55
68
  end
56
69
 
57
70
  def notification_string(notification)
58
71
  strings = {
59
- 'Elabs::Album' => _('%<user>s %<action>s your album %<link>s'),
72
+ 'Elabs::Album' => _('%<user>s %<action>s your album %<link>s'),
60
73
  'Elabs::Article' => _('%<user>s %<action>s your article %<link>s'),
61
74
  'Elabs::Note' => _('%<user>s %<action>s your note %<link>s'),
62
75
  'Elabs::Project' => _('%<user>s %<action>s your project %<link>s'),
63
76
  'Elabs::Upload' => _('%<user>s %<action>s your file %<link>s'),
64
- 'Elabs::Report' => _('%<user>s %<action>s %<link>s')
77
+ 'Elabs::Report' => _('%<user>s %<action>s %<link>s'),
78
+ 'Elabs::Comment' => _('%<user>s %<action>s %<link>s')
65
79
  }.freeze
66
80
  strings[notification.content_type] || '%<user> %<action>s something (<%link>)'
67
81
  end
@@ -0,0 +1,108 @@
1
+ module Elabs
2
+ module ShortcodesHelper
3
+ SHORT_CODES = {
4
+ /\[album:([\w-]+)\]/ => [:shortcode_content, { type: :album, size: :inline }],
5
+ /\[article:([\w-]+)\]/ => [:shortcode_content, { type: :article, size: :inline }],
6
+ /\[note:([\w-]+)\]/ => [:shortcode_content, { type: :note, size: :inline }],
7
+ /\[project:([\w-]+)\]/ => [:shortcode_content, { type: :project, size: :inline }],
8
+ /\[upload:([\w-]+)\]/ => [:shortcode_content, { type: :upload, size: :inline }],
9
+ /\[user:([a-zA-Z0-9]+([_-]?[a-zA-Z0-9]+)?)\]/ => [:shortcode_content, { type: :user, size: :inline }],
10
+ /\[album-card:([\w-]+)\]/ => [:shortcode_content, { type: :album, size: :large }],
11
+ /\[article-card:([\w-]+)\]/ => [:shortcode_content, { type: :article, size: :large }],
12
+ /\[note-card:([\w-]+)\]/ => [:shortcode_content, { type: :note, size: :large }],
13
+ /\[project-card:([\w-]+)\]/ => [:shortcode_content, { type: :project, size: :large }],
14
+ /\[upload-card:([\w-]+)\]/ => [:shortcode_content, { type: :upload, size: :large }],
15
+ /\[user-card:([a-zA-Z0-9]+([_-]?[a-zA-Z0-9]+)?)\]/ => [:shortcode_content, { type: :user, size: :large }],
16
+ %r{\[github-repo:([a-zA-Z0-9\-_]+/[a-zA-Z0-9\-_]+)\]} => [:shortcode_github_repo_inline, { size: :inline }],
17
+ %r{\[github-repo-card:([a-zA-Z0-9\-_]+/[a-zA-Z0-9\-_]+)\]} => [:shortcode_github_repo, {}],
18
+ /\[github-user-card:([a-zA-Z0-9\-_]+)\]/ => [:shortcode_github_user, {}],
19
+ %r{\[gitlab-repo:(https://.*)\]} => [:shortcode_gitlab_repo_inline, { size: :inline }],
20
+ %r{\[gitlab-repo-card:(https://.*)\]} => [:shortcode_gitlab_repo, {}],
21
+ %r{\[gitlab-user-card:(https://.*)\]} => [:shortcode_gitlab_user, {}],
22
+ %r{\[gitlab-group-card:(https://.*)\]} => [:shortcode_gitlab_group, {}]
23
+ }.freeze
24
+
25
+ def process_short_codes(text, original_entity = nil, display = true)
26
+ SHORT_CODES.each do |key, method|
27
+ text.gsub! key do |match|
28
+ size = method[1].key?(:size) ? method[1][:size] : :inline
29
+ if display || size == :inline
30
+ send(method[0], original_entity, match.sub(key, '\1'), method[1])
31
+ else
32
+ render(partial: 'elabs/layouts/shortcodes/open_to_see') unless display
33
+ end
34
+ end
35
+ end
36
+ text.html_safe
37
+ end
38
+
39
+ private
40
+
41
+ def shortcode_content(original_entity, slug, options = { size: :large })
42
+ type = options[:type].to_s
43
+ model = model_from_entity type
44
+ widget_size = options[:size] == :inline ? '_inline' : ''
45
+
46
+ return render "elabs/layouts/shortcodes/infinite_loop#{widget_size}", format: :html if shortcode_may_cause_loop?(model, slug, original_entity)
47
+
48
+ entity = find_entity_for_shortcode(model, slug)
49
+ return render "elabs/layouts/shortcodes/missing_content#{widget_size}", format: :html unless entity
50
+
51
+ render_shortcode_widget(model, type, entity, widget_size)
52
+ end
53
+
54
+ def shortcode_github_repo(_original_entity, repo_url, _options = {})
55
+ render partial: 'elabs/layouts/shortcodes/widgets/github_repo_card', locals: { repo_url: repo_url }
56
+ end
57
+
58
+ def shortcode_github_repo_inline(_original_entity, repo_url, _options = {})
59
+ url_matches = %r{([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)}.match repo_url
60
+ render partial: 'elabs/layouts/shortcodes/widgets/github_repo_inline', locals: { url_matches: url_matches }
61
+ end
62
+
63
+ def shortcode_github_user(_original_entity, user_name, _options = {})
64
+ render partial: 'elabs/layouts/shortcodes/widgets/github_user_card', locals: { user_name: user_name }
65
+ end
66
+
67
+ def shortcode_gitlab_repo(_original_entity, repo_url, _options = {})
68
+ url_matches = %r{(?:https://)?([a-z0-9\-_\.]+)/(.+)}.match repo_url
69
+ render partial: 'elabs/layouts/shortcodes/widgets/gitlab_repo_card', locals: { url_matches: url_matches }
70
+ end
71
+
72
+ def shortcode_gitlab_repo_inline(_original_entity, repo_url, _options = {})
73
+ url_matches = %r{(.*)/([a-zA-Z0-9\-_]+)/([a-zA-Z0-9\-_]+)}.match repo_url
74
+ render partial: 'elabs/layouts/shortcodes/widgets/gitlab_repo_inline', locals: { url_matches: url_matches }
75
+ end
76
+
77
+ def shortcode_gitlab_user(_original_entity, user_url, _options = {})
78
+ url_matches = %r{(?:https://)?([a-z0-9\-_\.]*)/([a-zA-Z0-9\-_]+)}.match user_url
79
+ render partial: 'elabs/layouts/shortcodes/widgets/gitlab_user_card', locals: { url_matches: url_matches }
80
+ end
81
+
82
+ def shortcode_gitlab_group(_original_entity, group_url, _options = {})
83
+ url_matches = %r{(?:https://)?([a-z0-9\-_\.]*)/([a-zA-Z0-9\-_]+)}.match group_url
84
+ render partial: 'elabs/layouts/shortcodes/widgets/gitlab_group_card', locals: { url_matches: url_matches }
85
+ end
86
+
87
+ def shortcode_may_cause_loop?(model, slug, original_entity)
88
+ original_entity && original_entity[model::SLUG_FIELD] == slug && original_entity.class == model
89
+ end
90
+
91
+ def find_entity_for_shortcode(model, slug)
92
+ return model.where("#{model::SLUG_FIELD}": slug).publicly_visible.first if shortcode_for_content? model
93
+
94
+ model.find_by("#{model::SLUG_FIELD}": slug)
95
+ end
96
+
97
+ def shortcode_for_content?(model)
98
+ %w[Elabs::Article Elabs::Album Elabs::Note Elabs::Project Elabs::Upload].include? model.to_s
99
+ end
100
+
101
+ def render_shortcode_widget(model, type, entity, widget_size)
102
+ return render partial: "elabs/#{type.pluralize}/#{type}_inline", locals: { type.to_sym => entity }, format: :html if widget_size == '_inline'
103
+ return render partial: 'elabs/layouts/content_card', locals: { entity: entity }, format: :html if shortcode_for_content? model
104
+
105
+ render partial: "elabs/#{type.pluralize}/#{type}#{widget_size}", locals: { type.to_sym => entity }, format: :html
106
+ end
107
+ end
108
+ end
@@ -18,7 +18,7 @@ module Elabs
18
18
  end
19
19
 
20
20
  def thumbnail_preview_placeholder_file
21
- 'elabs/preview_placeholder.png'
21
+ '/assets/elabs/preview_placeholder.png'
22
22
  end
23
23
 
24
24
  def image_resize_properties(size = :page)
@@ -22,7 +22,21 @@ module Elabs
22
22
  has_many :projects, through: :projects_albums, dependent: :destroy
23
23
  has_many :uploads, through: :albums_uploads, dependent: :destroy
24
24
  has_many :comments, as: 'content'
25
+ has_many :visible_projects, -> { where(published: true, locked: false) },
26
+ through: :projects_albums, source: :project
25
27
 
26
28
  scope :for_list, -> { order(:name).pluck(:name, :id) }
29
+
30
+ def title_to_display
31
+ name
32
+ end
33
+
34
+ def short_text_to_display
35
+ nil
36
+ end
37
+
38
+ def long_text_to_display
39
+ description
40
+ end
27
41
  end
28
42
  end
@@ -0,0 +1,33 @@
1
+ module Elabs
2
+ class Announcement < ApplicationRecord
3
+ self.table_name = 'announcements'
4
+
5
+ validates :level, inclusion: { in: %w[info warning danger] }, presence: true
6
+ validates :target, inclusion: { in: %w[global public member admin] }, presence: true
7
+ validates :content, presence: true
8
+
9
+ before_save :clean_dates
10
+
11
+ belongs_to :user
12
+
13
+ scope :visible, lambda {
14
+ now = Time.now
15
+ where('start_at <= ? OR start_at IS NULL', now).where('end_at >= ? OR end_at IS NULL', now)
16
+ }
17
+
18
+ def self.for_user(user)
19
+ return visible.where('target = ? OR target = ?', :global, :member) if user&.role == 'user'
20
+
21
+ return visible.where('target = ? OR target = ? OR target = ?', :global, :member, :admin) if user&.role == 'admin'
22
+
23
+ visible.where(target: :global)
24
+ end
25
+
26
+ private
27
+
28
+ def clean_dates
29
+ self.start_at = nil if start_at == ''
30
+ self.end_at = nil if end_at == ''
31
+ end
32
+ end
33
+ end
@@ -21,5 +21,19 @@ module Elabs
21
21
  has_many :tags, through: :articles_tags, dependent: :destroy
22
22
  has_many :projects, through: :projects_articles, dependent: :destroy
23
23
  has_many :comments, as: 'content'
24
+ has_many :visible_projects, -> { where(published: true, locked: false) },
25
+ through: :projects_articles, source: :project
26
+
27
+ def title_to_display
28
+ title
29
+ end
30
+
31
+ def short_text_to_display
32
+ excerpt
33
+ end
34
+
35
+ def long_text_to_display
36
+ content
37
+ end
24
38
  end
25
39
  end
@@ -6,21 +6,27 @@ module Elabs
6
6
  validates :user, presence: true, unless: :name
7
7
  validates :name, presence: true, unless: :user
8
8
 
9
- belongs_to :content, polymorphic: true
10
- belongs_to :user, optional: true
9
+ belongs_to :content, polymorphic: true
10
+ belongs_to :user, optional: true
11
+ has_many :notifications, as: :content, dependent: :destroy
11
12
 
12
- after_save :notify_author, if: :notify_author?
13
+ after_create :notify_author, if: :notify_author?
13
14
 
14
15
  def notify_author?
15
16
  user_id ? content.user_id != user_id : true
16
17
  end
17
18
 
18
19
  def notify_author
19
- notification = { content: content,
20
+ notification = { content: self,
20
21
  event: :comment,
21
22
  user_id: content.user_id }
22
23
  notification[:source_user] = user if user_id
23
24
  Elabs::Notification.create! notification
24
25
  end
26
+
27
+ def archive!
28
+ update(archived: true)
29
+ notifications.destroy_all
30
+ end
25
31
  end
26
32
  end