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,194 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "base64"
|
4
|
+
|
5
|
+
module Admin; end
|
6
|
+
|
7
|
+
class Admin::ContentController < Admin::BaseController
|
8
|
+
def index
|
9
|
+
@search = params[:search] || {}
|
10
|
+
@articles = this_blog.articles.search_with(@search).page(params[:page]).
|
11
|
+
per(this_blog.admin_display_elements)
|
12
|
+
|
13
|
+
if request.xhr?
|
14
|
+
respond_to do |format|
|
15
|
+
format.js {}
|
16
|
+
end
|
17
|
+
else
|
18
|
+
@article = Article.new(params[:article])
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def new
|
23
|
+
@article = Article::Factory.new(this_blog, current_user).default
|
24
|
+
load_resources
|
25
|
+
render layout: "editor"
|
26
|
+
end
|
27
|
+
|
28
|
+
def edit
|
29
|
+
return unless access_granted?(params[:id])
|
30
|
+
|
31
|
+
@article = Article.find(params[:id])
|
32
|
+
@article.text_filter ||= default_text_filter
|
33
|
+
@article.keywords = Tag.collection_to_string @article.tags
|
34
|
+
load_resources
|
35
|
+
render layout: "editor"
|
36
|
+
end
|
37
|
+
|
38
|
+
def create
|
39
|
+
article_factory = Article::Factory.new(this_blog, current_user)
|
40
|
+
@article = article_factory.get_or_build_from(params[:article][:id])
|
41
|
+
|
42
|
+
update_article_attributes
|
43
|
+
|
44
|
+
if @article.draft
|
45
|
+
@article.state = "draft"
|
46
|
+
elsif @article.draft?
|
47
|
+
@article.publish!
|
48
|
+
end
|
49
|
+
|
50
|
+
if @article.save
|
51
|
+
flash[:success] = I18n.t("admin.content.create.success")
|
52
|
+
redirect_to action: "index"
|
53
|
+
else
|
54
|
+
@article.keywords = Tag.collection_to_string @article.tags
|
55
|
+
load_resources
|
56
|
+
render "new", layout: "editor"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def update
|
61
|
+
return unless access_granted?(params[:id])
|
62
|
+
|
63
|
+
id = params[:article][:id] || params[:id]
|
64
|
+
@article = Article.find(id)
|
65
|
+
|
66
|
+
if params[:article][:draft]
|
67
|
+
fetch_fresh_or_existing_draft_for_article
|
68
|
+
else
|
69
|
+
@article = Article.find(@article.parent_id) unless @article.parent_id.nil?
|
70
|
+
end
|
71
|
+
|
72
|
+
update_article_attributes
|
73
|
+
|
74
|
+
if @article.draft
|
75
|
+
@article.state = "draft"
|
76
|
+
elsif @article.draft?
|
77
|
+
@article.publish!
|
78
|
+
end
|
79
|
+
|
80
|
+
if @article.save
|
81
|
+
Article.where(parent_id: @article.id).map(&:destroy) unless @article.draft
|
82
|
+
flash[:success] = I18n.t("admin.content.update.success")
|
83
|
+
redirect_to action: "index"
|
84
|
+
else
|
85
|
+
@article.keywords = Tag.collection_to_string @article.tags
|
86
|
+
load_resources
|
87
|
+
render "edit"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def destroy
|
92
|
+
destroy_a(Article)
|
93
|
+
end
|
94
|
+
|
95
|
+
def auto_complete_for_article_keywords
|
96
|
+
@items = Tag.select(:display_name).order(:display_name).map(&:display_name)
|
97
|
+
render json: @items
|
98
|
+
end
|
99
|
+
|
100
|
+
def autosave
|
101
|
+
return false unless request.xhr?
|
102
|
+
|
103
|
+
id = params[:article][:id] || params[:id]
|
104
|
+
|
105
|
+
article_factory = Article::Factory.new(this_blog, current_user)
|
106
|
+
@article = article_factory.get_or_build_from(id)
|
107
|
+
|
108
|
+
fetch_fresh_or_existing_draft_for_article
|
109
|
+
|
110
|
+
@article.attributes = params[:article].permit!
|
111
|
+
|
112
|
+
@article.id = nil if @article.new_record?
|
113
|
+
@article.author = current_user
|
114
|
+
@article.save_attachments!(params[:attachments])
|
115
|
+
@article.state = "draft" unless @article.withdrawn?
|
116
|
+
@article.text_filter_name ||= current_user.text_filter.name
|
117
|
+
|
118
|
+
if @article.title.blank?
|
119
|
+
lastid = Article.order("id desc").first.id
|
120
|
+
@article.title = "Draft article " + lastid.to_s
|
121
|
+
end
|
122
|
+
|
123
|
+
if @article.save
|
124
|
+
flash[:success] = I18n.t("admin.content.autosave.success")
|
125
|
+
@must_update_calendar =
|
126
|
+
(params[:article][:published_at] and
|
127
|
+
params[:article][:published_at].to_time.to_i < Time.zone.now.to_time.to_i and
|
128
|
+
@article.parent_id.nil?)
|
129
|
+
respond_to do |format|
|
130
|
+
format.js
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
protected
|
136
|
+
|
137
|
+
def fetch_fresh_or_existing_draft_for_article
|
138
|
+
return unless @article.published? && @article.id
|
139
|
+
|
140
|
+
parent_id = @article.id
|
141
|
+
@article =
|
142
|
+
this_blog.articles.drafts.child_of(parent_id).first || this_blog.articles.build
|
143
|
+
@article.allow_comments = this_blog.default_allow_comments
|
144
|
+
@article.allow_pings = this_blog.default_allow_pings
|
145
|
+
@article.parent_id = parent_id
|
146
|
+
end
|
147
|
+
|
148
|
+
attr_accessor :resources, :resource
|
149
|
+
|
150
|
+
private
|
151
|
+
|
152
|
+
def load_resources
|
153
|
+
@post_types = PostType.all
|
154
|
+
@macros = TextFilterPlugin.macro_filters
|
155
|
+
end
|
156
|
+
|
157
|
+
def access_granted?(article_id)
|
158
|
+
article = Article.find(article_id)
|
159
|
+
if article.access_by? current_user
|
160
|
+
true
|
161
|
+
else
|
162
|
+
flash[:error] = I18n.t("admin.content.access_granted.error")
|
163
|
+
redirect_to action: "index"
|
164
|
+
false
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
def update_article_attributes
|
169
|
+
@article.assign_attributes(update_params)
|
170
|
+
@article.author = current_user
|
171
|
+
@article.save_attachments!(params[:attachments])
|
172
|
+
@article.text_filter_name ||= default_text_filter
|
173
|
+
end
|
174
|
+
|
175
|
+
def update_params
|
176
|
+
params.
|
177
|
+
require(:article).
|
178
|
+
permit(:allow_comments,
|
179
|
+
:allow_pings,
|
180
|
+
:body,
|
181
|
+
:body_and_extended,
|
182
|
+
:resource_id,
|
183
|
+
:draft,
|
184
|
+
:extended,
|
185
|
+
:permalink,
|
186
|
+
:published_at,
|
187
|
+
:title,
|
188
|
+
:keywords)
|
189
|
+
end
|
190
|
+
|
191
|
+
def default_text_filter
|
192
|
+
current_user.text_filter || this_blog.text_filter
|
193
|
+
end
|
194
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Admin::DashboardController < Admin::BaseController
|
4
|
+
require "open-uri"
|
5
|
+
require "time"
|
6
|
+
require "rexml/document"
|
7
|
+
|
8
|
+
def index
|
9
|
+
today = Time.zone.now.strftime("%Y-%m-%d 00:00")
|
10
|
+
|
11
|
+
# Since last visit
|
12
|
+
last_sign_in = current_user.last_sign_in_at
|
13
|
+
@newposts_count = Article.published_since(last_sign_in).count
|
14
|
+
@newcomments_count = Feedback.created_since(last_sign_in).count
|
15
|
+
|
16
|
+
# Today
|
17
|
+
@statposts = Article.published.where("published_at > ?", today).count
|
18
|
+
@statsdrafts = Article.drafts.where("created_at > ?", today).count
|
19
|
+
@statspages = Page.where("published_at > ?", today).count
|
20
|
+
@statuses = Note.where("published_at > ?", today).count
|
21
|
+
@statuserposts = Article.published.where("published_at > ?", today).
|
22
|
+
where(user_id: current_user.id).count
|
23
|
+
@statcomments = Comment.where("created_at > ?", today).count
|
24
|
+
@presumedspam = Comment.presumed_spam.where("created_at > ?", today).count
|
25
|
+
@confirmed = Comment.ham.where("created_at > ?", today).count
|
26
|
+
@unconfirmed = Comment.unconfirmed.where("created_at > ?", today).count
|
27
|
+
|
28
|
+
@comments = Comment.last_published
|
29
|
+
@drafts = Article.drafts.where("user_id = ?", current_user.id).limit(5)
|
30
|
+
|
31
|
+
@statspam = Comment.spam.count
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,160 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Admin::FeedbackController < Admin::BaseController
|
4
|
+
ONLY_DOMAIN = %w(unapproved presumed_ham presumed_spam ham spam).freeze
|
5
|
+
|
6
|
+
def index
|
7
|
+
scoped_feedback = this_blog.feedback
|
8
|
+
|
9
|
+
if params[:only].present?
|
10
|
+
@only_param = ONLY_DOMAIN.dup.delete(params[:only])
|
11
|
+
scoped_feedback = scoped_feedback.send(@only_param) if @only_param
|
12
|
+
end
|
13
|
+
|
14
|
+
params.delete(:page) if params[:page].blank? || params[:page] == "0"
|
15
|
+
|
16
|
+
@feedback = scoped_feedback.paginated(params[:page], this_blog.admin_display_elements)
|
17
|
+
end
|
18
|
+
|
19
|
+
def destroy
|
20
|
+
@record = Feedback.find params[:id]
|
21
|
+
|
22
|
+
unless @record.article.user_id == current_user.id
|
23
|
+
return redirect_to admin_feedback_index_url unless current_user.admin?
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
@record.destroy
|
28
|
+
flash[:success] = I18n.t("admin.feedback.destroy.success")
|
29
|
+
rescue ActiveRecord::RecordNotFound
|
30
|
+
flash[:error] = I18n.t("admin.feedback.destroy.error")
|
31
|
+
end
|
32
|
+
redirect_to action: "article", id: @record.article.id
|
33
|
+
end
|
34
|
+
|
35
|
+
def create
|
36
|
+
@article = Article.find(params[:article_id])
|
37
|
+
@comment = @article.comments.build(comment_params)
|
38
|
+
@comment.user_id = current_user.id
|
39
|
+
|
40
|
+
if request.post? && @comment.save
|
41
|
+
# We should probably wave a spam filter over this, but for now, just mark
|
42
|
+
# it as published.
|
43
|
+
@comment.mark_as_ham
|
44
|
+
@comment.save!
|
45
|
+
flash[:success] = I18n.t("admin.feedback.create.success")
|
46
|
+
end
|
47
|
+
redirect_to action: "article", id: @article.id
|
48
|
+
end
|
49
|
+
|
50
|
+
def edit
|
51
|
+
@comment = Comment.find(params[:id])
|
52
|
+
@article = @comment.article
|
53
|
+
unless @article.access_by? current_user
|
54
|
+
redirect_to admin_feedback_index_url
|
55
|
+
nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def update
|
60
|
+
comment = Comment.find(params[:id])
|
61
|
+
unless comment.article.access_by? current_user
|
62
|
+
redirect_to admin_feedback_index_url
|
63
|
+
return
|
64
|
+
end
|
65
|
+
comment.attributes = comment_params
|
66
|
+
if request.post? && comment.save
|
67
|
+
flash[:success] = I18n.t("admin.feedback.update.success")
|
68
|
+
redirect_to action: "article", id: comment.article.id
|
69
|
+
else
|
70
|
+
redirect_to action: "edit", id: comment.id
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def article
|
75
|
+
@article = this_blog.articles.find(params[:id])
|
76
|
+
@feedback = @article.comments
|
77
|
+
@feedback = @feedback.ham if params[:ham] && params[:spam].blank?
|
78
|
+
@feedback = @feedback.spam if params[:spam] && params[:ham].blank?
|
79
|
+
end
|
80
|
+
|
81
|
+
# TODO: Replace with actions that move to a specified state
|
82
|
+
def change_state
|
83
|
+
return unless request.xhr?
|
84
|
+
|
85
|
+
@feedback = Feedback.find(params[:id])
|
86
|
+
template = @feedback.change_state!
|
87
|
+
|
88
|
+
respond_to do |format|
|
89
|
+
# TODO: Make this special case not necessary
|
90
|
+
if params[:context] != "listing"
|
91
|
+
@comments = Comment.last_published
|
92
|
+
page.replace_html("commentList", partial: "admin/dashboard/comment")
|
93
|
+
elsif template == "ham"
|
94
|
+
format.js { render "ham" }
|
95
|
+
else
|
96
|
+
format.js { render "spam" }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def bulkops
|
102
|
+
ids = (params[:feedback_check] || {}).keys.map(&:to_i)
|
103
|
+
items = Feedback.find(ids)
|
104
|
+
@unexpired = true
|
105
|
+
|
106
|
+
bulkop = if (params[:bulkop_top] || {}).empty?
|
107
|
+
params[:bulkop_bottom]
|
108
|
+
else
|
109
|
+
params[:bulkop_top]
|
110
|
+
end
|
111
|
+
|
112
|
+
case bulkop
|
113
|
+
when "Delete Checked Items"
|
114
|
+
count = 0
|
115
|
+
ids.each do |id|
|
116
|
+
count += Feedback.delete(id)
|
117
|
+
end
|
118
|
+
flash[:success] = I18n.t("admin.feedback.bulkops.success_deleted", count: count)
|
119
|
+
when "Mark Checked Items as Ham"
|
120
|
+
update_feedback(items, :mark_as_ham!)
|
121
|
+
flash[:success] = I18n.t("admin.feedback.bulkops.success_mark_as_ham",
|
122
|
+
count: ids.size)
|
123
|
+
when "Mark Checked Items as Spam"
|
124
|
+
update_feedback(items, :mark_as_spam!)
|
125
|
+
flash[:success] = I18n.t("admin.feedback.bulkops.success_mark_as_spam",
|
126
|
+
count: ids.size)
|
127
|
+
when "Confirm Classification of Checked Items"
|
128
|
+
update_feedback(items, :confirm_classification!)
|
129
|
+
flash[:success] = I18n.t("admin.feedback.bulkops.success_classification",
|
130
|
+
count: ids.size)
|
131
|
+
when "Delete all spam"
|
132
|
+
if request.post?
|
133
|
+
Feedback.where("state = ?", "spam").delete_all
|
134
|
+
flash[:success] = I18n.t("admin.feedback.bulkops.success_deleted_spam")
|
135
|
+
end
|
136
|
+
else
|
137
|
+
flash[:error] = I18n.t("admin.feedback.bulkops.error")
|
138
|
+
end
|
139
|
+
|
140
|
+
if params[:article_id]
|
141
|
+
redirect_to action: "article", id: params[:article_id], confirmed: params[:confirmed],
|
142
|
+
published: params[:published]
|
143
|
+
else
|
144
|
+
redirect_to action: "index", page: params[:page], search: params[:search],
|
145
|
+
confirmed: params[:confirmed], published: params[:published]
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
private
|
150
|
+
|
151
|
+
def comment_params
|
152
|
+
params.require(:comment).permit(:author, :email, :url, :body)
|
153
|
+
end
|
154
|
+
|
155
|
+
def update_feedback(items, method)
|
156
|
+
items.each do |value|
|
157
|
+
value.send(method)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Admin::NotesController < Admin::BaseController
|
4
|
+
layout "administration"
|
5
|
+
|
6
|
+
before_action :load_existing_notes, only: [:index, :edit]
|
7
|
+
before_action :find_note, only: [:edit, :update, :show, :destroy]
|
8
|
+
|
9
|
+
def index
|
10
|
+
@note = new_note
|
11
|
+
end
|
12
|
+
|
13
|
+
def show
|
14
|
+
unless @note.access_by?(current_user)
|
15
|
+
flash[:error] = I18n.t("admin.base.not_allowed")
|
16
|
+
redirect_to admin_notes_url
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def edit; end
|
21
|
+
|
22
|
+
def create
|
23
|
+
note = new_note
|
24
|
+
|
25
|
+
note.state = "published"
|
26
|
+
note.attributes = params[:note].permit!
|
27
|
+
note.text_filter ||= default_text_filter
|
28
|
+
note.published_at ||= Time.zone.now
|
29
|
+
if note.save
|
30
|
+
if params[:push_to_twitter] && note.twitter_id.blank?
|
31
|
+
unless note.send_to_twitter
|
32
|
+
flash[:error] = I18n.t("errors.problem_sending_to_twitter")
|
33
|
+
flash[:error] += " : #{note.errors.full_messages.join(" ")}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
flash[:notice] = I18n.t("notice.note_successfully_created")
|
37
|
+
else
|
38
|
+
flash[:error] = note.errors.full_messages
|
39
|
+
end
|
40
|
+
redirect_to admin_notes_url
|
41
|
+
end
|
42
|
+
|
43
|
+
def update
|
44
|
+
@note.attributes = params[:note].permit!
|
45
|
+
@note.save
|
46
|
+
redirect_to admin_notes_url
|
47
|
+
end
|
48
|
+
|
49
|
+
def destroy
|
50
|
+
@note.destroy
|
51
|
+
flash[:notice] = I18n.t("admin.base.successfully_deleted", name: "note")
|
52
|
+
redirect_to admin_notes_url
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def load_existing_notes
|
58
|
+
@notes = Note.page(params[:page]).per(this_blog.limit_article_display)
|
59
|
+
end
|
60
|
+
|
61
|
+
def find_note
|
62
|
+
@note = Note.find(params[:id])
|
63
|
+
end
|
64
|
+
|
65
|
+
def new_note
|
66
|
+
this_blog.notes.build(author: current_user,
|
67
|
+
text_filter_name: default_text_filter)
|
68
|
+
end
|
69
|
+
|
70
|
+
def default_text_filter
|
71
|
+
current_user.text_filter_name || this_blog.text_filter
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "base64"
|
4
|
+
|
5
|
+
class Admin::PagesController < Admin::BaseController
|
6
|
+
before_action :set_macro, only: [:new, :edit]
|
7
|
+
before_action :set_page, only: [:edit, :update, :destroy]
|
8
|
+
|
9
|
+
def index
|
10
|
+
@search = params[:search] || {}
|
11
|
+
@pages = Page.search_with(@search).page(params[:page]).
|
12
|
+
per(this_blog.admin_display_elements)
|
13
|
+
end
|
14
|
+
|
15
|
+
def new
|
16
|
+
@page = Page.new
|
17
|
+
@page.text_filter_name ||= default_text_filter
|
18
|
+
@page.user_id = current_user.id
|
19
|
+
@page.state = "published"
|
20
|
+
render layout: "editor"
|
21
|
+
end
|
22
|
+
|
23
|
+
def edit
|
24
|
+
@page.text_filter_name ||= default_text_filter
|
25
|
+
render layout: "editor"
|
26
|
+
end
|
27
|
+
|
28
|
+
def create
|
29
|
+
@page = Page.new(page_params)
|
30
|
+
@page.published_at = Time.zone.now
|
31
|
+
@page.blog = this_blog
|
32
|
+
@page.user_id = current_user.id
|
33
|
+
|
34
|
+
if @page.save
|
35
|
+
redirect_to admin_pages_url, notice: I18n.t("admin.pages.new.success")
|
36
|
+
else
|
37
|
+
render :new, layout: "editor"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def update
|
42
|
+
@page.text_filter_name ||= default_text_filter
|
43
|
+
if @page.update(page_params)
|
44
|
+
redirect_to admin_pages_url, notice: I18n.t("admin.pages.edit.success")
|
45
|
+
else
|
46
|
+
render :edit
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def destroy
|
51
|
+
destroy_a(Page)
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
|
56
|
+
def default_text_filter
|
57
|
+
current_user.text_filter_name || this_blog.text_filter
|
58
|
+
end
|
59
|
+
|
60
|
+
def set_macro
|
61
|
+
@macros = TextFilterPlugin.macro_filters
|
62
|
+
end
|
63
|
+
|
64
|
+
# Use callbacks to share common setup or constraints between actions.
|
65
|
+
def set_page
|
66
|
+
@page = Page.find(params[:id])
|
67
|
+
end
|
68
|
+
|
69
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
70
|
+
def page_params
|
71
|
+
params.require(:page).permit(:title, :body, :name, :state, :text_filter_name)
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Admin::PostTypesController < Admin::BaseController
|
4
|
+
before_action :set_post_type, only: [:edit, :update, :destroy]
|
5
|
+
|
6
|
+
def index
|
7
|
+
@post_types = PostType.all
|
8
|
+
@post_type = PostType.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def edit
|
12
|
+
@post_types = PostType.all
|
13
|
+
end
|
14
|
+
|
15
|
+
def create
|
16
|
+
@post_type = PostType.new(post_type_params)
|
17
|
+
|
18
|
+
if @post_type.save
|
19
|
+
redirect_to admin_post_types_url, notice: "Post type was successfully created."
|
20
|
+
else
|
21
|
+
render :index
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def update
|
26
|
+
if @post_type.update(post_type_params)
|
27
|
+
redirect_to admin_post_types_url, notice: "Post type was successfully updated."
|
28
|
+
else
|
29
|
+
render :edit
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def destroy
|
34
|
+
# Reset all Articles from the PostType we're destroying to the default PostType
|
35
|
+
# Wrap it in a transaction for safety
|
36
|
+
@post_type.transaction do
|
37
|
+
Article.where("post_type = ?", @post_type.permalink).each do |article|
|
38
|
+
article.post_type = "read"
|
39
|
+
article.save
|
40
|
+
end
|
41
|
+
@post_type.destroy
|
42
|
+
end
|
43
|
+
redirect_to admin_post_types_url, notice: "Post was successfully destroyed."
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
# Use callbacks to share common setup or constraints between actions.
|
49
|
+
def set_post_type
|
50
|
+
@post_type = PostType.find(params[:id])
|
51
|
+
end
|
52
|
+
|
53
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
54
|
+
def post_type_params
|
55
|
+
params.require(:post_type).permit(:name, :description)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This controller handles updating your own user data.
|
4
|
+
class Admin::ProfilesController < Admin::BaseController
|
5
|
+
before_action :set_user, only: [:index, :update]
|
6
|
+
|
7
|
+
def index; end
|
8
|
+
|
9
|
+
def update
|
10
|
+
@user.resource = upload_avatar if params[:user][:filename]
|
11
|
+
|
12
|
+
if @user.update(update_params)
|
13
|
+
redirect_to admin_profiles_url, notice: I18n.t("admin.profiles.index.success")
|
14
|
+
else
|
15
|
+
render :index
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def upload_avatar
|
22
|
+
file = params[:user][:filename]
|
23
|
+
|
24
|
+
mime = if file.content_type
|
25
|
+
file.content_type.chomp
|
26
|
+
else
|
27
|
+
"text/plain"
|
28
|
+
end
|
29
|
+
|
30
|
+
Resource.create(upload: file, mime: mime, created_at: Time.zone.now)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Use callbacks to share common setup or constraints between actions.
|
34
|
+
def set_user
|
35
|
+
@user = current_user
|
36
|
+
end
|
37
|
+
|
38
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
39
|
+
def user_params
|
40
|
+
params.require(:user).permit(:login, :password, :password_confirmation,
|
41
|
+
:email, :firstname, :lastname, :nickname,
|
42
|
+
:name, :notify_via_email,
|
43
|
+
:notify_on_new_articles, :notify_on_comments,
|
44
|
+
:text_filter_id, :state,
|
45
|
+
:twitter_account, :twitter_oauth_token,
|
46
|
+
:twitter_oauth_token_secret, :description,
|
47
|
+
:url, :msn, :yahoo, :jabber, :aim, :twitter)
|
48
|
+
end
|
49
|
+
|
50
|
+
def update_params
|
51
|
+
if user_params[:password].blank? && user_params[:password_confirmation].blank?
|
52
|
+
user_params.except(:password_confirmation, :password)
|
53
|
+
else
|
54
|
+
user_params
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Admin::RedirectsController < Admin::BaseController
|
4
|
+
before_action :set_redirect, only: [:edit, :update, :destroy]
|
5
|
+
|
6
|
+
def index
|
7
|
+
@redirects = Redirect.where(content_id: nil).order("id desc").page(params[:page]).
|
8
|
+
per(this_blog.admin_display_elements)
|
9
|
+
@redirect = Redirect.new
|
10
|
+
end
|
11
|
+
|
12
|
+
def edit
|
13
|
+
@redirects = Redirect.where(content_id: nil).order("id desc").page(params[:page]).
|
14
|
+
per(this_blog.admin_display_elements)
|
15
|
+
end
|
16
|
+
|
17
|
+
def create
|
18
|
+
@redirect = this_blog.redirects.build(redirect_params)
|
19
|
+
|
20
|
+
if @redirect.save
|
21
|
+
redirect_to admin_redirects_url, notice: "Redirect was successfully created."
|
22
|
+
else
|
23
|
+
render :index
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def update
|
28
|
+
if @redirect.update(redirect_params)
|
29
|
+
redirect_to admin_redirects_url, notice: "Redirect was successfully updated."
|
30
|
+
else
|
31
|
+
render :edit
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def destroy
|
36
|
+
@redirect.destroy
|
37
|
+
redirect_to admin_redirects_url, notice: I18n.t("admin.redirects.destroy.success")
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
# Use callbacks to share common setup or constraints between actions.
|
43
|
+
def set_redirect
|
44
|
+
@redirect = Redirect.find(params[:id])
|
45
|
+
end
|
46
|
+
|
47
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
48
|
+
def redirect_params
|
49
|
+
params.require(:redirect).permit(:from_path, :to_path)
|
50
|
+
end
|
51
|
+
end
|