HornsAndHooves-publify_core 10.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +102 -0
- data/MIT-LICENSE +21 -0
- data/README.md +9 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +288 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/fonts/open-sans-bold.woff +0 -0
- data/app/assets/fonts/open-sans.woff +0 -0
- data/app/assets/images/admin/loading.gif +0 -0
- data/app/assets/images/admin/typologo.gif +0 -0
- data/app/assets/images/calendar_date_select/calendar.gif +0 -0
- data/app/assets/images/close.gif +0 -0
- data/app/assets/images/closelabel.gif +0 -0
- data/app/assets/images/go.png +0 -0
- data/app/assets/images/loading.gif +0 -0
- data/app/assets/images/nextlabel.gif +0 -0
- data/app/assets/images/overlay.png +0 -0
- data/app/assets/images/powered.gif +0 -0
- data/app/assets/images/prevlabel.gif +0 -0
- data/app/assets/images/spinner-blue.gif +0 -0
- data/app/assets/images/spinner.gif +0 -0
- data/app/assets/images/thumb_blank.jpg +0 -0
- data/app/assets/javascripts/application.js +2 -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/bootstrap-sprockets.js +8 -0
- data/app/assets/javascripts/cookies.js +60 -0
- data/app/assets/javascripts/datetimepicker.js +1470 -0
- data/app/assets/javascripts/lang/da_DK.js +17 -0
- data/app/assets/javascripts/lang/default.js +21 -0
- data/app/assets/javascripts/lang/en_US.js +21 -0
- data/app/assets/javascripts/lang/fr_FR.js +21 -0
- data/app/assets/javascripts/lang/nl_NL.js +21 -0
- data/app/assets/javascripts/lang/zh_TW.js +17 -0
- data/app/assets/javascripts/lightbox.js +350 -0
- data/app/assets/javascripts/observe.js +28 -0
- data/app/assets/javascripts/publify.js +11 -0
- data/app/assets/javascripts/publify_admin.js +104 -0
- data/app/assets/javascripts/quicktags.js +448 -0
- data/app/assets/javascripts/set-timeago-lang.js +3 -0
- data/app/assets/javascripts/sidebar.js +28 -0
- data/app/assets/javascripts/spinnable.js +5 -0
- data/app/assets/javascripts/tagmanager.js +481 -0
- data/app/assets/javascripts/typeahead.js +1139 -0
- 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 +43 -0
- data/app/assets/stylesheets/accounts.css.scss +7 -0
- data/app/assets/stylesheets/administration_structure.css.scss +255 -0
- 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/_glyphicons.scss +307 -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 +654 -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/coderay.css +135 -0
- data/app/assets/stylesheets/datetimepicker.css +306 -0
- data/app/assets/stylesheets/lightbox.css +63 -0
- data/app/assets/stylesheets/publify.css.scss +9 -0
- data/app/assets/stylesheets/publify_admin.css.scss +10 -0
- data/app/assets/stylesheets/rss.css +53 -0
- data/app/assets/stylesheets/sidebar_admin.css.scss +36 -0
- data/app/assets/stylesheets/tagmanager.css +102 -0
- data/app/assets/stylesheets/user-styles.css +29 -0
- data/app/controllers/accounts_controller.rb +4 -0
- data/app/controllers/admin/base_controller.rb +27 -0
- data/app/controllers/admin/content_controller.rb +194 -0
- data/app/controllers/admin/dashboard_controller.rb +33 -0
- data/app/controllers/admin/feedback_controller.rb +160 -0
- data/app/controllers/admin/notes_controller.rb +73 -0
- data/app/controllers/admin/pages_controller.rb +73 -0
- data/app/controllers/admin/post_types_controller.rb +57 -0
- data/app/controllers/admin/profiles_controller.rb +57 -0
- data/app/controllers/admin/redirects_controller.rb +51 -0
- data/app/controllers/admin/resources_controller.rb +36 -0
- data/app/controllers/admin/seo_controller.rb +46 -0
- data/app/controllers/admin/settings_controller.rb +53 -0
- data/app/controllers/admin/sidebar_controller.rb +67 -0
- data/app/controllers/admin/tags_controller.rb +55 -0
- data/app/controllers/admin/themes_controller.rb +31 -0
- data/app/controllers/admin/users_controller.rb +67 -0
- data/app/controllers/articles_controller.rb +215 -0
- data/app/controllers/authors_controller.rb +30 -0
- data/app/controllers/base_controller.rb +43 -0
- data/app/controllers/comments_controller.rb +67 -0
- data/app/controllers/content_controller.rb +24 -0
- data/app/controllers/feedback_controller.rb +13 -0
- data/app/controllers/notes_controller.rb +35 -0
- data/app/controllers/setup_controller.rb +61 -0
- data/app/controllers/tags_controller.rb +50 -0
- data/app/controllers/text_controller.rb +7 -0
- data/app/controllers/textfilter_controller.rb +5 -0
- data/app/controllers/theme_controller.rb +63 -0
- data/app/controllers/xml_controller.rb +20 -0
- data/app/helpers/admin/base_helper.rb +87 -0
- data/app/helpers/admin/feedback_helper.rb +53 -0
- data/app/helpers/articles_helper.rb +10 -0
- data/app/helpers/authors_helper.rb +30 -0
- data/app/helpers/base_helper.rb +257 -0
- data/app/helpers/blog_helper.rb +14 -0
- data/app/helpers/xml_helper.rb +18 -0
- data/app/jobs/application_job.rb +5 -0
- data/app/mailers/notification_mailer.rb +40 -0
- data/app/models/ability.rb +53 -0
- data/app/models/archives_sidebar.rb +45 -0
- data/app/models/article/factory.rb +64 -0
- data/app/models/article.rb +308 -0
- data/app/models/blog.rb +280 -0
- data/app/models/comment.rb +57 -0
- data/app/models/config_manager.rb +83 -0
- data/app/models/content.rb +118 -0
- data/app/models/content_base.rb +88 -0
- data/app/models/feedback.rb +250 -0
- data/app/models/meta_sidebar.rb +10 -0
- data/app/models/note.rb +152 -0
- data/app/models/page.rb +42 -0
- data/app/models/page_sidebar.rb +14 -0
- data/app/models/ping.rb +5 -0
- data/app/models/post_type.rb +16 -0
- data/app/models/redirect.rb +51 -0
- data/app/models/redirection.rb +6 -0
- data/app/models/resource.rb +12 -0
- data/app/models/search_sidebar.rb +9 -0
- data/app/models/sidebar.rb +142 -0
- data/app/models/static_sidebar.rb +22 -0
- data/app/models/tag.rb +71 -0
- data/app/models/tag_sidebar.rb +30 -0
- data/app/models/text_filter.rb +141 -0
- data/app/models/trackback.rb +46 -0
- data/app/models/trigger.rb +34 -0
- data/app/models/user.rb +142 -0
- data/app/services/title_builder.rb +88 -0
- data/app/uploaders/resource_uploader.rb +63 -0
- data/app/views/accounts/confirm.html.erb +7 -0
- data/app/views/admin/content/_article_list.html.erb +26 -0
- data/app/views/admin/content/_form.html.erb +145 -0
- data/app/views/admin/content/autosave.js.erb +5 -0
- data/app/views/admin/content/edit.html.erb +3 -0
- data/app/views/admin/content/index.html.erb +48 -0
- data/app/views/admin/content/index.js.erb +1 -0
- data/app/views/admin/content/new.html.erb +3 -0
- data/app/views/admin/dashboard/_comment.html.erb +18 -0
- data/app/views/admin/dashboard/_comments.html.erb +10 -0
- data/app/views/admin/dashboard/_drafts.html.erb +25 -0
- data/app/views/admin/dashboard/_overview.html.erb +21 -0
- data/app/views/admin/dashboard/_welcome.html.erb +28 -0
- data/app/views/admin/dashboard/index.html.erb +16 -0
- data/app/views/admin/feedback/_button.html.erb +19 -0
- data/app/views/admin/feedback/_feedback.html.erb +7 -0
- data/app/views/admin/feedback/_ham.html.erb +17 -0
- data/app/views/admin/feedback/_spam.html.erb +23 -0
- data/app/views/admin/feedback/article.html.erb +69 -0
- data/app/views/admin/feedback/edit.html.erb +48 -0
- data/app/views/admin/feedback/ham.js +1 -0
- data/app/views/admin/feedback/index.html.erb +53 -0
- data/app/views/admin/feedback/spam.js +1 -0
- data/app/views/admin/migrations/show.html.erb +39 -0
- data/app/views/admin/notes/_form.html.erb +37 -0
- data/app/views/admin/notes/_header.html.erb +6 -0
- data/app/views/admin/notes/_list.html.erb +13 -0
- data/app/views/admin/notes/_note.html.erb +14 -0
- data/app/views/admin/notes/edit.html.erb +11 -0
- data/app/views/admin/notes/index.html.erb +11 -0
- data/app/views/admin/notes/show.html.erb +14 -0
- data/app/views/admin/pages/_form.html.erb +101 -0
- data/app/views/admin/pages/_pages.html.erb +21 -0
- data/app/views/admin/pages/edit.html.erb +1 -0
- data/app/views/admin/pages/index.html.erb +17 -0
- data/app/views/admin/pages/new.html.erb +1 -0
- data/app/views/admin/post_types/_index_and_form.html.erb +65 -0
- data/app/views/admin/post_types/edit.html.erb +1 -0
- data/app/views/admin/post_types/index.html.erb +1 -0
- data/app/views/admin/profiles/index.html.erb +10 -0
- data/app/views/admin/redirects/_index_and_form.html.erb +68 -0
- data/app/views/admin/redirects/edit.html.erb +1 -0
- data/app/views/admin/redirects/index.html.erb +1 -0
- data/app/views/admin/resources/index.html.erb +72 -0
- data/app/views/admin/seo/_general.html.erb +104 -0
- data/app/views/admin/seo/_permalinks.html.erb +53 -0
- data/app/views/admin/seo/_titles.html.erb +209 -0
- data/app/views/admin/seo/show.html.erb +28 -0
- data/app/views/admin/settings/display.html.erb +101 -0
- data/app/views/admin/settings/feedback.html.erb +118 -0
- data/app/views/admin/settings/index.html.erb +73 -0
- data/app/views/admin/settings/write.html.erb +69 -0
- data/app/views/admin/shared/_edit.html.erb +4 -0
- data/app/views/admin/shared/_menu.html.erb +121 -0
- data/app/views/admin/shared/_twitter_alert.html.erb +3 -0
- data/app/views/admin/sidebar/_available.html.erb +6 -0
- data/app/views/admin/sidebar/_available.json.erb +6 -0
- data/app/views/admin/sidebar/_config.html.erb +27 -0
- data/app/views/admin/sidebar/_target.html.erb +9 -0
- data/app/views/admin/sidebar/_target_sidebar.html.erb +20 -0
- data/app/views/admin/sidebar/destroy.js.erb +1 -0
- data/app/views/admin/sidebar/index.html.erb +31 -0
- data/app/views/admin/sidebar/sortable.js.erb +3 -0
- data/app/views/admin/sidebar/update.js.erb +2 -0
- data/app/views/admin/tags/_index_and_form.html.erb +59 -0
- data/app/views/admin/tags/edit.html.erb +1 -0
- data/app/views/admin/tags/index.html.erb +1 -0
- data/app/views/admin/themes/index.html.erb +27 -0
- data/app/views/admin/users/_form.html.erb +215 -0
- data/app/views/admin/users/edit.html.erb +8 -0
- data/app/views/admin/users/index.html.erb +39 -0
- data/app/views/admin/users/new.html.erb +8 -0
- data/app/views/archives_sidebar/_content.html.erb +13 -0
- data/app/views/articles/_archives_article.html.erb +9 -0
- data/app/views/articles/_article.html.erb +9 -0
- data/app/views/articles/_article_author.html.erb +4 -0
- data/app/views/articles/_article_collection.html.erb +8 -0
- data/app/views/articles/_article_content.html.erb +5 -0
- data/app/views/articles/_article_excerpt.html.erb +15 -0
- data/app/views/articles/_article_links.html.erb +12 -0
- data/app/views/articles/_comment.html.erb +1 -0
- data/app/views/articles/_comment_errors.html.erb +2 -0
- data/app/views/articles/_comment_form.html.erb +48 -0
- data/app/views/articles/_comment_list.html.erb +5 -0
- data/app/views/articles/_comment_preview.html.erb +4 -0
- data/app/views/articles/_full_article_content.html.erb +4 -0
- data/app/views/articles/_password_form.html.erb +10 -0
- data/app/views/articles/_trackback.html.erb +6 -0
- data/app/views/articles/archives.html.erb +15 -0
- data/app/views/articles/comment.js.erb +5 -0
- data/app/views/articles/comment_failed.js.erb +3 -0
- data/app/views/articles/error.html.erb +3 -0
- data/app/views/articles/feedback_atom_feed.atom.builder +10 -0
- data/app/views/articles/feedback_rss_feed.rss.builder +21 -0
- data/app/views/articles/index.html.erb +1 -0
- data/app/views/articles/index_atom_feed.atom.builder +9 -0
- data/app/views/articles/index_rss_feed.rss.builder +20 -0
- data/app/views/articles/live_search.html.erb +10 -0
- data/app/views/articles/read.html.erb +43 -0
- data/app/views/articles/search.html.erb +8 -0
- data/app/views/articles/trackback.xml.builder +7 -0
- data/app/views/articles/view_page.html.erb +3 -0
- data/app/views/authors/show.html.erb +30 -0
- data/app/views/authors/show_atom_feed.atom.builder +9 -0
- data/app/views/authors/show_rss_feed.rss.builder +20 -0
- data/app/views/comments/_comment.html.erb +17 -0
- data/app/views/comments/preview.html.erb +1 -0
- data/app/views/comments/preview.js.erb +3 -0
- data/app/views/devise/mailer/reset_password_instructions.html.erb +11 -0
- data/app/views/devise/passwords/edit.html.erb +28 -0
- data/app/views/devise/passwords/new.html.erb +20 -0
- data/app/views/devise/registrations/new.html.erb +36 -0
- data/app/views/devise/sessions/new.html.erb +32 -0
- data/app/views/devise/shared/_links.html.erb +11 -0
- data/app/views/errors/404.html.erb +2 -0
- data/app/views/feedback/index.atom.builder +9 -0
- data/app/views/feedback/index.rss.builder +20 -0
- data/app/views/layouts/accounts.html.erb +33 -0
- data/app/views/layouts/administration.html.erb +37 -0
- data/app/views/layouts/default.html.erb +33 -0
- data/app/views/layouts/editor.html.erb +17 -0
- data/app/views/meta_sidebar/_content.html.erb +8 -0
- data/app/views/notes/_note.html.erb +16 -0
- data/app/views/notes/error.html.erb +3 -0
- data/app/views/notes/index.html.erb +15 -0
- data/app/views/notes/show.html.erb +5 -0
- data/app/views/notes/show_in_reply.html.erb +18 -0
- data/app/views/notification_mailer/_mail_footer.html.erb +5 -0
- data/app/views/notification_mailer/_mail_header.html.erb +3 -0
- data/app/views/notification_mailer/article.html.erb +7 -0
- data/app/views/notification_mailer/comment.html.erb +12 -0
- data/app/views/notification_mailer/notif_user.html.erb +9 -0
- data/app/views/page_sidebar/_content.html.erb +12 -0
- data/app/views/search_sidebar/_content.html.erb +10 -0
- data/app/views/settings/done.html.erb +2 -0
- data/app/views/settings/install.html.erb +12 -0
- data/app/views/setup/index.html.erb +17 -0
- data/app/views/shared/_atom_header.atom.builder +6 -0
- data/app/views/shared/_atom_item_article.atom.builder +36 -0
- data/app/views/shared/_atom_item_comment.atom.builder +10 -0
- data/app/views/shared/_atom_item_trackback.atom.builder +10 -0
- data/app/views/shared/_flash.erb +10 -0
- data/app/views/shared/_google_analytics.html.erb +8 -0
- data/app/views/shared/_page_header.html.erb +23 -0
- data/app/views/shared/_rss_item_article.rss.builder +32 -0
- data/app/views/shared/_rss_item_comment.rss.builder +9 -0
- data/app/views/shared/_rss_item_trackback.rss.builder +9 -0
- data/app/views/sidebar/_row.html.erb +1 -0
- data/app/views/sidebar/_sidebar.html.erb +5 -0
- data/app/views/sidebar/display_plugins.html.erb +5 -0
- data/app/views/sidebar/show.html.erb +1 -0
- data/app/views/static_sidebar/_content.html.erb +2 -0
- data/app/views/tag_sidebar/_content.html.erb +10 -0
- data/app/views/tags/index.html.erb +15 -0
- data/app/views/tags/show.html.erb +1 -0
- data/app/views/theme/static_view_test.html.erb +1 -0
- data/app/views/xml/_googlesitemap_item_article.googlesitemap.builder +7 -0
- data/app/views/xml/_googlesitemap_item_category.googlesitemap.builder +6 -0
- data/app/views/xml/_googlesitemap_item_page.googlesitemap.builder +6 -0
- data/app/views/xml/_googlesitemap_item_tag.googlesitemap.builder +6 -0
- data/app/views/xml/sitemap.googlesitemap.builder +9 -0
- data/config/i18n-tasks.yml +49 -0
- data/config/initializers/devise.rb +271 -0
- data/config/initializers/mime_types.rb +7 -0
- data/config/locales/da.yml +769 -0
- data/config/locales/de.yml +769 -0
- data/config/locales/en.yml +770 -0
- data/config/locales/es-MX.yml +769 -0
- data/config/locales/fr.yml +769 -0
- data/config/locales/he.yml +769 -0
- data/config/locales/it.yml +769 -0
- data/config/locales/ja.yml +769 -0
- data/config/locales/lt.yml +783 -0
- data/config/locales/nb-NO.yml +769 -0
- data/config/locales/nl.yml +769 -0
- data/config/locales/pl.yml +797 -0
- data/config/locales/pt-BR.yml +769 -0
- data/config/locales/ro.yml +782 -0
- data/config/locales/ru.yml +797 -0
- data/config/locales/sidebars.da.yml +20 -0
- data/config/locales/sidebars.de.yml +20 -0
- data/config/locales/sidebars.en.yml +20 -0
- data/config/locales/sidebars.es-MX.yml +20 -0
- data/config/locales/sidebars.fr.yml +20 -0
- data/config/locales/sidebars.he.yml +20 -0
- data/config/locales/sidebars.it.yml +20 -0
- data/config/locales/sidebars.ja.yml +20 -0
- data/config/locales/sidebars.lt.yml +20 -0
- data/config/locales/sidebars.nb-NO.yml +20 -0
- data/config/locales/sidebars.nl.yml +20 -0
- data/config/locales/sidebars.pl.yml +20 -0
- data/config/locales/sidebars.pt-BR.yml +20 -0
- data/config/locales/sidebars.ro.yml +20 -0
- data/config/locales/sidebars.ru.yml +20 -0
- data/config/locales/sidebars.zh-CN.yml +20 -0
- data/config/locales/sidebars.zh-TW.yml +20 -0
- data/config/locales/zh-CN.yml +768 -0
- data/config/locales/zh-TW.yml +769 -0
- data/config/routes.rb +174 -0
- data/db/migrate/113_initial_schema.rb +210 -0
- data/db/migrate/114_fixes_buggy_articles_and_notes.rb +56 -0
- data/db/migrate/115_drops_categories_for_tags.rb +37 -0
- data/db/migrate/20150207131657_add_missing_indexes.rb +23 -0
- data/db/migrate/20150807134129_simplify_redirect_relations.rb +45 -0
- data/db/migrate/20150808052637_add_blog_ids.rb +39 -0
- data/db/migrate/20150808191127_add_blog_id_to_redirects.rb +19 -0
- data/db/migrate/20150810094754_add_blog_id_to_tags.rb +19 -0
- data/db/migrate/20160108111120_add_devise_to_users.rb +57 -0
- data/db/migrate/20160108184201_move_last_connection_to_last_sign_in_at.rb +20 -0
- data/db/migrate/20160110094906_remove_profiles_rights.rb +18 -0
- data/db/migrate/20160605103918_replace_profile_id_with_string.rb +32 -0
- data/db/migrate/20160605154632_remove_profiles.rb +31 -0
- data/db/migrate/20160701061851_demand_blog_id_on_contents.rb +13 -0
- data/db/migrate/20160701062604_add_blog_id_to_resources.rb +32 -0
- data/db/migrate/20170528093024_move_resources_to_content.rb +9 -0
- data/db/migrate/20170528094923_move_tags_to_content.rb +10 -0
- data/db/migrate/20170528201606_remove_separate_published_flag.rb +9 -0
- data/db/migrate/20170605071626_remove_extra_state_columns_from_feedback.rb +10 -0
- data/db/migrate/20170702105201_remove_published_at_from_feedback.rb +9 -0
- data/db/migrate/20190208151235_add_text_filter_name_fields.rb +11 -0
- data/db/migrate/20190208152646_move_text_filter_to_name.rb +99 -0
- data/db/migrate/20190209155717_remove_text_filter_ids.rb +21 -0
- data/db/migrate/20190209160610_remove_text_filters.rb +19 -0
- data/db/seeds.rb +25 -0
- data/lib/email_notify.rb +28 -0
- data/lib/format.rb +9 -0
- data/lib/publify_core/engine.rb +31 -0
- data/lib/publify_core/lang.rb +9 -0
- data/lib/publify_core/testing_support/dns_mock.rb +15 -0
- data/lib/publify_core/testing_support/factories.rb +242 -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 +5 -0
- data/lib/publify_core.rb +46 -0
- data/lib/publify_guid.rb +11 -0
- data/lib/publify_plugins.rb +77 -0
- data/lib/publify_textfilter_markdown.rb +57 -0
- data/lib/publify_textfilter_none.rb +16 -0
- data/lib/publify_textfilter_smartypants.rb +16 -0
- data/lib/publify_textfilter_textile.rb +23 -0
- data/lib/publify_textfilter_twitterfilter.rb +39 -0
- data/lib/publify_time.rb +34 -0
- data/lib/sidebar_field.rb +127 -0
- data/lib/sidebar_registry.rb +35 -0
- data/lib/spam_protection.rb +103 -0
- data/lib/tasks/i18n.rake +9 -0
- data/lib/tasks/manifest.rake +30 -0
- data/lib/tasks/publify_core_tasks.rake +6 -0
- data/lib/text_filter_plugin.rb +183 -0
- data/lib/theme.rb +72 -0
- data/lib/transforms.rb +47 -0
- data/themes/plain/about.markdown +4 -0
- data/themes/plain/javascripts/theme.js +0 -0
- data/themes/plain/preview.png +0 -0
- data/themes/plain/stylesheets/theme.css +57 -0
- metadata +1062 -0
@@ -0,0 +1,127 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SidebarField
|
4
|
+
attr_accessor :key
|
5
|
+
attr_accessor :options
|
6
|
+
attr_accessor :default
|
7
|
+
include ActionView::Helpers::TagHelper
|
8
|
+
include ActionView::Helpers::FormTagHelper
|
9
|
+
include ActionView::Helpers::FormOptionsHelper
|
10
|
+
|
11
|
+
def initialize(key, default, options = {})
|
12
|
+
@key = key.to_s
|
13
|
+
@default = default
|
14
|
+
@options = options
|
15
|
+
end
|
16
|
+
|
17
|
+
def label
|
18
|
+
options[:label] || key.humanize.gsub(/url/i, "URL")
|
19
|
+
end
|
20
|
+
|
21
|
+
def label_html(_sidebar)
|
22
|
+
content_tag("label", label)
|
23
|
+
end
|
24
|
+
|
25
|
+
def input_html(sidebar)
|
26
|
+
text_field_tag(input_name(sidebar), current_value(sidebar), class: "form-control")
|
27
|
+
end
|
28
|
+
|
29
|
+
def line_html(sidebar)
|
30
|
+
content_tag(:div, label_html(sidebar) + input_html(sidebar), class: "form-group")
|
31
|
+
end
|
32
|
+
|
33
|
+
def input_name(sidebar)
|
34
|
+
"configure[#{sidebar.id}][#{key}]"
|
35
|
+
end
|
36
|
+
|
37
|
+
def canonicalize(value)
|
38
|
+
value
|
39
|
+
end
|
40
|
+
|
41
|
+
def current_value(sidebar)
|
42
|
+
canonicalize(sidebar.config[key])
|
43
|
+
end
|
44
|
+
|
45
|
+
class SelectField < self
|
46
|
+
def input_html(sidebar)
|
47
|
+
select_tag(input_name(sidebar),
|
48
|
+
options_for_select(options[:choices], current_value(sidebar)),
|
49
|
+
options)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class TextAreaField < self
|
54
|
+
def input_html(sidebar)
|
55
|
+
html_options = { "rows" => "10", "class" => "form-control" }.
|
56
|
+
update(options.stringify_keys)
|
57
|
+
text_area_tag(input_name(sidebar), current_value(sidebar), html_options)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
class RadioField < self
|
62
|
+
def input_html(sidebar)
|
63
|
+
choices = options[:choices].map do |choice|
|
64
|
+
value = value_for(choice)
|
65
|
+
radio_button = radio_button_tag(input_name(sidebar),
|
66
|
+
value,
|
67
|
+
value == current_value(sidebar),
|
68
|
+
options)
|
69
|
+
content_tag("div", content_tag("label", radio_button + label_for(choice)),
|
70
|
+
class: "radio")
|
71
|
+
end
|
72
|
+
safe_join(choices)
|
73
|
+
end
|
74
|
+
|
75
|
+
def label_for(choice)
|
76
|
+
choice.is_a?(Array) ? choice.last : choice.to_s.humanize
|
77
|
+
end
|
78
|
+
|
79
|
+
def value_for(choice)
|
80
|
+
choice.is_a?(Array) ? choice.first : choice
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
class CheckBoxField < self
|
85
|
+
def line_html(sidebar)
|
86
|
+
content = hidden_field_tag(input_name(sidebar), 0) +
|
87
|
+
content_tag("label",
|
88
|
+
check_box_tag(input_name(sidebar), 1,
|
89
|
+
current_value(sidebar), options) + label)
|
90
|
+
content_tag("div", content, class: "checkbox")
|
91
|
+
end
|
92
|
+
|
93
|
+
def canonicalize(value)
|
94
|
+
case value
|
95
|
+
when "0"
|
96
|
+
false
|
97
|
+
else
|
98
|
+
true
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.build(key, default, options)
|
104
|
+
class_for(options).new(key, default, options)
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.class_for(options)
|
108
|
+
case options[:input_type]
|
109
|
+
when :text_area
|
110
|
+
TextAreaField
|
111
|
+
when :textarea
|
112
|
+
TextAreaField
|
113
|
+
when :radio
|
114
|
+
RadioField
|
115
|
+
when :checkbox
|
116
|
+
CheckBoxField
|
117
|
+
when :select
|
118
|
+
SelectField
|
119
|
+
else
|
120
|
+
if options[:choices]
|
121
|
+
SelectField
|
122
|
+
else
|
123
|
+
self
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SidebarRegistry
|
4
|
+
class << self
|
5
|
+
def register_sidebar(klass_name)
|
6
|
+
registered_sidebars << klass_name.to_s
|
7
|
+
end
|
8
|
+
|
9
|
+
def available_sidebars
|
10
|
+
registered_sidebars.sort.map(&:constantize)
|
11
|
+
end
|
12
|
+
|
13
|
+
def available_sidebar_types
|
14
|
+
registered_sidebars.sort
|
15
|
+
end
|
16
|
+
|
17
|
+
def register_sidebar_directory(plugins_root, paths)
|
18
|
+
separator = plugins_root.include?("/") ? "/" : '\\'
|
19
|
+
|
20
|
+
Dir.glob(File.join(plugins_root, "*_sidebar")).select do |file|
|
21
|
+
plugin_name = file.split(separator).last
|
22
|
+
register_sidebar plugin_name.classify
|
23
|
+
# TODO: Move Sidebars to app/models, and views to app/views so this can
|
24
|
+
# be simplified.
|
25
|
+
paths << File.join(plugins_root, plugin_name, "lib")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def registered_sidebars
|
32
|
+
@registered_sidebars ||= Set.new
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "format"
|
4
|
+
|
5
|
+
class SpamProtection
|
6
|
+
IP_RBLS = ["opm.blitzed.us", "bsb.empty.us"].freeze
|
7
|
+
HOST_RBLS = ["multi.surbl.org", "bsb.empty.us"].freeze
|
8
|
+
SECOND_LEVEL = %w(co com net org gov).freeze
|
9
|
+
|
10
|
+
attr_accessor :this_blog
|
11
|
+
|
12
|
+
def initialize(a_blog)
|
13
|
+
self.this_blog = a_blog
|
14
|
+
end
|
15
|
+
|
16
|
+
def is_spam?(string)
|
17
|
+
return false unless this_blog.sp_global
|
18
|
+
return false if string.blank?
|
19
|
+
|
20
|
+
reason = catch(:hit) do
|
21
|
+
case string
|
22
|
+
when Format::IP_ADDRESS then scan_ip(string)
|
23
|
+
when Format::HTTP_URI then scan_uris([string])
|
24
|
+
else scan_text(string)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if reason
|
29
|
+
logger.info("[SP] Hit: #{reason}")
|
30
|
+
true
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
protected
|
35
|
+
|
36
|
+
def scan_ip(ip_address)
|
37
|
+
logger.info("[SP] Scanning IP #{ip_address}")
|
38
|
+
query_rbls(IP_RBLS, ip_address.split(".").reverse.join("."))
|
39
|
+
end
|
40
|
+
|
41
|
+
def scan_text(string)
|
42
|
+
# FIXME: Unify HTTP URI matchers
|
43
|
+
uri_list = string.scan(%r{(http://[^\s"]+)}m).flatten
|
44
|
+
|
45
|
+
check_uri_count(uri_list)
|
46
|
+
scan_uris(uri_list)
|
47
|
+
|
48
|
+
false
|
49
|
+
end
|
50
|
+
|
51
|
+
def check_uri_count(uris)
|
52
|
+
limit = this_blog.sp_url_limit
|
53
|
+
return if limit.to_i.zero?
|
54
|
+
|
55
|
+
throw :hit, "Hard URL Limit hit: #{uris.size} > #{limit}" if uris.size > limit
|
56
|
+
end
|
57
|
+
|
58
|
+
def scan_uris(uris = [])
|
59
|
+
uris.each do |uri|
|
60
|
+
host = begin
|
61
|
+
URI.parse(uri).host
|
62
|
+
rescue URI::InvalidURIError
|
63
|
+
next
|
64
|
+
end
|
65
|
+
return scan_ip(host) if Format::IP_ADDRESS.match?(host)
|
66
|
+
|
67
|
+
host_parts = host.split(".").reverse
|
68
|
+
domain = []
|
69
|
+
|
70
|
+
# Check for two level TLD
|
71
|
+
(SECOND_LEVEL.include?(host_parts[1]) ? 3 : 2).times do
|
72
|
+
domain.unshift(host_parts.shift)
|
73
|
+
end
|
74
|
+
|
75
|
+
logger.info("[SP] Scanning domain #{domain.join(".")}")
|
76
|
+
query_rbls(HOST_RBLS, host, domain.join("."))
|
77
|
+
logger.info("[SP] Finished domain scan #{domain.join(".")}")
|
78
|
+
return false
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def query_rbls(rbls, *subdomains)
|
83
|
+
rbls.each do |rbl|
|
84
|
+
subdomains.uniq.each do |d|
|
85
|
+
begin
|
86
|
+
response = IPSocket.getaddress([d, rbl].join("."))
|
87
|
+
if /^127\.0\.0\./.match?(response)
|
88
|
+
throw :hit,
|
89
|
+
"#{rbl} positively resolved subdomain #{d} => #{response}"
|
90
|
+
end
|
91
|
+
rescue SocketError
|
92
|
+
# NXDOMAIN response => negative: d is not in RBL
|
93
|
+
next
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
false
|
98
|
+
end
|
99
|
+
|
100
|
+
def logger
|
101
|
+
@logger ||= ::Rails.logger || Logger.new(STDOUT)
|
102
|
+
end
|
103
|
+
end
|
data/lib/tasks/i18n.rake
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :manifest do
|
4
|
+
def gemmable_files
|
5
|
+
`git ls-files -z`.split("\x0").reject do |file|
|
6
|
+
file.match(%r{^(bin|spec)/}) ||
|
7
|
+
file.match(%r{/\.keep$}) ||
|
8
|
+
file.match(/^\./) ||
|
9
|
+
%w(Manifest.txt Gemfile Rakefile publify_core.gemspec).include?(file)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def manifest_files
|
14
|
+
File.open("Manifest.txt").readlines.map(&:chomp)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Create manifest"
|
18
|
+
task :create do
|
19
|
+
File.open("Manifest.txt", "w") do |manifest|
|
20
|
+
gemmable_files.each { |file| manifest.puts file }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Check manifest"
|
25
|
+
task :check do
|
26
|
+
unless gemmable_files == manifest_files
|
27
|
+
raise "Manifest check failed, try recreating the manifest"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,183 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "publify_plugins"
|
4
|
+
|
5
|
+
class TextFilterPlugin
|
6
|
+
class << self
|
7
|
+
include PublifyPlugins
|
8
|
+
include ActionView::Helpers::TextHelper
|
9
|
+
include ActionView::Helpers::TagHelper
|
10
|
+
end
|
11
|
+
|
12
|
+
@@filter_map = {}
|
13
|
+
def self.inherited(sub)
|
14
|
+
if sub.to_s =~ /^Plugin/ || sub.to_s =~ /^PublifyApp::Textfilter/
|
15
|
+
name = sub.short_name
|
16
|
+
@@filter_map[name] = sub
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.filter_map
|
21
|
+
@@filter_map
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.available_filters
|
25
|
+
filter_map.values
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.available_filter_types
|
29
|
+
unless @cached_filter_types
|
30
|
+
types = { "macropre" => [],
|
31
|
+
"macropost" => [],
|
32
|
+
"markup" => [],
|
33
|
+
"postprocess" => [],
|
34
|
+
"other" => [] }
|
35
|
+
|
36
|
+
available_filters.each { |filter| types[filter.filter_type].push(filter) }
|
37
|
+
|
38
|
+
@cached_filter_types = types
|
39
|
+
end
|
40
|
+
@cached_filter_types
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.macro_filters
|
44
|
+
available_filters.select { |filter| TextFilterPlugin::Macro > filter }
|
45
|
+
end
|
46
|
+
|
47
|
+
plugin_display_name "Unknown Text Filter"
|
48
|
+
plugin_description "Unknown Text Filter Description"
|
49
|
+
|
50
|
+
def self.reloadable?
|
51
|
+
false
|
52
|
+
end
|
53
|
+
|
54
|
+
# The name that needs to be used when refering to the plugin's
|
55
|
+
# controller in render statements
|
56
|
+
def self.component_name
|
57
|
+
if to_s =~ /::([a-zA-Z]+)$/
|
58
|
+
"plugins/textfilters/#{Regexp.last_match[1]}".downcase
|
59
|
+
else
|
60
|
+
raise "I don't know who I am: #{self}"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# The name that's stored in the DB. This is the final chunk of the
|
65
|
+
# controller name, like 'markdown' or 'smartypants'.
|
66
|
+
def self.short_name
|
67
|
+
component_name.split(%r{/}).last
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.filter_type
|
71
|
+
"other"
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.default_config
|
75
|
+
{}
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.help_text
|
79
|
+
""
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.sanitize(*args)
|
83
|
+
(@sanitizer ||= Rails::Html::WhiteListSanitizer.new).sanitize(*args)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.default_helper_module!; end
|
87
|
+
|
88
|
+
# Look up a config paramater, falling back to the default as needed.
|
89
|
+
def self.config_value(params, name)
|
90
|
+
params[:filterparams][name] || default_config[name][:default]
|
91
|
+
end
|
92
|
+
|
93
|
+
def self.logger
|
94
|
+
@logger ||= ::Rails.logger || Logger.new(STDOUT)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class TextFilterPlugin::PostProcess < TextFilterPlugin
|
99
|
+
def self.filter_type
|
100
|
+
"postprocess"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
class TextFilterPlugin::Macro < TextFilterPlugin
|
105
|
+
# Utility function -- hand it a XML string like <a href="foo" title="bar">
|
106
|
+
# and it'll give you back { "href" => "foo", "title" => "bar" }
|
107
|
+
def self.attributes_parse(string)
|
108
|
+
attributes = {}
|
109
|
+
|
110
|
+
string.gsub(/([^ =]+="[^"]*")/) do |match|
|
111
|
+
key, value = match.split(/=/, 2)
|
112
|
+
attributes[key] = value.delete('"')
|
113
|
+
end
|
114
|
+
|
115
|
+
string.gsub(/([^ =]+='[^']*')/) do |match|
|
116
|
+
key, value = match.split(/=/, 2)
|
117
|
+
attributes[key] = value.delete("'")
|
118
|
+
end
|
119
|
+
|
120
|
+
attributes
|
121
|
+
end
|
122
|
+
|
123
|
+
def self.filtertext(text)
|
124
|
+
regex1 = %r{<publify:#{short_name}(?:[ \t][^>]*)?/>}
|
125
|
+
regex2 = %r{<publify:#{short_name}([ \t][^>]*)?>(.*?)</publify:#{short_name}>}m
|
126
|
+
|
127
|
+
new_text = text.gsub(regex1) do |match|
|
128
|
+
macrofilter(attributes_parse(match))
|
129
|
+
end
|
130
|
+
|
131
|
+
new_text = new_text.gsub(regex2) do |_match|
|
132
|
+
macrofilter(attributes_parse(Regexp.last_match[1].to_s), Regexp.last_match[2].to_s)
|
133
|
+
end
|
134
|
+
|
135
|
+
new_text
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
class TextFilterPlugin::MacroPre < TextFilterPlugin::Macro
|
140
|
+
def self.filter_type
|
141
|
+
"macropre"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
class TextFilterPlugin::MacroPost < TextFilterPlugin::Macro
|
146
|
+
def self.filter_type
|
147
|
+
"macropost"
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
class TextFilterPlugin::Markup < TextFilterPlugin
|
152
|
+
def self.filter_type
|
153
|
+
"markup"
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
class PublifyApp
|
158
|
+
class Textfilter
|
159
|
+
class MacroPost < TextFilterPlugin
|
160
|
+
plugin_display_name "MacroPost"
|
161
|
+
plugin_description "Macro expansion meta-filter (post-markup)"
|
162
|
+
|
163
|
+
def self.filtertext(text)
|
164
|
+
macros = TextFilterPlugin.available_filter_types["macropost"]
|
165
|
+
macros.reduce(text) do |new_text, macro|
|
166
|
+
macro.filtertext(new_text)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
class MacroPre < TextFilterPlugin
|
172
|
+
plugin_display_name "MacroPre"
|
173
|
+
plugin_description "Macro expansion meta-filter (pre-markup)"
|
174
|
+
|
175
|
+
def self.filtertext(text)
|
176
|
+
macros = TextFilterPlugin.available_filter_types["macropre"]
|
177
|
+
macros.reduce(text) do |new_text, macro|
|
178
|
+
macro.filtertext(new_text)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
data/lib/theme.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Theme
|
4
|
+
attr_accessor :name, :path, :description_html
|
5
|
+
|
6
|
+
def initialize(name, path)
|
7
|
+
@name = name
|
8
|
+
@path = path
|
9
|
+
end
|
10
|
+
|
11
|
+
def layout(action = :default)
|
12
|
+
if action.to_s == "view_page"
|
13
|
+
return "layouts/pages" if File.exist? "#{view_path}/layouts/pages.html.erb"
|
14
|
+
end
|
15
|
+
"layouts/default"
|
16
|
+
end
|
17
|
+
|
18
|
+
def description
|
19
|
+
about_file = "#{path}/about.markdown"
|
20
|
+
if File.exist? about_file
|
21
|
+
File.read about_file
|
22
|
+
else
|
23
|
+
"### #{name}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def view_path
|
28
|
+
"#{path}/views"
|
29
|
+
end
|
30
|
+
|
31
|
+
# Find a theme, given the theme name
|
32
|
+
def self.find(name)
|
33
|
+
registered_themes[name]
|
34
|
+
end
|
35
|
+
|
36
|
+
# List all themes
|
37
|
+
def self.find_all
|
38
|
+
registered_themes.values
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.register_theme(path)
|
42
|
+
theme = theme_from_path(path)
|
43
|
+
registered_themes[theme.name] = theme
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.register_themes(themes_root)
|
47
|
+
search_theme_directory(themes_root).each do |path|
|
48
|
+
register_theme path
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Private
|
53
|
+
|
54
|
+
def self.registered_themes
|
55
|
+
@registered_themes ||= {}
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.theme_from_path(path)
|
59
|
+
name = path.scan(/[-\w]+$/i).flatten.first
|
60
|
+
new(name, path)
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.search_theme_directory(themes_root)
|
64
|
+
glob = "#{themes_root}/[a-zA-Z0-9]*"
|
65
|
+
Dir.glob(glob).select do |file|
|
66
|
+
File.readable?("#{file}/about.markdown")
|
67
|
+
end.compact
|
68
|
+
end
|
69
|
+
|
70
|
+
private_class_method :search_theme_directory,
|
71
|
+
:theme_from_path, :registered_themes
|
72
|
+
end
|
data/lib/transforms.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# FIXME: Replace with helpers and/or methods provided by Rails
|
4
|
+
class String
|
5
|
+
ACCENTS = { %w(á à â ä ã Ã Ä Â À) => "a",
|
6
|
+
%w(é è ê ë Ë É È Ê) => "e",
|
7
|
+
%w(í ì î ï I Î Ì) => "i",
|
8
|
+
%w(ó ò ô ö õ Õ Ö Ô Ò) => "o",
|
9
|
+
["œ"] => "oe",
|
10
|
+
["ß"] => "ss",
|
11
|
+
%w(ú ù û ü U Û Ù) => "u",
|
12
|
+
%w(ç Ç) => "c" }.freeze
|
13
|
+
|
14
|
+
def to_permalink
|
15
|
+
string = self
|
16
|
+
ACCENTS.each do |key, value|
|
17
|
+
string = string.tr(key.join, value)
|
18
|
+
end
|
19
|
+
string = string.tr("'", "-")
|
20
|
+
string.gsub(/<[^>]*>/, "").to_url
|
21
|
+
end
|
22
|
+
|
23
|
+
# Returns a-string-with-dashes when passed 'a string with dashes'.
|
24
|
+
# All special chars are stripped in the process
|
25
|
+
def to_url
|
26
|
+
return if nil?
|
27
|
+
|
28
|
+
s = downcase.tr("\"'", "")
|
29
|
+
s = s.gsub(/\P{Word}/, " ")
|
30
|
+
s.strip.tr_s(" ", "-").tr(" ", "-").sub(/^$/, "-")
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_title(item, settings, params)
|
34
|
+
TitleBuilder.new(self).build(item, settings, params)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Strips any html markup from a string
|
38
|
+
TYPO_TAG_KEY = TYPO_ATTRIBUTE_KEY = /[\w:_-]+/.freeze
|
39
|
+
TYPO_ATTRIBUTE_VALUE = /(?:[A-Za-z0-9]+|(?:'[^']*?'|"[^"]*?"))/.freeze
|
40
|
+
TYPO_ATTRIBUTE = /(?:#{TYPO_ATTRIBUTE_KEY}(?:\s*=\s*#{TYPO_ATTRIBUTE_VALUE})?)/.freeze
|
41
|
+
TYPO_ATTRIBUTES = /(?:#{TYPO_ATTRIBUTE}(?:\s+#{TYPO_ATTRIBUTE})*)/.freeze
|
42
|
+
TAG =
|
43
|
+
%r{<[!/?\[]?(?:#{TYPO_TAG_KEY}|--)(?:\s+#{TYPO_ATTRIBUTES})?\s*(?:[!/?\]]+|--)?>}.freeze
|
44
|
+
def strip_html
|
45
|
+
gsub(TAG, "").gsub(/\s+/, " ").strip
|
46
|
+
end
|
47
|
+
end
|
File without changes
|
Binary file
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/* Fonts and colors */
|
2
|
+
body {
|
3
|
+
font-family: sans-serif;
|
4
|
+
}
|
5
|
+
h1 a, h2 a {
|
6
|
+
text-decoration: none;
|
7
|
+
color: black;
|
8
|
+
}
|
9
|
+
h1 a:hover, h2 a:hover {
|
10
|
+
text-decoration: underline;
|
11
|
+
}
|
12
|
+
div.header, div.footer {
|
13
|
+
text-align: center;
|
14
|
+
}
|
15
|
+
#errors {
|
16
|
+
border: red 1px solid;
|
17
|
+
border-radius: 0.5rem;
|
18
|
+
background-color: #f88;
|
19
|
+
padding: 1rem;
|
20
|
+
}
|
21
|
+
|
22
|
+
/*
|
23
|
+
* Simple horizontal layout based on a 20 4 20 4 20 grid
|
24
|
+
*/
|
25
|
+
div.container {
|
26
|
+
max-width: 44rem;
|
27
|
+
margin-left: auto;
|
28
|
+
margin-right: auto;
|
29
|
+
}
|
30
|
+
div.sidebar {
|
31
|
+
max-width: 20rem;
|
32
|
+
display: inline-block;
|
33
|
+
}
|
34
|
+
div.content, div.sidebar {
|
35
|
+
margin-bottom: 2rem;
|
36
|
+
}
|
37
|
+
|
38
|
+
@media(min-width: 68rem) {
|
39
|
+
div.container {
|
40
|
+
max-width: 68rem;
|
41
|
+
}
|
42
|
+
div.content {
|
43
|
+
width: 44rem;
|
44
|
+
float: left;
|
45
|
+
}
|
46
|
+
div.sidebar {
|
47
|
+
margin-left: 4rem;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
div.footer {
|
51
|
+
clear: both;
|
52
|
+
}
|
53
|
+
|
54
|
+
/* Admin tools */
|
55
|
+
.admintools {
|
56
|
+
float: right;
|
57
|
+
}
|