roroacms 0.0.6.9 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -20
- data/Gemfile +14 -14
- data/Gemfile.lock +207 -207
- data/MIT-LICENSE +20 -20
- data/README.md +61 -62
- data/Rakefile +19 -19
- data/app/assets/javascripts/roroacms/admin/admin.js +95 -95
- data/app/assets/javascripts/roroacms/admin/application.js +8 -8
- data/app/assets/javascripts/roroacms/admin/menu.js +135 -135
- data/app/assets/javascripts/roroacms/admin/posts/posts.js +69 -69
- data/app/assets/javascripts/roroacms/admin/roroacms-tour.js +48 -48
- data/app/assets/javascripts/roroacms/admin/settings/settings.js +27 -27
- data/app/assets/javascripts/roroacms/admin/site.js +289 -289
- data/app/assets/javascripts/roroacms/application.js +9 -9
- data/app/assets/javascripts/roroacms/vendor/bootstrap/js/bootstrap.min.js +5 -5
- data/app/assets/javascripts/roroacms/vendor/chosen/chosen.jquery.min.js +1211 -1211
- data/app/assets/javascripts/roroacms/vendor/datatables/js/datatables.bootstrap.js +250 -250
- data/app/assets/javascripts/roroacms/vendor/datatables/js/jquery.datatables.js +150 -150
- data/app/assets/javascripts/roroacms/vendor/ghostdown/ghostdown.js +6425 -6425
- data/app/assets/javascripts/roroacms/vendor/ghostdown/jquery.ghostdown.js +88 -88
- data/app/assets/javascripts/roroacms/vendor/hopscotch.js +2409 -2409
- data/app/assets/javascripts/roroacms/vendor/html5shiv.js +8 -8
- data/app/assets/javascripts/roroacms/vendor/icheck/js/icheck.min.js +219 -219
- data/app/assets/javascripts/roroacms/vendor/jquery/jquery-1.10.2.min.js +6 -6
- data/app/assets/javascripts/roroacms/vendor/jquery/jquery-ui-1.10.4.min.js +6 -6
- data/app/assets/javascripts/roroacms/vendor/jquery/modernizr-2.6.2.min.js +4 -4
- data/app/assets/javascripts/roroacms/vendor/respond.min.js +4 -4
- data/app/assets/stylesheets/roroacms/admin/application.css +5 -5
- data/app/assets/stylesheets/roroacms/admin/main.css.scss +3676 -3676
- data/app/assets/stylesheets/roroacms/vendor/animate.css +2724 -2724
- data/app/assets/stylesheets/roroacms/vendor/bootstrap/css/bootstrap.min.css +6 -6
- data/app/assets/stylesheets/roroacms/vendor/chosen/chosen.css.erb +365 -365
- data/app/assets/stylesheets/roroacms/vendor/datatables/css/dataTables.css +226 -226
- data/app/assets/stylesheets/roroacms/vendor/ghostdown.css +584 -584
- data/app/assets/stylesheets/roroacms/vendor/hopscotch.css +464 -464
- data/app/assets/stylesheets/roroacms/vendor/icheck/css/_all.css.erb +559 -559
- data/app/assets/stylesheets/roroacms/vendor/icheck/css/grey.css.erb +55 -55
- data/app/assets/stylesheets/roroacms/vendor/jquery/jquery-ui.css +1177 -1177
- data/app/assets/stylesheets/roroacms/vendor/typeahead.css +182 -182
- data/app/controllers/roroacms/admin/administrators_controller.rb +149 -149
- data/app/controllers/roroacms/admin/articles_controller.rb +169 -169
- data/app/controllers/roroacms/admin/comments_controller.rb +103 -103
- data/app/controllers/roroacms/admin/dashboard_controller.rb +11 -11
- data/app/controllers/roroacms/admin/menus_controller.rb +90 -90
- data/app/controllers/roroacms/admin/pages_controller.rb +137 -137
- data/app/controllers/roroacms/admin/revisions_controller.rb +39 -39
- data/app/controllers/roroacms/admin/settings_controller.rb +72 -72
- data/app/controllers/roroacms/admin/terms_controller.rb +140 -140
- data/app/controllers/roroacms/admin/themes_controller.rb +45 -45
- data/app/controllers/roroacms/admin/trash_controller.rb +56 -56
- data/app/controllers/roroacms/admin_controller.rb +64 -64
- data/app/controllers/roroacms/application_controller.rb +154 -154
- data/app/controllers/roroacms/comments_controller.rb +42 -42
- data/app/controllers/roroacms/pages_controller.rb +55 -55
- data/app/controllers/roroacms/setup_controller.rb +104 -104
- data/app/helpers/roroacms/admin_menu_helper.rb +110 -110
- data/app/helpers/roroacms/admin_roroa_helper.rb +355 -355
- data/app/helpers/roroacms/admin_ui_helper.rb +22 -22
- data/app/helpers/roroacms/admin_view_helper.rb +24 -24
- data/app/helpers/roroacms/application_helper.rb +4 -4
- data/app/helpers/roroacms/comments_helper.rb +39 -39
- data/app/helpers/roroacms/general_helper.rb +144 -144
- data/app/helpers/roroacms/media_helper.rb +44 -44
- data/app/helpers/roroacms/menu_helper.rb +183 -183
- data/app/helpers/roroacms/prepcontent_helper.rb +27 -27
- data/app/helpers/roroacms/routing_helper.rb +392 -392
- data/app/helpers/roroacms/seo_helper.rb +257 -257
- data/app/helpers/roroacms/theme_helper.rb +6 -6
- data/app/helpers/roroacms/view_helper.rb +1229 -1229
- data/app/mailers/roroacms/emailer.rb +31 -31
- data/app/models/roroacms/admin.rb +86 -86
- data/app/models/roroacms/comment.rb +83 -83
- data/app/models/roroacms/menu.rb +18 -18
- data/app/models/roroacms/menu_option.rb +41 -41
- data/app/models/roroacms/post.rb +380 -380
- data/app/models/roroacms/setting.rb +190 -190
- data/app/models/roroacms/term.rb +157 -157
- data/app/models/roroacms/term_anatomy.rb +8 -8
- data/app/models/roroacms/term_relationship.rb +9 -9
- data/app/models/roroacms/trash.rb +67 -67
- data/app/views/devise/confirmations/new.html.erb +11 -11
- data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -5
- data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -8
- data/app/views/devise/mailer/unlock_instructions.html.erb +6 -6
- data/app/views/devise/passwords/edit.html.erb +33 -33
- data/app/views/devise/passwords/new.html.erb +22 -22
- data/app/views/devise/registrations/edit.html.erb +24 -24
- data/app/views/devise/registrations/new.html.erb +17 -17
- data/app/views/devise/sessions/new.html.erb +42 -42
- data/app/views/devise/shared/_links.erb +12 -12
- data/app/views/devise/unlocks/new.html.erb +11 -11
- data/app/views/layouts/roroacms/admin.html.erb +172 -172
- data/app/views/layouts/roroacms/login.html.erb +35 -35
- data/app/views/layouts/roroacms/setup.html.erb +36 -36
- data/app/views/roroacms/admin/administrators/_form.html.erb +135 -135
- data/app/views/roroacms/admin/administrators/edit.html.erb +5 -5
- data/app/views/roroacms/admin/administrators/index.html.erb +59 -59
- data/app/views/roroacms/admin/administrators/new.html.erb +5 -5
- data/app/views/roroacms/admin/articles/edit.html.erb +8 -8
- data/app/views/roroacms/admin/articles/index.html.erb +14 -14
- data/app/views/roroacms/admin/articles/new.html.erb +7 -7
- data/app/views/roroacms/admin/comments/_form.html.erb +89 -89
- data/app/views/roroacms/admin/comments/edit.html.erb +24 -24
- data/app/views/roroacms/admin/comments/index.html.erb +78 -78
- data/app/views/roroacms/admin/dashboard/index.html.erb +144 -144
- data/app/views/roroacms/admin/menus/_menu_form.html.erb +31 -31
- data/app/views/roroacms/admin/menus/_menu_list.html.erb +2 -2
- data/app/views/roroacms/admin/menus/edit.html.erb +29 -29
- data/app/views/roroacms/admin/menus/index.html.erb +42 -42
- data/app/views/roroacms/admin/menus/partials/_menu_content_accordion.html.erb +70 -70
- data/app/views/roroacms/admin/menus/partials/_menu_custom_accordion.html.erb +39 -39
- data/app/views/roroacms/admin/menus/partials/_menu_dropdown.html.erb +49 -49
- data/app/views/roroacms/admin/menus/partials/_menu_list_loop.html.erb +64 -64
- data/app/views/roroacms/admin/menus/partials/_menu_menu_groups.html.erb +18 -18
- data/app/views/roroacms/admin/pages/edit.html.erb +6 -6
- data/app/views/roroacms/admin/pages/index.html.erb +15 -15
- data/app/views/roroacms/admin/pages/new.html.erb +7 -7
- data/app/views/roroacms/admin/partials/_admin_comment.html.erb +18 -18
- data/app/views/roroacms/admin/partials/_append_sidebar_menu.html.erb +51 -51
- data/app/views/roroacms/admin/partials/_articles_table.html.erb +46 -46
- data/app/views/roroacms/admin/partials/_bulk_update_dropdown.html.erb +35 -35
- data/app/views/roroacms/admin/partials/_comment.html.erb +18 -18
- data/app/views/roroacms/admin/partials/_content_form.html.erb +316 -316
- data/app/views/roroacms/admin/partials/_cover_image.html.erb +12 -12
- data/app/views/roroacms/admin/partials/_editor.html.erb +21 -21
- data/app/views/roroacms/admin/partials/_markdown_modal.html.erb +57 -57
- data/app/views/roroacms/admin/partials/_pages_table.html.erb +25 -25
- data/app/views/roroacms/admin/partials/_post_additional_data_view.html.erb +7 -7
- data/app/views/roroacms/admin/partials/_revision_tree.html.erb +78 -78
- data/app/views/roroacms/admin/partials/_submit_bar.html.erb +30 -30
- data/app/views/roroacms/admin/partials/_table_header.html.erb +14 -14
- data/app/views/roroacms/admin/partials/_table_row.html.erb +34 -34
- data/app/views/roroacms/admin/partials/_term_table_row.html.erb +22 -22
- data/app/views/roroacms/admin/partials/_user_group_view.html.erb +19 -19
- data/app/views/roroacms/admin/revisions/_autosave_table.html.erb +36 -36
- data/app/views/roroacms/admin/revisions/edit.html.erb +91 -91
- data/app/views/roroacms/admin/settings/index.html.erb +398 -398
- data/app/views/roroacms/admin/terms/_form.html.erb +50 -50
- data/app/views/roroacms/admin/terms/_table.html.erb +21 -21
- data/app/views/roroacms/admin/terms/edit.html.erb +49 -49
- data/app/views/roroacms/admin/terms/view.html.erb +31 -31
- data/app/views/roroacms/admin/themes/index.html.erb +81 -81
- data/app/views/roroacms/admin/trash/index.html.erb +110 -110
- data/app/views/roroacms/devise/confirmations/new.html.erb +11 -11
- data/app/views/roroacms/devise/mailer/confirmation_instructions.html.erb +5 -5
- data/app/views/roroacms/devise/mailer/reset_password_instructions.html.erb +8 -8
- data/app/views/roroacms/devise/mailer/unlock_instructions.html.erb +6 -6
- data/app/views/roroacms/devise/passwords/edit.html.erb +33 -33
- data/app/views/roroacms/devise/passwords/new.html.erb +22 -22
- data/app/views/roroacms/devise/registrations/edit.html.erb +24 -24
- data/app/views/roroacms/devise/registrations/new.html.erb +17 -17
- data/app/views/roroacms/devise/sessions/new.html.erb +39 -39
- data/app/views/roroacms/devise/shared/_links.erb +12 -12
- data/app/views/roroacms/devise/unlocks/new.html.erb +11 -11
- data/app/views/roroacms/emailer/comment.html.erb +13 -13
- data/app/views/roroacms/emailer/comment.text.erb +12 -12
- data/app/views/roroacms/emailer/profile.html.erb +5 -5
- data/app/views/roroacms/emailer/profile.text.erb +5 -5
- data/app/views/roroacms/setup/_theme.html.erb +61 -61
- data/app/views/roroacms/setup/administrator.html.erb +72 -72
- data/app/views/roroacms/setup/index.html.erb +116 -116
- data/bin/rails +12 -12
- data/config/initializers/devise.rb +258 -258
- data/config/locales/devise.en.yml +115 -115
- data/config/routes.rb +96 -96
- data/db/migrate/20140801203556_add_admins.rb +44 -44
- data/db/migrate/20140802084604_add_roroacms_comments.rb +31 -31
- data/db/migrate/20140802084615_add_roroacms_menu_options.rb +24 -24
- data/db/migrate/20140802084624_add_roroacms_menus.rb +18 -18
- data/db/migrate/20140802084631_add_roroacms_posts.rb +42 -42
- data/db/migrate/20140802084638_add_roroacms_settings.rb +21 -21
- data/db/migrate/20140802084658_add_roroacms_term_anatomies.rb +20 -20
- data/db/migrate/20140802084707_add_roroacms_term_relationships.rb +23 -23
- data/db/migrate/20140802084717_add_roroacms_terms.rb +27 -27
- data/db/seeds.rb +60 -60
- data/lib/ext/string.rb +4 -4
- data/lib/generators/roroacms/install_generator.rb +16 -16
- data/lib/roroacms/engine.rb +83 -84
- data/lib/roroacms/version.rb +3 -3
- data/lib/roroacms.rb +5 -5
- data/lib/tasks/roroacms_tasks.rake +9 -9
- data/spec/controllers/roroacms/admin/administrators_controller_spec.rb +136 -0
- data/spec/controllers/roroacms/admin/articles_controller_spec.rb +135 -0
- data/spec/controllers/roroacms/admin/comments_controller_spec.rb +123 -0
- data/spec/controllers/roroacms/admin/dashboard_controller_spec.rb +24 -0
- data/spec/controllers/roroacms/admin/menus_controller_spec.rb +103 -0
- data/spec/controllers/roroacms/admin/pages_controller_spec.rb +163 -0
- data/spec/controllers/roroacms/admin/revisions_controller_spec.rb +44 -0
- data/spec/controllers/roroacms/admin/settings_controller_spec.rb +75 -0
- data/spec/controllers/roroacms/admin/terms_controller_spec.rb +177 -0
- data/spec/controllers/roroacms/admin/themes_controller_spec.rb +57 -0
- data/spec/controllers/roroacms/admin/trash_controller_spec.rb +62 -0
- data/spec/controllers/roroacms/comments_controller_spec.rb +24 -0
- data/spec/controllers/roroacms/pages_controller_spec.rb +34 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +1 -0
- data/spec/dummy/app/assets/stylesheets/application.css +1 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/helpers/theme_helper.rb +13 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/_sidebar.html.erb +33 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/archive.html.erb +60 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/article.html.erb +38 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/font/glyphicons-halflings-regular.eot +0 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/font/glyphicons-halflings-regular.svg +229 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/font/glyphicons-halflings-regular.ttf +0 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/font/glyphicons-halflings-regular.woff +0 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/javascripts/roroacms-bs3-theme.js +17 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/javascripts/theme.js +4 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/javascripts/vendor/bootstrap.min.js +6 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/stylesheets/roroacms-bs3-theme.css +222 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/stylesheets/theme.css +4 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/assets/stylesheets/vendor/bootstrap.min.css +7 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/category.html.erb +66 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/comments_form.html.erb +43 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/error_404.html.erb +6 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/footer.html.erb +81 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/header.html.erb +129 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/home.html.erb +23 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/layout.html.erb +5 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/page.html.erb +27 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/search.html.erb +33 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/search_form.html.erb +9 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/template-contact.html.erb +81 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/theme.yml +6 -0
- data/spec/dummy/app/views/theme/roroa-bootstrap-3/theme_helper.rb +9 -0
- data/spec/dummy/app/views/theme/roroa1/_sidebar.html.erb +18 -0
- data/spec/dummy/app/views/theme/roroa1/archive.html.erb +33 -0
- data/spec/dummy/app/views/theme/roroa1/article.html.erb +23 -0
- data/spec/dummy/app/views/theme/roroa1/assets/javascripts/roroa-standard.js.coffee +10 -0
- data/spec/dummy/app/views/theme/roroa1/assets/javascripts/theme.js +1 -0
- data/spec/dummy/app/views/theme/roroa1/assets/stylesheets/style.css.scss +884 -0
- data/spec/dummy/app/views/theme/roroa1/assets/stylesheets/theme.css +3 -0
- data/spec/dummy/app/views/theme/roroa1/category.html.erb +37 -0
- data/spec/dummy/app/views/theme/roroa1/comments_form.html.erb +61 -0
- data/spec/dummy/app/views/theme/roroa1/error_404.html.erb +4 -0
- data/spec/dummy/app/views/theme/roroa1/home.html.erb +25 -0
- data/spec/dummy/app/views/theme/roroa1/layout.html.erb +95 -0
- data/spec/dummy/app/views/theme/roroa1/page.html.erb +7 -0
- data/spec/dummy/app/views/theme/roroa1/search.html.erb +31 -0
- data/spec/dummy/app/views/theme/roroa1/search_form.html.erb +6 -0
- data/spec/dummy/app/views/theme/roroa1/template-contact.html.erb +125 -0
- data/spec/dummy/app/views/theme/roroa1/template-news.html.erb +1 -0
- data/spec/dummy/app/views/theme/roroa1/theme.yml +5 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config/application.rb +23 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +8 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +82 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +149 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/translations.js +2 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/01b0bb90f5966d00bf38cc2e4c6dc61c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/01c4f566937fc1135c9aac08aaed1d7f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/02ac78c2224882185ca7d2180a010a02 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/02dd9be3b289f56169f00da8d6e8cb63 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/044f18e425557a4db28813e3d413b2ac +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/062c6b6c1fd8cc4dec9482e22b8bf15e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0671a937a155d760eb50f0a4673b361e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/075f916e73522805629055d0ebc0a96f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/07c31f29bd114c516fec34c12e23040b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/07df29267aa56c3d60701d02593b42fe +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/07ed3087294a5538008469d14dad37ec +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0915aabdb5273fb452531154011b1530 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/096998b34babf611dd1fd30affcce1f8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0a959d1d6d5addc548e6a7d72cda5513 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0aa0cf2c509791fae370e676145661e9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0b82858a45f9840a67e62c589b49a30b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0c31dca9d5a7fe6fa13975f398bf6755 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0c7ddb3a4e6bd5f58621aafa9d8b268c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0ccfaad24ef387850a25da694a32fdeb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0d014c14229f4e6af12b9f5214c2c900 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0d2c92577a98a55e84279cf35fa47154 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0f1a8d8cb2d347d2c43e167b6e8dd772 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0f7739cbdf17c178ed8302927ab6f91a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0fd906d894053aa32d20273d272914a6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/108902bac7ebd1b233ad72bff14a3c6e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/117c1540c942b9a30221507b7b545ac7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/120699e4b9a291742d32cc3f1d54a1c0 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/12823874e85d7f4b0d0f24e75b6a606f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/12d4f50804f6b2e95ae22d6240d5f251 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/14a07aa21f4b662c3a00906bb7fd96a1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/16246104f8ae735f81f309dff662f6ac +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/170c2bd9dd32f95b5ff94772e3046435 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/175f517f3f99a11bea98f1b106cbad3e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/182f982bc1069c944b0768c5fb8e70e8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/189afb43eebc6790a343d47e099b5b3b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/18f00a43e59b4caf8cab8002225abb16 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/19cc7d516e9c5c945152a00c520652a7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1a49195845de370bd0390b666bf63002 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1aabd6297701193c87b371bb28423093 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1ad4574bbfb58c18cf27bde856cfb8e6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1bbda697ecdf1dab2d9857c246167e61 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1c8fd5c201d2c1c04f0dfa7f84406549 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1e13b0d0d3273c81783675257ae416a5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1ecda2df373750075af958a84e177443 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/1ed030685f785031c518b9c084d2c562 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/20a8ce6b001e3f5e000d83b03c39973a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/22a1b56f54d66c951d0414589ae7e592 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/22b316eb2ae844d2aa5b3d56609e7134 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/23979d8c8de077d9c5aca204af6d1cae +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2405f0ab32bb68958749badf5c0c5ab2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/24507a849b1f6f49e4d80806a2ae8f7f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2611a6793dffe5cf691fc66ef8a1d96f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2649e6f5622aa342a69fa0c56058f50e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/266a1d6eaa1096958f5220dcd72fa818 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/28257287bdb69e9da885553af4d784fd +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/283ae16090ef393308b47b6eac68a78d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2855a662a410acf5b8341d18ea08ad09 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/29027878740c3347a585de84e2468cec +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/29b612a243d57e996aa25e6bd55c3ae0 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2a1ca299203dc52bfd48e9e990234288 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2a3ef4fee1ead82a2e020bd01e0f9492 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2b31fdf797816a4d7eeb501882522245 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2d14fddff832dffcfdc6b7c16543a37a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2d57904662e5b6b51010d683ea36f3aa +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2ed37822c6f252a1bb9a2a4186d51b80 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2ed54505fb85c659a5d40fd42fdb8c82 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f7814e3b44a611d9cc5ba4838783cec +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f95938c43835c0d255c4d98c85130a2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2ffa1a843006a5e108eb823936fc4b8d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/30c74df35467423ca4f594c50ca972cb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/31de52bfeb25a36a638e82c1d44b6110 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/32189e4bb4be3499e1154394fe5fa5cf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3316f6752e709d7a6eb5a3781fced097 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/33177563a7306549dc9684f9348ae6c6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/34fac393d91ac96fad0606d7d210212c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/354bc78e74a0ae625ed0173f96ad5356 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/35ab8dc5331965047a6a48cfebf03234 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/36264cd973b91fad389f3a7e83d358df +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3633cb5a540f9da590a8be6b659357d9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/363ec8b1e6c0e4e28147577cd9aa1767 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/36899e053ce425269daeefbc24afde74 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/374a7e699349c3747ad0eb80df319ee5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3792de44b7ef5883097d33bd02bb66a7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/37a02dc6a0d71db376ca89c53f25713b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/385067d2a8c69821fc305178e1abec5d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/389b05cb7df2beb5f9f7f7ae2983276a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/39e74d6deb67d83562723310a49d2343 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3d7a543a402dfe7a63a4d4dfc2f02e35 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3dac43d31d5e2baae0882a187f995373 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3df24cb6966ced6c31468ea144303cba +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3e9e1f77164027e372eab31e44bd792e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/402809273e09d12a0d961e96277c93ff +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/40dcda7ab7c26916df1b499cf472b036 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/415a7735417367ba5c89a10bda3c3664 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/42875948b15702a8e6423bfcd55eb397 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4361292ee0e8da4ffba6417b67d107d7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4416c7d372391892156a3ad7e796eea2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/44aff36650b10dfc65996edc7c5ba786 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/45f19765f78bbeaf456e3e85d8eeaeea +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/460c01975695d2221ebfe45345c66c14 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/474d3d268fe31fa85b9ad6a702106f89 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4818258c6899deb650e9b7a11472a5cb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/485ba245fdff299bc3993a1dfae69830 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/48f01ff4ef7bc5f6389a2481742a32cc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/490efd99068b27bb2660dd5f97822f75 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/49bc81ab46512983d6c99fe5ee89c87a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4a0b8c669e9c663a5d7a6fe73bf92961 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4aef0c0538c834078e6d8537889cc2a1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4af8affa02b9ecd9051258755d4be60a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4b5d082bdfae4f56c090f7c10cb6647d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4b6f1eca9b2c126af3c3790129ba15e6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4beeeb189ce51371e4edc7569eb4a53a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4c86f80454f717e7151747beb022d61d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4cffdc29cdafdcdf76ae764312573579 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4d26f6579d12e4f1d3c79fba613933fb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4e13d96aef7929980b0c503756cc0c6b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4f5ca293a17dc427299d712706be99d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4f6e11155789e81497dc94d22a2c9db8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4f829c2dffc45c149adee4cd1b35f23b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5132d2c56e2db02645975ee877d5ecb9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/579cf218fbfa8b52dd892d7f9c39c65e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/57a51996827da8be33316d6e513c1856 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/581344a3bce36221a1fc5ee9d507cb78 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/58f64a672004610fe63c125f3cd8fe7d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/596d21a0e4b0e82491dd946147d0b509 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5ac8aaa5bee9489bc446a774e2e646b9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5b79b1a35f5118fe38011ca429634834 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5c8ebcef7b93c3061021528083a680c6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5cb8219e4c1db70267fb2a88ba7b599f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5d5b525c2315ad3fd4711a7ca14b9cc2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5d6d4e3b38e87b2de5b9b9b4b2fddf53 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5de859ea92a0f8d5b1cf81233ff541ce +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5df45e879827bae35f9c0af1d89d3484 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5ea7acc2a017fb91990f70b1c94413b5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5ef3f544813f934df08810f79021eecb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5f52bb9c53ea90254f76b8d305b70373 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5f58ba12a115846181d5932f8ebe1108 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/5f8bf71cbb460285f2151bac01ea7481 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6095811354e7dc1babcb682c0fdfd69e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/60be3ded1b6e36fb0c87316b38156ae2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/622cbabaed3da4fff5fab28bbcf32bed +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6250be42273c14b0aad242da2150d901 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/631f072a6df346c42e13a97388ae3156 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/634081a34eeeb1ff0f78e8a8cabcf12c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/64563ba9a277596542f2bf4558a991e4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/65c1cea3dc9ac48c3fd086462bb01d43 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/65caafdf3d25c108b8c44d7c616745d1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/674bfd6d5bf888941166039a3e65eb72 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/675dcab958bbfb0582a7113840bbe35d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/68a9f70d3be10ed9f50de29a1e300d27 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/696323f68df35557d1dc046a9dbf1a81 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/699417eba3487c8f71acd9d596662606 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/699787446bc5facff1e55d8f4b31221f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/69a29b2ad8cdf192be64b3c3f8b77d8c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/69cf4fd612d34478f8065d84838e982c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6a9320eaa769c69aaae2231ba2f82fb6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6aab73cf49337b2782e983900ad3a3ab +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6affc41afde1d2df6ba129053c1babcd +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6bcfde2d65e4e5d1903a5936de95a86e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6c927972735d32feb6ed10e7ef1f894e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6ca2d6d64a82723279eccd56b81e6755 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6d7dfd8665840288a937f61efa149aed +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6e01bdf2376fcd0c30a6a79058c1e504 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6e9c00de1c41fdc6467ef2dadc20c591 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6f2c9037f8ccf7c2a4bca6a25fb598b9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7066aee6f2d50aa1675ee592a4c336ba +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7084e05e641b381bfff47c554afec2da +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/71d7f12a2022920f7a2a28dbdff79019 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/723bcf3e6983a0559b9e0be394f10c01 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/724781877ef4c3636943c3610499bf87 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/73a26df4a7d7bdc16b247ccfade6121a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/74340e2a21288361b5df1465dea4cc1f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/74cc560b7e7c5a745659ec08176b13c5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7507fec5587acab83f4625979da7c58b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/754e347f3d36e2977fd81db154e80602 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/75eb11c26a539bb390644b542a59a231 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/76cd0ec15ae2bbfa35a9f78bef162b83 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7709ff603668ddf82318669448ae5364 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/77190fb71aee455df365832e249ff2bd +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/77e6403a2258ce2966c037bc05d3d35f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/78210e807010563b375b608f20ccefa1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/78f00a860f4c5ded036af4761397352d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/79a104fd39f788070c7d9add71efa32c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/79b65d2d7b7bab646f6c393bd9703bc3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/79bab032f54eb5a98a68a8bc06b57822 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7a4c12dd007420226c0bc78951585006 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7aeeee63a3e1037db68405ac86e30a4f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7b2bf6a64d27177512054df06580f092 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7cbd90392269c732b318fc901d004f43 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7cd7c56a479baddf925e01aec7848a4c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7cf77ddd2975dd6830a4880fb1fc1dbe +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7def427cd79eb67621a05b2d5ad64a61 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7e5b5fd06d5df24ebb2221f640358492 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7f7f0e62735d0c01e2e3203eb47c2c3f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7fbff98235e61aaf8d4b230dd31e9c25 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/7fdf03e57d42dfff59c41760e67fa65e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/80b092dfcd9313068d17c057182f71bd +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/80c2f11f8bad645b74798a955ca8e89c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/81c527c170a21781457f6cea4e7b27ce +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/81f727984d6b9c602f2b0932f06ebe25 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/81f9c4e9d09403395a2e9d809b10fc1a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8224aeb6f917522433c9f3d235d83fd1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/83f5fffe46a2a0b83ef4b6efbe951083 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/84961945b1044869ca1248d1828de33a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/85684bab4511b98c766527cf9f03acd2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/85b350459ae7cc9bd89e9b8d52a61b75 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8601c7a96bd24a6af87741abd57e5e94 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/86d499f85b615bdfa95f9f976f8ea3ad +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8704d0a0e9f0ff5e5a2aa2eea9f14a5f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/87c4b682fff94bf74e6b1438033b7c60 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/88327adbd46a84276cfb290bbdb7dca3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/88eae1724e3694d2070c7155ea3021cc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/89becf26df10662c7cab4b1adcdce227 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8c696e0458f6923f2458d7a44ad21211 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/8f49105e73394ed3b12e18d79f7a4ff6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9146fcb24656f70dfb5c4d8a0461a473 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9155c28c949a5bdfe776bf620dbc6dc3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/91b1792019998f509e7965b8fa75c378 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/91c9b223dfe8a224fb6b451a51eb63dd +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9232fe8335151d85d1a8aad7c8c0524b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9304a78db8748cd47489295ed4843152 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/93845737b6f58a77e524653ce5d6926b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/948e894982cb58176b6ee43037ccf460 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/99002a27f7d6702b0ae6da7da7036dc6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/99354d91c97da4d779f609eb9935b8fe +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9a37f19ccd71116845a63ff439dd5bf4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9b38afb533f8d22148e93931754162c5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9c358f08b8672c0d2fd6db7a16ed6c2b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9c3f89f42447b0c2bdc921ec9317fb38 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9d56b3e3616119ca42b546e0fb96b7c8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9e120a10db5fa35fd3c421f933ebd01a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9f6baf784711e665ea8352685be3676b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9fe740ce6c837b3418e0972324ffdb7b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a1d664104b57e68ca75daa681364b1e4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a1e099d69cea07186941a247f24a23e7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a319221d824e8f5b647c0b5a6203a67d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a3ace8e3eb3d918414cf185e820e5b8d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a3f16a7b18a62765c0c73c95dc786de8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a56cdc9b1cc0cd1372a15c410ce15f52 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a58a85a704454cee53c7a15541ed5e6a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a5f93f7d4c4dc37755df8de1011556d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a5fc7fe296e4ee928bf5454edc9c334b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a6902cd66f93fe0640c6d25ba7bbab74 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a751ef0c349119da69b47d3e8a5411e0 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a7d46bacc8876cb9f26574792a4eb602 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a7fda81a77165684dcaf76b8a5c0d98c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a8d295cec937ed4c43b627c1ec2ee3bf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/a9070b0220974335806b38921350ae6f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/aa04111e924cc573b669237eaa1459a7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ab1955c741364b51eafef10d828fe3c0 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ab25f25883b53de5ea5aa934233b96fd +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ac5eb83633eca54957093b7eacaed98a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/acf6532dc4556d46cbb143a53c1c9d99 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ad3755af68762ce29bc54dc42b36c7d2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ad644b75f8c65173f38014035baeac41 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/adc76ee6c343c47fd7d666b54465af8a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/aeb4f87af70343155cc847f44080a197 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/af16c115b782a328caa529dc3d7ca063 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b01d038005ad822401663f5ec72fa6ef +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b0ec8166abdcc705333dd67e4f4d2e52 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b22ac2c9e1f1284a84e42681ced6af62 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b3a92f2154a373b214e1c134c82aa35a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b522e8257bebed61822f79ef5b631af5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b53c3ca1da3cc97ff2d061205c93f09f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b53f839c1435533b1f9f096792b75ba2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b5679ed21250dca0e0afaccbc4dbea96 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b79572ce5447929b8752d55866019e5d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ba4cdbcfe8d56a527507346ec0b0aaa8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/bb82cf918d1f9deb18fd513203e12b65 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/bde0358bf67ceb4b32068fa3c9bfb3b6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/be7e82e0b81f8ffb8f906ab45b453305 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/bea40ce674c3fb117ef21e05fade75b1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/beabf9e96ebd3323d01ae3a39fb6babc +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/bed9255c41c5b2e5ff029fef9cde0f77 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/bfd9eac23f2a5c80c63c2af546c6ccaa +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/bfdabecefcd035cd13ad6dd39628b98c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c07fbd81375ee01b6e5816e938a7c11b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c10616d9f47b2417f5182868178a348e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c1086ef26030d24fa0820807aa477ea9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c2862a0368fa4de5e2f7d189f2301cf2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c2d2edeabc3f4e1488bc3d2bc65aeeb5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c31de5bdd33cb06b2f048832cc17bb33 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c392b9f02046ab5ac544b4b768d6c873 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c3f6d29f592a6debd961bf7090260a63 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c40f5cd3096b72ead5fbc1bbd3fae161 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c60c7de98dc1644323fe3e1042b9b6f7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c99a79f0817c71898237ba09de527dee +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c9a9d61d59425108b4b277185175e2a8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c9b91475983f0835ba45ca2fe35d240d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c9e64896be951cc49773ac83696255d1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ca142e718b036301f24dac4e3275e9b6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/caf60d972f82c0ee76b650f65b8fdcb1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cbc2f7b8866f0684266e6ad2e7a30352 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cbd483d17ac0184f48a8509c18f979b7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cc721a188ab3d7e83b31a1f04b713426 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cc914eaa2dce30f7d476190bd890061e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ce6b662fdbe7682b43ddc78b3b9cad70 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ce9ed001e3d4f0735c213877e8a81df2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ceaf1a9beac2d5eeb6d34f1ec3b4ba18 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cee893d2db4350453a50c4e9ca1d232f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cf6435acb846ab2d7c5fa87f58813ebd +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d065c115c2649e84ceda18a5424c6a19 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d07e71e2ceaa8385c55f2d3b8fbf07b3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d152ac74ddbbe9d32933a12ddfdde296 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d169f1441cbbc3af7e89e80362df3e76 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d1b84034e0429b81de91ed8fc1aaecaf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d253accae3b846232602bc6c995368f9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d3104281c8b0826ddc1ac16ebcabf6d5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d3f00f999f8970016ac14a517904a010 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d41a28273f01863d778343769f561a15 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d46338cdeab8149426f52310289fce9f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d51f7e1dd8a079a07dca6b54555b0619 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d7168a34b2c50ddfedd98542037fa67e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d72b5c6c396050709ed7a61795624bcf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d8d0ad6c27cfbaf3dc08f4b89c943aee +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/da00d054a700ca1243a14fe7ed80f957 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/db5a3f247b11ff272a640ca13b7e4282 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/dbe16788dcd2defa93482f68099b0d93 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/dce3bb78b49b624e0ef121de61c90eb5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/dcf33d27a8bc879ea6dc1460a6896572 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/dd4661c809be283f24af745cd471fef2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ddd024b41556433726d54ab75efc4cf6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/de76378a179dbe23a8b6938fecaeaead +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/dec6c0affea84dfd7c9509d3b82cb67a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/df9f17599b8555c7e5f33f3096d0908d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e0b8689ae5bba59b9f14acd1f9f2e2e1 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e1b60cab102fc77a9250c3cec9005f2f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e20b05c5de673581bbaa330f6f5a8e26 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e2bf8a1dcf48c25b3c508c348b77d073 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e33f8e486061b22bb4e64bbda4fd264e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e395be2c63ec3c4d214bbaf44fb03973 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e5357bc5a31b7a2fb6e078aaaa4d913b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e5c14e1961152bd7edd7743b7d623416 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e6433186bf62e32f40d2aa957885e12b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e647b5d9467ba8f6bea35247e2c08f38 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e7a0f449e890f16fe0114f946c3c2e23 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e9512b851cc002cb6564586e198bff22 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ea53643fc53873e31950c304a2dd81bf +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ea7dd58d64f762e53736715fbef1379d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/eaad17bfad25bffeaa285383f55b6683 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/eb6ce605b7a9878f16ce34a3d47043a3 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/eb757c948334f75d17bbf23e8c48ef43 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ebea8f383de1fdfd76ff7f1095ab95ec +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ec65ed1571852474143593894f051fda +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/ee379911da706e69963a52263eab4755 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f0c46205ec11714608a5716a6b6867df +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f1161e3366336f110844aee9ed699af6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f12044c9db79b466f15257e01c41932b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f13ba0b59341c6ffd42d680c6d6a57af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f3c8f45ef41694b747be31b658829a4a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f3dd8a99ff713f718a8a2b197d5dd469 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f471c0922a75832dec078946cb0a1086 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f54740d21191b3939d47b6e87b5d6ef2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f566a6d534c7e8e6f4cd1e5ca907df2c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f5f4f0999132979f9f325a78e0a6fd47 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f61dc0dc55f73dca2c580f5914074a9a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f6dc9afc56ceced12c16a1f7022d6623 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f702a7d63bc9bbaa4b9da177d4220dfb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7f67c6fdf257bb9b675445ad3ca2aca +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fb942ec0bc8d87080136d1eb2abcfa33 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fbb623d8d4700f3e7eccae88700e5e73 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fbee64fb1d31d4687a8068c38ff0889e +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fbfcf6fdc335e01d8f7f0c7a26e9a9fb +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fc33f62b017026ea2cb55de4fe0786c5 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fd5afb63c8690c4e0df71ff9498d049f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fdb60665342a3a54a59aa9b7b77a135b +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fdc31d89f3b051d66029a28b59cc7e63 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fe0dc53c09ac52e5b9255086e0ffb328 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fe1e7428179101b62bdf21409049badd +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fee99bdbec260ac672198e956afd0698 +0 -0
- data/spec/dummy/tmp/cache/i18n-js.yml +36 -0
- data/spec/models/roroacms/admin_spec.rb +67 -0
- data/spec/models/roroacms/comment_spec.rb +76 -0
- data/spec/models/roroacms/menu_spec.rb +17 -0
- data/spec/models/roroacms/post_spec.rb +121 -0
- data/spec/models/roroacms/setting_spec.rb +66 -0
- data/spec/models/roroacms/term_spec.rb +67 -0
- data/spec/models/roroacms/trash_spec.rb +31 -0
- data/spec/requests/roroacms/admin/administration_spec.rb +71 -0
- data/spec/requests/roroacms/admin/article_spec.rb +113 -0
- data/spec/requests/roroacms/admin/comment_spec.rb +85 -0
- data/spec/requests/roroacms/admin/dashboard_spec.rb +55 -0
- data/spec/requests/roroacms/admin/menu_spec.rb +67 -0
- data/spec/requests/roroacms/admin/page_spec.rb +102 -0
- data/spec/requests/roroacms/admin/revision_spec.rb +41 -0
- data/spec/requests/roroacms/admin/setting_spec.rb +113 -0
- data/spec/requests/roroacms/admin/term_spec.rb +194 -0
- data/spec/requests/roroacms/admin/theme_spec.rb +33 -0
- data/spec/requests/roroacms/admin/trash_spec.rb +70 -0
- data/spec/requests/roroacms/pages_spec.rb +28 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/support/devise.rb +3 -0
- data/spec/support/factories.rb +79 -0
- data/spec/support/selectors.rb +5 -0
- data/spec/support/utilities.rb +6 -0
- metadata +1027 -301
@@ -1,1230 +1,1230 @@
|
|
1
|
-
module Roroacms
|
2
|
-
module ViewHelper
|
3
|
-
|
4
|
-
# Returns the url of site appended with the given string
|
5
|
-
# Params:
|
6
|
-
# +str+:: the string to append onto the end of the site url
|
7
|
-
|
8
|
-
def site_url(str = nil)
|
9
|
-
url = Setting.get('site_url')
|
10
|
-
str = str[1..-1] if !str.blank? && str[0,1] == '/'
|
11
|
-
"#{Setting.get('url_prefix')}#{strip_url(url)}/#{str}"
|
12
|
-
end
|
13
|
-
|
14
|
-
# GENERIC Functions #
|
15
|
-
|
16
|
-
# INTERNAL FUNC - returns a hash of the posts but removes the autosave records
|
17
|
-
# Params:
|
18
|
-
# +hash+:: a hash of post ActiveRecord::records
|
19
|
-
|
20
|
-
def filter_results(hash)
|
21
|
-
return [] if hash.blank?
|
22
|
-
h = []
|
23
|
-
hash.each do |k,v|
|
24
|
-
h << k if k.post_type != 'autosave'
|
25
|
-
end
|
26
|
-
h
|
27
|
-
end
|
28
|
-
|
29
|
-
# returns the children records for the post.
|
30
|
-
# Params:
|
31
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
32
|
-
# +depth+:: The nest depth that you want to children to return
|
33
|
-
# +orderby+:: What table column you want the posts to be ordered by
|
34
|
-
|
35
|
-
def obtain_children(check = nil, orderby = 'post_title DESC')
|
36
|
-
post = !check.blank? ? obtain_record(check) : @content
|
37
|
-
return {} if post.blank?
|
38
|
-
p = post.children
|
39
|
-
p = p.arrange(:order => orderby.to_sym) if !orderby.blank?
|
40
|
-
filter_results(p)
|
41
|
-
end
|
42
|
-
|
43
|
-
# returns a boolean as to wether the post has children
|
44
|
-
# Params:
|
45
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable
|
46
|
-
|
47
|
-
def has_children?(check = nil)
|
48
|
-
post = obtain_record(check)
|
49
|
-
post.blank? ? false : post.has_children?
|
50
|
-
end
|
51
|
-
|
52
|
-
# returns a boolean as to wether the post has siblings
|
53
|
-
# Params:
|
54
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable
|
55
|
-
|
56
|
-
def has_siblings?(check = nil)
|
57
|
-
post = obtain_record(check)
|
58
|
-
post.blank? ? false : post.has_siblings?
|
59
|
-
end
|
60
|
-
|
61
|
-
# returns the sibling records for the given post.
|
62
|
-
# Params:
|
63
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
64
|
-
# +depth+:: The nest depth that you want to children to return
|
65
|
-
# +orderby+:: What table column you want the posts to be ordered by
|
66
|
-
|
67
|
-
def obtain_siblings(check = nil, orderby = 'post_title DESC')
|
68
|
-
post = obtain_record(check)
|
69
|
-
return nil if post.blank?
|
70
|
-
p = post.siblings
|
71
|
-
p = p.arrange(:order => orderby.to_sym) if !orderby.blank?
|
72
|
-
filter_results(p)
|
73
|
-
end
|
74
|
-
|
75
|
-
# returns the ancestors for the given post
|
76
|
-
# Params:
|
77
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
78
|
-
|
79
|
-
def obtain_ancestor(check = nil, orderby = 'post_title DESC')
|
80
|
-
post = obtain_record(check)
|
81
|
-
return nil if post.blank?
|
82
|
-
p = post.ancestors
|
83
|
-
p = p.arrange(:order => orderby.to_sym) if !orderby.blank?
|
84
|
-
filter_results(p)
|
85
|
-
end
|
86
|
-
|
87
|
-
# returns the link to the given post
|
88
|
-
# Params:
|
89
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
90
|
-
# +render+:: wether to render the link straight on to the page or return the link in a string
|
91
|
-
|
92
|
-
def obtain_the_permalink(check = nil, render_inline = true)
|
93
|
-
site_url = Setting.get('site_url')
|
94
|
-
post = obtain_record(check)
|
95
|
-
|
96
|
-
return '' if post.blank?
|
97
|
-
|
98
|
-
article_url = Setting.get('articles_slug')
|
99
|
-
|
100
|
-
url =
|
101
|
-
if post.post_type == 'post'
|
102
|
-
site_url("#{article_url}#{post.structured_url}")
|
103
|
-
else
|
104
|
-
site_url("#{post.structured_url}")
|
105
|
-
end
|
106
|
-
|
107
|
-
if render_inline
|
108
|
-
render :inline => url
|
109
|
-
else
|
110
|
-
url
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
# returns a short extract from the post content
|
116
|
-
# Params:
|
117
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
118
|
-
# +length+:: length of the string in characters
|
119
|
-
# +omission+:: something to represent the omission of the content
|
120
|
-
|
121
|
-
def obtain_the_excerpt(check = nil, length = 250, omission = '...')
|
122
|
-
post = obtain_record(check)
|
123
|
-
render :inline => truncate(post.post_content.to_s.gsub(/<[^>]*>/ui,'').html_safe, :omission => omission, :length => length) if !post.blank?
|
124
|
-
end
|
125
|
-
|
126
|
-
# returns a boolean as to wether the post has cover image
|
127
|
-
# Params:
|
128
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
129
|
-
|
130
|
-
def has_cover_image?(check = nil)
|
131
|
-
post = obtain_record(check)
|
132
|
-
!post.blank? && !post.cover_image.blank? ? true : false
|
133
|
-
end
|
134
|
-
|
135
|
-
# returns the cover image of the given post
|
136
|
-
# Params:
|
137
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
138
|
-
|
139
|
-
def obtain_cover_image(check = nil)
|
140
|
-
post = obtain_record(check)
|
141
|
-
return !post.blank? ? post.cover_image : ''
|
142
|
-
end
|
143
|
-
|
144
|
-
|
145
|
-
# returns the date of the given post
|
146
|
-
# Params:
|
147
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
148
|
-
# +render+:: wether to render the link straight on to the page or return the link in a string
|
149
|
-
# +format+:: the date format that you want the date to be provided in
|
150
|
-
|
151
|
-
def obtain_the_date(check = nil, render_inline = true, format = "%d-%m-%Y")
|
152
|
-
post = obtain_record(check)
|
153
|
-
render :inline => post.post_date.strftime(format)
|
154
|
-
end
|
155
|
-
|
156
|
-
|
157
|
-
# CATEGORY functions #
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
# returns an array of all the ids that are either in the system or attached to the given post
|
162
|
-
# Params:
|
163
|
-
# +articleid+:: ID of the article you want to get all the categories for - if this is nil it will return all the categories in the system
|
164
|
-
|
165
|
-
def obtain_all_category_ids(articleid = nil)
|
166
|
-
if article_id.blank?
|
167
|
-
Term.joins(:term_anatomy).where(roroacms_term_anatomies: { taxonomy: 'category' }).pluck(:id)
|
168
|
-
else
|
169
|
-
# get via the posts
|
170
|
-
Term.joins(:term_anatomy, :posts).where(posts: {id: articleid}, roroacms_term_anatomies: { taxonomy: 'category' }).pluck(:id)
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
# returns all the categories in the system
|
175
|
-
|
176
|
-
def obtain_categories
|
177
|
-
Term::CATEGORIES
|
178
|
-
end
|
179
|
-
|
180
|
-
# returns the data for a certain category
|
181
|
-
# Params:
|
182
|
-
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
183
|
-
|
184
|
-
def obtain_category(check = nil)
|
185
|
-
segments = []
|
186
|
-
if check.blank?
|
187
|
-
return nil if params[:slug].blank?
|
188
|
-
segments = params[:slug].split('/')
|
189
|
-
end
|
190
|
-
|
191
|
-
# get the taxonomy name and search the database for the record with this as its slug
|
192
|
-
t = obtain_term_check(check, segments, 'category')
|
193
|
-
t if !t.blank?
|
194
|
-
end
|
195
|
-
|
196
|
-
# returns the title to the given category
|
197
|
-
# Params:
|
198
|
-
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
199
|
-
|
200
|
-
def obtain_category_name(check = nil)
|
201
|
-
segments = []
|
202
|
-
if check.blank?
|
203
|
-
return nil if params[:slug].blank?
|
204
|
-
segments = params[:slug].split('/')
|
205
|
-
end
|
206
|
-
|
207
|
-
# get the taxonomy name and search the database for the record with this as its slug
|
208
|
-
t = obtain_term_check(check, segments, 'category')
|
209
|
-
t.name if !t.blank?
|
210
|
-
|
211
|
-
end
|
212
|
-
|
213
|
-
# returns the link to the given category
|
214
|
-
# Params:
|
215
|
-
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
216
|
-
|
217
|
-
def obtain_category_link(check = nil)
|
218
|
-
segments = []
|
219
|
-
if check.blank?
|
220
|
-
return nil if params[:slug].blank?
|
221
|
-
segments = params[:slug].split('/')
|
222
|
-
end
|
223
|
-
|
224
|
-
# get the taxonomy name and search the database for the record with this as its slug
|
225
|
-
t = obtain_term_check(check, segments, 'category')
|
226
|
-
|
227
|
-
(Setting.get('articles_slug') + '/' + Setting.get('category_slug') + t.structured_url) if !t.blank?
|
228
|
-
end
|
229
|
-
|
230
|
-
# returns the link to the given category
|
231
|
-
# Params:
|
232
|
-
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
233
|
-
|
234
|
-
def obtain_category_description(check = nil)
|
235
|
-
segments = []
|
236
|
-
if check.blank?
|
237
|
-
return nil if params[:slug].blank?
|
238
|
-
segments = params[:slug].split('/')
|
239
|
-
end
|
240
|
-
|
241
|
-
# get the taxonomy name and search the database for the record with this as its slug
|
242
|
-
t = obtain_term_check(check, segments, 'category')
|
243
|
-
t.description if !t.blank?
|
244
|
-
|
245
|
-
end
|
246
|
-
|
247
|
-
# returns a boolean as to wether the given post is in the given category
|
248
|
-
# Params:
|
249
|
-
# +categoryid+:: ID of the category that you want to check
|
250
|
-
# +postid+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
251
|
-
|
252
|
-
def in_category?(categoryid, postid = nil)
|
253
|
-
post = obtain_record(postid)
|
254
|
-
return false if post.blank?
|
255
|
-
!Post.includes(:terms => :term_anatomy).where(id: post.id, terms: { id: categoryid }, roroacms_term_anatomies: { taxonomy: 'category' }).blank?
|
256
|
-
end
|
257
|
-
|
258
|
-
def obtain_category_cover_image(check = nil)
|
259
|
-
cat = obtain_term_check(check, nil, 'category')
|
260
|
-
return !cat.blank? ? cat.cover_image : ''
|
261
|
-
end
|
262
|
-
|
263
|
-
# Returns a list of the categories
|
264
|
-
# Params:
|
265
|
-
# +sub_only+:: show only the sub categories of the current category
|
266
|
-
|
267
|
-
def obtain_category_list(sub_only = false)
|
268
|
-
|
269
|
-
segments = params[:slug].split('/')
|
270
|
-
category_url = Setting.get('category_slug')
|
271
|
-
# variables and data
|
272
|
-
|
273
|
-
# check to see if we are on the category term type, that we just want the sub cateogries and the segments actually exist
|
274
|
-
if segments[1] == category_url && sub_only && !segments[2].blank?
|
275
|
-
|
276
|
-
# get the current category
|
277
|
-
parent_term = Term.where(roroacms_term_anatomies: {taxonomy: 'category'}, :structured_url => "/" + segments.drop(2).join('/')).includes(:term_anatomy).first
|
278
|
-
|
279
|
-
terms =
|
280
|
-
if !parent_term.blank?
|
281
|
-
# get all the records with the current category as its parent
|
282
|
-
Term.where(:parent_id => parent_term.id)
|
283
|
-
else
|
284
|
-
[]
|
285
|
-
end
|
286
|
-
|
287
|
-
else
|
288
|
-
# get all the categories
|
289
|
-
terms = Term.where(roroacms_term_anatomies: {taxonomy: 'category'}, :parent_id => nil).includes(:term_anatomy)
|
290
|
-
end
|
291
|
-
|
292
|
-
li_loop_for_terms(terms.arrange, category_url)
|
293
|
-
|
294
|
-
end
|
295
|
-
|
296
|
-
|
297
|
-
# TAG Functions #
|
298
|
-
|
299
|
-
|
300
|
-
# returns the link to the given tag
|
301
|
-
# Params:
|
302
|
-
# +check+:: ID, slug, or name of the tag - if this is nil it will return the current tag you are on
|
303
|
-
|
304
|
-
def obtain_tag_link(check = nil)
|
305
|
-
segments = []
|
306
|
-
if check.blank?
|
307
|
-
return nil if params[:slug].blank?
|
308
|
-
segments = params[:slug].split('/')
|
309
|
-
end
|
310
|
-
|
311
|
-
t = obtain_term_check(check, segments, 'tag')
|
312
|
-
|
313
|
-
(Setting.get('articles_slug') + '/' + Setting.get('tag_slug') + t.structured_url) if !t.blank?
|
314
|
-
end
|
315
|
-
|
316
|
-
# returns all the tags in the system
|
317
|
-
|
318
|
-
def obtain_tags
|
319
|
-
Term::TAGS
|
320
|
-
end
|
321
|
-
|
322
|
-
# returns a boolean as to wether the given post has the give tag attached to it
|
323
|
-
# Params:
|
324
|
-
# +categoryid+:: ID of the tag that you want to check
|
325
|
-
# +postid+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
326
|
-
|
327
|
-
def has_tag?(tagid, postid = nil)
|
328
|
-
post = obtain_record(postid)
|
329
|
-
return false if post.blank?
|
330
|
-
!Post.includes(:terms => :term_anatomy).where(id: post.id, terms: { id: tagid }, roroacms_term_anatomies: { taxonomy: 'tag' }).blank?
|
331
|
-
end
|
332
|
-
|
333
|
-
# returns the title to the given tag
|
334
|
-
# Params:
|
335
|
-
# +check+:: ID, slug, or name of the tag - if this is nil it will return the current tag you are on
|
336
|
-
|
337
|
-
def obtain_tag_name(check = nil)
|
338
|
-
segments = []
|
339
|
-
if check.blank?
|
340
|
-
return nil if params[:slug].blank?
|
341
|
-
segments = params[:slug].split('/')
|
342
|
-
end
|
343
|
-
|
344
|
-
# get the taxonomy name and search the database for the record with this as its slug
|
345
|
-
t = obtain_term_check(check, segments, 'tag')
|
346
|
-
t.name if !t.blank?
|
347
|
-
|
348
|
-
end
|
349
|
-
|
350
|
-
# returns the description to the given tag
|
351
|
-
# Params:
|
352
|
-
# +check+:: ID, slug, or name of the tag - if this is nil it will return the current tag you are on
|
353
|
-
|
354
|
-
def obtain_tag_description(check = nil)
|
355
|
-
segments = []
|
356
|
-
if check.blank?
|
357
|
-
return nil if params[:slug].blank?
|
358
|
-
segments = params[:slug].split('/')
|
359
|
-
end
|
360
|
-
|
361
|
-
# get the taxonomy name and search the database for the record with this as its slug
|
362
|
-
t = obtain_term_check(check, segments, 'tag')
|
363
|
-
t.description if !t.blank?
|
364
|
-
|
365
|
-
end
|
366
|
-
|
367
|
-
# returns all the data for the given tag
|
368
|
-
# Params:
|
369
|
-
# +check+:: ID, slug, or name of the tag - if this is nil it will return the current tag you are on
|
370
|
-
|
371
|
-
def obtain_tag(check = nil)
|
372
|
-
segments = []
|
373
|
-
if check.blank?
|
374
|
-
return nil if params[:slug].blank?
|
375
|
-
segments = params[:slug].split('/')
|
376
|
-
end
|
377
|
-
|
378
|
-
# get the taxonomy name and search the database for the record with this as its slug
|
379
|
-
t = obtain_term_check(check, segments, 'tag')
|
380
|
-
t if !t.blank?
|
381
|
-
|
382
|
-
end
|
383
|
-
|
384
|
-
# returns the cover image of the given tag
|
385
|
-
# Params:
|
386
|
-
# +check+:: ID, slug, or name - if this is nil it will slug to work out the tag the system is currently viewing
|
387
|
-
|
388
|
-
def obtain_tag_cover_image(check = nil)
|
389
|
-
tag = obtain_term_check(check, nil, 'tag')
|
390
|
-
return !tag.blank? ? tag.cover_image : ''
|
391
|
-
end
|
392
|
-
|
393
|
-
# returns the array of records to display
|
394
|
-
|
395
|
-
def obtain_category_data
|
396
|
-
@content
|
397
|
-
end
|
398
|
-
|
399
|
-
# returns either a list or a tag cloud of the tags - this shows ALL of the tags
|
400
|
-
# Params:
|
401
|
-
# +type+:: string or list style
|
402
|
-
# +sub_only+:: show only the sub tags of the current category
|
403
|
-
|
404
|
-
def obtain_tag_cloud(type, sub_only = false)
|
405
|
-
|
406
|
-
article_url = Setting.get('articles_slug')
|
407
|
-
tag_url = Setting.get('tag_slug')
|
408
|
-
segments = params[:slug].split('/')
|
409
|
-
|
410
|
-
if type == 'string'
|
411
|
-
return '' if not defined?(@content.terms)
|
412
|
-
terms = @content.terms.where(roroacms_term_anatomies: {taxonomy: 'tag'}).includes(:term_anatomy)
|
413
|
-
return terms.all.map do |u|
|
414
|
-
url = article_url + '/' + tag_url + u.structured_url
|
415
|
-
"<a href='#{site_url(url)}'>" + u.name + "</a>"
|
416
|
-
end.join(', ').html_safe
|
417
|
-
|
418
|
-
elsif type == 'list'
|
419
|
-
|
420
|
-
# check to see if we are on the tag term type, that we just want the sub tags and the segments actually exist
|
421
|
-
if segments[1] == tag_url && sub_only && !segments[2].blank?
|
422
|
-
|
423
|
-
# get the current tag record
|
424
|
-
parent_term = Term.where(roroacms_term_anatomies: {taxonomy: 'tag'}, :structured_url => "/" + segments.drop(2).join('/')).includes(:term_anatomy).first
|
425
|
-
|
426
|
-
if !parent_term.blank?
|
427
|
-
# get all the records with the current tag as its parent
|
428
|
-
terms = Term.where(:parent_id => parent_term.id)
|
429
|
-
else
|
430
|
-
terms = []
|
431
|
-
end
|
432
|
-
|
433
|
-
else
|
434
|
-
# get all the tags
|
435
|
-
terms = Term.where(roroacms_term_anatomies: {taxonomy: 'tag'}, :parent_id => nil).includes(:term_anatomy)
|
436
|
-
end
|
437
|
-
# if you want a list style
|
438
|
-
li_loop_for_terms(terms.arrange, tag_url)
|
439
|
-
|
440
|
-
end
|
441
|
-
|
442
|
-
end
|
443
|
-
|
444
|
-
|
445
|
-
# ARTICLE Functions #
|
446
|
-
|
447
|
-
|
448
|
-
# returns all the data for the given article
|
449
|
-
# Params:
|
450
|
-
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
451
|
-
|
452
|
-
def obtain_article(check = nil)
|
453
|
-
if check.blank? && !@content.blank? && @content[0].blank?
|
454
|
-
@content
|
455
|
-
else
|
456
|
-
obtain_record(check, 'post')
|
457
|
-
end
|
458
|
-
end
|
459
|
-
|
460
|
-
# returns the value of the given field for the given article
|
461
|
-
# Params:
|
462
|
-
# +field+:: admin_id, post_content, post_date, post_name, parent_id, post_slug, sort_order, post_visible, post_additional_data, post_status, post_title, cover_image, post_template, post_type, disabled, post_seo_title, post_seo_description, post_seo_keywords, post_seo_is_disabled, post_seo_no_follow, post_seo_no_index
|
463
|
-
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
464
|
-
|
465
|
-
def obtain_article_field(field, check = nil)
|
466
|
-
article =
|
467
|
-
if check.blank? && !@content.blank? && @content[0].blank?
|
468
|
-
@content
|
469
|
-
else
|
470
|
-
obtain_record(check, 'post')
|
471
|
-
end
|
472
|
-
!article.blank? && article.has_attribute?(field) ? article[field.to_sym] : nil
|
473
|
-
end
|
474
|
-
|
475
|
-
# returns the status of the given article
|
476
|
-
# Params:
|
477
|
-
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
478
|
-
|
479
|
-
def obtain_article_status(check = nil)
|
480
|
-
article =
|
481
|
-
if check.blank? && !@content.blank? && @content[0].blank?
|
482
|
-
@content
|
483
|
-
else
|
484
|
-
obtain_record(check, 'page')
|
485
|
-
end
|
486
|
-
!article.blank? && article.has_attribute?('post_status') ? article.post_status : nil
|
487
|
-
end
|
488
|
-
|
489
|
-
# returns all the data of the given articles
|
490
|
-
# Params:
|
491
|
-
# +ids+:: an array of article ids that you want to obtain the data for - if this is nil it will simply return the @content variable data in an array format
|
492
|
-
# +orderby+:: What table column you want the posts to be ordered by, this is a sql string format
|
493
|
-
|
494
|
-
def obtain_articles(ids = nil, orderby = "post_title DESC")
|
495
|
-
return Post.where(:id => ids, :post_type => 'post').order(orderby) if !ids.blank?
|
496
|
-
return [@content] if !@content[0].blank?
|
497
|
-
return Post.where(:post_type => 'post', :post_status => 'Published').order(orderby)
|
498
|
-
end
|
499
|
-
|
500
|
-
# returns all the archive records for the archive you are currently on
|
501
|
-
|
502
|
-
def obtain_archive_data
|
503
|
-
@content
|
504
|
-
end
|
505
|
-
|
506
|
-
# Returns a list of the archives
|
507
|
-
# Params:
|
508
|
-
# +type+:: has to be either Y (year) or M (month)
|
509
|
-
|
510
|
-
def obtain_archive_list(type, blockbydate = nil)
|
511
|
-
|
512
|
-
article_url = Setting.get('articles_slug')
|
513
|
-
category_url = Setting.get('category_slug')
|
514
|
-
h = {}
|
515
|
-
|
516
|
-
# if year
|
517
|
-
if type == 'Y'
|
518
|
-
|
519
|
-
# variables and data
|
520
|
-
p = Post.where(:post_type => 'post', :post_status => 'Published', :disabled => 'N').uniq.pluck("EXTRACT(year FROM post_date)")
|
521
|
-
|
522
|
-
if !p.blank?
|
523
|
-
p.each do |f|
|
524
|
-
h["#{article_url}/#{f}"] = f
|
525
|
-
end
|
526
|
-
end
|
527
|
-
|
528
|
-
# if month
|
529
|
-
elsif type == 'M'
|
530
|
-
|
531
|
-
# variables and data
|
532
|
-
p = Post.where("(post_type = 'post' AND post_status = 'Published' AND disabled = 'N') AND post_date <= CURRENT_TIMESTAMP").uniq.pluck("EXTRACT(year FROM post_date)")
|
533
|
-
lp = {}
|
534
|
-
|
535
|
-
|
536
|
-
if !p.blank?
|
537
|
-
p.each do |f|
|
538
|
-
lp["#{f}"] = Post.where("EXTRACT(year from post_date) = #{f} AND (post_type = 'post' AND disabled = 'N' AND post_status = 'Published' AND post_date <= CURRENT_TIMESTAMP)").uniq.pluck("EXTRACT(MONTH FROM post_date)")
|
539
|
-
end
|
540
|
-
end
|
541
|
-
|
542
|
-
if !lp.blank?
|
543
|
-
|
544
|
-
lp.each do |k, i|
|
545
|
-
|
546
|
-
if blockbydate
|
547
|
-
h["#{article_url}/#{k.to_i}"] = k.to_i
|
548
|
-
end
|
549
|
-
|
550
|
-
i.sort.each do |nm|
|
551
|
-
h["#{article_url}/#{k.to_i}/#{nm.to_i}"] = "#{get_date_name_by_number(nm.to_i)} - #{k.to_i}"
|
552
|
-
end
|
553
|
-
|
554
|
-
end
|
555
|
-
|
556
|
-
end
|
557
|
-
|
558
|
-
end
|
559
|
-
|
560
|
-
li_loop(h)
|
561
|
-
|
562
|
-
end
|
563
|
-
|
564
|
-
|
565
|
-
# returns the lastest article. By default this is 1 but you can get more than one if you want.
|
566
|
-
# Params:
|
567
|
-
# +how_many+:: how many records you want to return
|
568
|
-
|
569
|
-
def obtain_latest_article(how_many = 1)
|
570
|
-
Post.where("post_type ='post' AND disabled = 'N' AND post_status = 'Published' AND (post_date <= CURRENT_TIMESTAMP)").order('post_date DESC').limit(how_many)
|
571
|
-
end
|
572
|
-
|
573
|
-
|
574
|
-
# PAGE functions #
|
575
|
-
|
576
|
-
|
577
|
-
# returns all the data for the given page
|
578
|
-
# Params:
|
579
|
-
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
580
|
-
|
581
|
-
def obtain_page(check = nil)
|
582
|
-
if check.blank? && !@content.blank? && @content[0].blank?
|
583
|
-
@content
|
584
|
-
else
|
585
|
-
obtain_record(check, 'page')
|
586
|
-
end
|
587
|
-
end
|
588
|
-
|
589
|
-
# returns all the data of the given pages
|
590
|
-
# Params:
|
591
|
-
# +ids+:: an array of article ids that you want to obtain the data for - if this is nil it will simply return the @content variable data in an array format
|
592
|
-
# +orderby+:: What table column you want the posts to be ordered by, this is a sql string format
|
593
|
-
|
594
|
-
def obtain_pages(ids = nil, orderby = "post_title DESC")
|
595
|
-
return Post.where(:id => ids, :post_type => 'page').order(orderby) if !ids.blank?
|
596
|
-
return [@content] if !@content[0].blank?
|
597
|
-
return Post.where(:post_type => 'page', :post_status => 'Published').order(orderby)
|
598
|
-
end
|
599
|
-
|
600
|
-
# returns the value of the given field for the given page
|
601
|
-
# Params:
|
602
|
-
# +field+:: admin_id, post_content, post_date, post_name, parent_id, post_slug, sort_order, post_visible, post_additional_data, post_status, post_title, cover_image, post_template, post_type, disabled, post_seo_title, post_seo_description, post_seo_keywords, post_seo_is_disabled, post_seo_no_follow, post_seo_no_index
|
603
|
-
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
604
|
-
|
605
|
-
def obtain_page_field(field, check = nil)
|
606
|
-
page =
|
607
|
-
if check.blank? && !@content.blank? && @content[0].blank?
|
608
|
-
@content
|
609
|
-
else
|
610
|
-
obtain_record(check, 'page')
|
611
|
-
end
|
612
|
-
!page.blank? && page.has_attribute?(field) ? page[field.to_sym] : nil
|
613
|
-
end
|
614
|
-
|
615
|
-
# CONDITIONAL functions #
|
616
|
-
|
617
|
-
|
618
|
-
# TODO: Clean this code up
|
619
|
-
# returns a boolean as to wether the given page/post is a page
|
620
|
-
# Params:
|
621
|
-
# +check+:: ID of the page
|
622
|
-
|
623
|
-
def is_page?(check = nil)
|
624
|
-
|
625
|
-
return false if @content.blank? || !@content[0].blank?
|
626
|
-
return true if @content.post_type == 'page' && check.blank?
|
627
|
-
return true if @content.id == check.to_i
|
628
|
-
return false
|
629
|
-
|
630
|
-
end
|
631
|
-
|
632
|
-
# returns a boolean as to wether the current view is the blog homepage
|
633
|
-
|
634
|
-
def is_articles_home?
|
635
|
-
get_type_by_url == 'C' ? true : false
|
636
|
-
end
|
637
|
-
|
638
|
-
# returns a boolean as to whether the current view is an archive
|
639
|
-
|
640
|
-
def is_archive?
|
641
|
-
get_type_by_url == 'AR' ? true : false
|
642
|
-
end
|
643
|
-
|
644
|
-
# returns a boolean as to whether the current view is a day archive
|
645
|
-
|
646
|
-
def is_day_archive?
|
647
|
-
segments = params[:slug].split('/')
|
648
|
-
(get_type_by_url == 'AR' && !segments[3].blank?) ? true : false
|
649
|
-
end
|
650
|
-
|
651
|
-
# returns a boolean as to whether the current view is a month archive
|
652
|
-
|
653
|
-
def is_month_archive?
|
654
|
-
segments = params[:slug].split('/')
|
655
|
-
(get_type_by_url == 'AR' && !segments[2].blank? && segments[3].blank?) ? true : false
|
656
|
-
end
|
657
|
-
|
658
|
-
# returns a boolean as to whether the current view is a year archive
|
659
|
-
|
660
|
-
def is_year_archive?
|
661
|
-
segments = params[:slug].split('/')
|
662
|
-
(get_type_by_url == 'AR' && !segments[1].blank? && segments[2].blank? && segments[3].blank?) ? true : false
|
663
|
-
end
|
664
|
-
|
665
|
-
# returns the that year/month/day of the current archive
|
666
|
-
|
667
|
-
def obtain_archive_year
|
668
|
-
|
669
|
-
if get_type_by_url == 'AR'
|
670
|
-
segments = params[:slug].split('/')
|
671
|
-
str = ''
|
672
|
-
str = (get_date_name_by_number(segments[2].to_i) + ' ') if !segments[2].blank?
|
673
|
-
str += segments[1]
|
674
|
-
end
|
675
|
-
|
676
|
-
end
|
677
|
-
|
678
|
-
# returns a boolean as to whether the current view is the homepage
|
679
|
-
|
680
|
-
def is_homepage?
|
681
|
-
return false if (!defined?(@content.length).blank? || @content.blank?)
|
682
|
-
@content.id == Setting.get('home_page').to_i ? true : false
|
683
|
-
end
|
684
|
-
|
685
|
-
|
686
|
-
# returns a boolean as to whether the current page is either an article or whether it is the given article provided by the check variable
|
687
|
-
# Params:
|
688
|
-
# +check+:: ID, slug, or name of the article you want to check - if this is nil it will just return if the current view is an article or not
|
689
|
-
|
690
|
-
def is_article?(check = nil)
|
691
|
-
return false if params[:slug].blank?
|
692
|
-
segments = params[:slug].split('/')
|
693
|
-
if check.blank?
|
694
|
-
(segments[0] == Setting.get('articles_slug') && !segments[1].blank? && segments[1] != Setting.get('tag_slug') && segments[1] != Setting.get('category_slug') && @content.class != ActiveRecord::Relation) ? true : false
|
695
|
-
else
|
696
|
-
if !defined?(@content.size).blank?
|
697
|
-
return false
|
698
|
-
end
|
699
|
-
(Setting.get('articles_slug') == segments[0] && (@content.post_title == check || @content.id == check || @content.post_slug == check) ) ? true : false
|
700
|
-
end
|
701
|
-
end
|
702
|
-
|
703
|
-
# returns a boolean as to whether the current view is a search view or not
|
704
|
-
|
705
|
-
def is_search?
|
706
|
-
(defined?(params[:search]) && !params[:search].blank?) ? true : false
|
707
|
-
end
|
708
|
-
|
709
|
-
# returns a boolean as to whether the current page is either an tag view or whether it is the given tag provided by the check variable
|
710
|
-
# Params:
|
711
|
-
# +check+:: ID, slug, or name of the tag - if this is nil it will just check to see if the current view is a tag view
|
712
|
-
|
713
|
-
def is_tag?(check = nil)
|
714
|
-
return false if params[:slug].blank?
|
715
|
-
segments = params[:slug].split('/')
|
716
|
-
if check.blank?
|
717
|
-
Setting.get('tag_slug') == segments[1] ? true : false
|
718
|
-
else
|
719
|
-
term = obtain_term(segments)
|
720
|
-
term_check('tag_slug', segments)
|
721
|
-
end
|
722
|
-
end
|
723
|
-
|
724
|
-
# returns a boolean as to whether the current page is either an category view or whether it is the given category provided by the check variable
|
725
|
-
# Params:
|
726
|
-
# +check+:: ID, slug, or name of the category - if this is nil it will just check to see if the current view is a category view
|
727
|
-
|
728
|
-
def is_category?(check = nil)
|
729
|
-
return false if params[:slug].blank?
|
730
|
-
segments = params[:slug].split('/')
|
731
|
-
if check.blank?
|
732
|
-
Setting.get('category_slug') == segments[1] ? true : false
|
733
|
-
else
|
734
|
-
term = obtain_term(segments)
|
735
|
-
term_check('category_slug', segments)
|
736
|
-
end
|
737
|
-
end
|
738
|
-
|
739
|
-
|
740
|
-
# USER Functions #
|
741
|
-
|
742
|
-
# returns all the data for the given user
|
743
|
-
# Params:
|
744
|
-
# +check+:: ID, email, or username of the user
|
745
|
-
|
746
|
-
def obtain_user_profile(check = nil)
|
747
|
-
return nil if check.blank?
|
748
|
-
obtain_users(check)
|
749
|
-
end
|
750
|
-
|
751
|
-
# returns all the users
|
752
|
-
# Params:
|
753
|
-
# +access+:: restrict the returned data to show only certain access levels access level - the options can be found in the admin panel
|
754
|
-
|
755
|
-
def obtain_users(access = nil)
|
756
|
-
admins = obtain_users
|
757
|
-
if access.is_a?(Array)
|
758
|
-
admins = admins.where(:id => access) if !access.blank?
|
759
|
-
else
|
760
|
-
admins = admins.where(:access_level => access) if !access.blank?
|
761
|
-
end
|
762
|
-
|
763
|
-
admins
|
764
|
-
end
|
765
|
-
|
766
|
-
# returns certian field of the given user
|
767
|
-
# Params:
|
768
|
-
# +field+:: the field that you want to return - id, email, first_name, last_name, username, access_level, avatar, cover_picture, overlord
|
769
|
-
# +check+:: ID, email, or username of the user - if this is nil it will user the user that wrote the current article/page
|
770
|
-
|
771
|
-
def obtain_user_field(field, check = nil)
|
772
|
-
admin =
|
773
|
-
if !check.blank?
|
774
|
-
obtain_users(check)
|
775
|
-
else
|
776
|
-
return nil if @content.blank? || !@content[0].blank?
|
777
|
-
Admin.find_by_id(@content.admin_id)
|
778
|
-
end
|
779
|
-
return '' if admin.blank?
|
780
|
-
admin.has_attribute?(field) ? admin[field].to_s : ''
|
781
|
-
end
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
# COMMENT Functions #
|
786
|
-
|
787
|
-
# returns the author name of the given comment
|
788
|
-
# Params:
|
789
|
-
# +comment_id+:: ID of the comment
|
790
|
-
|
791
|
-
def obtain_comment_author(comment_id = nil)
|
792
|
-
return nil if comment_id.blank?
|
793
|
-
comm = Comment.find_by_id(comment_id)
|
794
|
-
comm.author if !comm.blank?
|
795
|
-
end
|
796
|
-
|
797
|
-
# returns the date of the given comment
|
798
|
-
# Params:
|
799
|
-
# +comment_id+:: ID of the comment
|
800
|
-
# +format+:: the format that you want the date to be returned in
|
801
|
-
|
802
|
-
def obtain_comment_date(comment_id = nil, format = "%d-%m-%Y")
|
803
|
-
return nil if comment_id.blank?
|
804
|
-
comment = Comment.find_by_id(comment_id)
|
805
|
-
comment = comment.submitted_on.strftime(format) if !comment.blank?
|
806
|
-
comment if !comment.blank?
|
807
|
-
end
|
808
|
-
|
809
|
-
# returns the time of the given comment
|
810
|
-
# Params:
|
811
|
-
# +comment_id+:: ID of the comment
|
812
|
-
# +format+:: the format that you want the time to be returned in
|
813
|
-
|
814
|
-
def obtain_comment_time(comment_id = nil, format = "%H:%M:%S")
|
815
|
-
return nil if comment_id.blank?
|
816
|
-
comment = Comment.find_by_id(comment_id)
|
817
|
-
comment = comment.submitted_on.strftime(format) if !comment.blank?
|
818
|
-
comment if !comment.blank?
|
819
|
-
end
|
820
|
-
|
821
|
-
# returns the comments for the given article
|
822
|
-
# Params:
|
823
|
-
# +check+:: ID, post_slug, or post_title - if this is nil it return the comments for the the @content variable (the current page)
|
824
|
-
|
825
|
-
def obtain_comments(check = nil)
|
826
|
-
|
827
|
-
if check.blank? && !@content.blank? && @content[0].blank?
|
828
|
-
Comment.where(:post_id => @content.id, :comment_approved => 'Y')
|
829
|
-
else
|
830
|
-
Comment.where(:post_id => check, :comment_approved => 'Y')
|
831
|
-
end
|
832
|
-
|
833
|
-
end
|
834
|
-
|
835
|
-
# returns the comment form that is created in the theme folder.
|
836
|
-
|
837
|
-
def obtain_comments_form
|
838
|
-
|
839
|
-
if Setting.get('article_comments') == 'Y'
|
840
|
-
type = Setting.get('article_comment_type')
|
841
|
-
@new_comment = Comment.new
|
842
|
-
if File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/comments_form." + get_theme_ext)
|
843
|
-
render(:template => "themes/#{current_theme}/comments_form." + get_theme_ext , :layout => nil, :locals => { type: type }).to_s
|
844
|
-
else
|
845
|
-
render :inline => 'comments_form.html.erb does not exist in current theme'
|
846
|
-
end
|
847
|
-
end
|
848
|
-
|
849
|
-
end
|
850
|
-
|
851
|
-
# Easy to understand function for getting the search form.
|
852
|
-
# this is created and displayed from the theme.
|
853
|
-
|
854
|
-
def obtain_search_form
|
855
|
-
if File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/search_form." + get_theme_ext)
|
856
|
-
render :template => "themes/#{current_theme}/search_form." + get_theme_ext
|
857
|
-
else
|
858
|
-
render :inline => 'search_form.html.erb does not exist in current theme'
|
859
|
-
end
|
860
|
-
end
|
861
|
-
|
862
|
-
# MISCELLANEOUS Functions #
|
863
|
-
|
864
|
-
# returns the ID for the current view that you are on
|
865
|
-
|
866
|
-
def obtain_id
|
867
|
-
@content.id if !@content.blank? && @content[0].blank?
|
868
|
-
end
|
869
|
-
|
870
|
-
# returns the author of the current article/page
|
871
|
-
# Params:
|
872
|
-
# +postid+:: ID of the post/page that you want o obtain the author for
|
873
|
-
|
874
|
-
def obtain_the_author(postid = nil)
|
875
|
-
if id.blank?
|
876
|
-
return nil if @content.blank? || !@content[0].blank?
|
877
|
-
obtain_users(@content.admin_id)
|
878
|
-
else
|
879
|
-
Admin.joins(:posts).select(user_select_fields).where(posts: { id: postid }).first
|
880
|
-
end
|
881
|
-
end
|
882
|
-
|
883
|
-
# returns all of the articles that the user has created
|
884
|
-
# Params:
|
885
|
-
# +id+:: ID of the user that you want to get all the records for
|
886
|
-
|
887
|
-
def obtain_the_authors_articles(id = nil)
|
888
|
-
return nil if id.blank? && (@content.blank? || !@content[0].blank?)
|
889
|
-
check =
|
890
|
-
if id.blank?
|
891
|
-
@content.admin_id
|
892
|
-
else
|
893
|
-
id
|
894
|
-
end
|
895
|
-
Post.where(:admin_id => check)
|
896
|
-
end
|
897
|
-
|
898
|
-
# returns the content for the given post/page
|
899
|
-
# Params:
|
900
|
-
# +id+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
901
|
-
|
902
|
-
def obtain_the_content(check = nil)
|
903
|
-
post = obtain_record(check)
|
904
|
-
render :inline => prep_content(post).html_safe if !post.blank?
|
905
|
-
end
|
906
|
-
|
907
|
-
# returns the title for the given post/page
|
908
|
-
# Params:
|
909
|
-
# +id+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
910
|
-
|
911
|
-
def obtain_the_title(check = nil)
|
912
|
-
post = obtain_record(check)
|
913
|
-
render :inline => post.post_title if !post.blank?
|
914
|
-
end
|
915
|
-
|
916
|
-
# return what type of taxonomy it is either - category or tag
|
917
|
-
|
918
|
-
def obtain_term_type
|
919
|
-
return nil if params[:slug].blank?
|
920
|
-
segments = params[:slug].split('/')
|
921
|
-
|
922
|
-
if !segments[1].blank?
|
923
|
-
term = TermAnatomy.where(:taxonomy => segments[1]).last
|
924
|
-
term.taxonomy if !term.blank?
|
925
|
-
else
|
926
|
-
nil
|
927
|
-
end
|
928
|
-
|
929
|
-
end
|
930
|
-
|
931
|
-
# returns the title to the given term, the differnece between obtain_tag_name/obtain_category_name is that this will return the title if you do not know what term type you are on.
|
932
|
-
# Params:
|
933
|
-
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
934
|
-
|
935
|
-
def obtain_term_title(check = nil)
|
936
|
-
segments = []
|
937
|
-
if check.blank?
|
938
|
-
return nil if params[:slug].blank?
|
939
|
-
segments = params[:slug].split('/')
|
940
|
-
end
|
941
|
-
|
942
|
-
# get the taxonomy name and search the database for the record with this as its slug
|
943
|
-
t = obtain_term_check(check, segments)
|
944
|
-
t.name if !t.blank?
|
945
|
-
|
946
|
-
end
|
947
|
-
|
948
|
-
# returns the additional data record
|
949
|
-
# Params:
|
950
|
-
# +key+:: the key to the additional data that you want to return - if this is nil it will return all of the additional data for the given record
|
951
|
-
# +check+:: ID, post_slug, or post_title of the post record - if this is nil it will use the @content variable (the current page)
|
952
|
-
|
953
|
-
def obtain_additional_data(key = nil, check = nil)
|
954
|
-
|
955
|
-
if check.blank?
|
956
|
-
return nil if @content.blank? || !@content[0].blank?
|
957
|
-
end
|
958
|
-
|
959
|
-
post =
|
960
|
-
if check.blank?
|
961
|
-
@content.post_additional_data
|
962
|
-
else
|
963
|
-
obtain_record(check).post_additional_data
|
964
|
-
end
|
965
|
-
|
966
|
-
return nil if post.blank?
|
967
|
-
|
968
|
-
data = @json.decode(post)
|
969
|
-
if key.blank?
|
970
|
-
data
|
971
|
-
else
|
972
|
-
data[key]
|
973
|
-
end
|
974
|
-
|
975
|
-
end
|
976
|
-
|
977
|
-
# returns a short extract of the given content
|
978
|
-
# Params:
|
979
|
-
# +content+:: the content
|
980
|
-
# +length+:: length of the string in characters
|
981
|
-
# +omission+:: something to represent the omission of the content
|
982
|
-
|
983
|
-
def create_excerpt(content = '', length = 255, omission = '...')
|
984
|
-
render :inline => truncate(content, :omission => omission, :length => length)
|
985
|
-
end
|
986
|
-
|
987
|
-
# returns a full post record (this is used mainly internally to retrieve the data for other functions)
|
988
|
-
# Params:
|
989
|
-
# +check+:: ID, post_slug, or post_title of the post record - if this is nil it will use the @content variable (the current page)
|
990
|
-
|
991
|
-
def obtain_record(check = nil, type = nil)
|
992
|
-
|
993
|
-
return check if check.is_a?(ActiveRecord::Base)
|
994
|
-
|
995
|
-
if check.blank?
|
996
|
-
return nil if @content.blank? || !@content[0].blank?
|
997
|
-
@content
|
998
|
-
else
|
999
|
-
records = Post.where( 'post_title = :p OR post_slug = :p2 OR id = :p3', { p: check.to_s, p2: check.to_s, p3: check.to_i} )
|
1000
|
-
if !type.blank?
|
1001
|
-
records = records.where("post_type = :p4", {p4: type})
|
1002
|
-
end
|
1003
|
-
records.first
|
1004
|
-
end
|
1005
|
-
|
1006
|
-
end
|
1007
|
-
|
1008
|
-
# returns a full term record (this is used mainly internally to retrieve the data for above functions)
|
1009
|
-
# Params:
|
1010
|
-
# +segments+:: URL segments
|
1011
|
-
|
1012
|
-
def obtain_term(segments)
|
1013
|
-
Term.where(structured_url: ('/' + segments[2..-1].join('/')))
|
1014
|
-
end
|
1015
|
-
|
1016
|
-
# returns a full tag record (this is used mainly internally to retrieve the data for above functions)
|
1017
|
-
# Params:
|
1018
|
-
# +check+:: ID, slug, or name of the term record - if this is nil it will use the url to work out the current tag that you are viewing
|
1019
|
-
# +segments+:: pass in the segments of the url
|
1020
|
-
# +type+:: wether you want to check the term type against tag or category
|
1021
|
-
|
1022
|
-
def obtain_term_check(check = nil, segments = nil, type = nil)
|
1023
|
-
term =
|
1024
|
-
if check.blank? && !segments.blank? && !segments[2].blank?
|
1025
|
-
Term.includes(:term_anatomy).where(:structured_url => "/" + segments.drop(2).join('/')).first
|
1026
|
-
else
|
1027
|
-
Term.includes(:term_anatomy).where("name = :p OR slug = :p2 OR terms.id = :p3", { p: check.to_s, p2: check.to_s, p3: check.to_i })
|
1028
|
-
end
|
1029
|
-
|
1030
|
-
term = term.where(roroacms_term_anatomies: { taxonomy: type }) if !type.blank?
|
1031
|
-
|
1032
|
-
term
|
1033
|
-
|
1034
|
-
end
|
1035
|
-
|
1036
|
-
# returns wether the current url is the given term type
|
1037
|
-
# Params:
|
1038
|
-
# +type+:: the type of term you want to check against
|
1039
|
-
# +segments+:: pass in the segments of the url
|
1040
|
-
|
1041
|
-
def term_check(type, segments)
|
1042
|
-
(Setting.get(type) == segments[1] && (term.first.name == check || term.first.id == check || term.first.slug == check) ) ? true : false
|
1043
|
-
end
|
1044
|
-
|
1045
|
-
# returns the users (this is used mainly internally to retrieve the data for above functions)
|
1046
|
-
# Params:
|
1047
|
-
# +check+:: ID, email, or username of the user record - if this is nil it will return all users
|
1048
|
-
|
1049
|
-
def obtain_users(check = nil)
|
1050
|
-
admin = Admin.select(user_select_fields)
|
1051
|
-
admin = admin.where( 'id = :p OR email = :p2 OR username = :p3', { p: check.to_i, p2: check.to_s, p3: check.to_s} ).first if !check.blank?
|
1052
|
-
admin
|
1053
|
-
end
|
1054
|
-
|
1055
|
-
# returns the fields that the user will be allowed to access when using the user functions (this is used mainly internally to retrieve the data for above functions)
|
1056
|
-
|
1057
|
-
def user_select_fields
|
1058
|
-
return 'admins.id, email, first_name, last_name, username, access_level, avatar, cover_picture, overlord'
|
1059
|
-
end
|
1060
|
-
|
1061
|
-
# The view helper contains all of the functions that the views
|
1062
|
-
# will use in order to display the contents of either the content
|
1063
|
-
# or format other data
|
1064
|
-
|
1065
|
-
# Returns a nested list of the comments
|
1066
|
-
# Params:
|
1067
|
-
# +post_id+:: id of the post that you want to get comments for
|
1068
|
-
|
1069
|
-
def display_comments_loop(post_id = nil)
|
1070
|
-
|
1071
|
-
# get the comments by the post id or the globalized @content record
|
1072
|
-
comments =
|
1073
|
-
if !post_id.nil?
|
1074
|
-
Comment.where(:post_id => post_id)
|
1075
|
-
else
|
1076
|
-
Comment.where(:post_id => @content.id, :comment_approved => 'Y', :is_spam => 'N')
|
1077
|
-
end
|
1078
|
-
|
1079
|
-
if comments.size > 0
|
1080
|
-
html = "<h3 id='comments-title'>#{comments.count}" + I18n.t("helpers.view_helper.display_comments_loop.response") + " #{obtain_the_title}</h3>"
|
1081
|
-
end
|
1082
|
-
|
1083
|
-
html = nested_comments obtain_comments.arrange(:order => 'created_at ASC')
|
1084
|
-
|
1085
|
-
render :inline => html.html_safe
|
1086
|
-
|
1087
|
-
end
|
1088
|
-
|
1089
|
-
|
1090
|
-
# Return the author information of the articles
|
1091
|
-
# Params:
|
1092
|
-
# +raw+:: if set to true you will just get the author information in a raw ActiveRcord format
|
1093
|
-
|
1094
|
-
def display_author_information(raw = false)
|
1095
|
-
|
1096
|
-
admin = Admin.find_by_id(@content.admin_id)
|
1097
|
-
if raw
|
1098
|
-
admin
|
1099
|
-
else
|
1100
|
-
unless @admin.blank?
|
1101
|
-
html = "<div id='author-info'>
|
1102
|
-
<div id='author-description'>
|
1103
|
-
<h2>#{@admin.first_name} #{@admin.last_name}</h2>
|
1104
|
-
<p>#{@admin.description}</p>
|
1105
|
-
</div>
|
1106
|
-
</div>"
|
1107
|
-
|
1108
|
-
render :inline => html.html_safe
|
1109
|
-
end
|
1110
|
-
end
|
1111
|
-
|
1112
|
-
end
|
1113
|
-
|
1114
|
-
|
1115
|
-
# Returns the html for the comments tree of a post
|
1116
|
-
# Params:
|
1117
|
-
# +messages+:: all of the messages for the post
|
1118
|
-
|
1119
|
-
def nested_comments(messages)
|
1120
|
-
messages.map do |message, sub_messages|
|
1121
|
-
@comment = message
|
1122
|
-
render('roroacms/admin/partials/comment') + content_tag(:div, nested_comments(sub_messages), :class => "nested_comments")
|
1123
|
-
end.join.html_safe
|
1124
|
-
end
|
1125
|
-
|
1126
|
-
def admin_nested_comments(messages)
|
1127
|
-
messages.map do |message, sub_messages|
|
1128
|
-
@comment = message
|
1129
|
-
render('roroacms/admin/partials/admin_comment') + content_tag(:ul, admin_nested_comments(sub_messages), :class => "list-group nested_comments")
|
1130
|
-
end.join.html_safe
|
1131
|
-
end
|
1132
|
-
|
1133
|
-
|
1134
|
-
# Returns a list of the given data
|
1135
|
-
# Params:
|
1136
|
-
# +arr+:: array that you want to list through to create the list
|
1137
|
-
|
1138
|
-
def li_loop(arr)
|
1139
|
-
|
1140
|
-
html = '<ul>'
|
1141
|
-
arr.each do |k, v|
|
1142
|
-
html += "<li><a href='#{site_url}#{k}'>#{v}</a></li>"
|
1143
|
-
end
|
1144
|
-
html += '</ul>'
|
1145
|
-
|
1146
|
-
render :inline => html
|
1147
|
-
|
1148
|
-
end
|
1149
|
-
|
1150
|
-
# Returns a list of the given data, but puts children records in the loop
|
1151
|
-
# Params:
|
1152
|
-
# +arr+:: array that you want to list through to create the list
|
1153
|
-
|
1154
|
-
def li_loop_for_terms(arr, term_type, initial = 'initial')
|
1155
|
-
|
1156
|
-
article_url = Setting.get('articles_slug')
|
1157
|
-
|
1158
|
-
html = '<ul class="' + initial + '">'
|
1159
|
-
arr.each do |key, val|
|
1160
|
-
html += "<li><a href='#{site_url}#{article_url}/#{term_type}#{key.structured_url}'>#{key.name}</a>"
|
1161
|
-
html += li_loop_for_terms(val, term_type, 'sub') unless val.blank?
|
1162
|
-
end
|
1163
|
-
html += '</ul>'
|
1164
|
-
|
1165
|
-
render :inline => html
|
1166
|
-
|
1167
|
-
end
|
1168
|
-
|
1169
|
-
|
1170
|
-
# Returns a sub string of the month name
|
1171
|
-
# Params:
|
1172
|
-
# +str+:: integer of the month
|
1173
|
-
|
1174
|
-
def get_date_name_by_number(str)
|
1175
|
-
case str
|
1176
|
-
when 1 then I18n.t("helpers.view_helper.get_date_name_by_number.date_1")
|
1177
|
-
when 2 then I18n.t("helpers.view_helper.get_date_name_by_number.date_2")
|
1178
|
-
when 3 then I18n.t("helpers.view_helper.get_date_name_by_number.date_3")
|
1179
|
-
when 4 then I18n.t("helpers.view_helper.get_date_name_by_number.date_4")
|
1180
|
-
when 5 then I18n.t("helpers.view_helper.get_date_name_by_number.date_5")
|
1181
|
-
when 6 then I18n.t("helpers.view_helper.get_date_name_by_number.date_6")
|
1182
|
-
when 7 then I18n.t("helpers.view_helper.get_date_name_by_number.date_7")
|
1183
|
-
when 8 then I18n.t("helpers.view_helper.get_date_name_by_number.date_8")
|
1184
|
-
when 9 then I18n.t("helpers.view_helper.get_date_name_by_number.date_9")
|
1185
|
-
when 10 then I18n.t("helpers.view_helper.get_date_name_by_number.date_10")
|
1186
|
-
when 11 then I18n.t("helpers.view_helper.get_date_name_by_number.date_11")
|
1187
|
-
when 12 then I18n.t("helpers.view_helper.get_date_name_by_number.date_12")
|
1188
|
-
end
|
1189
|
-
end
|
1190
|
-
|
1191
|
-
|
1192
|
-
# returns a boolean as to wether the template file actually exists
|
1193
|
-
# Params:
|
1194
|
-
# +name+:: the name of the template file that you want to check exists
|
1195
|
-
|
1196
|
-
def view_file_exists?(name)
|
1197
|
-
File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/template-#{name}." + get_theme_ext )
|
1198
|
-
end
|
1199
|
-
|
1200
|
-
|
1201
|
-
# get current theme
|
1202
|
-
|
1203
|
-
def current_theme
|
1204
|
-
Setting.get('theme_folder')
|
1205
|
-
end
|
1206
|
-
|
1207
|
-
|
1208
|
-
# returns a full url to the file that you want to render from the theme file.
|
1209
|
-
# example usage would be: <%= render theme_url 'sidebar' %>
|
1210
|
-
# Params:
|
1211
|
-
# +append+:: the name of the file that you want to render
|
1212
|
-
|
1213
|
-
def theme_url(append)
|
1214
|
-
"themes/#{current_theme}/#{append}"
|
1215
|
-
end
|
1216
|
-
|
1217
|
-
# displays the header. + get_theme_ext template in the theme if the file exists
|
1218
|
-
|
1219
|
-
def display_header
|
1220
|
-
render :template => "/themes/#{current_theme}/header." + get_theme_ext if File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/header." + get_theme_ext )
|
1221
|
-
end
|
1222
|
-
|
1223
|
-
# displays the header. + get_theme_ext template in the theme if the file exists
|
1224
|
-
|
1225
|
-
def display_footer
|
1226
|
-
render :template => "themes/#{current_theme}/footer." + get_theme_ext if File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/footer." + get_theme_ext )
|
1227
|
-
end
|
1228
|
-
|
1229
|
-
end
|
1
|
+
module Roroacms
|
2
|
+
module ViewHelper
|
3
|
+
|
4
|
+
# Returns the url of site appended with the given string
|
5
|
+
# Params:
|
6
|
+
# +str+:: the string to append onto the end of the site url
|
7
|
+
|
8
|
+
def site_url(str = nil)
|
9
|
+
url = Setting.get('site_url')
|
10
|
+
str = str[1..-1] if !str.blank? && str[0,1] == '/'
|
11
|
+
"#{Setting.get('url_prefix')}#{strip_url(url)}/#{str}"
|
12
|
+
end
|
13
|
+
|
14
|
+
# GENERIC Functions #
|
15
|
+
|
16
|
+
# INTERNAL FUNC - returns a hash of the posts but removes the autosave records
|
17
|
+
# Params:
|
18
|
+
# +hash+:: a hash of post ActiveRecord::records
|
19
|
+
|
20
|
+
def filter_results(hash)
|
21
|
+
return [] if hash.blank?
|
22
|
+
h = []
|
23
|
+
hash.each do |k,v|
|
24
|
+
h << k if k.post_type != 'autosave'
|
25
|
+
end
|
26
|
+
h
|
27
|
+
end
|
28
|
+
|
29
|
+
# returns the children records for the post.
|
30
|
+
# Params:
|
31
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
32
|
+
# +depth+:: The nest depth that you want to children to return
|
33
|
+
# +orderby+:: What table column you want the posts to be ordered by
|
34
|
+
|
35
|
+
def obtain_children(check = nil, orderby = 'post_title DESC')
|
36
|
+
post = !check.blank? ? obtain_record(check) : @content
|
37
|
+
return {} if post.blank?
|
38
|
+
p = post.children
|
39
|
+
p = p.arrange(:order => orderby.to_sym) if !orderby.blank?
|
40
|
+
filter_results(p)
|
41
|
+
end
|
42
|
+
|
43
|
+
# returns a boolean as to wether the post has children
|
44
|
+
# Params:
|
45
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable
|
46
|
+
|
47
|
+
def has_children?(check = nil)
|
48
|
+
post = obtain_record(check)
|
49
|
+
post.blank? ? false : post.has_children?
|
50
|
+
end
|
51
|
+
|
52
|
+
# returns a boolean as to wether the post has siblings
|
53
|
+
# Params:
|
54
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable
|
55
|
+
|
56
|
+
def has_siblings?(check = nil)
|
57
|
+
post = obtain_record(check)
|
58
|
+
post.blank? ? false : post.has_siblings?
|
59
|
+
end
|
60
|
+
|
61
|
+
# returns the sibling records for the given post.
|
62
|
+
# Params:
|
63
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
64
|
+
# +depth+:: The nest depth that you want to children to return
|
65
|
+
# +orderby+:: What table column you want the posts to be ordered by
|
66
|
+
|
67
|
+
def obtain_siblings(check = nil, orderby = 'post_title DESC')
|
68
|
+
post = obtain_record(check)
|
69
|
+
return nil if post.blank?
|
70
|
+
p = post.siblings
|
71
|
+
p = p.arrange(:order => orderby.to_sym) if !orderby.blank?
|
72
|
+
filter_results(p)
|
73
|
+
end
|
74
|
+
|
75
|
+
# returns the ancestors for the given post
|
76
|
+
# Params:
|
77
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
78
|
+
|
79
|
+
def obtain_ancestor(check = nil, orderby = 'post_title DESC')
|
80
|
+
post = obtain_record(check)
|
81
|
+
return nil if post.blank?
|
82
|
+
p = post.ancestors
|
83
|
+
p = p.arrange(:order => orderby.to_sym) if !orderby.blank?
|
84
|
+
filter_results(p)
|
85
|
+
end
|
86
|
+
|
87
|
+
# returns the link to the given post
|
88
|
+
# Params:
|
89
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
90
|
+
# +render+:: wether to render the link straight on to the page or return the link in a string
|
91
|
+
|
92
|
+
def obtain_the_permalink(check = nil, render_inline = true)
|
93
|
+
site_url = Setting.get('site_url')
|
94
|
+
post = obtain_record(check)
|
95
|
+
|
96
|
+
return '' if post.blank?
|
97
|
+
|
98
|
+
article_url = Setting.get('articles_slug')
|
99
|
+
|
100
|
+
url =
|
101
|
+
if post.post_type == 'post'
|
102
|
+
site_url("#{article_url}#{post.structured_url}")
|
103
|
+
else
|
104
|
+
site_url("#{post.structured_url}")
|
105
|
+
end
|
106
|
+
|
107
|
+
if render_inline
|
108
|
+
render :inline => url
|
109
|
+
else
|
110
|
+
url
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
# returns a short extract from the post content
|
116
|
+
# Params:
|
117
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
118
|
+
# +length+:: length of the string in characters
|
119
|
+
# +omission+:: something to represent the omission of the content
|
120
|
+
|
121
|
+
def obtain_the_excerpt(check = nil, length = 250, omission = '...')
|
122
|
+
post = obtain_record(check)
|
123
|
+
render :inline => truncate(post.post_content.to_s.gsub(/<[^>]*>/ui,'').html_safe, :omission => omission, :length => length) if !post.blank?
|
124
|
+
end
|
125
|
+
|
126
|
+
# returns a boolean as to wether the post has cover image
|
127
|
+
# Params:
|
128
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
129
|
+
|
130
|
+
def has_cover_image?(check = nil)
|
131
|
+
post = obtain_record(check)
|
132
|
+
!post.blank? && !post.cover_image.blank? ? true : false
|
133
|
+
end
|
134
|
+
|
135
|
+
# returns the cover image of the given post
|
136
|
+
# Params:
|
137
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
138
|
+
|
139
|
+
def obtain_cover_image(check = nil)
|
140
|
+
post = obtain_record(check)
|
141
|
+
return !post.blank? ? post.cover_image : ''
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
# returns the date of the given post
|
146
|
+
# Params:
|
147
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
148
|
+
# +render+:: wether to render the link straight on to the page or return the link in a string
|
149
|
+
# +format+:: the date format that you want the date to be provided in
|
150
|
+
|
151
|
+
def obtain_the_date(check = nil, render_inline = true, format = "%d-%m-%Y")
|
152
|
+
post = obtain_record(check)
|
153
|
+
render :inline => post.post_date.strftime(format)
|
154
|
+
end
|
155
|
+
|
156
|
+
|
157
|
+
# CATEGORY functions #
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
# returns an array of all the ids that are either in the system or attached to the given post
|
162
|
+
# Params:
|
163
|
+
# +articleid+:: ID of the article you want to get all the categories for - if this is nil it will return all the categories in the system
|
164
|
+
|
165
|
+
def obtain_all_category_ids(articleid = nil)
|
166
|
+
if article_id.blank?
|
167
|
+
Term.joins(:term_anatomy).where(roroacms_term_anatomies: { taxonomy: 'category' }).pluck(:id)
|
168
|
+
else
|
169
|
+
# get via the posts
|
170
|
+
Term.joins(:term_anatomy, :posts).where(posts: {id: articleid}, roroacms_term_anatomies: { taxonomy: 'category' }).pluck(:id)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
# returns all the categories in the system
|
175
|
+
|
176
|
+
def obtain_categories
|
177
|
+
Term::CATEGORIES
|
178
|
+
end
|
179
|
+
|
180
|
+
# returns the data for a certain category
|
181
|
+
# Params:
|
182
|
+
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
183
|
+
|
184
|
+
def obtain_category(check = nil)
|
185
|
+
segments = []
|
186
|
+
if check.blank?
|
187
|
+
return nil if params[:slug].blank?
|
188
|
+
segments = params[:slug].split('/')
|
189
|
+
end
|
190
|
+
|
191
|
+
# get the taxonomy name and search the database for the record with this as its slug
|
192
|
+
t = obtain_term_check(check, segments, 'category')
|
193
|
+
t if !t.blank?
|
194
|
+
end
|
195
|
+
|
196
|
+
# returns the title to the given category
|
197
|
+
# Params:
|
198
|
+
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
199
|
+
|
200
|
+
def obtain_category_name(check = nil)
|
201
|
+
segments = []
|
202
|
+
if check.blank?
|
203
|
+
return nil if params[:slug].blank?
|
204
|
+
segments = params[:slug].split('/')
|
205
|
+
end
|
206
|
+
|
207
|
+
# get the taxonomy name and search the database for the record with this as its slug
|
208
|
+
t = obtain_term_check(check, segments, 'category')
|
209
|
+
t.name if !t.blank?
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
# returns the link to the given category
|
214
|
+
# Params:
|
215
|
+
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
216
|
+
|
217
|
+
def obtain_category_link(check = nil)
|
218
|
+
segments = []
|
219
|
+
if check.blank?
|
220
|
+
return nil if params[:slug].blank?
|
221
|
+
segments = params[:slug].split('/')
|
222
|
+
end
|
223
|
+
|
224
|
+
# get the taxonomy name and search the database for the record with this as its slug
|
225
|
+
t = obtain_term_check(check, segments, 'category')
|
226
|
+
|
227
|
+
(Setting.get('articles_slug') + '/' + Setting.get('category_slug') + t.structured_url) if !t.blank?
|
228
|
+
end
|
229
|
+
|
230
|
+
# returns the link to the given category
|
231
|
+
# Params:
|
232
|
+
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
233
|
+
|
234
|
+
def obtain_category_description(check = nil)
|
235
|
+
segments = []
|
236
|
+
if check.blank?
|
237
|
+
return nil if params[:slug].blank?
|
238
|
+
segments = params[:slug].split('/')
|
239
|
+
end
|
240
|
+
|
241
|
+
# get the taxonomy name and search the database for the record with this as its slug
|
242
|
+
t = obtain_term_check(check, segments, 'category')
|
243
|
+
t.description if !t.blank?
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
# returns a boolean as to wether the given post is in the given category
|
248
|
+
# Params:
|
249
|
+
# +categoryid+:: ID of the category that you want to check
|
250
|
+
# +postid+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
251
|
+
|
252
|
+
def in_category?(categoryid, postid = nil)
|
253
|
+
post = obtain_record(postid)
|
254
|
+
return false if post.blank?
|
255
|
+
!Post.includes(:terms => :term_anatomy).where(id: post.id, terms: { id: categoryid }, roroacms_term_anatomies: { taxonomy: 'category' }).blank?
|
256
|
+
end
|
257
|
+
|
258
|
+
def obtain_category_cover_image(check = nil)
|
259
|
+
cat = obtain_term_check(check, nil, 'category')
|
260
|
+
return !cat.blank? ? cat.cover_image : ''
|
261
|
+
end
|
262
|
+
|
263
|
+
# Returns a list of the categories
|
264
|
+
# Params:
|
265
|
+
# +sub_only+:: show only the sub categories of the current category
|
266
|
+
|
267
|
+
def obtain_category_list(sub_only = false)
|
268
|
+
|
269
|
+
segments = params[:slug].split('/')
|
270
|
+
category_url = Setting.get('category_slug')
|
271
|
+
# variables and data
|
272
|
+
|
273
|
+
# check to see if we are on the category term type, that we just want the sub cateogries and the segments actually exist
|
274
|
+
if segments[1] == category_url && sub_only && !segments[2].blank?
|
275
|
+
|
276
|
+
# get the current category
|
277
|
+
parent_term = Term.where(roroacms_term_anatomies: {taxonomy: 'category'}, :structured_url => "/" + segments.drop(2).join('/')).includes(:term_anatomy).first
|
278
|
+
|
279
|
+
terms =
|
280
|
+
if !parent_term.blank?
|
281
|
+
# get all the records with the current category as its parent
|
282
|
+
Term.where(:parent_id => parent_term.id)
|
283
|
+
else
|
284
|
+
[]
|
285
|
+
end
|
286
|
+
|
287
|
+
else
|
288
|
+
# get all the categories
|
289
|
+
terms = Term.where(roroacms_term_anatomies: {taxonomy: 'category'}, :parent_id => nil).includes(:term_anatomy)
|
290
|
+
end
|
291
|
+
|
292
|
+
li_loop_for_terms(terms.arrange, category_url)
|
293
|
+
|
294
|
+
end
|
295
|
+
|
296
|
+
|
297
|
+
# TAG Functions #
|
298
|
+
|
299
|
+
|
300
|
+
# returns the link to the given tag
|
301
|
+
# Params:
|
302
|
+
# +check+:: ID, slug, or name of the tag - if this is nil it will return the current tag you are on
|
303
|
+
|
304
|
+
def obtain_tag_link(check = nil)
|
305
|
+
segments = []
|
306
|
+
if check.blank?
|
307
|
+
return nil if params[:slug].blank?
|
308
|
+
segments = params[:slug].split('/')
|
309
|
+
end
|
310
|
+
|
311
|
+
t = obtain_term_check(check, segments, 'tag')
|
312
|
+
|
313
|
+
(Setting.get('articles_slug') + '/' + Setting.get('tag_slug') + t.structured_url) if !t.blank?
|
314
|
+
end
|
315
|
+
|
316
|
+
# returns all the tags in the system
|
317
|
+
|
318
|
+
def obtain_tags
|
319
|
+
Term::TAGS
|
320
|
+
end
|
321
|
+
|
322
|
+
# returns a boolean as to wether the given post has the give tag attached to it
|
323
|
+
# Params:
|
324
|
+
# +categoryid+:: ID of the tag that you want to check
|
325
|
+
# +postid+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
326
|
+
|
327
|
+
def has_tag?(tagid, postid = nil)
|
328
|
+
post = obtain_record(postid)
|
329
|
+
return false if post.blank?
|
330
|
+
!Post.includes(:terms => :term_anatomy).where(id: post.id, terms: { id: tagid }, roroacms_term_anatomies: { taxonomy: 'tag' }).blank?
|
331
|
+
end
|
332
|
+
|
333
|
+
# returns the title to the given tag
|
334
|
+
# Params:
|
335
|
+
# +check+:: ID, slug, or name of the tag - if this is nil it will return the current tag you are on
|
336
|
+
|
337
|
+
def obtain_tag_name(check = nil)
|
338
|
+
segments = []
|
339
|
+
if check.blank?
|
340
|
+
return nil if params[:slug].blank?
|
341
|
+
segments = params[:slug].split('/')
|
342
|
+
end
|
343
|
+
|
344
|
+
# get the taxonomy name and search the database for the record with this as its slug
|
345
|
+
t = obtain_term_check(check, segments, 'tag')
|
346
|
+
t.name if !t.blank?
|
347
|
+
|
348
|
+
end
|
349
|
+
|
350
|
+
# returns the description to the given tag
|
351
|
+
# Params:
|
352
|
+
# +check+:: ID, slug, or name of the tag - if this is nil it will return the current tag you are on
|
353
|
+
|
354
|
+
def obtain_tag_description(check = nil)
|
355
|
+
segments = []
|
356
|
+
if check.blank?
|
357
|
+
return nil if params[:slug].blank?
|
358
|
+
segments = params[:slug].split('/')
|
359
|
+
end
|
360
|
+
|
361
|
+
# get the taxonomy name and search the database for the record with this as its slug
|
362
|
+
t = obtain_term_check(check, segments, 'tag')
|
363
|
+
t.description if !t.blank?
|
364
|
+
|
365
|
+
end
|
366
|
+
|
367
|
+
# returns all the data for the given tag
|
368
|
+
# Params:
|
369
|
+
# +check+:: ID, slug, or name of the tag - if this is nil it will return the current tag you are on
|
370
|
+
|
371
|
+
def obtain_tag(check = nil)
|
372
|
+
segments = []
|
373
|
+
if check.blank?
|
374
|
+
return nil if params[:slug].blank?
|
375
|
+
segments = params[:slug].split('/')
|
376
|
+
end
|
377
|
+
|
378
|
+
# get the taxonomy name and search the database for the record with this as its slug
|
379
|
+
t = obtain_term_check(check, segments, 'tag')
|
380
|
+
t if !t.blank?
|
381
|
+
|
382
|
+
end
|
383
|
+
|
384
|
+
# returns the cover image of the given tag
|
385
|
+
# Params:
|
386
|
+
# +check+:: ID, slug, or name - if this is nil it will slug to work out the tag the system is currently viewing
|
387
|
+
|
388
|
+
def obtain_tag_cover_image(check = nil)
|
389
|
+
tag = obtain_term_check(check, nil, 'tag')
|
390
|
+
return !tag.blank? ? tag.cover_image : ''
|
391
|
+
end
|
392
|
+
|
393
|
+
# returns the array of records to display
|
394
|
+
|
395
|
+
def obtain_category_data
|
396
|
+
@content
|
397
|
+
end
|
398
|
+
|
399
|
+
# returns either a list or a tag cloud of the tags - this shows ALL of the tags
|
400
|
+
# Params:
|
401
|
+
# +type+:: string or list style
|
402
|
+
# +sub_only+:: show only the sub tags of the current category
|
403
|
+
|
404
|
+
def obtain_tag_cloud(type, sub_only = false)
|
405
|
+
|
406
|
+
article_url = Setting.get('articles_slug')
|
407
|
+
tag_url = Setting.get('tag_slug')
|
408
|
+
segments = params[:slug].split('/')
|
409
|
+
|
410
|
+
if type == 'string'
|
411
|
+
return '' if not defined?(@content.terms)
|
412
|
+
terms = @content.terms.where(roroacms_term_anatomies: {taxonomy: 'tag'}).includes(:term_anatomy)
|
413
|
+
return terms.all.map do |u|
|
414
|
+
url = article_url + '/' + tag_url + u.structured_url
|
415
|
+
"<a href='#{site_url(url)}'>" + u.name + "</a>"
|
416
|
+
end.join(', ').html_safe
|
417
|
+
|
418
|
+
elsif type == 'list'
|
419
|
+
|
420
|
+
# check to see if we are on the tag term type, that we just want the sub tags and the segments actually exist
|
421
|
+
if segments[1] == tag_url && sub_only && !segments[2].blank?
|
422
|
+
|
423
|
+
# get the current tag record
|
424
|
+
parent_term = Term.where(roroacms_term_anatomies: {taxonomy: 'tag'}, :structured_url => "/" + segments.drop(2).join('/')).includes(:term_anatomy).first
|
425
|
+
|
426
|
+
if !parent_term.blank?
|
427
|
+
# get all the records with the current tag as its parent
|
428
|
+
terms = Term.where(:parent_id => parent_term.id)
|
429
|
+
else
|
430
|
+
terms = []
|
431
|
+
end
|
432
|
+
|
433
|
+
else
|
434
|
+
# get all the tags
|
435
|
+
terms = Term.where(roroacms_term_anatomies: {taxonomy: 'tag'}, :parent_id => nil).includes(:term_anatomy)
|
436
|
+
end
|
437
|
+
# if you want a list style
|
438
|
+
li_loop_for_terms(terms.arrange, tag_url)
|
439
|
+
|
440
|
+
end
|
441
|
+
|
442
|
+
end
|
443
|
+
|
444
|
+
|
445
|
+
# ARTICLE Functions #
|
446
|
+
|
447
|
+
|
448
|
+
# returns all the data for the given article
|
449
|
+
# Params:
|
450
|
+
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
451
|
+
|
452
|
+
def obtain_article(check = nil)
|
453
|
+
if check.blank? && !@content.blank? && @content[0].blank?
|
454
|
+
@content
|
455
|
+
else
|
456
|
+
obtain_record(check, 'post')
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
460
|
+
# returns the value of the given field for the given article
|
461
|
+
# Params:
|
462
|
+
# +field+:: admin_id, post_content, post_date, post_name, parent_id, post_slug, sort_order, post_visible, post_additional_data, post_status, post_title, cover_image, post_template, post_type, disabled, post_seo_title, post_seo_description, post_seo_keywords, post_seo_is_disabled, post_seo_no_follow, post_seo_no_index
|
463
|
+
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
464
|
+
|
465
|
+
def obtain_article_field(field, check = nil)
|
466
|
+
article =
|
467
|
+
if check.blank? && !@content.blank? && @content[0].blank?
|
468
|
+
@content
|
469
|
+
else
|
470
|
+
obtain_record(check, 'post')
|
471
|
+
end
|
472
|
+
!article.blank? && article.has_attribute?(field) ? article[field.to_sym] : nil
|
473
|
+
end
|
474
|
+
|
475
|
+
# returns the status of the given article
|
476
|
+
# Params:
|
477
|
+
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
478
|
+
|
479
|
+
def obtain_article_status(check = nil)
|
480
|
+
article =
|
481
|
+
if check.blank? && !@content.blank? && @content[0].blank?
|
482
|
+
@content
|
483
|
+
else
|
484
|
+
obtain_record(check, 'page')
|
485
|
+
end
|
486
|
+
!article.blank? && article.has_attribute?('post_status') ? article.post_status : nil
|
487
|
+
end
|
488
|
+
|
489
|
+
# returns all the data of the given articles
|
490
|
+
# Params:
|
491
|
+
# +ids+:: an array of article ids that you want to obtain the data for - if this is nil it will simply return the @content variable data in an array format
|
492
|
+
# +orderby+:: What table column you want the posts to be ordered by, this is a sql string format
|
493
|
+
|
494
|
+
def obtain_articles(ids = nil, orderby = "post_title DESC")
|
495
|
+
return Post.where(:id => ids, :post_type => 'post').order(orderby) if !ids.blank?
|
496
|
+
return [@content] if !@content[0].blank?
|
497
|
+
return Post.where(:post_type => 'post', :post_status => 'Published').order(orderby)
|
498
|
+
end
|
499
|
+
|
500
|
+
# returns all the archive records for the archive you are currently on
|
501
|
+
|
502
|
+
def obtain_archive_data
|
503
|
+
@content
|
504
|
+
end
|
505
|
+
|
506
|
+
# Returns a list of the archives
|
507
|
+
# Params:
|
508
|
+
# +type+:: has to be either Y (year) or M (month)
|
509
|
+
|
510
|
+
def obtain_archive_list(type, blockbydate = nil)
|
511
|
+
|
512
|
+
article_url = Setting.get('articles_slug')
|
513
|
+
category_url = Setting.get('category_slug')
|
514
|
+
h = {}
|
515
|
+
|
516
|
+
# if year
|
517
|
+
if type == 'Y'
|
518
|
+
|
519
|
+
# variables and data
|
520
|
+
p = Post.where(:post_type => 'post', :post_status => 'Published', :disabled => 'N').uniq.pluck("EXTRACT(year FROM post_date)")
|
521
|
+
|
522
|
+
if !p.blank?
|
523
|
+
p.each do |f|
|
524
|
+
h["#{article_url}/#{f}"] = f
|
525
|
+
end
|
526
|
+
end
|
527
|
+
|
528
|
+
# if month
|
529
|
+
elsif type == 'M'
|
530
|
+
|
531
|
+
# variables and data
|
532
|
+
p = Post.where("(post_type = 'post' AND post_status = 'Published' AND disabled = 'N') AND post_date <= CURRENT_TIMESTAMP").uniq.pluck("EXTRACT(year FROM post_date)")
|
533
|
+
lp = {}
|
534
|
+
|
535
|
+
|
536
|
+
if !p.blank?
|
537
|
+
p.each do |f|
|
538
|
+
lp["#{f}"] = Post.where("EXTRACT(year from post_date) = #{f} AND (post_type = 'post' AND disabled = 'N' AND post_status = 'Published' AND post_date <= CURRENT_TIMESTAMP)").uniq.pluck("EXTRACT(MONTH FROM post_date)")
|
539
|
+
end
|
540
|
+
end
|
541
|
+
|
542
|
+
if !lp.blank?
|
543
|
+
|
544
|
+
lp.each do |k, i|
|
545
|
+
|
546
|
+
if blockbydate
|
547
|
+
h["#{article_url}/#{k.to_i}"] = k.to_i
|
548
|
+
end
|
549
|
+
|
550
|
+
i.sort.each do |nm|
|
551
|
+
h["#{article_url}/#{k.to_i}/#{nm.to_i}"] = "#{get_date_name_by_number(nm.to_i)} - #{k.to_i}"
|
552
|
+
end
|
553
|
+
|
554
|
+
end
|
555
|
+
|
556
|
+
end
|
557
|
+
|
558
|
+
end
|
559
|
+
|
560
|
+
li_loop(h)
|
561
|
+
|
562
|
+
end
|
563
|
+
|
564
|
+
|
565
|
+
# returns the lastest article. By default this is 1 but you can get more than one if you want.
|
566
|
+
# Params:
|
567
|
+
# +how_many+:: how many records you want to return
|
568
|
+
|
569
|
+
def obtain_latest_article(how_many = 1)
|
570
|
+
Post.where("post_type ='post' AND disabled = 'N' AND post_status = 'Published' AND (post_date <= CURRENT_TIMESTAMP)").order('post_date DESC').limit(how_many)
|
571
|
+
end
|
572
|
+
|
573
|
+
|
574
|
+
# PAGE functions #
|
575
|
+
|
576
|
+
|
577
|
+
# returns all the data for the given page
|
578
|
+
# Params:
|
579
|
+
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
580
|
+
|
581
|
+
def obtain_page(check = nil)
|
582
|
+
if check.blank? && !@content.blank? && @content[0].blank?
|
583
|
+
@content
|
584
|
+
else
|
585
|
+
obtain_record(check, 'page')
|
586
|
+
end
|
587
|
+
end
|
588
|
+
|
589
|
+
# returns all the data of the given pages
|
590
|
+
# Params:
|
591
|
+
# +ids+:: an array of article ids that you want to obtain the data for - if this is nil it will simply return the @content variable data in an array format
|
592
|
+
# +orderby+:: What table column you want the posts to be ordered by, this is a sql string format
|
593
|
+
|
594
|
+
def obtain_pages(ids = nil, orderby = "post_title DESC")
|
595
|
+
return Post.where(:id => ids, :post_type => 'page').order(orderby) if !ids.blank?
|
596
|
+
return [@content] if !@content[0].blank?
|
597
|
+
return Post.where(:post_type => 'page', :post_status => 'Published').order(orderby)
|
598
|
+
end
|
599
|
+
|
600
|
+
# returns the value of the given field for the given page
|
601
|
+
# Params:
|
602
|
+
# +field+:: admin_id, post_content, post_date, post_name, parent_id, post_slug, sort_order, post_visible, post_additional_data, post_status, post_title, cover_image, post_template, post_type, disabled, post_seo_title, post_seo_description, post_seo_keywords, post_seo_is_disabled, post_seo_no_follow, post_seo_no_index
|
603
|
+
# +check+:: ID, slug, or name of the article - if this is nil it will use the @content variable (the current page)
|
604
|
+
|
605
|
+
def obtain_page_field(field, check = nil)
|
606
|
+
page =
|
607
|
+
if check.blank? && !@content.blank? && @content[0].blank?
|
608
|
+
@content
|
609
|
+
else
|
610
|
+
obtain_record(check, 'page')
|
611
|
+
end
|
612
|
+
!page.blank? && page.has_attribute?(field) ? page[field.to_sym] : nil
|
613
|
+
end
|
614
|
+
|
615
|
+
# CONDITIONAL functions #
|
616
|
+
|
617
|
+
|
618
|
+
# TODO: Clean this code up
|
619
|
+
# returns a boolean as to wether the given page/post is a page
|
620
|
+
# Params:
|
621
|
+
# +check+:: ID of the page
|
622
|
+
|
623
|
+
def is_page?(check = nil)
|
624
|
+
|
625
|
+
return false if @content.blank? || !@content[0].blank?
|
626
|
+
return true if @content.post_type == 'page' && check.blank?
|
627
|
+
return true if @content.id == check.to_i
|
628
|
+
return false
|
629
|
+
|
630
|
+
end
|
631
|
+
|
632
|
+
# returns a boolean as to wether the current view is the blog homepage
|
633
|
+
|
634
|
+
def is_articles_home?
|
635
|
+
get_type_by_url == 'C' ? true : false
|
636
|
+
end
|
637
|
+
|
638
|
+
# returns a boolean as to whether the current view is an archive
|
639
|
+
|
640
|
+
def is_archive?
|
641
|
+
get_type_by_url == 'AR' ? true : false
|
642
|
+
end
|
643
|
+
|
644
|
+
# returns a boolean as to whether the current view is a day archive
|
645
|
+
|
646
|
+
def is_day_archive?
|
647
|
+
segments = params[:slug].split('/')
|
648
|
+
(get_type_by_url == 'AR' && !segments[3].blank?) ? true : false
|
649
|
+
end
|
650
|
+
|
651
|
+
# returns a boolean as to whether the current view is a month archive
|
652
|
+
|
653
|
+
def is_month_archive?
|
654
|
+
segments = params[:slug].split('/')
|
655
|
+
(get_type_by_url == 'AR' && !segments[2].blank? && segments[3].blank?) ? true : false
|
656
|
+
end
|
657
|
+
|
658
|
+
# returns a boolean as to whether the current view is a year archive
|
659
|
+
|
660
|
+
def is_year_archive?
|
661
|
+
segments = params[:slug].split('/')
|
662
|
+
(get_type_by_url == 'AR' && !segments[1].blank? && segments[2].blank? && segments[3].blank?) ? true : false
|
663
|
+
end
|
664
|
+
|
665
|
+
# returns the that year/month/day of the current archive
|
666
|
+
|
667
|
+
def obtain_archive_year
|
668
|
+
|
669
|
+
if get_type_by_url == 'AR'
|
670
|
+
segments = params[:slug].split('/')
|
671
|
+
str = ''
|
672
|
+
str = (get_date_name_by_number(segments[2].to_i) + ' ') if !segments[2].blank?
|
673
|
+
str += segments[1]
|
674
|
+
end
|
675
|
+
|
676
|
+
end
|
677
|
+
|
678
|
+
# returns a boolean as to whether the current view is the homepage
|
679
|
+
|
680
|
+
def is_homepage?
|
681
|
+
return false if (!defined?(@content.length).blank? || @content.blank?)
|
682
|
+
@content.id == Setting.get('home_page').to_i ? true : false
|
683
|
+
end
|
684
|
+
|
685
|
+
|
686
|
+
# returns a boolean as to whether the current page is either an article or whether it is the given article provided by the check variable
|
687
|
+
# Params:
|
688
|
+
# +check+:: ID, slug, or name of the article you want to check - if this is nil it will just return if the current view is an article or not
|
689
|
+
|
690
|
+
def is_article?(check = nil)
|
691
|
+
return false if params[:slug].blank?
|
692
|
+
segments = params[:slug].split('/')
|
693
|
+
if check.blank?
|
694
|
+
(segments[0] == Setting.get('articles_slug') && !segments[1].blank? && segments[1] != Setting.get('tag_slug') && segments[1] != Setting.get('category_slug') && @content.class != ActiveRecord::Relation) ? true : false
|
695
|
+
else
|
696
|
+
if !defined?(@content.size).blank?
|
697
|
+
return false
|
698
|
+
end
|
699
|
+
(Setting.get('articles_slug') == segments[0] && (@content.post_title == check || @content.id == check || @content.post_slug == check) ) ? true : false
|
700
|
+
end
|
701
|
+
end
|
702
|
+
|
703
|
+
# returns a boolean as to whether the current view is a search view or not
|
704
|
+
|
705
|
+
def is_search?
|
706
|
+
(defined?(params[:search]) && !params[:search].blank?) ? true : false
|
707
|
+
end
|
708
|
+
|
709
|
+
# returns a boolean as to whether the current page is either an tag view or whether it is the given tag provided by the check variable
|
710
|
+
# Params:
|
711
|
+
# +check+:: ID, slug, or name of the tag - if this is nil it will just check to see if the current view is a tag view
|
712
|
+
|
713
|
+
def is_tag?(check = nil)
|
714
|
+
return false if params[:slug].blank?
|
715
|
+
segments = params[:slug].split('/')
|
716
|
+
if check.blank?
|
717
|
+
Setting.get('tag_slug') == segments[1] ? true : false
|
718
|
+
else
|
719
|
+
term = obtain_term(segments)
|
720
|
+
term_check('tag_slug', segments)
|
721
|
+
end
|
722
|
+
end
|
723
|
+
|
724
|
+
# returns a boolean as to whether the current page is either an category view or whether it is the given category provided by the check variable
|
725
|
+
# Params:
|
726
|
+
# +check+:: ID, slug, or name of the category - if this is nil it will just check to see if the current view is a category view
|
727
|
+
|
728
|
+
def is_category?(check = nil)
|
729
|
+
return false if params[:slug].blank?
|
730
|
+
segments = params[:slug].split('/')
|
731
|
+
if check.blank?
|
732
|
+
Setting.get('category_slug') == segments[1] ? true : false
|
733
|
+
else
|
734
|
+
term = obtain_term(segments)
|
735
|
+
term_check('category_slug', segments)
|
736
|
+
end
|
737
|
+
end
|
738
|
+
|
739
|
+
|
740
|
+
# USER Functions #
|
741
|
+
|
742
|
+
# returns all the data for the given user
|
743
|
+
# Params:
|
744
|
+
# +check+:: ID, email, or username of the user
|
745
|
+
|
746
|
+
def obtain_user_profile(check = nil)
|
747
|
+
return nil if check.blank?
|
748
|
+
obtain_users(check)
|
749
|
+
end
|
750
|
+
|
751
|
+
# returns all the users
|
752
|
+
# Params:
|
753
|
+
# +access+:: restrict the returned data to show only certain access levels access level - the options can be found in the admin panel
|
754
|
+
|
755
|
+
def obtain_users(access = nil)
|
756
|
+
admins = obtain_users
|
757
|
+
if access.is_a?(Array)
|
758
|
+
admins = admins.where(:id => access) if !access.blank?
|
759
|
+
else
|
760
|
+
admins = admins.where(:access_level => access) if !access.blank?
|
761
|
+
end
|
762
|
+
|
763
|
+
admins
|
764
|
+
end
|
765
|
+
|
766
|
+
# returns certian field of the given user
|
767
|
+
# Params:
|
768
|
+
# +field+:: the field that you want to return - id, email, first_name, last_name, username, access_level, avatar, cover_picture, overlord
|
769
|
+
# +check+:: ID, email, or username of the user - if this is nil it will user the user that wrote the current article/page
|
770
|
+
|
771
|
+
def obtain_user_field(field, check = nil)
|
772
|
+
admin =
|
773
|
+
if !check.blank?
|
774
|
+
obtain_users(check)
|
775
|
+
else
|
776
|
+
return nil if @content.blank? || !@content[0].blank?
|
777
|
+
Admin.find_by_id(@content.admin_id)
|
778
|
+
end
|
779
|
+
return '' if admin.blank?
|
780
|
+
admin.has_attribute?(field) ? admin[field].to_s : ''
|
781
|
+
end
|
782
|
+
|
783
|
+
|
784
|
+
|
785
|
+
# COMMENT Functions #
|
786
|
+
|
787
|
+
# returns the author name of the given comment
|
788
|
+
# Params:
|
789
|
+
# +comment_id+:: ID of the comment
|
790
|
+
|
791
|
+
def obtain_comment_author(comment_id = nil)
|
792
|
+
return nil if comment_id.blank?
|
793
|
+
comm = Comment.find_by_id(comment_id)
|
794
|
+
comm.author if !comm.blank?
|
795
|
+
end
|
796
|
+
|
797
|
+
# returns the date of the given comment
|
798
|
+
# Params:
|
799
|
+
# +comment_id+:: ID of the comment
|
800
|
+
# +format+:: the format that you want the date to be returned in
|
801
|
+
|
802
|
+
def obtain_comment_date(comment_id = nil, format = "%d-%m-%Y")
|
803
|
+
return nil if comment_id.blank?
|
804
|
+
comment = Comment.find_by_id(comment_id)
|
805
|
+
comment = comment.submitted_on.strftime(format) if !comment.blank?
|
806
|
+
comment if !comment.blank?
|
807
|
+
end
|
808
|
+
|
809
|
+
# returns the time of the given comment
|
810
|
+
# Params:
|
811
|
+
# +comment_id+:: ID of the comment
|
812
|
+
# +format+:: the format that you want the time to be returned in
|
813
|
+
|
814
|
+
def obtain_comment_time(comment_id = nil, format = "%H:%M:%S")
|
815
|
+
return nil if comment_id.blank?
|
816
|
+
comment = Comment.find_by_id(comment_id)
|
817
|
+
comment = comment.submitted_on.strftime(format) if !comment.blank?
|
818
|
+
comment if !comment.blank?
|
819
|
+
end
|
820
|
+
|
821
|
+
# returns the comments for the given article
|
822
|
+
# Params:
|
823
|
+
# +check+:: ID, post_slug, or post_title - if this is nil it return the comments for the the @content variable (the current page)
|
824
|
+
|
825
|
+
def obtain_comments(check = nil)
|
826
|
+
|
827
|
+
if check.blank? && !@content.blank? && @content[0].blank?
|
828
|
+
Comment.where(:post_id => @content.id, :comment_approved => 'Y')
|
829
|
+
else
|
830
|
+
Comment.where(:post_id => check, :comment_approved => 'Y')
|
831
|
+
end
|
832
|
+
|
833
|
+
end
|
834
|
+
|
835
|
+
# returns the comment form that is created in the theme folder.
|
836
|
+
|
837
|
+
def obtain_comments_form
|
838
|
+
|
839
|
+
if Setting.get('article_comments') == 'Y'
|
840
|
+
type = Setting.get('article_comment_type')
|
841
|
+
@new_comment = Comment.new
|
842
|
+
if File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/comments_form." + get_theme_ext)
|
843
|
+
render(:template => "themes/#{current_theme}/comments_form." + get_theme_ext , :layout => nil, :locals => { type: type }).to_s
|
844
|
+
else
|
845
|
+
render :inline => 'comments_form.html.erb does not exist in current theme'
|
846
|
+
end
|
847
|
+
end
|
848
|
+
|
849
|
+
end
|
850
|
+
|
851
|
+
# Easy to understand function for getting the search form.
|
852
|
+
# this is created and displayed from the theme.
|
853
|
+
|
854
|
+
def obtain_search_form
|
855
|
+
if File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/search_form." + get_theme_ext)
|
856
|
+
render :template => "themes/#{current_theme}/search_form." + get_theme_ext
|
857
|
+
else
|
858
|
+
render :inline => 'search_form.html.erb does not exist in current theme'
|
859
|
+
end
|
860
|
+
end
|
861
|
+
|
862
|
+
# MISCELLANEOUS Functions #
|
863
|
+
|
864
|
+
# returns the ID for the current view that you are on
|
865
|
+
|
866
|
+
def obtain_id
|
867
|
+
@content.id if !@content.blank? && @content[0].blank?
|
868
|
+
end
|
869
|
+
|
870
|
+
# returns the author of the current article/page
|
871
|
+
# Params:
|
872
|
+
# +postid+:: ID of the post/page that you want o obtain the author for
|
873
|
+
|
874
|
+
def obtain_the_author(postid = nil)
|
875
|
+
if id.blank?
|
876
|
+
return nil if @content.blank? || !@content[0].blank?
|
877
|
+
obtain_users(@content.admin_id)
|
878
|
+
else
|
879
|
+
Admin.joins(:posts).select(user_select_fields).where(posts: { id: postid }).first
|
880
|
+
end
|
881
|
+
end
|
882
|
+
|
883
|
+
# returns all of the articles that the user has created
|
884
|
+
# Params:
|
885
|
+
# +id+:: ID of the user that you want to get all the records for
|
886
|
+
|
887
|
+
def obtain_the_authors_articles(id = nil)
|
888
|
+
return nil if id.blank? && (@content.blank? || !@content[0].blank?)
|
889
|
+
check =
|
890
|
+
if id.blank?
|
891
|
+
@content.admin_id
|
892
|
+
else
|
893
|
+
id
|
894
|
+
end
|
895
|
+
Post.where(:admin_id => check)
|
896
|
+
end
|
897
|
+
|
898
|
+
# returns the content for the given post/page
|
899
|
+
# Params:
|
900
|
+
# +id+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
901
|
+
|
902
|
+
def obtain_the_content(check = nil)
|
903
|
+
post = obtain_record(check)
|
904
|
+
render :inline => prep_content(post).html_safe if !post.blank?
|
905
|
+
end
|
906
|
+
|
907
|
+
# returns the title for the given post/page
|
908
|
+
# Params:
|
909
|
+
# +id+:: ID, post_slug, or post_title - if this is nil it will use the @content variable (the current page)
|
910
|
+
|
911
|
+
def obtain_the_title(check = nil)
|
912
|
+
post = obtain_record(check)
|
913
|
+
render :inline => post.post_title if !post.blank?
|
914
|
+
end
|
915
|
+
|
916
|
+
# return what type of taxonomy it is either - category or tag
|
917
|
+
|
918
|
+
def obtain_term_type
|
919
|
+
return nil if params[:slug].blank?
|
920
|
+
segments = params[:slug].split('/')
|
921
|
+
|
922
|
+
if !segments[1].blank?
|
923
|
+
term = TermAnatomy.where(:taxonomy => segments[1]).last
|
924
|
+
term.taxonomy if !term.blank?
|
925
|
+
else
|
926
|
+
nil
|
927
|
+
end
|
928
|
+
|
929
|
+
end
|
930
|
+
|
931
|
+
# returns the title to the given term, the differnece between obtain_tag_name/obtain_category_name is that this will return the title if you do not know what term type you are on.
|
932
|
+
# Params:
|
933
|
+
# +check+:: ID, slug, or name of the category - if this is nil it will return the current category you are in
|
934
|
+
|
935
|
+
def obtain_term_title(check = nil)
|
936
|
+
segments = []
|
937
|
+
if check.blank?
|
938
|
+
return nil if params[:slug].blank?
|
939
|
+
segments = params[:slug].split('/')
|
940
|
+
end
|
941
|
+
|
942
|
+
# get the taxonomy name and search the database for the record with this as its slug
|
943
|
+
t = obtain_term_check(check, segments)
|
944
|
+
t.name if !t.blank?
|
945
|
+
|
946
|
+
end
|
947
|
+
|
948
|
+
# returns the additional data record
|
949
|
+
# Params:
|
950
|
+
# +key+:: the key to the additional data that you want to return - if this is nil it will return all of the additional data for the given record
|
951
|
+
# +check+:: ID, post_slug, or post_title of the post record - if this is nil it will use the @content variable (the current page)
|
952
|
+
|
953
|
+
def obtain_additional_data(key = nil, check = nil)
|
954
|
+
|
955
|
+
if check.blank?
|
956
|
+
return nil if @content.blank? || !@content[0].blank?
|
957
|
+
end
|
958
|
+
|
959
|
+
post =
|
960
|
+
if check.blank?
|
961
|
+
@content.post_additional_data
|
962
|
+
else
|
963
|
+
obtain_record(check).post_additional_data
|
964
|
+
end
|
965
|
+
|
966
|
+
return nil if post.blank?
|
967
|
+
|
968
|
+
data = @json.decode(post)
|
969
|
+
if key.blank?
|
970
|
+
data
|
971
|
+
else
|
972
|
+
data[key]
|
973
|
+
end
|
974
|
+
|
975
|
+
end
|
976
|
+
|
977
|
+
# returns a short extract of the given content
|
978
|
+
# Params:
|
979
|
+
# +content+:: the content
|
980
|
+
# +length+:: length of the string in characters
|
981
|
+
# +omission+:: something to represent the omission of the content
|
982
|
+
|
983
|
+
def create_excerpt(content = '', length = 255, omission = '...')
|
984
|
+
render :inline => truncate(content, :omission => omission, :length => length)
|
985
|
+
end
|
986
|
+
|
987
|
+
# returns a full post record (this is used mainly internally to retrieve the data for other functions)
|
988
|
+
# Params:
|
989
|
+
# +check+:: ID, post_slug, or post_title of the post record - if this is nil it will use the @content variable (the current page)
|
990
|
+
|
991
|
+
def obtain_record(check = nil, type = nil)
|
992
|
+
|
993
|
+
return check if check.is_a?(ActiveRecord::Base)
|
994
|
+
|
995
|
+
if check.blank?
|
996
|
+
return nil if @content.blank? || !@content[0].blank?
|
997
|
+
@content
|
998
|
+
else
|
999
|
+
records = Post.where( 'post_title = :p OR post_slug = :p2 OR id = :p3', { p: check.to_s, p2: check.to_s, p3: check.to_i} )
|
1000
|
+
if !type.blank?
|
1001
|
+
records = records.where("post_type = :p4", {p4: type})
|
1002
|
+
end
|
1003
|
+
records.first
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
# returns a full term record (this is used mainly internally to retrieve the data for above functions)
|
1009
|
+
# Params:
|
1010
|
+
# +segments+:: URL segments
|
1011
|
+
|
1012
|
+
def obtain_term(segments)
|
1013
|
+
Term.where(structured_url: ('/' + segments[2..-1].join('/')))
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
# returns a full tag record (this is used mainly internally to retrieve the data for above functions)
|
1017
|
+
# Params:
|
1018
|
+
# +check+:: ID, slug, or name of the term record - if this is nil it will use the url to work out the current tag that you are viewing
|
1019
|
+
# +segments+:: pass in the segments of the url
|
1020
|
+
# +type+:: wether you want to check the term type against tag or category
|
1021
|
+
|
1022
|
+
def obtain_term_check(check = nil, segments = nil, type = nil)
|
1023
|
+
term =
|
1024
|
+
if check.blank? && !segments.blank? && !segments[2].blank?
|
1025
|
+
Term.includes(:term_anatomy).where(:structured_url => "/" + segments.drop(2).join('/')).first
|
1026
|
+
else
|
1027
|
+
Term.includes(:term_anatomy).where("name = :p OR slug = :p2 OR terms.id = :p3", { p: check.to_s, p2: check.to_s, p3: check.to_i })
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
term = term.where(roroacms_term_anatomies: { taxonomy: type }) if !type.blank?
|
1031
|
+
|
1032
|
+
term
|
1033
|
+
|
1034
|
+
end
|
1035
|
+
|
1036
|
+
# returns wether the current url is the given term type
|
1037
|
+
# Params:
|
1038
|
+
# +type+:: the type of term you want to check against
|
1039
|
+
# +segments+:: pass in the segments of the url
|
1040
|
+
|
1041
|
+
def term_check(type, segments)
|
1042
|
+
(Setting.get(type) == segments[1] && (term.first.name == check || term.first.id == check || term.first.slug == check) ) ? true : false
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
# returns the users (this is used mainly internally to retrieve the data for above functions)
|
1046
|
+
# Params:
|
1047
|
+
# +check+:: ID, email, or username of the user record - if this is nil it will return all users
|
1048
|
+
|
1049
|
+
def obtain_users(check = nil)
|
1050
|
+
admin = Admin.select(user_select_fields)
|
1051
|
+
admin = admin.where( 'id = :p OR email = :p2 OR username = :p3', { p: check.to_i, p2: check.to_s, p3: check.to_s} ).first if !check.blank?
|
1052
|
+
admin
|
1053
|
+
end
|
1054
|
+
|
1055
|
+
# returns the fields that the user will be allowed to access when using the user functions (this is used mainly internally to retrieve the data for above functions)
|
1056
|
+
|
1057
|
+
def user_select_fields
|
1058
|
+
return 'admins.id, email, first_name, last_name, username, access_level, avatar, cover_picture, overlord'
|
1059
|
+
end
|
1060
|
+
|
1061
|
+
# The view helper contains all of the functions that the views
|
1062
|
+
# will use in order to display the contents of either the content
|
1063
|
+
# or format other data
|
1064
|
+
|
1065
|
+
# Returns a nested list of the comments
|
1066
|
+
# Params:
|
1067
|
+
# +post_id+:: id of the post that you want to get comments for
|
1068
|
+
|
1069
|
+
def display_comments_loop(post_id = nil)
|
1070
|
+
|
1071
|
+
# get the comments by the post id or the globalized @content record
|
1072
|
+
comments =
|
1073
|
+
if !post_id.nil?
|
1074
|
+
Comment.where(:post_id => post_id)
|
1075
|
+
else
|
1076
|
+
Comment.where(:post_id => @content.id, :comment_approved => 'Y', :is_spam => 'N')
|
1077
|
+
end
|
1078
|
+
|
1079
|
+
if comments.size > 0
|
1080
|
+
html = "<h3 id='comments-title'>#{comments.count}" + I18n.t("helpers.view_helper.display_comments_loop.response") + " #{obtain_the_title}</h3>"
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
html = nested_comments obtain_comments.arrange(:order => 'created_at ASC')
|
1084
|
+
|
1085
|
+
render :inline => html.html_safe
|
1086
|
+
|
1087
|
+
end
|
1088
|
+
|
1089
|
+
|
1090
|
+
# Return the author information of the articles
|
1091
|
+
# Params:
|
1092
|
+
# +raw+:: if set to true you will just get the author information in a raw ActiveRcord format
|
1093
|
+
|
1094
|
+
def display_author_information(raw = false)
|
1095
|
+
|
1096
|
+
admin = Admin.find_by_id(@content.admin_id)
|
1097
|
+
if raw
|
1098
|
+
admin
|
1099
|
+
else
|
1100
|
+
unless @admin.blank?
|
1101
|
+
html = "<div id='author-info'>
|
1102
|
+
<div id='author-description'>
|
1103
|
+
<h2>#{@admin.first_name} #{@admin.last_name}</h2>
|
1104
|
+
<p>#{@admin.description}</p>
|
1105
|
+
</div>
|
1106
|
+
</div>"
|
1107
|
+
|
1108
|
+
render :inline => html.html_safe
|
1109
|
+
end
|
1110
|
+
end
|
1111
|
+
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
|
1115
|
+
# Returns the html for the comments tree of a post
|
1116
|
+
# Params:
|
1117
|
+
# +messages+:: all of the messages for the post
|
1118
|
+
|
1119
|
+
def nested_comments(messages)
|
1120
|
+
messages.map do |message, sub_messages|
|
1121
|
+
@comment = message
|
1122
|
+
render('roroacms/admin/partials/comment') + content_tag(:div, nested_comments(sub_messages), :class => "nested_comments")
|
1123
|
+
end.join.html_safe
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
def admin_nested_comments(messages)
|
1127
|
+
messages.map do |message, sub_messages|
|
1128
|
+
@comment = message
|
1129
|
+
render('roroacms/admin/partials/admin_comment') + content_tag(:ul, admin_nested_comments(sub_messages), :class => "list-group nested_comments")
|
1130
|
+
end.join.html_safe
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
|
1134
|
+
# Returns a list of the given data
|
1135
|
+
# Params:
|
1136
|
+
# +arr+:: array that you want to list through to create the list
|
1137
|
+
|
1138
|
+
def li_loop(arr)
|
1139
|
+
|
1140
|
+
html = '<ul>'
|
1141
|
+
arr.each do |k, v|
|
1142
|
+
html += "<li><a href='#{site_url}#{k}'>#{v}</a></li>"
|
1143
|
+
end
|
1144
|
+
html += '</ul>'
|
1145
|
+
|
1146
|
+
render :inline => html
|
1147
|
+
|
1148
|
+
end
|
1149
|
+
|
1150
|
+
# Returns a list of the given data, but puts children records in the loop
|
1151
|
+
# Params:
|
1152
|
+
# +arr+:: array that you want to list through to create the list
|
1153
|
+
|
1154
|
+
def li_loop_for_terms(arr, term_type, initial = 'initial')
|
1155
|
+
|
1156
|
+
article_url = Setting.get('articles_slug')
|
1157
|
+
|
1158
|
+
html = '<ul class="' + initial + '">'
|
1159
|
+
arr.each do |key, val|
|
1160
|
+
html += "<li><a href='#{site_url}#{article_url}/#{term_type}#{key.structured_url}'>#{key.name}</a>"
|
1161
|
+
html += li_loop_for_terms(val, term_type, 'sub') unless val.blank?
|
1162
|
+
end
|
1163
|
+
html += '</ul>'
|
1164
|
+
|
1165
|
+
render :inline => html
|
1166
|
+
|
1167
|
+
end
|
1168
|
+
|
1169
|
+
|
1170
|
+
# Returns a sub string of the month name
|
1171
|
+
# Params:
|
1172
|
+
# +str+:: integer of the month
|
1173
|
+
|
1174
|
+
def get_date_name_by_number(str)
|
1175
|
+
case str
|
1176
|
+
when 1 then I18n.t("helpers.view_helper.get_date_name_by_number.date_1")
|
1177
|
+
when 2 then I18n.t("helpers.view_helper.get_date_name_by_number.date_2")
|
1178
|
+
when 3 then I18n.t("helpers.view_helper.get_date_name_by_number.date_3")
|
1179
|
+
when 4 then I18n.t("helpers.view_helper.get_date_name_by_number.date_4")
|
1180
|
+
when 5 then I18n.t("helpers.view_helper.get_date_name_by_number.date_5")
|
1181
|
+
when 6 then I18n.t("helpers.view_helper.get_date_name_by_number.date_6")
|
1182
|
+
when 7 then I18n.t("helpers.view_helper.get_date_name_by_number.date_7")
|
1183
|
+
when 8 then I18n.t("helpers.view_helper.get_date_name_by_number.date_8")
|
1184
|
+
when 9 then I18n.t("helpers.view_helper.get_date_name_by_number.date_9")
|
1185
|
+
when 10 then I18n.t("helpers.view_helper.get_date_name_by_number.date_10")
|
1186
|
+
when 11 then I18n.t("helpers.view_helper.get_date_name_by_number.date_11")
|
1187
|
+
when 12 then I18n.t("helpers.view_helper.get_date_name_by_number.date_12")
|
1188
|
+
end
|
1189
|
+
end
|
1190
|
+
|
1191
|
+
|
1192
|
+
# returns a boolean as to wether the template file actually exists
|
1193
|
+
# Params:
|
1194
|
+
# +name+:: the name of the template file that you want to check exists
|
1195
|
+
|
1196
|
+
def view_file_exists?(name)
|
1197
|
+
File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/template-#{name}." + get_theme_ext )
|
1198
|
+
end
|
1199
|
+
|
1200
|
+
|
1201
|
+
# get current theme
|
1202
|
+
|
1203
|
+
def current_theme
|
1204
|
+
Setting.get('theme_folder')
|
1205
|
+
end
|
1206
|
+
|
1207
|
+
|
1208
|
+
# returns a full url to the file that you want to render from the theme file.
|
1209
|
+
# example usage would be: <%= render theme_url 'sidebar' %>
|
1210
|
+
# Params:
|
1211
|
+
# +append+:: the name of the file that you want to render
|
1212
|
+
|
1213
|
+
def theme_url(append)
|
1214
|
+
"themes/#{current_theme}/#{append}"
|
1215
|
+
end
|
1216
|
+
|
1217
|
+
# displays the header. + get_theme_ext template in the theme if the file exists
|
1218
|
+
|
1219
|
+
def display_header
|
1220
|
+
render :template => "/themes/#{current_theme}/header." + get_theme_ext if File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/header." + get_theme_ext )
|
1221
|
+
end
|
1222
|
+
|
1223
|
+
# displays the header. + get_theme_ext template in the theme if the file exists
|
1224
|
+
|
1225
|
+
def display_footer
|
1226
|
+
render :template => "themes/#{current_theme}/footer." + get_theme_ext if File.exists?("#{Rails.root}/app/views/themes/#{current_theme}/footer." + get_theme_ext )
|
1227
|
+
end
|
1228
|
+
|
1229
|
+
end
|
1230
1230
|
end
|