publify_core 9.1.0 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of publify_core might be problematic. Click here for more details.

Files changed (357) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -1
  3. data/app/assets/javascripts/bootstrap-sprockets.js +8 -0
  4. data/app/assets/javascripts/bootstrap/affix.js +164 -0
  5. data/app/assets/javascripts/bootstrap/alert.js +95 -0
  6. data/app/assets/javascripts/bootstrap/button.js +125 -0
  7. data/app/assets/javascripts/bootstrap/collapse.js +212 -0
  8. data/app/assets/javascripts/bootstrap/dropdown.js +165 -0
  9. data/app/assets/javascripts/bootstrap/modal.js +358 -0
  10. data/app/assets/javascripts/bootstrap/tab.js +155 -0
  11. data/app/assets/javascripts/bootstrap/transition.js +59 -0
  12. data/app/assets/javascripts/lightbox.js +4 -4
  13. data/app/assets/javascripts/publify_admin.js +1 -35
  14. data/app/assets/stylesheets/_bootstrap-compass.scss +9 -0
  15. data/app/assets/stylesheets/_bootstrap-mincer.scss +19 -0
  16. data/app/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
  17. data/app/assets/stylesheets/_bootstrap.scss +42 -0
  18. data/app/assets/stylesheets/administration_structure.css.scss +1 -45
  19. data/app/assets/stylesheets/bootstrap/_alerts.scss +73 -0
  20. data/app/assets/stylesheets/bootstrap/_button-groups.scss +242 -0
  21. data/app/assets/stylesheets/bootstrap/_buttons.scss +168 -0
  22. data/app/assets/stylesheets/bootstrap/_close.scss +37 -0
  23. data/app/assets/stylesheets/bootstrap/_code.scss +69 -0
  24. data/app/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
  25. data/app/assets/stylesheets/bootstrap/_dropdowns.scss +213 -0
  26. data/app/assets/stylesheets/bootstrap/_forms.scss +586 -0
  27. data/app/assets/stylesheets/bootstrap/_grid.scss +94 -0
  28. data/app/assets/stylesheets/bootstrap/_labels.scss +66 -0
  29. data/app/assets/stylesheets/bootstrap/_media.scss +66 -0
  30. data/app/assets/stylesheets/bootstrap/_mixins.scss +37 -0
  31. data/app/assets/stylesheets/bootstrap/_modals.scss +150 -0
  32. data/app/assets/stylesheets/bootstrap/_navbar.scss +479 -0
  33. data/app/assets/stylesheets/bootstrap/_navs.scss +242 -0
  34. data/app/assets/stylesheets/bootstrap/_normalize.scss +427 -0
  35. data/app/assets/stylesheets/bootstrap/_pagination.scss +86 -0
  36. data/app/assets/stylesheets/bootstrap/_panels.scss +222 -0
  37. data/app/assets/stylesheets/bootstrap/_print.scss +99 -0
  38. data/app/assets/stylesheets/bootstrap/_scaffolding.scss +160 -0
  39. data/app/assets/stylesheets/bootstrap/_tables.scss +234 -0
  40. data/app/assets/stylesheets/bootstrap/_theme.scss +224 -0
  41. data/app/assets/stylesheets/bootstrap/_type.scss +296 -0
  42. data/app/assets/stylesheets/bootstrap/_utilities.scss +55 -0
  43. data/app/assets/stylesheets/bootstrap/_variables.scss +638 -0
  44. data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
  45. data/app/assets/stylesheets/bootstrap/mixins/_alerts.scss +15 -0
  46. data/app/assets/stylesheets/bootstrap/mixins/_background-variant.scss +12 -0
  47. data/app/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
  48. data/app/assets/stylesheets/bootstrap/mixins/_buttons.scss +56 -0
  49. data/app/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
  50. data/app/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
  51. data/app/assets/stylesheets/bootstrap/mixins/_forms.scss +82 -0
  52. data/app/assets/stylesheets/bootstrap/mixins/_gradients.scss +56 -0
  53. data/app/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
  54. data/app/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
  55. data/app/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
  56. data/app/assets/stylesheets/bootstrap/mixins/_image.scss +28 -0
  57. data/app/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
  58. data/app/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
  59. data/app/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  60. data/app/assets/stylesheets/bootstrap/mixins/_opacity.scss +7 -0
  61. data/app/assets/stylesheets/bootstrap/mixins/_pagination.scss +24 -0
  62. data/app/assets/stylesheets/bootstrap/mixins/_panels.scss +20 -0
  63. data/app/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
  64. data/app/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  65. data/app/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +17 -0
  66. data/app/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
  67. data/app/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
  68. data/app/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
  69. data/app/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +12 -0
  70. data/app/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
  71. data/app/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
  72. data/app/assets/stylesheets/lightbox.css +3 -3
  73. data/app/assets/stylesheets/publify_admin.css.scss +0 -1
  74. data/app/controllers/accounts_controller.rb +2 -0
  75. data/app/controllers/admin/base_controller.rb +8 -5
  76. data/app/controllers/admin/content_controller.rb +37 -24
  77. data/app/controllers/admin/dashboard_controller.rb +16 -64
  78. data/app/controllers/admin/feedback_controller.rb +45 -38
  79. data/app/controllers/admin/notes_controller.rb +15 -9
  80. data/app/controllers/admin/pages_controller.rb +18 -15
  81. data/app/controllers/admin/post_types_controller.rb +7 -5
  82. data/app/controllers/admin/profiles_controller.rb +4 -2
  83. data/app/controllers/admin/redirects_controller.rb +9 -5
  84. data/app/controllers/admin/resources_controller.rb +7 -4
  85. data/app/controllers/admin/seo_controller.rb +14 -10
  86. data/app/controllers/admin/settings_controller.rb +7 -5
  87. data/app/controllers/admin/sidebar_controller.rb +7 -4
  88. data/app/controllers/admin/tags_controller.rb +6 -3
  89. data/app/controllers/admin/themes_controller.rb +10 -7
  90. data/app/controllers/admin/users_controller.rb +9 -6
  91. data/app/controllers/articles_controller.rb +49 -33
  92. data/app/controllers/authors_controller.rb +6 -3
  93. data/app/controllers/base_controller.rb +9 -5
  94. data/app/controllers/comments_controller.rb +12 -8
  95. data/app/controllers/content_controller.rb +4 -2
  96. data/app/controllers/feedback_controller.rb +4 -2
  97. data/app/controllers/notes_controller.rb +5 -3
  98. data/app/controllers/setup_controller.rb +14 -10
  99. data/app/controllers/tags_controller.rb +6 -4
  100. data/app/controllers/text_controller.rb +2 -4
  101. data/app/controllers/textfilter_controller.rb +2 -0
  102. data/app/controllers/theme_controller.rb +14 -12
  103. data/app/controllers/xml_controller.rb +2 -0
  104. data/app/helpers/admin/base_helper.rb +28 -28
  105. data/app/helpers/admin/feedback_helper.rb +34 -24
  106. data/app/helpers/articles_helper.rb +4 -2
  107. data/app/helpers/authors_helper.rb +6 -3
  108. data/app/helpers/base_helper.rb +50 -34
  109. data/app/helpers/blog_helper.rb +4 -2
  110. data/app/helpers/xml_helper.rb +2 -0
  111. data/app/jobs/application_job.rb +2 -0
  112. data/app/mailers/notification_mailer.rb +5 -3
  113. data/app/models/ability.rb +25 -23
  114. data/app/models/archives_sidebar.rb +14 -11
  115. data/app/models/article.rb +44 -32
  116. data/app/models/article/factory.rb +14 -6
  117. data/app/models/blog.rb +85 -65
  118. data/app/models/comment.rb +10 -7
  119. data/app/models/config_manager.rb +4 -2
  120. data/app/models/content.rb +34 -40
  121. data/app/models/content_base.rb +9 -3
  122. data/app/models/feedback.rb +19 -16
  123. data/app/models/meta_sidebar.rb +5 -2
  124. data/app/models/note.rb +25 -23
  125. data/app/models/page.rb +8 -6
  126. data/app/models/page_sidebar.rb +4 -2
  127. data/app/models/ping.rb +2 -0
  128. data/app/models/post_type.rb +3 -1
  129. data/app/models/redirect.rb +11 -6
  130. data/app/models/redirection.rb +2 -0
  131. data/app/models/resource.rb +4 -2
  132. data/app/models/search_sidebar.rb +4 -2
  133. data/app/models/sidebar.rb +10 -5
  134. data/app/models/static_sidebar.rb +15 -12
  135. data/app/models/tag.rb +14 -10
  136. data/app/models/tag_sidebar.rb +6 -3
  137. data/app/models/text_filter.rb +85 -11
  138. data/app/models/trackback.rb +7 -11
  139. data/app/models/trigger.rb +6 -3
  140. data/app/models/user.rb +43 -42
  141. data/app/services/title_builder.rb +56 -45
  142. data/app/uploaders/resource_uploader.rb +7 -3
  143. data/app/views/accounts/confirm.html.erb +3 -3
  144. data/app/views/admin/content/_article_list.html.erb +23 -8
  145. data/app/views/admin/content/_form.html.erb +71 -47
  146. data/app/views/admin/content/edit.html.erb +1 -1
  147. data/app/views/admin/content/index.html.erb +25 -15
  148. data/app/views/admin/content/new.html.erb +2 -2
  149. data/app/views/admin/dashboard/_comment.html.erb +5 -5
  150. data/app/views/admin/dashboard/_comments.html.erb +2 -2
  151. data/app/views/admin/dashboard/_drafts.html.erb +5 -5
  152. data/app/views/admin/dashboard/_overview.html.erb +7 -9
  153. data/app/views/admin/dashboard/_welcome.html.erb +11 -11
  154. data/app/views/admin/dashboard/index.html.erb +12 -7
  155. data/app/views/admin/feedback/_button.html.erb +6 -6
  156. data/app/views/admin/feedback/_feedback.html.erb +3 -3
  157. data/app/views/admin/feedback/_ham.html.erb +27 -9
  158. data/app/views/admin/feedback/_spam.html.erb +26 -16
  159. data/app/views/admin/feedback/article.html.erb +20 -21
  160. data/app/views/admin/feedback/edit.html.erb +14 -15
  161. data/app/views/admin/feedback/{ham.js → ham.js.erb} +0 -0
  162. data/app/views/admin/feedback/index.html.erb +25 -23
  163. data/app/views/admin/feedback/{spam.js → spam.js.erb} +0 -0
  164. data/app/views/admin/migrations/show.html.erb +10 -11
  165. data/app/views/admin/notes/_form.html.erb +13 -13
  166. data/app/views/admin/notes/_list.html.erb +19 -8
  167. data/app/views/admin/notes/_note.html.erb +12 -7
  168. data/app/views/admin/notes/edit.html.erb +6 -1
  169. data/app/views/admin/notes/index.html.erb +5 -1
  170. data/app/views/admin/notes/show.html.erb +2 -2
  171. data/app/views/admin/pages/_form.html.erb +86 -77
  172. data/app/views/admin/pages/_pages.html.erb +11 -4
  173. data/app/views/admin/pages/edit.html.erb +3 -1
  174. data/app/views/admin/pages/index.html.erb +10 -6
  175. data/app/views/admin/pages/new.html.erb +3 -1
  176. data/app/views/admin/post_types/_index_and_form.html.erb +15 -16
  177. data/app/views/admin/post_types/edit.html.erb +1 -1
  178. data/app/views/admin/post_types/index.html.erb +1 -1
  179. data/app/views/admin/profiles/index.html.erb +2 -3
  180. data/app/views/admin/redirects/_index_and_form.html.erb +10 -11
  181. data/app/views/admin/redirects/edit.html.erb +1 -1
  182. data/app/views/admin/redirects/index.html.erb +1 -1
  183. data/app/views/admin/resources/index.html.erb +19 -16
  184. data/app/views/admin/seo/_general.html.erb +23 -47
  185. data/app/views/admin/seo/_permalinks.html.erb +14 -14
  186. data/app/views/admin/seo/_titles.html.erb +63 -64
  187. data/app/views/admin/seo/show.html.erb +14 -19
  188. data/app/views/admin/settings/display.html.erb +22 -25
  189. data/app/views/admin/settings/feedback.html.erb +31 -32
  190. data/app/views/admin/settings/index.html.erb +23 -24
  191. data/app/views/admin/settings/write.html.erb +21 -22
  192. data/app/views/admin/shared/_edit.html.erb +3 -3
  193. data/app/views/admin/shared/_menu.html.erb +26 -26
  194. data/app/views/admin/shared/_twitter_alert.html.erb +1 -1
  195. data/app/views/admin/sidebar/_config.html.erb +5 -5
  196. data/app/views/admin/sidebar/_target_sidebar.html.erb +4 -4
  197. data/app/views/admin/sidebar/index.html.erb +7 -7
  198. data/app/views/admin/tags/_index_and_form.html.erb +11 -12
  199. data/app/views/admin/tags/edit.html.erb +1 -1
  200. data/app/views/admin/tags/index.html.erb +1 -1
  201. data/app/views/admin/themes/index.html.erb +5 -6
  202. data/app/views/admin/users/_form.html.erb +34 -34
  203. data/app/views/admin/users/edit.html.erb +2 -2
  204. data/app/views/admin/users/index.html.erb +10 -12
  205. data/app/views/admin/users/new.html.erb +2 -2
  206. data/app/views/archives_sidebar/_content.html.erb +2 -2
  207. data/app/views/articles/_archives_article.html.erb +3 -3
  208. data/app/views/articles/_article.html.erb +7 -9
  209. data/app/views/articles/_article_author.html.erb +4 -0
  210. data/app/views/articles/_article_content.html.erb +2 -2
  211. data/app/views/articles/_article_excerpt.html.erb +2 -2
  212. data/app/views/articles/_article_links.html.erb +1 -1
  213. data/app/views/articles/_comment_errors.html.erb +1 -1
  214. data/app/views/articles/_comment_form.html.erb +12 -12
  215. data/app/views/articles/_comment_preview.html.erb +3 -3
  216. data/app/views/articles/_password_form.html.erb +4 -4
  217. data/app/views/articles/_trackback.html.erb +2 -2
  218. data/app/views/articles/archives.html.erb +1 -1
  219. data/app/views/articles/feedback_atom_feed.atom.builder +3 -1
  220. data/app/views/articles/feedback_rss_feed.rss.builder +9 -7
  221. data/app/views/articles/index_atom_feed.atom.builder +5 -3
  222. data/app/views/articles/index_rss_feed.rss.builder +10 -8
  223. data/app/views/articles/live_search.html.erb +3 -3
  224. data/app/views/articles/read.html.erb +16 -8
  225. data/app/views/articles/search.html.erb +2 -2
  226. data/app/views/articles/trackback.xml.builder +3 -1
  227. data/app/views/articles/view_page.html.erb +1 -1
  228. data/app/views/authors/show.html.erb +9 -9
  229. data/app/views/authors/show_atom_feed.atom.builder +4 -2
  230. data/app/views/authors/show_rss_feed.rss.builder +10 -8
  231. data/app/views/comments/_comment.html.erb +3 -3
  232. data/app/views/devise/mailer/reset_password_instructions.html.erb +7 -9
  233. data/app/views/devise/passwords/edit.html.erb +4 -4
  234. data/app/views/devise/passwords/new.html.erb +1 -1
  235. data/app/views/devise/registrations/new.html.erb +5 -5
  236. data/app/views/devise/sessions/new.html.erb +3 -3
  237. data/app/views/errors/404.html.erb +2 -2
  238. data/app/views/feedback/index.atom.builder +3 -1
  239. data/app/views/feedback/index.rss.builder +9 -7
  240. data/app/views/layouts/accounts.html.erb +26 -26
  241. data/app/views/layouts/administration.html.erb +31 -31
  242. data/app/views/layouts/default.html.erb +3 -3
  243. data/app/views/layouts/editor.html.erb +5 -19
  244. data/app/views/meta_sidebar/_content.html.erb +2 -2
  245. data/app/views/notes/_note.html.erb +1 -1
  246. data/app/views/notes/index.html.erb +1 -1
  247. data/app/views/notes/show_in_reply.html.erb +1 -1
  248. data/app/views/notification_mailer/_mail_footer.html.erb +3 -3
  249. data/app/views/notification_mailer/article.html.erb +2 -2
  250. data/app/views/notification_mailer/comment.html.erb +5 -5
  251. data/app/views/notification_mailer/notif_user.html.erb +1 -1
  252. data/app/views/page_sidebar/_content.html.erb +1 -1
  253. data/app/views/search_sidebar/_content.html.erb +2 -2
  254. data/app/views/settings/install.html.erb +2 -2
  255. data/app/views/setup/index.html.erb +7 -7
  256. data/app/views/shared/_atom_header.atom.builder +4 -2
  257. data/app/views/shared/_atom_item_article.atom.builder +11 -6
  258. data/app/views/shared/_atom_item_comment.atom.builder +4 -2
  259. data/app/views/shared/_atom_item_trackback.atom.builder +4 -2
  260. data/app/views/shared/_page_header.html.erb +9 -12
  261. data/app/views/shared/_rss_item_article.rss.builder +6 -3
  262. data/app/views/shared/_rss_item_comment.rss.builder +3 -1
  263. data/app/views/shared/_rss_item_trackback.rss.builder +3 -1
  264. data/app/views/sidebar/display_plugins.html.erb +1 -1
  265. data/app/views/tag_sidebar/_content.html.erb +1 -1
  266. data/app/views/tags/index.html.erb +1 -1
  267. data/app/views/xml/_googlesitemap_item_article.googlesitemap.builder +2 -0
  268. data/app/views/xml/_googlesitemap_item_category.googlesitemap.builder +2 -0
  269. data/app/views/xml/_googlesitemap_item_page.googlesitemap.builder +2 -0
  270. data/app/views/xml/_googlesitemap_item_tag.googlesitemap.builder +2 -0
  271. data/app/views/xml/sitemap.googlesitemap.builder +4 -2
  272. data/config/i18n-tasks.yml +0 -5
  273. data/config/initializers/devise.rb +10 -4
  274. data/config/initializers/mime_types.rb +3 -1
  275. data/config/locales/da.yml +134 -71
  276. data/config/locales/de.yml +142 -75
  277. data/config/locales/en.yml +128 -66
  278. data/config/locales/es-MX.yml +135 -69
  279. data/config/locales/fr.yml +167 -86
  280. data/config/locales/he.yml +128 -70
  281. data/config/locales/it.yml +136 -72
  282. data/config/locales/ja.yml +110 -64
  283. data/config/locales/lt.yml +153 -74
  284. data/config/locales/nb-NO.yml +123 -65
  285. data/config/locales/nl.yml +140 -75
  286. data/config/locales/pl.yml +160 -69
  287. data/config/locales/pt-BR.yml +137 -70
  288. data/config/locales/ro.yml +148 -70
  289. data/config/locales/ru.yml +161 -69
  290. data/config/locales/zh-CN.yml +106 -59
  291. data/config/locales/zh-TW.yml +109 -61
  292. data/config/routes.rb +68 -63
  293. data/db/migrate/113_initial_schema.rb +192 -190
  294. data/db/migrate/114_fixes_buggy_articles_and_notes.rb +9 -6
  295. data/db/migrate/115_drops_categories_for_tags.rb +3 -1
  296. data/db/migrate/20150207131657_add_missing_indexes.rb +2 -0
  297. data/db/migrate/20150807134129_simplify_redirect_relations.rb +8 -1
  298. data/db/migrate/20150808052637_add_blog_ids.rb +4 -2
  299. data/db/migrate/20150808191127_add_blog_id_to_redirects.rb +2 -0
  300. data/db/migrate/20150810094754_add_blog_id_to_tags.rb +2 -0
  301. data/db/migrate/20160108111120_add_devise_to_users.rb +4 -2
  302. data/db/migrate/20160108184201_move_last_connection_to_last_sign_in_at.rb +2 -0
  303. data/db/migrate/20160110094906_remove_profiles_rights.rb +2 -0
  304. data/db/migrate/20160605103918_replace_profile_id_with_string.rb +2 -0
  305. data/db/migrate/20160605154632_remove_profiles.rb +10 -5
  306. data/db/migrate/20160701061851_demand_blog_id_on_contents.rb +2 -0
  307. data/db/migrate/20160701062604_add_blog_id_to_resources.rb +2 -0
  308. data/db/migrate/20170528093024_move_resources_to_content.rb +2 -0
  309. data/db/migrate/20170528094923_move_tags_to_content.rb +2 -0
  310. data/db/migrate/20170528201606_remove_separate_published_flag.rb +2 -0
  311. data/db/migrate/20170605071626_remove_extra_state_columns_from_feedback.rb +2 -0
  312. data/db/migrate/20170702105201_remove_published_at_from_feedback.rb +2 -0
  313. data/db/migrate/20190208151235_add_text_filter_name_fields.rb +9 -0
  314. data/db/migrate/20190208152646_move_text_filter_to_name.rb +97 -0
  315. data/db/migrate/20190209155717_remove_text_filter_ids.rb +19 -0
  316. data/db/migrate/20190209160610_remove_text_filters.rb +17 -0
  317. data/db/migrate/20200413140440_add_unique_indexes.rb +10 -0
  318. data/db/seeds.rb +9 -19
  319. data/lib/email_notify.rb +3 -1
  320. data/lib/format.rb +4 -2
  321. data/lib/publify_core.rb +36 -35
  322. data/lib/publify_core/engine.rb +8 -6
  323. data/lib/publify_core/lang.rb +5 -1
  324. data/lib/publify_core/testing_support/dns_mock.rb +15 -0
  325. data/lib/publify_core/testing_support/factories.rb +240 -0
  326. data/lib/publify_core/testing_support/feed_assertions.rb +48 -0
  327. data/lib/publify_core/testing_support/fixtures/exploit.svg +4 -0
  328. data/lib/publify_core/testing_support/fixtures/fakepng.png +1 -0
  329. data/lib/publify_core/testing_support/fixtures/otherfile.txt +1 -0
  330. data/lib/publify_core/testing_support/fixtures/testfile.png +0 -0
  331. data/lib/publify_core/testing_support/fixtures/testfile.txt +1 -0
  332. data/lib/publify_core/testing_support/upload_fixtures.rb +15 -0
  333. data/lib/publify_core/version.rb +3 -1
  334. data/lib/publify_guid.rb +3 -1
  335. data/lib/publify_plugins.rb +10 -5
  336. data/lib/publify_textfilter_markdown.rb +38 -25
  337. data/lib/publify_textfilter_none.rb +5 -3
  338. data/lib/publify_textfilter_smartypants.rb +5 -3
  339. data/lib/publify_textfilter_textile.rb +7 -4
  340. data/lib/publify_textfilter_twitterfilter.rb +13 -7
  341. data/lib/publify_time.rb +4 -0
  342. data/lib/sidebar_field.rb +15 -13
  343. data/lib/sidebar_registry.rb +5 -3
  344. data/lib/spam_protection.rb +16 -13
  345. data/lib/tasks/i18n.rake +9 -0
  346. data/lib/tasks/manifest.rake +30 -0
  347. data/lib/tasks/publify_core_tasks.rake +2 -0
  348. data/lib/text_filter_plugin.rb +27 -25
  349. data/lib/theme.rb +5 -3
  350. data/lib/transforms.rb +22 -19
  351. metadata +217 -87
  352. data/app/assets/javascripts/widearea.js +0 -486
  353. data/app/assets/stylesheets/widearea.css +0 -133
  354. data/app/controllers/admin/textfilters_controller.rb +0 -6
  355. data/app/views/admin/dashboard/_inbound.html.erb +0 -31
  356. data/app/views/admin/notes/_header.html.erb +0 -6
  357. data/app/views/articles/_protected_article_content.html.erb +0 -6
@@ -1,10 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class FixesBuggyArticlesAndNotes < ActiveRecord::Migration[4.2]
2
4
  class Content < ActiveRecord::Base
3
5
  end
4
6
 
5
7
  class Article < Content
6
8
  def set_permalink
7
- return if state == 'draft' || permalink.present?
9
+ return if state == "draft" || permalink.present?
10
+
8
11
  self.permalink = title.to_permalink
9
12
  end
10
13
  end
@@ -29,16 +32,16 @@ class FixesBuggyArticlesAndNotes < ActiveRecord::Migration[4.2]
29
32
  end
30
33
 
31
34
  def self.up
32
- say 'Fixing contents permalinks, this may take some time'
35
+ say "Fixing contents permalinks, this may take some time"
33
36
 
34
- contents = Content.where('permalink is ? or permalink = ?', nil, '')
37
+ contents = Content.where("permalink is ? or permalink = ?", nil, "")
35
38
  contents.each do |c|
36
39
  c.set_permalink
37
40
  c.save
38
41
  end
39
42
 
40
- say 'Fixes empty notes GUID'
41
- notes = Note.where('guid is ? or guid = ?', nil, '')
43
+ say "Fixes empty notes GUID"
44
+ notes = Note.where("guid is ? or guid = ?", nil, "")
42
45
  notes.each do |n|
43
46
  n.create_guid
44
47
  n.save
@@ -46,6 +49,6 @@ class FixesBuggyArticlesAndNotes < ActiveRecord::Migration[4.2]
46
49
  end
47
50
 
48
51
  def self.down
49
- say 'Nothing to do here'
52
+ say "Nothing to do here"
50
53
  end
51
54
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class DropsCategoriesForTags < ActiveRecord::Migration[4.2]
2
4
  class Categorization < ActiveRecord::Base
3
5
  belongs_to :article
@@ -18,7 +20,7 @@ class DropsCategoriesForTags < ActiveRecord::Migration[4.2]
18
20
  end
19
21
 
20
22
  Redirect.create(from_path: "category/#{cat.permalink}",
21
- to_path: File.join(Blog.first.base_url, 'tag', tag.name))
23
+ to_path: File.join(Blog.first.base_url, "tag", tag.name))
22
24
  cat.articles.each do |article|
23
25
  article.tags << tag
24
26
  article.save
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddMissingIndexes < ActiveRecord::Migration[4.2]
2
4
  def change
3
5
  add_index :feedback, [:id, :type]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class SimplifyRedirectRelations < ActiveRecord::Migration[4.2]
2
4
  class Redirect < ActiveRecord::Base; end
3
5
  class Redirection < ActiveRecord::Base; end
@@ -6,9 +8,13 @@ class SimplifyRedirectRelations < ActiveRecord::Migration[4.2]
6
8
  add_column :redirects, :content_id, :integer
7
9
  Redirect.find_each do |redirect|
8
10
  redirections = Redirection.where(redirect_id: redirect.id)
9
- raise "Expected zero or one redirections, found #{redirections.count}" if redirections.count > 1
11
+ if redirections.count > 1
12
+ raise "Expected zero or one redirections, found #{redirections.count}"
13
+ end
14
+
10
15
  redirection = redirections.first
11
16
  next unless redirection
17
+
12
18
  redirect.content_id = redirection.content_id
13
19
  redirect.save!
14
20
  end
@@ -29,6 +35,7 @@ class SimplifyRedirectRelations < ActiveRecord::Migration[4.2]
29
35
 
30
36
  Redirect.find_each do |redirect|
31
37
  next unless redirect.content_id
38
+
32
39
  Redirection.create(redirect_id: redirect.id, content_id: redirect.content_id)
33
40
  end
34
41
  remove_column :redirects, :content_id
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddBlogIds < ActiveRecord::Migration[4.2]
2
4
  class Blog < ActiveRecord::Base; end
3
5
  class Content < ActiveRecord::Base; end
@@ -18,9 +20,9 @@ class AddBlogIds < ActiveRecord::Migration[4.2]
18
20
  end
19
21
 
20
22
  def down
21
- if adapter_name == 'PostgreSQL'
23
+ if adapter_name == "PostgreSQL"
22
24
  indexes(:contents).each do |index|
23
- remove_index(:contents, name: index.name) if index.name =~ /blog_id/
25
+ remove_index(:contents, name: index.name) if /blog_id/.match?(index.name)
24
26
  end
25
27
  else
26
28
  begin
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddBlogIdToRedirects < ActiveRecord::Migration[4.2]
2
4
  class Redirect < ActiveRecord::Base; end
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddBlogIdToTags < ActiveRecord::Migration[4.2]
2
4
  class Tag < ActiveRecord::Base; end
3
5
 
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddDeviseToUsers < ActiveRecord::Migration[4.2]
2
4
  def self.up
3
5
  ## Database authenticatable
4
- change_column :users, :email, :string, null: false, default: ''
6
+ change_column :users, :email, :string, null: false, default: ""
5
7
  rename_column :users, :password, :encrypted_password
6
- change_column :users, :encrypted_password, :string, null: false, default: ''
8
+ change_column :users, :encrypted_password, :string, null: false, default: ""
7
9
 
8
10
  change_table(:users) do |t|
9
11
  ## Recoverable
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class MoveLastConnectionToLastSignInAt < ActiveRecord::Migration[4.2]
2
4
  class User < ActiveRecord::Base
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RemoveProfilesRights < ActiveRecord::Migration[4.2]
2
4
  def up
3
5
  drop_table :profiles_rights
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ReplaceProfileIdWithString < ActiveRecord::Migration[4.2]
2
4
  class Profile < ActiveRecord::Base
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RemoveProfiles < ActiveRecord::Migration[4.2]
2
4
  class Profile < ActiveRecord::Base
3
5
  serialize :modules
@@ -14,11 +16,14 @@ class RemoveProfiles < ActiveRecord::Migration[4.2]
14
16
  t.text :modules
15
17
  end
16
18
 
17
- Profile.create!(label: 'admin', nicename: 'Publify administrator',
18
- modules: [:dashboard, :articles, :notes, :pages, :feedback, :media, :themes, :sidebar, :profile, :users, :settings, :seo])
19
- Profile.create!(label: 'publisher', nicename: 'Blog publisher',
20
- modules: [:dashboard, :articles, :notes, :pages, :feedback, :media, :profile])
21
- Profile.create!(label: 'contributor', nicename: 'Contributor',
19
+ Profile.create!(label: "admin", nicename: "Publify administrator",
20
+ modules: [:dashboard, :articles, :notes, :pages, :feedback,
21
+ :media, :themes, :sidebar, :profile, :users,
22
+ :settings, :seo])
23
+ Profile.create!(label: "publisher", nicename: "Blog publisher",
24
+ modules: [:dashboard, :articles, :notes, :pages, :feedback,
25
+ :media, :profile])
26
+ Profile.create!(label: "contributor", nicename: "Contributor",
22
27
  modules: [:dashboard, :profile])
23
28
  end
24
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class DemandBlogIdOnContents < ActiveRecord::Migration[4.2]
2
4
  def up
3
5
  change_column :contents, :blog_id, :integer, null: false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class AddBlogIdToResources < ActiveRecord::Migration[4.2]
2
4
  class Blog < ActiveRecord::Base; end
3
5
  class Content < ActiveRecord::Base; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class MoveResourcesToContent < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  rename_column :resources, :article_id, :content_id
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class MoveTagsToContent < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  rename_column :articles_tags, :article_id, :content_id
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RemoveSeparatePublishedFlag < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  remove_column :contents, :published, :boolean, default: false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RemoveExtraStateColumnsFromFeedback < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  remove_column :feedback, :published, :boolean, default: false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class RemovePublishedAtFromFeedback < ActiveRecord::Migration[5.0]
2
4
  def change
3
5
  remove_column :feedback, :published_at, :datetime
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddTextFilterNameFields < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :contents, :text_filter_name, :string
6
+ add_column :feedback, :text_filter_name, :string
7
+ add_column :users, :text_filter_name, :string
8
+ end
9
+ end
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ class MoveTextFilterToName < ActiveRecord::Migration[5.2]
4
+ class Content < ActiveRecord::Base
5
+ self.inheritance_column = :bogus
6
+
7
+ belongs_to :text_filter, optional: true
8
+ end
9
+
10
+ class Feedback < ActiveRecord::Base
11
+ self.table_name = "feedback"
12
+ self.inheritance_column = :bogus
13
+
14
+ belongs_to :text_filter, optional: true
15
+ end
16
+
17
+ class User < ActiveRecord::Base
18
+ belongs_to :text_filter, optional: true
19
+ end
20
+
21
+ class TextFilter < ActiveRecord::Base
22
+ serialize :filters, Array
23
+ serialize :params, Hash
24
+ end
25
+
26
+ def up
27
+ Content.find_each do |content|
28
+ filter = content.text_filter
29
+ filter_name = filter&.name || "none"
30
+ content.update!(text_filter_name: filter_name, text_filter_id: nil)
31
+ end
32
+
33
+ Feedback.find_each do |feedback|
34
+ filter = feedback.text_filter
35
+ filter_name = filter&.name || "none"
36
+ feedback.update!(text_filter_name: filter_name, text_filter_id: nil)
37
+ end
38
+
39
+ User.find_each do |user|
40
+ filter = user.text_filter
41
+ filter_name = filter&.name || "none"
42
+ user.update!(text_filter_name: filter_name, text_filter_id: nil)
43
+ end
44
+
45
+ TextFilter.destroy_all
46
+ end
47
+
48
+ def down
49
+ TextFilter.
50
+ create_with(description: "None", markup: "none", filters: [], params: {}).
51
+ find_or_create_by!(name: "none")
52
+ TextFilter.
53
+ create_with(description: "Markdown", markup: "markdown", filters: [], params: {}).
54
+ find_or_create_by!(name: "markdown")
55
+ TextFilter.
56
+ create_with(description: "SmartyPants", markup: "none", filters: [:smartypants],
57
+ params: {}).
58
+ find_or_create_by!(name: "smartypants")
59
+ TextFilter.
60
+ create_with(description: "Markdown with SmartyPants", markup: "markdown",
61
+ filters: [:smartypants], params: {}).
62
+ find_or_create_by!(name: "markdown smartypants")
63
+ TextFilter.
64
+ create_with(description: "Textile", markup: "textile", filters: [], params: {}).
65
+ find_or_create_by!(name: "textile")
66
+
67
+ Content.find_each do |content|
68
+ filter_name = content.text_filter_name
69
+ next unless filter_name
70
+
71
+ filter = TextFilter.find(name: filter_name)
72
+ raise "Filter #{filter_name} not found" unless filter
73
+
74
+ content.update!(text_filter: filter)
75
+ end
76
+
77
+ Feedback.find_each do |feedback|
78
+ filter_name = feedback.text_filter_name
79
+ next unless filter_name
80
+
81
+ filter = TextFilter.find(name: filter_name)
82
+ raise "Filter #{filter_name} not found" unless filter
83
+
84
+ feedback.update!(text_filter: filter)
85
+ end
86
+
87
+ User.find_each do |user|
88
+ filter_name = user.text_filter_name
89
+ next unless filter_name
90
+
91
+ filter = TextFilter.find(name: filter_name)
92
+ raise "Filter #{filter_name} not found" unless filter
93
+
94
+ user.update!(text_filter: filter)
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoveTextFilterIds < ActiveRecord::Migration[5.2]
4
+ def up
5
+ remove_column :contents, :text_filter_id
6
+ remove_column :feedback, :text_filter_id
7
+ remove_column :users, :text_filter_id
8
+ end
9
+
10
+ def down
11
+ add_column :contents, :text_filter_id, :integer
12
+ add_column :feedback, :text_filter_id, :integer
13
+ add_column :users, :text_filter_id, :string, default: "1"
14
+
15
+ add_index :contents, [:text_filter_id]
16
+ add_index :feedback, [:text_filter_id]
17
+ add_index :users, [:text_filter_id]
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoveTextFilters < ActiveRecord::Migration[5.2]
4
+ def up
5
+ drop_table :text_filters
6
+ end
7
+
8
+ def down
9
+ create_table :text_filters do |t|
10
+ t.string :name
11
+ t.string :description
12
+ t.string :markup
13
+ t.text :filters
14
+ t.text :params
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddUniqueIndexes < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_index :post_types, :name, unique: true
6
+ add_index :redirects, :from_path, unique: true
7
+ add_index :tags, [:blog_id, :name], unique: true
8
+ add_index :users, :login, unique: true
9
+ end
10
+ end
@@ -1,5 +1,9 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
1
+ # frozen_string_literal: true
2
+
3
+ # This file should contain all the record creation needed to seed the database
4
+ # with its default values.
5
+ # The data can then be loaded with the rake db:seed (or created alongside the
6
+ # db with db:setup).
3
7
  #
4
8
  # Examples:
5
9
  #
@@ -16,20 +20,6 @@ unless blog.sidebars.any?
16
20
  MetaSidebar.create!(active_position: 4, blog_id: blog.id)
17
21
  end
18
22
 
19
- TextFilter.
20
- create_with(description: 'None', markup: 'none', filters: [], params: {}).
21
- find_or_create_by!(name: 'none')
22
- TextFilter.
23
- create_with(description: 'Markdown', markup: 'markdown', filters: [], params: {}).
24
- find_or_create_by!(name: 'markdown')
25
- TextFilter.
26
- create_with(description: 'SmartyPants', markup: 'none', filters: [:smartypants], params: {}).
27
- find_or_create_by!(name: 'smartypants')
28
- TextFilter.
29
- create_with(description: 'Markdown with SmartyPants', markup: 'markdown', filters: [:smartypants], params: {}).
30
- find_or_create_by!(name: 'markdown smartypants')
31
- TextFilter.
32
- create_with(description: 'Textile', markup: 'textile', filters: [], params: {}).
33
- find_or_create_by!(name: 'textile')
34
-
35
- Dir.mkdir("#{::Rails.root}/public/files") unless File.directory?("#{::Rails.root}/public/files")
23
+ unless File.directory?("#{::Rails.root}/public/files")
24
+ Dir.mkdir("#{::Rails.root}/public/files")
25
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # TODO: Use deliver_later to avoid slowness and errors
2
4
  class EmailNotify
3
5
  def self.logger
4
- @@logger ||= ::Rails.logger || Logger.new(STDOUT)
6
+ @@logger ||= ::Rails.logger || Logger.new($stdout)
5
7
  end
6
8
 
7
9
  def self.send_comment(comment, user)
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Format
2
4
  # Laxly matches an IP Address , would also pass numbers > 255 though
3
- IP_ADDRESS = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/
5
+ IP_ADDRESS = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.freeze
4
6
 
5
7
  # Laxly matches an HTTP(S) URI
6
- HTTP_URI = %r{^https?:\/\/\S+$}
8
+ HTTP_URI = %r{^https?://\S+$}.freeze
7
9
  end