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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -1
- data/app/assets/javascripts/bootstrap-sprockets.js +8 -0
- data/app/assets/javascripts/bootstrap/affix.js +164 -0
- data/app/assets/javascripts/bootstrap/alert.js +95 -0
- data/app/assets/javascripts/bootstrap/button.js +125 -0
- data/app/assets/javascripts/bootstrap/collapse.js +212 -0
- data/app/assets/javascripts/bootstrap/dropdown.js +165 -0
- data/app/assets/javascripts/bootstrap/modal.js +358 -0
- data/app/assets/javascripts/bootstrap/tab.js +155 -0
- data/app/assets/javascripts/bootstrap/transition.js +59 -0
- data/app/assets/javascripts/lightbox.js +4 -4
- data/app/assets/javascripts/publify_admin.js +1 -35
- data/app/assets/stylesheets/_bootstrap-compass.scss +9 -0
- data/app/assets/stylesheets/_bootstrap-mincer.scss +19 -0
- data/app/assets/stylesheets/_bootstrap-sprockets.scss +9 -0
- data/app/assets/stylesheets/_bootstrap.scss +42 -0
- data/app/assets/stylesheets/administration_structure.css.scss +1 -45
- data/app/assets/stylesheets/bootstrap/_alerts.scss +73 -0
- data/app/assets/stylesheets/bootstrap/_button-groups.scss +242 -0
- data/app/assets/stylesheets/bootstrap/_buttons.scss +168 -0
- data/app/assets/stylesheets/bootstrap/_close.scss +37 -0
- data/app/assets/stylesheets/bootstrap/_code.scss +69 -0
- data/app/assets/stylesheets/bootstrap/_component-animations.scss +38 -0
- data/app/assets/stylesheets/bootstrap/_dropdowns.scss +213 -0
- data/app/assets/stylesheets/bootstrap/_forms.scss +586 -0
- data/app/assets/stylesheets/bootstrap/_grid.scss +94 -0
- data/app/assets/stylesheets/bootstrap/_labels.scss +66 -0
- data/app/assets/stylesheets/bootstrap/_media.scss +66 -0
- data/app/assets/stylesheets/bootstrap/_mixins.scss +37 -0
- data/app/assets/stylesheets/bootstrap/_modals.scss +150 -0
- data/app/assets/stylesheets/bootstrap/_navbar.scss +479 -0
- data/app/assets/stylesheets/bootstrap/_navs.scss +242 -0
- data/app/assets/stylesheets/bootstrap/_normalize.scss +427 -0
- data/app/assets/stylesheets/bootstrap/_pagination.scss +86 -0
- data/app/assets/stylesheets/bootstrap/_panels.scss +222 -0
- data/app/assets/stylesheets/bootstrap/_print.scss +99 -0
- data/app/assets/stylesheets/bootstrap/_scaffolding.scss +160 -0
- data/app/assets/stylesheets/bootstrap/_tables.scss +234 -0
- data/app/assets/stylesheets/bootstrap/_theme.scss +224 -0
- data/app/assets/stylesheets/bootstrap/_type.scss +296 -0
- data/app/assets/stylesheets/bootstrap/_utilities.scss +55 -0
- data/app/assets/stylesheets/bootstrap/_variables.scss +638 -0
- data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
- data/app/assets/stylesheets/bootstrap/mixins/_alerts.scss +15 -0
- data/app/assets/stylesheets/bootstrap/mixins/_background-variant.scss +12 -0
- data/app/assets/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
- data/app/assets/stylesheets/bootstrap/mixins/_buttons.scss +56 -0
- data/app/assets/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
- data/app/assets/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
- data/app/assets/stylesheets/bootstrap/mixins/_forms.scss +82 -0
- data/app/assets/stylesheets/bootstrap/mixins/_gradients.scss +56 -0
- data/app/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
- data/app/assets/stylesheets/bootstrap/mixins/_grid.scss +122 -0
- data/app/assets/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
- data/app/assets/stylesheets/bootstrap/mixins/_image.scss +28 -0
- data/app/assets/stylesheets/bootstrap/mixins/_labels.scss +12 -0
- data/app/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
- data/app/assets/stylesheets/bootstrap/mixins/_opacity.scss +7 -0
- data/app/assets/stylesheets/bootstrap/mixins/_pagination.scss +24 -0
- data/app/assets/stylesheets/bootstrap/mixins/_panels.scss +20 -0
- data/app/assets/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_resize.scss +6 -0
- data/app/assets/stylesheets/bootstrap/mixins/_responsive-visibility.scss +17 -0
- data/app/assets/stylesheets/bootstrap/mixins/_size.scss +10 -0
- data/app/assets/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
- data/app/assets/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
- data/app/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +12 -0
- data/app/assets/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
- data/app/assets/stylesheets/bootstrap/mixins/_vendor-prefixes.scss +222 -0
- data/app/assets/stylesheets/lightbox.css +3 -3
- data/app/assets/stylesheets/publify_admin.css.scss +0 -1
- data/app/controllers/accounts_controller.rb +2 -0
- data/app/controllers/admin/base_controller.rb +8 -5
- data/app/controllers/admin/content_controller.rb +37 -24
- data/app/controllers/admin/dashboard_controller.rb +16 -64
- data/app/controllers/admin/feedback_controller.rb +45 -38
- data/app/controllers/admin/notes_controller.rb +15 -9
- data/app/controllers/admin/pages_controller.rb +18 -15
- data/app/controllers/admin/post_types_controller.rb +7 -5
- data/app/controllers/admin/profiles_controller.rb +4 -2
- data/app/controllers/admin/redirects_controller.rb +9 -5
- data/app/controllers/admin/resources_controller.rb +7 -4
- data/app/controllers/admin/seo_controller.rb +14 -10
- data/app/controllers/admin/settings_controller.rb +7 -5
- data/app/controllers/admin/sidebar_controller.rb +7 -4
- data/app/controllers/admin/tags_controller.rb +6 -3
- data/app/controllers/admin/themes_controller.rb +10 -7
- data/app/controllers/admin/users_controller.rb +9 -6
- data/app/controllers/articles_controller.rb +49 -33
- data/app/controllers/authors_controller.rb +6 -3
- data/app/controllers/base_controller.rb +9 -5
- data/app/controllers/comments_controller.rb +12 -8
- data/app/controllers/content_controller.rb +4 -2
- data/app/controllers/feedback_controller.rb +4 -2
- data/app/controllers/notes_controller.rb +5 -3
- data/app/controllers/setup_controller.rb +14 -10
- data/app/controllers/tags_controller.rb +6 -4
- data/app/controllers/text_controller.rb +2 -4
- data/app/controllers/textfilter_controller.rb +2 -0
- data/app/controllers/theme_controller.rb +14 -12
- data/app/controllers/xml_controller.rb +2 -0
- data/app/helpers/admin/base_helper.rb +28 -28
- data/app/helpers/admin/feedback_helper.rb +34 -24
- data/app/helpers/articles_helper.rb +4 -2
- data/app/helpers/authors_helper.rb +6 -3
- data/app/helpers/base_helper.rb +50 -34
- data/app/helpers/blog_helper.rb +4 -2
- data/app/helpers/xml_helper.rb +2 -0
- data/app/jobs/application_job.rb +2 -0
- data/app/mailers/notification_mailer.rb +5 -3
- data/app/models/ability.rb +25 -23
- data/app/models/archives_sidebar.rb +14 -11
- data/app/models/article.rb +44 -32
- data/app/models/article/factory.rb +14 -6
- data/app/models/blog.rb +85 -65
- data/app/models/comment.rb +10 -7
- data/app/models/config_manager.rb +4 -2
- data/app/models/content.rb +34 -40
- data/app/models/content_base.rb +9 -3
- data/app/models/feedback.rb +19 -16
- data/app/models/meta_sidebar.rb +5 -2
- data/app/models/note.rb +25 -23
- data/app/models/page.rb +8 -6
- data/app/models/page_sidebar.rb +4 -2
- data/app/models/ping.rb +2 -0
- data/app/models/post_type.rb +3 -1
- data/app/models/redirect.rb +11 -6
- data/app/models/redirection.rb +2 -0
- data/app/models/resource.rb +4 -2
- data/app/models/search_sidebar.rb +4 -2
- data/app/models/sidebar.rb +10 -5
- data/app/models/static_sidebar.rb +15 -12
- data/app/models/tag.rb +14 -10
- data/app/models/tag_sidebar.rb +6 -3
- data/app/models/text_filter.rb +85 -11
- data/app/models/trackback.rb +7 -11
- data/app/models/trigger.rb +6 -3
- data/app/models/user.rb +43 -42
- data/app/services/title_builder.rb +56 -45
- data/app/uploaders/resource_uploader.rb +7 -3
- data/app/views/accounts/confirm.html.erb +3 -3
- data/app/views/admin/content/_article_list.html.erb +23 -8
- data/app/views/admin/content/_form.html.erb +71 -47
- data/app/views/admin/content/edit.html.erb +1 -1
- data/app/views/admin/content/index.html.erb +25 -15
- data/app/views/admin/content/new.html.erb +2 -2
- data/app/views/admin/dashboard/_comment.html.erb +5 -5
- data/app/views/admin/dashboard/_comments.html.erb +2 -2
- data/app/views/admin/dashboard/_drafts.html.erb +5 -5
- data/app/views/admin/dashboard/_overview.html.erb +7 -9
- data/app/views/admin/dashboard/_welcome.html.erb +11 -11
- data/app/views/admin/dashboard/index.html.erb +12 -7
- data/app/views/admin/feedback/_button.html.erb +6 -6
- data/app/views/admin/feedback/_feedback.html.erb +3 -3
- data/app/views/admin/feedback/_ham.html.erb +27 -9
- data/app/views/admin/feedback/_spam.html.erb +26 -16
- data/app/views/admin/feedback/article.html.erb +20 -21
- data/app/views/admin/feedback/edit.html.erb +14 -15
- data/app/views/admin/feedback/{ham.js → ham.js.erb} +0 -0
- data/app/views/admin/feedback/index.html.erb +25 -23
- data/app/views/admin/feedback/{spam.js → spam.js.erb} +0 -0
- data/app/views/admin/migrations/show.html.erb +10 -11
- data/app/views/admin/notes/_form.html.erb +13 -13
- data/app/views/admin/notes/_list.html.erb +19 -8
- data/app/views/admin/notes/_note.html.erb +12 -7
- data/app/views/admin/notes/edit.html.erb +6 -1
- data/app/views/admin/notes/index.html.erb +5 -1
- data/app/views/admin/notes/show.html.erb +2 -2
- data/app/views/admin/pages/_form.html.erb +86 -77
- data/app/views/admin/pages/_pages.html.erb +11 -4
- data/app/views/admin/pages/edit.html.erb +3 -1
- data/app/views/admin/pages/index.html.erb +10 -6
- data/app/views/admin/pages/new.html.erb +3 -1
- data/app/views/admin/post_types/_index_and_form.html.erb +15 -16
- data/app/views/admin/post_types/edit.html.erb +1 -1
- data/app/views/admin/post_types/index.html.erb +1 -1
- data/app/views/admin/profiles/index.html.erb +2 -3
- data/app/views/admin/redirects/_index_and_form.html.erb +10 -11
- data/app/views/admin/redirects/edit.html.erb +1 -1
- data/app/views/admin/redirects/index.html.erb +1 -1
- data/app/views/admin/resources/index.html.erb +19 -16
- data/app/views/admin/seo/_general.html.erb +23 -47
- data/app/views/admin/seo/_permalinks.html.erb +14 -14
- data/app/views/admin/seo/_titles.html.erb +63 -64
- data/app/views/admin/seo/show.html.erb +14 -19
- data/app/views/admin/settings/display.html.erb +22 -25
- data/app/views/admin/settings/feedback.html.erb +31 -32
- data/app/views/admin/settings/index.html.erb +23 -24
- data/app/views/admin/settings/write.html.erb +21 -22
- data/app/views/admin/shared/_edit.html.erb +3 -3
- data/app/views/admin/shared/_menu.html.erb +26 -26
- data/app/views/admin/shared/_twitter_alert.html.erb +1 -1
- data/app/views/admin/sidebar/_config.html.erb +5 -5
- data/app/views/admin/sidebar/_target_sidebar.html.erb +4 -4
- data/app/views/admin/sidebar/index.html.erb +7 -7
- data/app/views/admin/tags/_index_and_form.html.erb +11 -12
- data/app/views/admin/tags/edit.html.erb +1 -1
- data/app/views/admin/tags/index.html.erb +1 -1
- data/app/views/admin/themes/index.html.erb +5 -6
- data/app/views/admin/users/_form.html.erb +34 -34
- data/app/views/admin/users/edit.html.erb +2 -2
- data/app/views/admin/users/index.html.erb +10 -12
- data/app/views/admin/users/new.html.erb +2 -2
- data/app/views/archives_sidebar/_content.html.erb +2 -2
- data/app/views/articles/_archives_article.html.erb +3 -3
- data/app/views/articles/_article.html.erb +7 -9
- data/app/views/articles/_article_author.html.erb +4 -0
- data/app/views/articles/_article_content.html.erb +2 -2
- data/app/views/articles/_article_excerpt.html.erb +2 -2
- data/app/views/articles/_article_links.html.erb +1 -1
- data/app/views/articles/_comment_errors.html.erb +1 -1
- data/app/views/articles/_comment_form.html.erb +12 -12
- data/app/views/articles/_comment_preview.html.erb +3 -3
- data/app/views/articles/_password_form.html.erb +4 -4
- data/app/views/articles/_trackback.html.erb +2 -2
- data/app/views/articles/archives.html.erb +1 -1
- data/app/views/articles/feedback_atom_feed.atom.builder +3 -1
- data/app/views/articles/feedback_rss_feed.rss.builder +9 -7
- data/app/views/articles/index_atom_feed.atom.builder +5 -3
- data/app/views/articles/index_rss_feed.rss.builder +10 -8
- data/app/views/articles/live_search.html.erb +3 -3
- data/app/views/articles/read.html.erb +16 -8
- data/app/views/articles/search.html.erb +2 -2
- data/app/views/articles/trackback.xml.builder +3 -1
- data/app/views/articles/view_page.html.erb +1 -1
- data/app/views/authors/show.html.erb +9 -9
- data/app/views/authors/show_atom_feed.atom.builder +4 -2
- data/app/views/authors/show_rss_feed.rss.builder +10 -8
- data/app/views/comments/_comment.html.erb +3 -3
- data/app/views/devise/mailer/reset_password_instructions.html.erb +7 -9
- data/app/views/devise/passwords/edit.html.erb +4 -4
- data/app/views/devise/passwords/new.html.erb +1 -1
- data/app/views/devise/registrations/new.html.erb +5 -5
- data/app/views/devise/sessions/new.html.erb +3 -3
- data/app/views/errors/404.html.erb +2 -2
- data/app/views/feedback/index.atom.builder +3 -1
- data/app/views/feedback/index.rss.builder +9 -7
- data/app/views/layouts/accounts.html.erb +26 -26
- data/app/views/layouts/administration.html.erb +31 -31
- data/app/views/layouts/default.html.erb +3 -3
- data/app/views/layouts/editor.html.erb +5 -19
- data/app/views/meta_sidebar/_content.html.erb +2 -2
- data/app/views/notes/_note.html.erb +1 -1
- data/app/views/notes/index.html.erb +1 -1
- data/app/views/notes/show_in_reply.html.erb +1 -1
- data/app/views/notification_mailer/_mail_footer.html.erb +3 -3
- data/app/views/notification_mailer/article.html.erb +2 -2
- data/app/views/notification_mailer/comment.html.erb +5 -5
- data/app/views/notification_mailer/notif_user.html.erb +1 -1
- data/app/views/page_sidebar/_content.html.erb +1 -1
- data/app/views/search_sidebar/_content.html.erb +2 -2
- data/app/views/settings/install.html.erb +2 -2
- data/app/views/setup/index.html.erb +7 -7
- data/app/views/shared/_atom_header.atom.builder +4 -2
- data/app/views/shared/_atom_item_article.atom.builder +11 -6
- data/app/views/shared/_atom_item_comment.atom.builder +4 -2
- data/app/views/shared/_atom_item_trackback.atom.builder +4 -2
- data/app/views/shared/_page_header.html.erb +9 -12
- data/app/views/shared/_rss_item_article.rss.builder +6 -3
- data/app/views/shared/_rss_item_comment.rss.builder +3 -1
- data/app/views/shared/_rss_item_trackback.rss.builder +3 -1
- data/app/views/sidebar/display_plugins.html.erb +1 -1
- data/app/views/tag_sidebar/_content.html.erb +1 -1
- data/app/views/tags/index.html.erb +1 -1
- data/app/views/xml/_googlesitemap_item_article.googlesitemap.builder +2 -0
- data/app/views/xml/_googlesitemap_item_category.googlesitemap.builder +2 -0
- data/app/views/xml/_googlesitemap_item_page.googlesitemap.builder +2 -0
- data/app/views/xml/_googlesitemap_item_tag.googlesitemap.builder +2 -0
- data/app/views/xml/sitemap.googlesitemap.builder +4 -2
- data/config/i18n-tasks.yml +0 -5
- data/config/initializers/devise.rb +10 -4
- data/config/initializers/mime_types.rb +3 -1
- data/config/locales/da.yml +134 -71
- data/config/locales/de.yml +142 -75
- data/config/locales/en.yml +128 -66
- data/config/locales/es-MX.yml +135 -69
- data/config/locales/fr.yml +167 -86
- data/config/locales/he.yml +128 -70
- data/config/locales/it.yml +136 -72
- data/config/locales/ja.yml +110 -64
- data/config/locales/lt.yml +153 -74
- data/config/locales/nb-NO.yml +123 -65
- data/config/locales/nl.yml +140 -75
- data/config/locales/pl.yml +160 -69
- data/config/locales/pt-BR.yml +137 -70
- data/config/locales/ro.yml +148 -70
- data/config/locales/ru.yml +161 -69
- data/config/locales/zh-CN.yml +106 -59
- data/config/locales/zh-TW.yml +109 -61
- data/config/routes.rb +68 -63
- data/db/migrate/113_initial_schema.rb +192 -190
- data/db/migrate/114_fixes_buggy_articles_and_notes.rb +9 -6
- data/db/migrate/115_drops_categories_for_tags.rb +3 -1
- data/db/migrate/20150207131657_add_missing_indexes.rb +2 -0
- data/db/migrate/20150807134129_simplify_redirect_relations.rb +8 -1
- data/db/migrate/20150808052637_add_blog_ids.rb +4 -2
- data/db/migrate/20150808191127_add_blog_id_to_redirects.rb +2 -0
- data/db/migrate/20150810094754_add_blog_id_to_tags.rb +2 -0
- data/db/migrate/20160108111120_add_devise_to_users.rb +4 -2
- data/db/migrate/20160108184201_move_last_connection_to_last_sign_in_at.rb +2 -0
- data/db/migrate/20160110094906_remove_profiles_rights.rb +2 -0
- data/db/migrate/20160605103918_replace_profile_id_with_string.rb +2 -0
- data/db/migrate/20160605154632_remove_profiles.rb +10 -5
- data/db/migrate/20160701061851_demand_blog_id_on_contents.rb +2 -0
- data/db/migrate/20160701062604_add_blog_id_to_resources.rb +2 -0
- data/db/migrate/20170528093024_move_resources_to_content.rb +2 -0
- data/db/migrate/20170528094923_move_tags_to_content.rb +2 -0
- data/db/migrate/20170528201606_remove_separate_published_flag.rb +2 -0
- data/db/migrate/20170605071626_remove_extra_state_columns_from_feedback.rb +2 -0
- data/db/migrate/20170702105201_remove_published_at_from_feedback.rb +2 -0
- data/db/migrate/20190208151235_add_text_filter_name_fields.rb +9 -0
- data/db/migrate/20190208152646_move_text_filter_to_name.rb +97 -0
- data/db/migrate/20190209155717_remove_text_filter_ids.rb +19 -0
- data/db/migrate/20190209160610_remove_text_filters.rb +17 -0
- data/db/migrate/20200413140440_add_unique_indexes.rb +10 -0
- data/db/seeds.rb +9 -19
- data/lib/email_notify.rb +3 -1
- data/lib/format.rb +4 -2
- data/lib/publify_core.rb +36 -35
- data/lib/publify_core/engine.rb +8 -6
- data/lib/publify_core/lang.rb +5 -1
- data/lib/publify_core/testing_support/dns_mock.rb +15 -0
- data/lib/publify_core/testing_support/factories.rb +240 -0
- data/lib/publify_core/testing_support/feed_assertions.rb +48 -0
- data/lib/publify_core/testing_support/fixtures/exploit.svg +4 -0
- data/lib/publify_core/testing_support/fixtures/fakepng.png +1 -0
- data/lib/publify_core/testing_support/fixtures/otherfile.txt +1 -0
- data/lib/publify_core/testing_support/fixtures/testfile.png +0 -0
- data/lib/publify_core/testing_support/fixtures/testfile.txt +1 -0
- data/lib/publify_core/testing_support/upload_fixtures.rb +15 -0
- data/lib/publify_core/version.rb +3 -1
- data/lib/publify_guid.rb +3 -1
- data/lib/publify_plugins.rb +10 -5
- data/lib/publify_textfilter_markdown.rb +38 -25
- data/lib/publify_textfilter_none.rb +5 -3
- data/lib/publify_textfilter_smartypants.rb +5 -3
- data/lib/publify_textfilter_textile.rb +7 -4
- data/lib/publify_textfilter_twitterfilter.rb +13 -7
- data/lib/publify_time.rb +4 -0
- data/lib/sidebar_field.rb +15 -13
- data/lib/sidebar_registry.rb +5 -3
- data/lib/spam_protection.rb +16 -13
- data/lib/tasks/i18n.rake +9 -0
- data/lib/tasks/manifest.rake +30 -0
- data/lib/tasks/publify_core_tasks.rake +2 -0
- data/lib/text_filter_plugin.rb +27 -25
- data/lib/theme.rb +5 -3
- data/lib/transforms.rb +22 -19
- metadata +217 -87
- data/app/assets/javascripts/widearea.js +0 -486
- data/app/assets/stylesheets/widearea.css +0 -133
- data/app/controllers/admin/textfilters_controller.rb +0 -6
- data/app/views/admin/dashboard/_inbound.html.erb +0 -31
- data/app/views/admin/notes/_header.html.erb +0 -6
- 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 ==
|
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
|
35
|
+
say "Fixing contents permalinks, this may take some time"
|
33
36
|
|
34
|
-
contents = Content.where(
|
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
|
41
|
-
notes = Note.where(
|
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
|
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,
|
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 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
|
-
|
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 ==
|
23
|
+
if adapter_name == "PostgreSQL"
|
22
24
|
indexes(:contents).each do |index|
|
23
|
-
remove_index(:contents, name: index.name) if index.name
|
25
|
+
remove_index(:contents, name: index.name) if /blog_id/.match?(index.name)
|
24
26
|
end
|
25
27
|
else
|
26
28
|
begin
|
@@ -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 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:
|
18
|
-
modules: [:dashboard, :articles, :notes, :pages, :feedback,
|
19
|
-
|
20
|
-
|
21
|
-
Profile.create!(label:
|
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
|
@@ -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
|
data/db/seeds.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
#
|
2
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
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
|
data/lib/email_notify.rb
CHANGED
@@ -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(
|
6
|
+
@@logger ||= ::Rails.logger || Logger.new($stdout)
|
5
7
|
end
|
6
8
|
|
7
9
|
def self.send_comment(comment, user)
|
data/lib/format.rb
CHANGED
@@ -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
|
8
|
+
HTTP_URI = %r{^https?://\S+$}.freeze
|
7
9
|
end
|