publify_core 9.0.0.pre1
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 +7 -0
- data/MIT-LICENSE +21 -0
- data/README.rdoc +3 -0
- data/Rakefile +35 -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/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 +138 -0
- data/app/assets/javascripts/quicktags.js +440 -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/javascripts/widearea.js +486 -0
- data/app/assets/stylesheets/accounts.css.scss +7 -0
- data/app/assets/stylesheets/administration_structure.css.scss +239 -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 +11 -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/assets/stylesheets/widearea.css +133 -0
- data/app/controllers/accounts_controller.rb +2 -0
- data/app/controllers/admin/base_controller.rb +41 -0
- data/app/controllers/admin/cache_controller.rb +33 -0
- data/app/controllers/admin/content_controller.rb +174 -0
- data/app/controllers/admin/dashboard_controller.rb +87 -0
- data/app/controllers/admin/feedback_controller.rb +159 -0
- data/app/controllers/admin/migrations_controller.rb +20 -0
- data/app/controllers/admin/notes_controller.rb +69 -0
- data/app/controllers/admin/pages_controller.rb +88 -0
- data/app/controllers/admin/post_types_controller.rb +56 -0
- data/app/controllers/admin/profiles_controller.rb +48 -0
- data/app/controllers/admin/redirects_controller.rb +47 -0
- data/app/controllers/admin/resources_controller.rb +30 -0
- data/app/controllers/admin/seo_controller.rb +45 -0
- data/app/controllers/admin/settings_controller.rb +53 -0
- data/app/controllers/admin/sidebar_controller.rb +66 -0
- data/app/controllers/admin/tags_controller.rb +53 -0
- data/app/controllers/admin/textfilters_controller.rb +6 -0
- data/app/controllers/admin/themes_controller.rb +37 -0
- data/app/controllers/admin/users_controller.rb +65 -0
- data/app/controllers/articles_controller.rb +205 -0
- data/app/controllers/authors_controller.rb +27 -0
- data/app/controllers/base_controller.rb +45 -0
- data/app/controllers/comments_controller.rb +69 -0
- data/app/controllers/content_controller.rb +31 -0
- data/app/controllers/feedback_controller.rb +47 -0
- data/app/controllers/notes_controller.rb +37 -0
- data/app/controllers/setup_controller.rb +62 -0
- data/app/controllers/tags_controller.rb +55 -0
- data/app/controllers/text_controller.rb +9 -0
- data/app/controllers/textfilter_controller.rb +3 -0
- data/app/controllers/theme_controller.rb +59 -0
- data/app/controllers/trackbacks_controller.rb +36 -0
- data/app/controllers/xml_controller.rb +70 -0
- data/app/helpers/admin/base_helper.rb +87 -0
- data/app/helpers/admin/feedback_helper.rb +42 -0
- data/app/helpers/articles_helper.rb +8 -0
- data/app/helpers/authors_helper.rb +39 -0
- data/app/helpers/base_helper.rb +246 -0
- data/app/helpers/blog_helper.rb +12 -0
- data/app/helpers/xml_helper.rb +16 -0
- data/app/mailers/notification_mailer.rb +38 -0
- data/app/models/ability.rb +52 -0
- data/app/models/archives_sidebar.rb +45 -0
- data/app/models/article/factory.rb +56 -0
- data/app/models/article/states.rb +178 -0
- data/app/models/article.rb +321 -0
- data/app/models/blog.rb +290 -0
- data/app/models/blog_sweeper.rb +86 -0
- data/app/models/comment.rb +53 -0
- data/app/models/config_manager.rb +81 -0
- data/app/models/content.rb +138 -0
- data/app/models/content_base.rb +95 -0
- data/app/models/feedback/states.rb +256 -0
- data/app/models/feedback.rb +225 -0
- data/app/models/meta_sidebar.rb +8 -0
- data/app/models/note.rb +144 -0
- data/app/models/page.rb +36 -0
- data/app/models/page_cache.rb +33 -0
- data/app/models/page_sidebar.rb +12 -0
- data/app/models/ping.rb +116 -0
- data/app/models/post_type.rb +15 -0
- data/app/models/redirect.rb +45 -0
- data/app/models/redirection.rb +4 -0
- data/app/models/resource.rb +28 -0
- data/app/models/search_sidebar.rb +7 -0
- data/app/models/sidebar.rb +138 -0
- data/app/models/static_sidebar.rb +20 -0
- data/app/models/tag.rb +63 -0
- data/app/models/tag_sidebar.rb +27 -0
- data/app/models/text_filter.rb +61 -0
- data/app/models/trackback.rb +58 -0
- data/app/models/trigger.rb +45 -0
- data/app/models/user.rb +148 -0
- data/app/services/migrator.rb +25 -0
- data/app/services/title_builder.rb +80 -0
- data/app/uploaders/resource_uploader.rb +30 -0
- data/app/views/accounts/confirm.html.erb +8 -0
- data/app/views/admin/cache/show.html.erb +18 -0
- data/app/views/admin/content/_article_list.html.erb +26 -0
- data/app/views/admin/content/_form.html.erb +165 -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/_inbound.html.erb +31 -0
- data/app/views/admin/dashboard/_overview.html.erb +23 -0
- data/app/views/admin/dashboard/_welcome.html.erb +28 -0
- data/app/views/admin/dashboard/index.html.erb +17 -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 +68 -0
- data/app/views/admin/seo/_general.html.erb +123 -0
- data/app/views/admin/seo/_permalinks.html.erb +53 -0
- data/app/views/admin/seo/_titles.html.erb +210 -0
- data/app/views/admin/seo/show.html.erb +32 -0
- data/app/views/admin/settings/display.html.erb +110 -0
- data/app/views/admin/settings/feedback.html.erb +125 -0
- data/app/views/admin/settings/index.html.erb +73 -0
- data/app/views/admin/settings/write.html.erb +87 -0
- data/app/views/admin/shared/_edit.html.erb +4 -0
- data/app/views/admin/shared/_menu.html.erb +122 -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/_article.html.erb +9 -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 +13 -0
- data/app/views/articles/_article_links.html.erb +10 -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 +2 -0
- data/app/views/articles/_password_form.html.erb +10 -0
- data/app/views/articles/_protected_article_content.html.erb +6 -0
- data/app/views/articles/_trackback.html.erb +6 -0
- data/app/views/articles/archives.html.erb +25 -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 +8 -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 +8 -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 +61 -0
- data/app/views/articles/search.html.erb +8 -0
- data/app/views/articles/trackback.xml.builder +5 -0
- data/app/views/articles/view_page.html.erb +3 -0
- data/app/views/authors/show.html.erb +40 -0
- data/app/views/authors/show_atom_feed.atom.builder +8 -0
- data/app/views/authors/show_rss_feed.rss.builder +20 -0
- data/app/views/comments/_comment.html.erb +16 -0
- data/app/views/comments/index.html.erb +1 -0
- data/app/views/comments/index_atom_feed.atom.builder +8 -0
- data/app/views/comments/index_rss_feed.rss.builder +20 -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 +13 -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 +15 -0
- data/app/views/errors/404.html.erb +2 -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 +32 -0
- data/app/views/layouts/editor.html.erb +31 -0
- data/app/views/meta_sidebar/_content.html.erb +8 -0
- data/app/views/notes/_note.html.erb +15 -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 +16 -0
- data/app/views/notification_mailer/_mail_footer.html.erb +7 -0
- data/app/views/notification_mailer/_mail_header.html.erb +1 -0
- data/app/views/notification_mailer/article.html.erb +6 -0
- data/app/views/notification_mailer/comment.html.erb +11 -0
- data/app/views/notification_mailer/notif_user.html.erb +14 -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 +13 -0
- data/app/views/shared/_atom_header.atom.builder +6 -0
- data/app/views/shared/_atom_item_article.atom.builder +39 -0
- data/app/views/shared/_atom_item_comment.atom.builder +10 -0
- data/app/views/shared/_atom_item_trackback.atom.builder +9 -0
- data/app/views/shared/_flash.erb +10 -0
- data/app/views/shared/_page_header.html.erb +26 -0
- data/app/views/shared/_rss_item_article.rss.builder +35 -0
- data/app/views/shared/_rss_item_comment.rss.builder +8 -0
- data/app/views/shared/_rss_item_trackback.rss.builder +7 -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/trackbacks/index_atom_feed.atom.builder +7 -0
- data/app/views/trackbacks/index_rss_feed.rss.builder +20 -0
- data/app/views/trackbacks/trackback.xml.builder +4 -0
- data/app/views/xml/_googlesitemap_item_article.googlesitemap.builder +5 -0
- data/app/views/xml/_googlesitemap_item_category.googlesitemap.builder +4 -0
- data/app/views/xml/_googlesitemap_item_page.googlesitemap.builder +4 -0
- data/app/views/xml/_googlesitemap_item_tag.googlesitemap.builder +4 -0
- data/app/views/xml/feed.googlesitemap.builder +7 -0
- data/app/views/xml/rsd.rsd.builder +8 -0
- data/config/i18n-tasks.yml +49 -0
- data/config/initializers/devise.rb +265 -0
- data/config/initializers/mime_types.rb +6 -0
- data/config/locales/da.yml +827 -0
- data/config/locales/de.yml +827 -0
- data/config/locales/en.yml +827 -0
- data/config/locales/es-MX.yml +827 -0
- data/config/locales/fr.yml +827 -0
- data/config/locales/he.yml +827 -0
- data/config/locales/it.yml +827 -0
- data/config/locales/ja.yml +827 -0
- data/config/locales/lt.yml +827 -0
- data/config/locales/nb-NO.yml +827 -0
- data/config/locales/nl.yml +827 -0
- data/config/locales/pl.yml +827 -0
- data/config/locales/pt-BR.yml +827 -0
- data/config/locales/ro.yml +827 -0
- data/config/locales/ru.yml +827 -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 +827 -0
- data/config/locales/zh-TW.yml +827 -0
- data/config/routes.rb +177 -0
- data/db/migrate/113_initial_schema.rb +205 -0
- data/db/migrate/114_fixes_buggy_articles_and_notes.rb +52 -0
- data/db/migrate/115_drops_categories_for_tags.rb +34 -0
- data/db/migrate/20150207131657_add_missing_indexes.rb +19 -0
- data/db/migrate/20150807134129_simplify_redirect_relations.rb +38 -0
- data/db/migrate/20150808052637_add_blog_ids.rb +33 -0
- data/db/migrate/20150808191127_add_blog_id_to_redirects.rb +15 -0
- data/db/migrate/20150810094754_add_blog_id_to_tags.rb +15 -0
- data/db/migrate/20160108111120_add_devise_to_users.rb +53 -0
- data/db/migrate/20160108184201_move_last_connection_to_last_sign_in_at.rb +16 -0
- data/db/migrate/20160110094906_remove_profiles_rights.rb +14 -0
- data/db/migrate/20160605103918_replace_profile_id_with_string.rb +30 -0
- data/db/migrate/20160605154632_remove_profiles.rb +24 -0
- data/db/migrate/20160701061851_demand_blog_id_on_contents.rb +9 -0
- data/db/migrate/20160701062604_add_blog_id_to_resources.rb +28 -0
- data/db/seeds.rb +37 -0
- data/lib/email_notify.rb +26 -0
- data/lib/format.rb +17 -0
- data/lib/publify_core/engine.rb +23 -0
- data/lib/publify_core/lang.rb +5 -0
- data/lib/publify_core/version.rb +3 -0
- data/lib/publify_core.rb +56 -0
- data/lib/publify_guid.rb +9 -0
- data/lib/publify_plugins.rb +72 -0
- data/lib/publify_textfilter_markdown.rb +44 -0
- data/lib/publify_textfilter_none.rb +14 -0
- data/lib/publify_textfilter_smartypants.rb +14 -0
- data/lib/publify_textfilter_textile.rb +21 -0
- data/lib/publify_textfilter_twitterfilter.rb +33 -0
- data/lib/publify_time.rb +30 -0
- data/lib/sidebar_field.rb +115 -0
- data/lib/sidebar_registry.rb +33 -0
- data/lib/spam_protection.rb +101 -0
- data/lib/stateful.rb +106 -0
- data/lib/tasks/publify_core_tasks.rake +4 -0
- data/lib/text_filter_plugin.rb +182 -0
- data/lib/theme.rb +72 -0
- data/lib/transforms.rb +45 -0
- metadata +865 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
Rails.application.routes.draw do
|
2
|
+
devise_for :users
|
3
|
+
# TODO: use only in archive sidebar. See how made other system
|
4
|
+
get ':year/:month', to: 'articles#index', year: /\d{4}/, month: /\d{1,2}/, as: 'articles_by_month', format: false
|
5
|
+
get ':year/:month/page/:page', to: 'articles#index', year: /\d{4}/, month: /\d{1,2}/, as: 'articles_by_month_page', format: false
|
6
|
+
get ':year', to: 'articles#index', year: /\d{4}/, as: 'articles_by_year', format: false
|
7
|
+
get ':year/page/:page', to: 'articles#index', year: /\d{4}/, as: 'articles_by_year_page', format: false
|
8
|
+
|
9
|
+
get 'articles.:format', to: 'articles#index', constraints: {format: 'rss'}, as: 'rss'
|
10
|
+
get 'articles.:format', to: 'articles#index', constraints: {format: 'atom'}, as: 'atom'
|
11
|
+
|
12
|
+
scope controller: 'xml', path: 'xml' do
|
13
|
+
get 'articlerss/:id/feed.xml', action: 'articlerss', format: false
|
14
|
+
get 'commentrss/feed.xml', action: 'commentrss', format: false
|
15
|
+
get 'trackbackrss/feed.xml', action: 'trackbackrss', format: false
|
16
|
+
end
|
17
|
+
|
18
|
+
get 'xml/:format', to: 'xml#feed', type: 'feed', constraints: {format: 'rss'}, as: 'xml'
|
19
|
+
get 'sitemap.xml', to: 'xml#feed', format: 'googlesitemap', type: 'sitemap', as: 'sitemap_xml'
|
20
|
+
|
21
|
+
scope controller: 'xml', path: 'xml', as: 'xml' do
|
22
|
+
scope action: 'feed' do
|
23
|
+
get ':format/feed.xml', type: 'feed'
|
24
|
+
get ':format/:type/:id/feed.xml'
|
25
|
+
get ':format/:type/feed.xml'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
get 'xml/rsd', to: 'xml#rsd', format: false
|
30
|
+
get 'xml/feed', to: 'xml#feed'
|
31
|
+
|
32
|
+
# CommentsController
|
33
|
+
resources :comments, as: 'admin_comments', only: [:index, :create] do
|
34
|
+
collection do
|
35
|
+
post :preview
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
resources :trackbacks
|
40
|
+
|
41
|
+
# I thinks it's useless. More investigating
|
42
|
+
post "trackbacks/:id/:day/:month/:year", to: 'trackbacks#create', format: false
|
43
|
+
|
44
|
+
# ArticlesController
|
45
|
+
get '/live_search/', to: 'articles#live_search', as: :live_search_articles, format: false
|
46
|
+
get '/search/:q(.:format)/page/:page', to: 'articles#search', as: 'search', defaults: {page: 1}
|
47
|
+
get '/search(/:q(.:format))', to: 'articles#search'
|
48
|
+
get '/search/', to: 'articles#search', as: 'search_base', format: false
|
49
|
+
get '/archives/', to: 'articles#archives', format: false
|
50
|
+
get '/page/:page', to: 'articles#index', page: /\d+/, format: false
|
51
|
+
get '/pages/*name', to: 'articles#view_page', format: false
|
52
|
+
get 'previews(/:id)', to: 'articles#preview', format: false
|
53
|
+
get 'previews_pages(/:id)', to: 'articles#preview_page', format: false
|
54
|
+
get 'check_password', to: 'articles#check_password', format: false
|
55
|
+
get 'articles/markup_help/:id', to: 'articles#markup_help', format: false
|
56
|
+
get 'articles/tag', to: 'articles#tag', format: false
|
57
|
+
|
58
|
+
# SetupController
|
59
|
+
match '/setup', to: 'setup#index', via: [:get, :post], format: false
|
60
|
+
|
61
|
+
# TagsController (imitate inflected_resource)
|
62
|
+
resources :tags, only: [:index, :create, :new]
|
63
|
+
resources :tags, path: 'tag', only: [:show, :edit, :update, :destroy]
|
64
|
+
get '/tag/:id/page/:page', to: 'tags#show', format: false
|
65
|
+
get '/tags/page/:page', to: 'tags#index', format: false
|
66
|
+
|
67
|
+
resources :authors, path: 'author', only: :show
|
68
|
+
|
69
|
+
# ThemeController
|
70
|
+
scope controller: 'theme', filename: /.*/ do
|
71
|
+
get 'stylesheets/theme/:filename', action: 'stylesheets', format: false
|
72
|
+
get 'javascripts/theme/:filename', action: 'javascript', format: false
|
73
|
+
get 'images/theme/:filename', action: 'images', format: false
|
74
|
+
get 'fonts/theme/:filename', action: 'fonts', format: false
|
75
|
+
end
|
76
|
+
|
77
|
+
# For the tests
|
78
|
+
get 'theme/static_view_test', format: false
|
79
|
+
|
80
|
+
# For the statuses
|
81
|
+
get '/notes', to: 'notes#index', format: false
|
82
|
+
get '/notes/page/:page', to: 'notes#index', format: false
|
83
|
+
get '/note/:permalink', to: 'notes#show', format: false
|
84
|
+
|
85
|
+
get '/humans', to: 'text#humans', format: 'txt'
|
86
|
+
get '/robots', to: 'text#robots', format: 'txt'
|
87
|
+
|
88
|
+
# TODO: Remove if possible
|
89
|
+
resources :accounts, only: [], format: false do
|
90
|
+
collection do
|
91
|
+
get 'confirm'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
namespace :admin do
|
96
|
+
root 'dashboard#index', as: 'dashboard'
|
97
|
+
|
98
|
+
get 'cache', to: 'cache#show', format: false
|
99
|
+
delete 'cache', to: 'cache#destroy', format: false
|
100
|
+
|
101
|
+
resources :content, only: [:index, :new, :edit, :create, :update, :destroy], format: false do
|
102
|
+
collection do
|
103
|
+
get 'auto_complete_for_article_keywords'
|
104
|
+
post 'autosave'
|
105
|
+
put 'autosave'
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
resources :feedback, only: [:index, :edit, :create, :update, :destroy], format: false do
|
110
|
+
collection do
|
111
|
+
post 'bulkops'
|
112
|
+
end
|
113
|
+
member do
|
114
|
+
get 'article'
|
115
|
+
post 'change_state'
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
resources :notes, only: [:index, :show, :edit, :create, :update, :destroy], format: false
|
120
|
+
|
121
|
+
resources :pages, only: [:index, :new, :edit, :create, :update, :destroy], format: false
|
122
|
+
|
123
|
+
resources :post_types, only: [:index, :edit, :create, :update, :destroy], format: false
|
124
|
+
|
125
|
+
resources :profiles, only: [:index, :update], format: false
|
126
|
+
|
127
|
+
resources :redirects, only: [:index, :edit, :create, :update, :destroy], format: false
|
128
|
+
|
129
|
+
resources :resources, only: [:index, :destroy], format: false do
|
130
|
+
collection do
|
131
|
+
post 'upload'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
resource :seo, controller: 'seo', only: [:show, :update], format: false
|
136
|
+
resource :migrations, only: [:show, :update]
|
137
|
+
|
138
|
+
# TODO: This should be a singular resource
|
139
|
+
resource :settings, only: [], format: false do
|
140
|
+
collection do
|
141
|
+
get 'index'
|
142
|
+
get 'display'
|
143
|
+
get 'feedback'
|
144
|
+
get 'write'
|
145
|
+
post 'migrate'
|
146
|
+
post 'update'
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# TODO: This should have a plural resource name
|
151
|
+
resources :sidebar, only: [:index, :update, :destroy] do
|
152
|
+
collection do
|
153
|
+
put :publish
|
154
|
+
post :sortable
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
resources :tags, only: [:index, :edit, :create, :update, :destroy], format: false
|
159
|
+
|
160
|
+
# TODO: Work out if post is actually used or not.
|
161
|
+
get 'textfilters/macro_help(/:id)', to: 'textfilters#macro_help', id: nil, format: false
|
162
|
+
post 'textfilters/macro_help(/:id)', to: 'textfilters#macro_help', id: nil, format: false
|
163
|
+
|
164
|
+
resources :themes, only: [:index], format: false do
|
165
|
+
collection do
|
166
|
+
get 'preview'
|
167
|
+
get 'switchto'
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
resources :users, only: [:index, :new, :edit, :create, :update, :destroy], format: false
|
172
|
+
end
|
173
|
+
|
174
|
+
root 'articles#index'
|
175
|
+
|
176
|
+
get '*from', to: 'articles#redirect', format: false
|
177
|
+
end
|
@@ -0,0 +1,205 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
class InitialSchema < ActiveRecord::Migration
|
4
|
+
def change
|
5
|
+
create_table "articles_tags", id: false, force: true do |t|
|
6
|
+
t.integer "article_id"
|
7
|
+
t.integer "tag_id"
|
8
|
+
end
|
9
|
+
|
10
|
+
create_table "blogs", force: true do |t|
|
11
|
+
t.text "settings"
|
12
|
+
t.string "base_url"
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table "categories", force: true do |t|
|
16
|
+
t.string "name"
|
17
|
+
t.integer "position"
|
18
|
+
t.string "permalink"
|
19
|
+
t.text "keywords"
|
20
|
+
t.text "description"
|
21
|
+
t.integer "parent_id"
|
22
|
+
end
|
23
|
+
|
24
|
+
add_index "categories", ["permalink"]
|
25
|
+
|
26
|
+
create_table "categorizations", force: true do |t|
|
27
|
+
t.integer "article_id"
|
28
|
+
t.integer "category_id"
|
29
|
+
t.boolean "is_primary"
|
30
|
+
end
|
31
|
+
|
32
|
+
create_table "contents", force: true do |t|
|
33
|
+
t.string "type"
|
34
|
+
t.string "title"
|
35
|
+
t.string "author"
|
36
|
+
t.text "body"
|
37
|
+
t.text "extended"
|
38
|
+
t.text "excerpt"
|
39
|
+
t.datetime "created_at"
|
40
|
+
t.datetime "updated_at"
|
41
|
+
t.integer "user_id"
|
42
|
+
t.string "permalink"
|
43
|
+
t.string "guid"
|
44
|
+
t.integer "text_filter_id"
|
45
|
+
t.text "whiteboard"
|
46
|
+
t.string "name"
|
47
|
+
t.boolean "published", default: false
|
48
|
+
t.boolean "allow_pings"
|
49
|
+
t.boolean "allow_comments"
|
50
|
+
t.datetime "published_at"
|
51
|
+
t.string "state"
|
52
|
+
t.integer "parent_id"
|
53
|
+
t.text "settings"
|
54
|
+
t.string "post_type", default: "read"
|
55
|
+
end
|
56
|
+
|
57
|
+
add_index "contents", ["published"]
|
58
|
+
add_index "contents", ["text_filter_id"]
|
59
|
+
|
60
|
+
create_table "feedback", force: true do |t|
|
61
|
+
t.string "type"
|
62
|
+
t.string "title"
|
63
|
+
t.string "author"
|
64
|
+
t.text "body"
|
65
|
+
t.text "excerpt"
|
66
|
+
t.datetime "created_at"
|
67
|
+
t.datetime "updated_at"
|
68
|
+
t.integer "user_id"
|
69
|
+
t.string "guid"
|
70
|
+
t.integer "text_filter_id"
|
71
|
+
t.text "whiteboard"
|
72
|
+
t.integer "article_id"
|
73
|
+
t.string "email"
|
74
|
+
t.string "url"
|
75
|
+
t.string "ip", limit: 40
|
76
|
+
t.string "blog_name"
|
77
|
+
t.boolean "published", default: false
|
78
|
+
t.datetime "published_at"
|
79
|
+
t.string "state"
|
80
|
+
t.boolean "status_confirmed"
|
81
|
+
t.string "user_agent"
|
82
|
+
end
|
83
|
+
|
84
|
+
add_index "feedback", ["article_id"]
|
85
|
+
add_index "feedback", ["text_filter_id"]
|
86
|
+
|
87
|
+
create_table "page_caches", force: true do |t|
|
88
|
+
t.string "name"
|
89
|
+
end
|
90
|
+
|
91
|
+
add_index "page_caches", ["name"]
|
92
|
+
|
93
|
+
create_table "pings", force: true do |t|
|
94
|
+
t.integer "article_id"
|
95
|
+
t.string "url"
|
96
|
+
t.datetime "created_at"
|
97
|
+
end
|
98
|
+
|
99
|
+
add_index "pings", ["article_id"]
|
100
|
+
|
101
|
+
create_table "post_types", force: true do |t|
|
102
|
+
t.string "name"
|
103
|
+
t.string "permalink"
|
104
|
+
t.string "description"
|
105
|
+
end
|
106
|
+
|
107
|
+
create_table "profiles", force: true do |t|
|
108
|
+
t.string "label"
|
109
|
+
t.string "nicename"
|
110
|
+
t.text "modules"
|
111
|
+
end
|
112
|
+
|
113
|
+
create_table "profiles_rights", id: false, force: true do |t|
|
114
|
+
t.integer "profile_id"
|
115
|
+
t.integer "right_id"
|
116
|
+
end
|
117
|
+
|
118
|
+
create_table "redirections", force: true do |t|
|
119
|
+
t.integer "content_id"
|
120
|
+
t.integer "redirect_id"
|
121
|
+
end
|
122
|
+
|
123
|
+
create_table "redirects", force: true do |t|
|
124
|
+
t.string "from_path"
|
125
|
+
t.string "to_path"
|
126
|
+
t.string "origin"
|
127
|
+
t.datetime "created_at"
|
128
|
+
t.datetime "updated_at"
|
129
|
+
end
|
130
|
+
|
131
|
+
create_table "resources", force: true do |t|
|
132
|
+
t.integer "size"
|
133
|
+
t.string "upload"
|
134
|
+
t.string "mime"
|
135
|
+
t.datetime "created_at"
|
136
|
+
t.datetime "updated_at"
|
137
|
+
t.integer "article_id"
|
138
|
+
t.boolean "itunes_metadata"
|
139
|
+
t.string "itunes_author"
|
140
|
+
t.string "itunes_subtitle"
|
141
|
+
t.integer "itunes_duration"
|
142
|
+
t.text "itunes_summary"
|
143
|
+
t.string "itunes_keywords"
|
144
|
+
t.string "itunes_category"
|
145
|
+
t.boolean "itunes_explicit"
|
146
|
+
end
|
147
|
+
|
148
|
+
create_table "sidebars", force: true do |t|
|
149
|
+
t.integer "active_position"
|
150
|
+
t.text "config"
|
151
|
+
t.integer "staged_position"
|
152
|
+
t.string "type"
|
153
|
+
end
|
154
|
+
|
155
|
+
create_table "sitealizer", force: true do |t|
|
156
|
+
t.string "path"
|
157
|
+
t.string "ip"
|
158
|
+
t.string "referer"
|
159
|
+
t.string "language"
|
160
|
+
t.string "user_agent"
|
161
|
+
t.datetime "created_at"
|
162
|
+
t.date "created_on"
|
163
|
+
end
|
164
|
+
|
165
|
+
create_table "tags", force: true do |t|
|
166
|
+
t.string "name"
|
167
|
+
t.datetime "created_at"
|
168
|
+
t.datetime "updated_at"
|
169
|
+
t.string "display_name"
|
170
|
+
end
|
171
|
+
|
172
|
+
create_table "text_filters", force: true do |t|
|
173
|
+
t.string "name"
|
174
|
+
t.string "description"
|
175
|
+
t.string "markup"
|
176
|
+
t.text "filters"
|
177
|
+
t.text "params"
|
178
|
+
end
|
179
|
+
|
180
|
+
create_table "triggers", force: true do |t|
|
181
|
+
t.integer "pending_item_id"
|
182
|
+
t.string "pending_item_type"
|
183
|
+
t.datetime "due_at"
|
184
|
+
t.string "trigger_method"
|
185
|
+
end
|
186
|
+
|
187
|
+
create_table "users", force: true do |t|
|
188
|
+
t.string "login"
|
189
|
+
t.string "password"
|
190
|
+
t.text "email"
|
191
|
+
t.text "name"
|
192
|
+
t.boolean "notify_via_email"
|
193
|
+
t.boolean "notify_on_new_articles"
|
194
|
+
t.boolean "notify_on_comments"
|
195
|
+
t.integer "profile_id"
|
196
|
+
t.string "remember_token"
|
197
|
+
t.datetime "remember_token_expires_at"
|
198
|
+
t.string "text_filter_id", default: "1"
|
199
|
+
t.string "state", default: "active"
|
200
|
+
t.datetime "last_connection"
|
201
|
+
t.text "settings"
|
202
|
+
t.integer "resource_id"
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class FixesBuggyArticlesAndNotes < ActiveRecord::Migration
|
2
|
+
class Content < ActiveRecord::Base
|
3
|
+
|
4
|
+
end
|
5
|
+
|
6
|
+
class Article < Content
|
7
|
+
def set_permalink
|
8
|
+
return if state == 'draft' || permalink.present?
|
9
|
+
self.permalink = title.to_permalink
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class Note < Content
|
14
|
+
def set_permalink
|
15
|
+
self.permalink = "#{id}-#{body.to_permalink[0..79]}" if permalink.blank?
|
16
|
+
save
|
17
|
+
end
|
18
|
+
|
19
|
+
def create_guid
|
20
|
+
return true unless guid.blank?
|
21
|
+
|
22
|
+
self.guid = UUIDTools::UUID.random_create.to_s
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Page < Content
|
27
|
+
def set_permalink
|
28
|
+
self.name = title.to_permalink if name.blank?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.up
|
33
|
+
say "Fixing contents permalinks, this may take some time"
|
34
|
+
|
35
|
+
contents = Content.where("permalink is ? or permalink = ?", nil, '')
|
36
|
+
contents.each do |c|
|
37
|
+
c.set_permalink
|
38
|
+
c.save
|
39
|
+
end
|
40
|
+
|
41
|
+
say "Fixes empty notes GUID"
|
42
|
+
notes = Note.where("guid is ? or guid = ?", nil, '')
|
43
|
+
notes.each do |n|
|
44
|
+
n.create_guid
|
45
|
+
n.save
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.down
|
50
|
+
say "Nothing to do here"
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class DropsCategoriesForTags < ActiveRecord::Migration
|
2
|
+
class Categorization < ActiveRecord::Base
|
3
|
+
belongs_to :article
|
4
|
+
belongs_to :category
|
5
|
+
end
|
6
|
+
|
7
|
+
class Category < ActiveRecord::Base
|
8
|
+
has_many :categorizations
|
9
|
+
has_many :articles, :through => :categorizations
|
10
|
+
end
|
11
|
+
|
12
|
+
def up
|
13
|
+
# First, we migrate categories into tags
|
14
|
+
Category.find_each do |cat|
|
15
|
+
# Does a tag with the same permalink exist?
|
16
|
+
tag = Tag.find_or_create_by(name: cat.permalink) do |tg|
|
17
|
+
tg.display_name = cat.name
|
18
|
+
end
|
19
|
+
|
20
|
+
redirect = Redirect.create(from_path: "category/#{cat.permalink}",
|
21
|
+
to_path: File.join(Blog.first.base_url, "tag", tag.name))
|
22
|
+
cat.articles.each do |article|
|
23
|
+
article.tags << tag
|
24
|
+
article.save
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
drop_table :categorizations
|
29
|
+
drop_table :categories
|
30
|
+
end
|
31
|
+
|
32
|
+
def down
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class AddMissingIndexes < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
add_index :feedback, [:id, :type]
|
4
|
+
add_index :feedback, :user_id
|
5
|
+
add_index :sidebars, [:id, :type]
|
6
|
+
add_index :contents, :user_id
|
7
|
+
add_index :contents, [:id, :type]
|
8
|
+
add_index :articles_tags, :tag_id
|
9
|
+
add_index :articles_tags, :article_id
|
10
|
+
add_index :profiles_rights, :profile_id
|
11
|
+
add_index :users, :profile_id
|
12
|
+
add_index :users, :text_filter_id
|
13
|
+
add_index :users, :resource_id
|
14
|
+
add_index :triggers, [:pending_item_id, :pending_item_type]
|
15
|
+
add_index :redirections, :content_id
|
16
|
+
add_index :redirections, :redirect_id
|
17
|
+
add_index :resources, :article_id
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
class SimplifyRedirectRelations < ActiveRecord::Migration
|
2
|
+
class Redirect < ActiveRecord::Base; end
|
3
|
+
class Redirection < ActiveRecord::Base; end
|
4
|
+
|
5
|
+
def up
|
6
|
+
add_column :redirects, :content_id, :integer
|
7
|
+
Redirect.find_each do |redirect|
|
8
|
+
redirections = Redirection.where(redirect_id: redirect.id)
|
9
|
+
if redirections.count > 1
|
10
|
+
raise "Expected zero or one redirections, found #{redirections.count}"
|
11
|
+
end
|
12
|
+
redirection = redirections.first
|
13
|
+
next unless redirection
|
14
|
+
redirect.content_id = redirection.content_id
|
15
|
+
redirect.save!
|
16
|
+
end
|
17
|
+
remove_column :redirects, :origin
|
18
|
+
drop_table :redirections
|
19
|
+
end
|
20
|
+
|
21
|
+
def down
|
22
|
+
create_table :redirections do |t|
|
23
|
+
t.integer :content_id
|
24
|
+
t.integer :redirect_id
|
25
|
+
end
|
26
|
+
|
27
|
+
add_index :redirections, [:content_id]
|
28
|
+
add_index :redirections, [:redirect_id]
|
29
|
+
|
30
|
+
add_column :redirects, :origin, :string
|
31
|
+
|
32
|
+
Redirect.find_each do |redirect|
|
33
|
+
next unless redirect.content_id
|
34
|
+
Redirection.create(redirect_id: redirect.id, content_id: redirect.content_id)
|
35
|
+
end
|
36
|
+
remove_column :redirects, :content_id
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class AddBlogIds < ActiveRecord::Migration
|
2
|
+
class Blog < ActiveRecord::Base; end
|
3
|
+
class Content < ActiveRecord::Base; end
|
4
|
+
class Sidebar < ActiveRecord::Base; end
|
5
|
+
|
6
|
+
def up
|
7
|
+
add_column :contents, :blog_id, :integer
|
8
|
+
add_column :sidebars, :blog_id, :integer
|
9
|
+
|
10
|
+
if Content.any? || Sidebar.any?
|
11
|
+
default_blog_id = Blog.order(:id).first.id
|
12
|
+
|
13
|
+
Content.update_all("blog_id = #{default_blog_id}")
|
14
|
+
Sidebar.update_all("blog_id = #{default_blog_id}")
|
15
|
+
end
|
16
|
+
|
17
|
+
change_column :sidebars, :blog_id, :integer, :null => false
|
18
|
+
end
|
19
|
+
|
20
|
+
def down
|
21
|
+
if adapter_name == 'PostgreSQL'
|
22
|
+
indexes(:contents).each do |index|
|
23
|
+
if index.name =~ /blog_id/
|
24
|
+
remove_index(:contents, :name => index.name)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
else
|
28
|
+
remove_index :contents, :blog_id rescue nil
|
29
|
+
end
|
30
|
+
remove_column :contents, :blog_id
|
31
|
+
remove_column :sidebars, :blog_id
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class AddBlogIdToRedirects < ActiveRecord::Migration
|
2
|
+
class Redirect < ActiveRecord::Base; end
|
3
|
+
|
4
|
+
def up
|
5
|
+
add_column :redirects, :blog_id, :integer
|
6
|
+
if Redirect.any?
|
7
|
+
default_blog_id = Blog.order(:id).first.id
|
8
|
+
Redirect.update_all("blog_id = #{default_blog_id}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
remove_column :redirects, :blog_id
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class AddBlogIdToTags < ActiveRecord::Migration
|
2
|
+
class Tag < ActiveRecord::Base; end
|
3
|
+
|
4
|
+
def up
|
5
|
+
add_column :tags, :blog_id, :integer
|
6
|
+
if Tag.any?
|
7
|
+
default_blog_id = Blog.order(:id).first.id
|
8
|
+
Tag.update_all("blog_id = #{default_blog_id}")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def down
|
13
|
+
remove_column :tags, :blog_id
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
class AddDeviseToUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
## Database authenticatable
|
4
|
+
change_column :users, :email, :string, null: false, default: ""
|
5
|
+
rename_column :users, :password, :encrypted_password
|
6
|
+
change_column :users, :encrypted_password, :string, null: false, default: ""
|
7
|
+
|
8
|
+
change_table(:users) do |t|
|
9
|
+
## Recoverable
|
10
|
+
t.string :reset_password_token
|
11
|
+
t.datetime :reset_password_sent_at
|
12
|
+
|
13
|
+
## Rememberable
|
14
|
+
t.datetime :remember_created_at
|
15
|
+
|
16
|
+
## Trackable
|
17
|
+
t.integer :sign_in_count, default: 0, null: false
|
18
|
+
t.datetime :current_sign_in_at
|
19
|
+
t.datetime :last_sign_in_at
|
20
|
+
t.string :current_sign_in_ip
|
21
|
+
t.string :last_sign_in_ip
|
22
|
+
|
23
|
+
# Timestamps were not included in our original model.
|
24
|
+
t.timestamps
|
25
|
+
end
|
26
|
+
|
27
|
+
add_index :users, :email, unique: true
|
28
|
+
add_index :users, :reset_password_token, unique: true
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.down
|
32
|
+
remove_index :users, :email
|
33
|
+
remove_index :users, :reset_password_token
|
34
|
+
|
35
|
+
remove_column :users, :created_at
|
36
|
+
remove_column :users, :updated_at
|
37
|
+
|
38
|
+
remove_column :users, :sign_in_count
|
39
|
+
remove_column :users, :current_sign_in_at
|
40
|
+
remove_column :users, :last_sign_in_at
|
41
|
+
remove_column :users, :current_sign_in_ip
|
42
|
+
remove_column :users, :last_sign_in_ip
|
43
|
+
|
44
|
+
remove_column :users, :remember_created_at
|
45
|
+
|
46
|
+
remove_column :users, :reset_password_token
|
47
|
+
remove_column :users, :reset_password_sent_at
|
48
|
+
|
49
|
+
change_column :users, :encrypted_password, :string, null: true, default: nil
|
50
|
+
rename_column :users, :encrypted_password, :password
|
51
|
+
change_column :users, :email, :text, null: true, default: nil
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class MoveLastConnectionToLastSignInAt < ActiveRecord::Migration
|
2
|
+
class User < ActiveRecord::Base
|
3
|
+
end
|
4
|
+
|
5
|
+
def up
|
6
|
+
User.find_each do |user|
|
7
|
+
user.update_attribute(:last_sign_in_at, user.last_connection)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def down
|
12
|
+
User.find_each do |user|
|
13
|
+
user.update_attribute(:last_connection, user.last_sign_in_at)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class RemoveProfilesRights < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
drop_table :profiles_rights
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
create_table :profiles_rights, id: false do |t|
|
8
|
+
t.integer :profile_id
|
9
|
+
t.integer :right_id
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index :profiles_rights, [:profile_id]
|
13
|
+
end
|
14
|
+
end
|