refinerycms-core 2.1.5 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/refinery/add.png +0 -0
- data/app/assets/images/refinery/admin_bg.png +0 -0
- data/app/assets/images/refinery/ajax-loader.gif +0 -0
- data/app/assets/images/refinery/branch-end.gif +0 -0
- data/app/assets/images/refinery/branch.gif +0 -0
- data/app/assets/images/refinery/cross.png +0 -0
- data/app/assets/images/refinery/dialogLoadingAnimation.gif +0 -0
- data/app/assets/images/refinery/header_background.png +0 -0
- data/app/assets/images/refinery/hover-gradient.jpg +0 -0
- data/app/assets/images/refinery/icons/accept.png +0 -0
- data/app/assets/images/refinery/icons/add.png +0 -0
- data/app/assets/images/refinery/icons/ajax-loader.gif +0 -0
- data/app/assets/images/refinery/icons/application_edit.png +0 -0
- data/app/assets/images/refinery/icons/application_go.png +0 -0
- data/app/assets/images/refinery/icons/arrow_left.png +0 -0
- data/app/assets/images/refinery/icons/arrow_left_right.png +0 -0
- data/app/assets/images/refinery/icons/arrow_switch.png +0 -0
- data/app/assets/images/refinery/icons/arrow_up.png +0 -0
- data/app/assets/images/refinery/icons/arrow_up_down.png +0 -0
- data/app/assets/images/refinery/icons/bin.png +0 -0
- data/app/assets/images/refinery/icons/bin_closed.png +0 -0
- data/app/assets/images/refinery/icons/cancel.png +0 -0
- data/app/assets/images/refinery/icons/cog_add.png +0 -0
- data/app/assets/images/refinery/icons/cog_edit.png +0 -0
- data/app/assets/images/refinery/icons/cross.png +0 -0
- data/app/assets/images/refinery/icons/delete.png +0 -0
- data/app/assets/images/refinery/icons/doc.png +0 -0
- data/app/assets/images/refinery/icons/down.gif +0 -0
- data/app/assets/images/refinery/icons/edit.png +0 -0
- data/app/assets/images/refinery/icons/email.png +0 -0
- data/app/assets/images/refinery/icons/email_edit.png +0 -0
- data/app/assets/images/refinery/icons/email_go.png +0 -0
- data/app/assets/images/refinery/icons/email_open.png +0 -0
- data/app/assets/images/refinery/icons/eye.png +0 -0
- data/app/assets/images/refinery/icons/folder.png +0 -0
- data/app/assets/images/refinery/icons/folder_open.png +0 -0
- data/app/assets/images/refinery/icons/folder_page_white.png +0 -0
- data/app/assets/images/refinery/icons/image_add.png +0 -0
- data/app/assets/images/refinery/icons/image_edit.png +0 -0
- data/app/assets/images/refinery/icons/img.png +0 -0
- data/app/assets/images/refinery/icons/information.png +0 -0
- data/app/assets/images/refinery/icons/layout_add.png +0 -0
- data/app/assets/images/refinery/icons/layout_edit.png +0 -0
- data/app/assets/images/refinery/icons/locale-blue.svg +15 -0
- data/app/assets/images/refinery/icons/locale.svg +11 -0
- data/app/assets/images/refinery/icons/music.png +0 -0
- data/app/assets/images/refinery/icons/page.png +0 -0
- data/app/assets/images/refinery/icons/page_add.png +0 -0
- data/app/assets/images/refinery/icons/page_edit.png +0 -0
- data/app/assets/images/refinery/icons/page_white_edit.png +0 -0
- data/app/assets/images/refinery/icons/page_white_gear.png +0 -0
- data/app/assets/images/refinery/icons/page_white_put.png +0 -0
- data/app/assets/images/refinery/icons/pdf.png +0 -0
- data/app/assets/images/refinery/icons/ppt.png +0 -0
- data/app/assets/images/refinery/icons/star.png +0 -0
- data/app/assets/images/refinery/icons/tick.png +0 -0
- data/app/assets/images/refinery/icons/up.gif +0 -0
- data/app/assets/images/refinery/icons/user_add.png +0 -0
- data/app/assets/images/refinery/icons/user_comment.png +0 -0
- data/app/assets/images/refinery/icons/user_edit.png +0 -0
- data/app/assets/images/refinery/icons/xls.png +0 -0
- data/app/assets/images/refinery/icons/zip.png +0 -0
- data/app/assets/images/refinery/icons/zoom.png +0 -0
- data/app/assets/images/refinery/logo-large.png +0 -0
- data/app/assets/images/refinery/logo-medium.png +0 -0
- data/app/assets/images/refinery/logo-site-bar.png +0 -0
- data/app/assets/images/refinery/logo-small-medium.png +0 -0
- data/app/assets/images/refinery/logo-small.png +0 -0
- data/app/assets/images/refinery/logo-tiny.png +0 -0
- data/app/assets/images/refinery/logo.png +0 -0
- data/app/assets/images/refinery/nav-3-background.gif +0 -0
- data/app/assets/images/refinery/nav_inactive_background.png +0 -0
- data/app/assets/images/refinery/orange_button.png +0 -0
- data/app/assets/images/refinery/page_bg.png +0 -0
- data/app/assets/images/refinery/text_field_background.png +0 -0
- data/app/assets/images/refinery/tooltip-nib.gif +0 -0
- data/app/assets/images/refinery/tooltip-nib.png +0 -0
- data/app/assets/javascripts/admin.js +7 -6
- data/app/assets/javascripts/refinery/admin.js.erb +99 -60
- data/app/assets/javascripts/refinery/ajaxy_pagination.js.coffee +2 -5
- data/app/assets/javascripts/refinery/application.js +8 -0
- data/app/assets/javascripts/refinery/core.js +4 -18
- data/app/assets/javascripts/refinery/interface.js.coffee.erb +5 -29
- data/app/assets/javascripts/refinery/modal_dialogs.js.erb +0 -105
- data/app/assets/javascripts/refinery/nestedsortables.js +183 -110
- data/app/assets/javascripts/refinery/refinery.js.erb +3 -9
- data/app/assets/javascripts/refinery/serializelist.js +1 -1
- data/app/assets/javascripts/refinery/site_bar.js +0 -5
- data/app/assets/javascripts/refinery/sortable_list.js +10 -11
- data/app/assets/javascripts/refinery/submit_continue.js.coffee.erb +1 -1
- data/app/assets/stylesheets/application.scss +2 -0
- data/app/assets/stylesheets/refinery/_colours.scss +18 -0
- data/app/assets/stylesheets/refinery/_icons.scss +85 -0
- data/app/assets/stylesheets/refinery/{layout.css.scss → _layout.scss} +306 -338
- data/app/assets/stylesheets/refinery/_mixins.scss +84 -0
- data/app/assets/stylesheets/refinery/{submenu.css.scss → _submenu.scss} +2 -2
- data/app/assets/stylesheets/refinery/{tooltips.css.scss → _tooltips.scss} +0 -0
- data/app/assets/stylesheets/refinery/_ui.scss +252 -0
- data/app/assets/stylesheets/refinery/{formatting.css.scss → formatting.scss} +0 -0
- data/app/assets/stylesheets/refinery/refinery.scss +10 -0
- data/app/assets/stylesheets/refinery/site_bar.scss +126 -0
- data/app/assets/stylesheets/refinery/{theme.css.scss → theme.scss} +0 -0
- data/app/controllers/refinery/admin/core_controller.rb +2 -7
- data/app/controllers/refinery/admin/dialogs_controller.rb +4 -3
- data/app/controllers/refinery/admin_controller.rb +0 -1
- data/app/controllers/refinery/fast_controller.rb +0 -4
- data/app/helpers/refinery/admin/visual_editor_helper.rb +13 -0
- data/app/helpers/refinery/admin_helper.rb +4 -0
- data/app/helpers/refinery/custom_assets_helper.rb +2 -2
- data/app/helpers/refinery/image_helper.rb +9 -8
- data/app/helpers/refinery/meta_helper.rb +1 -1
- data/app/helpers/refinery/site_bar_helper.rb +16 -2
- data/app/helpers/refinery/tag_helper.rb +38 -5
- data/app/models/refinery/core/base_model.rb +3 -1
- data/app/views/layouts/refinery/admin.html.erb +12 -10
- data/app/views/layouts/refinery/admin_dialog.html.erb +1 -4
- data/app/views/refinery/_content_page.html.erb +1 -1
- data/app/views/refinery/_google_analytics.html.erb +8 -9
- data/app/views/refinery/_head.html.erb +1 -1
- data/app/views/refinery/_javascripts.html.erb +0 -15
- data/app/views/refinery/_message.html.erb +1 -1
- data/app/views/refinery/_site_bar.html.erb +9 -6
- data/app/views/refinery/admin/_error_messages.html.erb +4 -4
- data/app/views/refinery/admin/_form_actions.html.erb +1 -0
- data/app/views/refinery/admin/_form_advanced_options_menu.html.erb +3 -4
- data/app/views/refinery/admin/_head.html.erb +3 -0
- data/app/views/refinery/admin/_image_picker.html.erb +4 -5
- data/app/views/refinery/admin/_javascripts.html.erb +4 -9
- data/app/views/refinery/admin/_locale_picker.html.erb +9 -2
- data/app/views/refinery/admin/_make_sortable.html.erb +8 -6
- data/app/views/refinery/admin/_menu.html.erb +2 -15
- data/app/views/refinery/admin/_menu_item.html.erb +3 -0
- data/app/views/refinery/admin/_resource_picker.html.erb +12 -22
- data/app/views/refinery/admin/_search.html.erb +1 -1
- data/app/views/refinery/admin/_tabbed_fields.html.erb +2 -2
- data/app/views/refinery/admin/_wysiwyg.html.erb +1 -1
- data/{lib/generators/refinery/cms/templates/app/decorators/controllers/refinery/.gitkeep → app/views/refinery/admin/dialog_success.html.erb} +0 -0
- data/app/views/refinery/admin/dialogs/show.html.erb +1 -19
- data/config/initializers/assets.rb +6 -0
- data/config/locales/ca.yml +84 -0
- data/config/locales/cs.yml +12 -5
- data/config/locales/en.yml +6 -2
- data/config/locales/fr.yml +15 -11
- data/config/locales/hu.yml +3 -1
- data/config/locales/it.yml +5 -1
- data/config/locales/ja.yml +2 -2
- data/config/locales/pt.yml +5 -3
- data/config/locales/ru.yml +7 -0
- data/config/locales/sl.yml +0 -3
- data/config/locales/tr.yml +43 -41
- data/config/routes.rb +1 -4
- data/lib/generators/refinery/cms/cms_generator.rb +68 -26
- data/lib/generators/refinery/cms/templates/app/decorators/{models/refinery/.gitkeep → controllers/refinery/.keep} +0 -0
- data/lib/generators/refinery/{form/templates/.gitkeep → cms/templates/app/decorators/models/refinery/.keep} +0 -0
- data/lib/generators/refinery/cms/templates/config/database.yml.mysql +3 -3
- data/lib/generators/refinery/cms/templates/config/database.yml.postgresql +3 -3
- data/lib/generators/refinery/core/templates/config/initializers/refinery/core.rb.erb +18 -5
- data/lib/generators/refinery/dummy/dummy_generator.rb +3 -1
- data/lib/generators/refinery/dummy/templates/rails/application.js +3 -0
- data/lib/generators/refinery/dummy/templates/rails/application.rb.erb +0 -2
- data/lib/generators/refinery/dummy/templates/rails/blank.png +0 -0
- data/lib/generators/refinery/dummy/templates/rails/routes.rb +1 -1
- data/lib/generators/refinery/engine/engine_generator.rb +3 -2
- data/lib/generators/refinery/engine/templates/Gemfile +9 -4
- data/lib/generators/refinery/engine/templates/Rakefile +3 -4
- data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb +11 -2
- data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb +2 -2
- data/lib/generators/refinery/engine/templates/app/models/refinery/namespace/singular_name.rb.erb +5 -5
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_actions.html.erb +7 -12
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb +8 -8
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +3 -3
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_singular_name.html.erb +6 -11
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/index.html.erb +1 -1
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/plural_name/show.html.erb +4 -4
- data/lib/generators/refinery/engine/templates/db/migrate/1_create_namespace_plural_name.rb.erb +2 -9
- data/lib/generators/refinery/engine/templates/db/seeds.rb.erb +13 -19
- data/lib/generators/refinery/engine/templates/lib/refinery/plural_name/engine.rb.erb +0 -4
- data/lib/generators/refinery/engine/templates/readme.md +3 -3
- data/lib/generators/refinery/engine/templates/refinerycms-extension_plural_name.gemspec +1 -0
- data/lib/generators/refinery/engine/templates/spec/features/refinery/namespace/admin/plural_name_spec.rb.erb +25 -28
- data/lib/generators/refinery/engine/templates/spec/models/refinery/namespace/singular_name_spec.rb.erb +1 -1
- data/lib/generators/refinery/engine/templates/spec/spec_helper.rb +1 -1
- data/lib/refinery.rb +7 -9
- data/lib/refinery/admin/base_controller.rb +42 -32
- data/lib/refinery/application_controller.rb +25 -17
- data/lib/refinery/cli.rb +54 -19
- data/lib/refinery/core.rb +5 -0
- data/lib/refinery/core/authorisation_adapter.rb +11 -0
- data/lib/refinery/core/authorisation_manager.rb +14 -0
- data/lib/refinery/core/configuration.rb +25 -4
- data/lib/refinery/core/default_route.rb +16 -0
- data/lib/refinery/core/engine.rb +44 -25
- data/lib/refinery/core/nil_user.rb +42 -0
- data/lib/refinery/crud.rb +40 -29
- data/lib/refinery/extension_generation.rb +11 -22
- data/lib/refinery/generators/generated_attribute.rb +54 -0
- data/lib/refinery/generators/named_base.rb +16 -0
- data/lib/refinery/menu.rb +3 -2
- data/lib/refinery/menu_item.rb +1 -1
- data/lib/refinery/plugin.rb +27 -43
- data/lib/refinery/plugins.rb +22 -26
- data/lib/refinery/users_manager.rb +8 -0
- data/lib/refinery/version.rb +7 -3
- data/lib/tasks/refinery.rake +7 -0
- data/license.md +1 -1
- data/refinerycms-core.gemspec +11 -8
- data/spec/controllers/refinery/admin/dummy_controller_spec.rb +23 -11
- data/spec/controllers/refinery/sitemap_controller_spec.rb +2 -2
- data/spec/features/refinery/admin/custom_assets_spec.rb +12 -10
- data/spec/features/refinery/admin/dialogs_spec.rb +5 -5
- data/spec/features/refinery/admin/xhr_paging_spec.rb +24 -38
- data/spec/features/refinery/application_layout_spec.rb +3 -3
- data/spec/features/refinery/core_spec.rb +1 -1
- data/spec/features/refinery/site_bar_spec.rb +44 -23
- data/spec/helpers/refinery/admin_helper_spec.rb +15 -0
- data/spec/helpers/refinery/custom_assets_helper_spec.rb +15 -23
- data/spec/helpers/refinery/html_truncation_helper_spec.rb +10 -5
- data/spec/helpers/refinery/meta_helper_spec.rb +3 -3
- data/spec/helpers/refinery/pagination_helper_spec.rb +7 -7
- data/spec/helpers/refinery/tag_helper_spec.rb +4 -4
- data/spec/helpers/refinery/translation_helper_spec.rb +3 -3
- data/spec/lib/generators/refinery/cms/cms_generator_spec.rb +30 -25
- data/spec/lib/generators/refinery/core/core_generator_spec.rb +1 -1
- data/spec/lib/generators/refinery/engine/engine_generator_multiple_resources_spec.rb +7 -8
- data/spec/lib/generators/refinery/engine/engine_generator_sanity_check_spec.rb +15 -15
- data/spec/lib/generators/refinery/engine/engine_generator_spec.rb +9 -9
- data/spec/lib/generators/refinery/engine/engine_generator_with_i18n_spec.rb +1 -1
- data/spec/lib/generators/refinery/engine/engine_generator_without_frontend_spec.rb +1 -1
- data/spec/lib/refinery/application_controller_spec.rb +16 -16
- data/spec/lib/refinery/authorisation_manager_spec.rb +10 -0
- data/spec/lib/refinery/cli_spec.rb +83 -21
- data/spec/lib/refinery/core/configuration_spec.rb +5 -5
- data/spec/lib/refinery/core/nil_user_spec.rb +39 -0
- data/spec/lib/refinery/core_spec.rb +39 -30
- data/spec/lib/refinery/crud_spec.rb +70 -59
- data/spec/lib/refinery/menu_spec.rb +4 -4
- data/spec/lib/refinery/plugin_spec.rb +56 -45
- data/spec/lib/refinery/plugins_spec.rb +39 -87
- data/spec/lib/refinery/users_manager_spec.rb +9 -0
- data/spec/support/refinery.rb +3 -8
- data/vendor/assets/fonts/font-awesome/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.svg +565 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/font-awesome/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/stylesheets/_font-awesome-compass.scss +5 -0
- data/vendor/assets/stylesheets/_font-awesome-sprockets.scss +5 -0
- data/vendor/assets/stylesheets/_font-awesome.scss +17 -0
- data/vendor/assets/stylesheets/font-awesome/_animated.scss +34 -0
- data/vendor/assets/stylesheets/font-awesome/_bordered-pulled.scss +16 -0
- data/vendor/assets/stylesheets/font-awesome/_core.scss +12 -0
- data/vendor/assets/stylesheets/font-awesome/_extras.scss +44 -0
- data/vendor/assets/stylesheets/font-awesome/_fixed-width.scss +6 -0
- data/vendor/assets/stylesheets/font-awesome/_icons.scss +596 -0
- data/vendor/assets/stylesheets/font-awesome/_larger.scss +13 -0
- data/vendor/assets/stylesheets/font-awesome/_list.scss +19 -0
- data/vendor/assets/stylesheets/font-awesome/_mixins.scss +26 -0
- data/vendor/assets/stylesheets/font-awesome/_path.scss +14 -0
- data/vendor/assets/stylesheets/font-awesome/_rotated-flipped.scss +20 -0
- data/vendor/assets/stylesheets/font-awesome/_stacked.scss +20 -0
- data/vendor/assets/stylesheets/font-awesome/_variables.scss +606 -0
- metadata +144 -441
- data/app/assets/images/refinery/carousel-left.png +0 -0
- data/app/assets/images/refinery/carousel-right.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/arrow_redo.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/arrow_undo.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/eye.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/article.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/aside.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/blockquote.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/command.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/details.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/figcaption.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/figure.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/footer.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h1.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h2.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h3.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h4.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h5.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/h6.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/header.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/hgroup.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/mark.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/meter.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/nav.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/p.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/pre.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/progress.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/readme.md +0 -1
- data/app/assets/images/wymeditor/skins/refinery/html5/rp.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/rt.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/ruby.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/section.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/summary.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/html5/time.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-blockquote.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h1.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h2.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h3.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h4.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h5.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-h6.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-p.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/iframe/lbl-pre.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/link_add.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/link_break.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/page_code.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/page_paste.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/photo_add.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/right.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/style.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/table_add.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_align_center.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_align_justify.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_align_left.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_align_right.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_bold.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_1.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_2.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_3.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_4.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_5.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_heading_6.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_indent.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_indent_remove.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_italic.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_list_bullets.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_list_numbers.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_paragraph.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_strikethrough.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_subscript.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_superscript.png +0 -0
- data/app/assets/images/wymeditor/skins/refinery/text_underline.png +0 -0
- data/app/assets/images/wymeditor/skins/wymeditor_icon.png +0 -0
- data/app/assets/javascripts/refinery/boot_wym.js.erb +0 -285
- data/app/assets/javascripts/refinery/sortable_menu.js.coffee.erb +0 -20
- data/app/assets/javascripts/refinery/wymeditor.js +0 -37
- data/app/assets/javascripts/wymeditor/GPL-license.txt +0 -278
- data/app/assets/javascripts/wymeditor/MIT-license.txt +0 -20
- data/app/assets/javascripts/wymeditor/README +0 -35
- data/app/assets/javascripts/wymeditor/browsers/ie.js.erb +0 -224
- data/app/assets/javascripts/wymeditor/browsers/mozilla.js.erb +0 -292
- data/app/assets/javascripts/wymeditor/browsers/opera.js.erb +0 -123
- data/app/assets/javascripts/wymeditor/browsers/webkit.js.erb +0 -283
- data/app/assets/javascripts/wymeditor/classes.js.erb +0 -1575
- data/app/assets/javascripts/wymeditor/functions.js.erb +0 -222
- data/app/assets/javascripts/wymeditor/lang/bg.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/ca.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/cs.js +0 -58
- data/app/assets/javascripts/wymeditor/lang/da.js +0 -48
- data/app/assets/javascripts/wymeditor/lang/de.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/en.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/es.js +0 -58
- data/app/assets/javascripts/wymeditor/lang/fa.js +0 -46
- data/app/assets/javascripts/wymeditor/lang/fi.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/fr.js +0 -58
- data/app/assets/javascripts/wymeditor/lang/he.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/hu.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/it.js +0 -48
- data/app/assets/javascripts/wymeditor/lang/ja.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/lv.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/nb.js +0 -48
- data/app/assets/javascripts/wymeditor/lang/nl.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/nn.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/pl.js +0 -56
- data/app/assets/javascripts/wymeditor/lang/pt-BR.js +0 -58
- data/app/assets/javascripts/wymeditor/lang/pt.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/rs.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/ru.js +0 -57
- data/app/assets/javascripts/wymeditor/lang/sk.js +0 -56
- data/app/assets/javascripts/wymeditor/lang/sl.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/sv.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/tr.js +0 -45
- data/app/assets/javascripts/wymeditor/lang/vi.js +0 -47
- data/app/assets/javascripts/wymeditor/lang/zh-CN.js +0 -47
- data/app/assets/javascripts/wymeditor/prototypes.js.erb +0 -1103
- data/app/assets/javascripts/wymeditor/setup.js.erb +0 -622
- data/app/assets/javascripts/wymeditor/skins/refinery/skin.js +0 -45
- data/app/assets/javascripts/wymeditor/validators.js.erb +0 -777
- data/app/assets/stylesheets/refinery/refinery.css +0 -15
- data/app/assets/stylesheets/refinery/site_bar.css.scss +0 -92
- data/app/assets/stylesheets/refinery/ui.css.scss +0 -103
- data/app/assets/stylesheets/wymeditor/skins/refinery/skin.css.scss +0 -530
- data/app/assets/stylesheets/wymeditor/skins/refinery/wymiframe.css.scss +0 -156
- data/app/helpers/refinery/admin/core_helper.rb +0 -6
- data/app/helpers/refinery/admin/dialogs_helper.rb +0 -6
- data/app/helpers/refinery/fast_helper.rb +0 -4
- data/app/helpers/refinery/sitemap_helper.rb +0 -4
- data/app/views/refinery/wymiframe.html.erb +0 -14
- data/lib/generators/refinery/form/USAGE +0 -20
- data/lib/generators/refinery/form/form_generator.rb +0 -25
- data/lib/generators/refinery/form/templates/.gitignore +0 -2
- data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb.erb +0 -54
- data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/admin/settings_controller.rb.erb +0 -45
- data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/plural_name_controller.rb.erb +0 -53
- data/lib/generators/refinery/form/templates/app/mailers/refinery/namespace/mailer.rb.erb +0 -22
- data/lib/generators/refinery/form/templates/app/models/refinery/namespace/setting.rb.erb +0 -34
- data/lib/generators/refinery/form/templates/app/models/refinery/namespace/singular_name.rb.erb +0 -49
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +0 -23
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_singular_name.html.erb +0 -25
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_submenu.html.erb +0 -29
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/index.html.erb +0 -4
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/show.html.erb +0 -52
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/spam.html.erb +0 -27
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/_confirmation_email_form.html.erb +0 -51
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/_notification_recipients_form.html.erb +0 -21
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/edit.html.erb +0 -5
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/mailer/confirmation.html.erb +0 -1
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/mailer/notification.html.erb +0 -17
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/new.html.erb +0 -43
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/thank_you.html.erb +0 -1
- data/lib/generators/refinery/form/templates/config/locales/cs.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/da.yml +0 -66
- data/lib/generators/refinery/form/templates/config/locales/de.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/en.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/es.yml +0 -66
- data/lib/generators/refinery/form/templates/config/locales/fr.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/it.yml +0 -66
- data/lib/generators/refinery/form/templates/config/locales/lv.yml +0 -77
- data/lib/generators/refinery/form/templates/config/locales/nb.yml +0 -75
- data/lib/generators/refinery/form/templates/config/locales/nl.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/pt-BR.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/ru.yml +0 -77
- data/lib/generators/refinery/form/templates/config/locales/sk.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/sl.yml +0 -67
- data/lib/generators/refinery/form/templates/config/locales/tr.yml +0 -78
- data/lib/generators/refinery/form/templates/config/locales/zh-CN.yml +0 -78
- data/lib/generators/refinery/form/templates/config/routes.rb.erb +0 -26
- data/lib/generators/refinery/form/templates/db/migrate/1_create_plural_name.rb.erb +0 -39
- data/lib/generators/refinery/form/templates/db/seeds.rb.erb +0 -31
- data/lib/generators/refinery/form/templates/lib/generators/refinery/plural_name_generator.rb.erb +0 -20
- data/lib/generators/refinery/form/templates/lib/refinery/plural_name.rb.erb +0 -18
- data/lib/generators/refinery/form/templates/lib/refinery/plural_name/engine.rb.erb +0 -27
- data/lib/generators/refinery/form/templates/lib/refinerycms-plural_name.rb.erb +0 -1
- data/lib/generators/refinery/form/templates/refinerycms-plural_name.gemspec +0 -16
- data/lib/generators/refinery/form/templates/script/rails +0 -10
- data/lib/refinery/activity.rb +0 -113
- data/lib/refinery/ext/action_view/helpers/form_builder.rb +0 -9
- data/lib/refinery/ext/action_view/helpers/form_helper.rb +0 -20
- data/lib/refinery/ext/action_view/helpers/form_tag_helper.rb +0 -10
- data/spec/controllers/refinery/admin/refinery_core_controller_spec.rb +0 -19
- data/spec/controllers/refinery/fast_controller_spec.rb +0 -12
- data/spec/lib/generators/refinery/form/form_generator_spec.rb +0 -99
- data/spec/lib/refinery/activity_spec.rb +0 -46
- data/spec/support/background_selenium_firefox_driver.rb +0 -14
- data/vendor/assets/javascripts/jquery/jquery.jcarousel.js +0 -900
@@ -1,10 +1,10 @@
|
|
1
1
|
# <%= extension_plural_name.titleize %> extension for Refinery CMS.
|
2
2
|
|
3
|
-
## How to build this extension as a gem
|
3
|
+
## How to build this extension as a gem (not required)
|
4
4
|
|
5
5
|
cd vendor/extensions/<%= extension_plural_name %>
|
6
6
|
gem build refinerycms-<%= extension_plural_name %>.gemspec
|
7
7
|
gem install refinerycms-<%= extension_plural_name %>.gem
|
8
8
|
|
9
|
-
# Sign up for a
|
10
|
-
gem push refinerycms-<%= extension_plural_name %>.gem
|
9
|
+
# Sign up for a https://rubygems.org/ account and publish the gem
|
10
|
+
gem push refinerycms-<%= extension_plural_name %>.gem
|
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
# Runtime dependencies
|
14
14
|
s.add_dependency 'refinerycms-core', '~> <%= Refinery::Version %>'
|
15
|
+
s.add_dependency 'acts_as_indexed', '~> 0.8.0'
|
15
16
|
|
16
17
|
# Development dependencies (usually used for testing)
|
17
18
|
s.add_development_dependency 'refinerycms-testing', '~> <%= Refinery::Version %>'
|
@@ -4,8 +4,8 @@ require "spec_helper"
|
|
4
4
|
describe Refinery do
|
5
5
|
describe "<%= namespacing %>" do
|
6
6
|
describe "Admin" do
|
7
|
-
describe "<%= plural_name %>" do
|
8
|
-
|
7
|
+
describe "<%= plural_name %>", type: :feature do
|
8
|
+
refinery_login
|
9
9
|
<% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? %>
|
10
10
|
describe "<%= plural_name %> list" do
|
11
11
|
before do
|
@@ -15,8 +15,8 @@ describe Refinery do
|
|
15
15
|
|
16
16
|
it "shows two items" do
|
17
17
|
visit refinery.<%= namespacing.underscore %>_admin_<%= plural_name %>_path
|
18
|
-
page.
|
19
|
-
page.
|
18
|
+
expect(page).to have_content("UniqueTitleOne")
|
19
|
+
expect(page).to have_content("UniqueTitleTwo")
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -30,19 +30,17 @@ describe Refinery do
|
|
30
30
|
context "valid data" do
|
31
31
|
it "should succeed" do
|
32
32
|
fill_in "<%= title.name.titleize %>", :with => "This is a test of the first string field"
|
33
|
-
click_button "Save"
|
33
|
+
expect { click_button "Save" }.to change(Refinery::<%= namespacing %>::<%= class_name %>, :count).from(0).to(1)
|
34
34
|
|
35
|
-
page.
|
36
|
-
Refinery::<%= namespacing %>::<%= class_name %>.count.should == 1
|
35
|
+
expect(page).to have_content("'This is a test of the first string field' was successfully added.")
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
39
|
context "invalid data" do
|
41
40
|
it "should fail" do
|
42
|
-
click_button "Save"
|
41
|
+
expect { click_button "Save" }.not_to change(Refinery::<%= namespacing %>::<%= class_name %>, :count)
|
43
42
|
|
44
|
-
page.
|
45
|
-
Refinery::<%= namespacing %>::<%= class_name %>.count.should == 0
|
43
|
+
expect(page).to have_content("<%= title.name.titleize %> can't be blank")
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
@@ -55,10 +53,9 @@ describe Refinery do
|
|
55
53
|
click_link "Add New <%= singular_name.titleize %>"
|
56
54
|
|
57
55
|
fill_in "<%= title.name.titleize %>", :with => "UniqueTitle"
|
58
|
-
click_button "Save"
|
56
|
+
expect { click_button "Save" }.not_to change(Refinery::<%= namespacing %>::<%= class_name %>, :count)
|
59
57
|
|
60
|
-
page.
|
61
|
-
Refinery::<%= namespacing %>::<%= class_name %>.count.should == 1
|
58
|
+
expect(page).to have_content("There were problems")
|
62
59
|
end
|
63
60
|
end
|
64
61
|
<% if localized? %>
|
@@ -76,20 +73,20 @@ describe Refinery do
|
|
76
73
|
end
|
77
74
|
|
78
75
|
it "should succeed" do
|
79
|
-
Refinery::<%= namespacing %>::<%= class_name %>.count.
|
76
|
+
expect(Refinery::<%= namespacing %>::<%= class_name %>.count).to eq(1)
|
80
77
|
end
|
81
78
|
|
82
|
-
it "should show locale
|
79
|
+
it "should show locale marker for page" do
|
83
80
|
p = Refinery::<%= namespacing %>::<%= class_name %>.last
|
84
81
|
within "#<%= singular_name %>_#{p.id}" do
|
85
|
-
page.
|
82
|
+
expect(page).to have_css(".locale_marker", content: 'EN')
|
86
83
|
end
|
87
84
|
end
|
88
85
|
|
89
86
|
it "should show <%= title.name %> in the admin menu" do
|
90
87
|
p = Refinery::<%= namespacing %>::<%= class_name %>.last
|
91
88
|
within "#<%= singular_name %>_#{p.id}" do
|
92
|
-
page.
|
89
|
+
expect(page).to have_content('First column')
|
93
90
|
end
|
94
91
|
end
|
95
92
|
end
|
@@ -113,22 +110,22 @@ describe Refinery do
|
|
113
110
|
end
|
114
111
|
|
115
112
|
it "should succeed" do
|
116
|
-
Refinery::<%= namespacing %>::<%= class_name %>.count.
|
117
|
-
Refinery::<%= namespacing %>::<%= class_name %>::Translation.count.
|
113
|
+
expect(Refinery::<%= namespacing %>::<%= class_name %>.count).to eq(1)
|
114
|
+
expect(Refinery::<%= namespacing %>::<%= class_name %>::Translation.count).to eq(2)
|
118
115
|
end
|
119
116
|
|
120
117
|
it "should show locale flag for page" do
|
121
118
|
p = Refinery::<%= namespacing %>::<%= class_name %>.last
|
122
119
|
within "#<%= singular_name %>_#{p.id}" do
|
123
|
-
page.
|
124
|
-
page.
|
120
|
+
expect(page).to have_css(".locale_marker", content: 'EN')
|
121
|
+
expect(page).to have_css(".locale_marker", content: 'CS')
|
125
122
|
end
|
126
123
|
end
|
127
124
|
|
128
125
|
it "should show <%= title.name %> in backend locale in the admin menu" do
|
129
126
|
p = Refinery::<%= namespacing %>::<%= class_name %>.last
|
130
127
|
within "#<%= singular_name %>_#{p.id}" do
|
131
|
-
page.
|
128
|
+
expect(page).to have_content('First column')
|
132
129
|
end
|
133
130
|
end
|
134
131
|
end
|
@@ -148,14 +145,14 @@ describe Refinery do
|
|
148
145
|
it "should show title in backend locale in the admin menu" do
|
149
146
|
p = Refinery::<%= namespacing %>::<%= class_name %>.last
|
150
147
|
within "#<%= singular_name %>_#{p.id}" do
|
151
|
-
page.
|
148
|
+
expect(page).to have_content('First translated column')
|
152
149
|
end
|
153
150
|
end
|
154
151
|
|
155
152
|
it "should show locale flag for page" do
|
156
153
|
p = Refinery::<%= namespacing %>::<%= class_name %>.last
|
157
154
|
within "#<%= singular_name %>_#{p.id}" do
|
158
|
-
page.
|
155
|
+
expect(page).to have_css(".locale_marker", content: 'CS')
|
159
156
|
end
|
160
157
|
end
|
161
158
|
end
|
@@ -176,8 +173,8 @@ describe Refinery do
|
|
176
173
|
fill_in "<%= title.name.titleize %>", :with => "A different <%= title.name %>"
|
177
174
|
click_button "Save"
|
178
175
|
|
179
|
-
page.
|
180
|
-
page.
|
176
|
+
expect(page).to have_content("'A different <%= title.name %>' was successfully updated.")
|
177
|
+
expect(page).not_to have_content("A <%= title.name %>")
|
181
178
|
end
|
182
179
|
end
|
183
180
|
|
@@ -189,8 +186,8 @@ describe Refinery do
|
|
189
186
|
|
190
187
|
click_link "Remove this <%= singular_name.titleize.downcase %> forever"
|
191
188
|
|
192
|
-
page.
|
193
|
-
Refinery::<%= namespacing %>::<%= class_name %>.count.
|
189
|
+
expect(page).to have_content("'UniqueTitleOne' was successfully removed.")
|
190
|
+
expect(Refinery::<%= namespacing %>::<%= class_name %>.count).to eq(0)
|
194
191
|
end
|
195
192
|
end
|
196
193
|
<% end %>
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
module Refinery
|
4
4
|
module <%= namespacing %>
|
5
5
|
describe <%= class_name %> do
|
6
|
-
describe "validations" do
|
6
|
+
describe "validations", type: :model do
|
7
7
|
subject do
|
8
8
|
FactoryGirl.create(:<%= singular_name %><% if (title = attributes.detect { |a| a.type.to_s == "string" }).present? -%>,
|
9
9
|
:<%= title.name %> => "Refinery CMS"<% end %>)
|
@@ -24,7 +24,7 @@ end
|
|
24
24
|
|
25
25
|
# Requires supporting files with custom matchers and macros, etc,
|
26
26
|
# in ./support/ and its subdirectories including factories.
|
27
|
-
([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{|p|
|
27
|
+
([Rails.root.to_s] | ::Refinery::Plugins.registered.pathnames).map{ |p|
|
28
28
|
Dir[File.join(p, 'spec', 'support', '**', '*.rb').to_s]
|
29
29
|
}.flatten.sort.each do |support_file|
|
30
30
|
require support_file
|
data/lib/refinery.rb
CHANGED
@@ -17,10 +17,6 @@ module Refinery
|
|
17
17
|
autoload :Crud, 'refinery/crud'
|
18
18
|
autoload :BasePresenter, 'refinery/base_presenter'
|
19
19
|
|
20
|
-
require 'refinery/ext/action_view/helpers/form_builder'
|
21
|
-
require 'refinery/ext/action_view/helpers/form_helper'
|
22
|
-
require 'refinery/ext/action_view/helpers/form_tag_helper'
|
23
|
-
|
24
20
|
module Admin
|
25
21
|
autoload :BaseController, 'refinery/admin/base_controller'
|
26
22
|
end
|
@@ -142,13 +138,15 @@ module Refinery
|
|
142
138
|
options = {:plural => false, :admin => true}.merge options
|
143
139
|
|
144
140
|
klass = klass.constantize if klass.respond_to?(:constantize)
|
145
|
-
active_name = ActiveModel::Name.new
|
141
|
+
active_name = ::ActiveModel::Name.new(
|
142
|
+
klass, (Refinery if klass.parents.include?(Refinery))
|
143
|
+
)
|
146
144
|
|
147
145
|
if options[:admin]
|
148
146
|
# Most of the time this gets rid of 'refinery'
|
149
|
-
parts = active_name.underscore.split('/').reject
|
147
|
+
parts = active_name.to_s.underscore.split('/').reject do |name|
|
150
148
|
active_name.singular_route_key.exclude?(name)
|
151
|
-
|
149
|
+
end
|
152
150
|
|
153
151
|
# Get the singular resource_name from the url parts
|
154
152
|
resource_name = parts.pop
|
@@ -169,14 +167,14 @@ module Refinery
|
|
169
167
|
private
|
170
168
|
def detect_invoker(the_caller = caller)
|
171
169
|
return '' unless the_caller && the_caller.respond_to?(:detect)
|
172
|
-
the_caller.detect{|c| /#{Rails.root}/ === c }.inspect.to_s.split(':in').first
|
170
|
+
the_caller.detect{ |c| /#{Rails.root}/ === c }.inspect.to_s.split(':in').first
|
173
171
|
end
|
174
172
|
|
175
173
|
# plain Module#included? or Module#included_modules doesn't cut it here
|
176
174
|
def included_extension_module?(base, extension_module)
|
177
175
|
if base.kind_of?(Class)
|
178
176
|
direct_superclass = base.superclass
|
179
|
-
base.ancestors.take_while {|ancestor| ancestor != direct_superclass}.include?(extension_module)
|
177
|
+
base.ancestors.take_while { |ancestor| ancestor != direct_superclass}.include?(extension_module)
|
180
178
|
else
|
181
179
|
base < extension_module # can't do better than that for modules
|
182
180
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'action_controller'
|
2
|
+
require 'refinery/core/authorisation_manager'
|
3
|
+
require 'zilch/authorisation/users_manager'
|
2
4
|
|
3
5
|
module Refinery
|
4
6
|
module Admin
|
@@ -7,12 +9,13 @@ module Refinery
|
|
7
9
|
def self.included(base)
|
8
10
|
base.layout :layout?
|
9
11
|
|
10
|
-
base.
|
11
|
-
:authenticate_refinery_user!,
|
12
|
+
base.before_action :force_ssl!,
|
13
|
+
:authenticate_refinery_user!,
|
12
14
|
:restrict_controller
|
13
|
-
base.after_filter :store_location?, :only => [:index] # for redirect_back_or_default
|
14
15
|
|
15
|
-
base.
|
16
|
+
base.after_action :store_location?, :only => [:index] # for redirect_back_or_default
|
17
|
+
|
18
|
+
base.helper_method :searching?, :group_by_date, :refinery_admin_root_path
|
16
19
|
end
|
17
20
|
|
18
21
|
def admin?
|
@@ -23,60 +26,54 @@ module Refinery
|
|
23
26
|
params[:search].present?
|
24
27
|
end
|
25
28
|
|
29
|
+
def refinery_admin_root_path
|
30
|
+
current_refinery_user.landing_url
|
31
|
+
end
|
32
|
+
|
26
33
|
protected
|
27
34
|
|
28
35
|
def force_ssl!
|
29
36
|
redirect_to :protocol => 'https' if Refinery::Core.force_ssl && !request.ssl?
|
30
37
|
end
|
31
38
|
|
39
|
+
def authenticate_refinery_user!
|
40
|
+
authorisation_manager.authenticate!
|
41
|
+
end
|
42
|
+
|
32
43
|
def group_by_date(records)
|
33
44
|
new_records = []
|
34
45
|
|
35
46
|
records.each do |record|
|
36
47
|
key = record.created_at.strftime("%Y-%m-%d")
|
37
|
-
record_group = new_records.
|
38
|
-
(new_records.delete_if {|i| i.first == key}) << [key, record_group]
|
48
|
+
record_group = new_records.map{ |r| r.last if r.first == key }.flatten.compact << record
|
49
|
+
(new_records.delete_if { |i| i.first == key}) << [key, record_group]
|
39
50
|
end
|
40
51
|
|
41
52
|
new_records
|
42
53
|
end
|
43
54
|
|
44
|
-
def require_refinery_users!
|
45
|
-
redirect_to refinery.signup_path if just_installed? && controller_name != 'users'
|
46
|
-
end
|
47
|
-
|
48
|
-
def restrict_plugins
|
49
|
-
current_length = (plugins = current_refinery_user.authorized_plugins).length
|
50
|
-
|
51
|
-
# Superusers get granted access if they don't already have access.
|
52
|
-
if current_refinery_user.has_role?(:superuser)
|
53
|
-
if (plugins = plugins | ::Refinery::Plugins.registered.names).length > current_length
|
54
|
-
current_refinery_user.plugins = plugins
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
::Refinery::Plugins.set_active(plugins)
|
59
|
-
end
|
60
|
-
|
61
55
|
def restrict_controller
|
62
|
-
unless allow_controller?
|
63
|
-
logger.warn "'#{current_refinery_user
|
56
|
+
unless allow_controller?(params[:controller].gsub('admin/', ''))
|
57
|
+
logger.warn "'#{current_refinery_user}' tried to access '#{params[:controller]}' but was rejected."
|
64
58
|
error_404
|
65
59
|
end
|
66
60
|
end
|
67
61
|
|
68
62
|
private
|
69
63
|
|
70
|
-
def allow_controller?(
|
71
|
-
|
72
|
-
|
73
|
-
|
64
|
+
def allow_controller?(controller_name)
|
65
|
+
authorisation_manager.allow?(:controller, controller_name)
|
66
|
+
end
|
67
|
+
|
68
|
+
def authorisation_manager
|
69
|
+
@authorisation_manager ||= ::Refinery::Core::AuthorisationManager.new
|
74
70
|
end
|
75
71
|
|
76
72
|
def layout?
|
77
73
|
"refinery/admin#{'_dialog' if from_dialog?}"
|
78
74
|
end
|
79
75
|
|
76
|
+
# TODO: all store_location stuff should be in its own object..
|
80
77
|
# Check whether it makes sense to return the user to the last page they
|
81
78
|
# were at instead of the default e.g. refinery_admin_pages_path
|
82
79
|
# right now we just want to snap back to index actions and definitely not to dialogues.
|
@@ -84,9 +81,22 @@ module Refinery
|
|
84
81
|
store_location unless request.xhr? || from_dialog?
|
85
82
|
end
|
86
83
|
|
87
|
-
#
|
88
|
-
|
89
|
-
|
84
|
+
# Store the URI of the current request in the session.
|
85
|
+
#
|
86
|
+
# We can return to this location by calling #redirect_back_or_default.
|
87
|
+
def store_location
|
88
|
+
session[:return_to] = request.fullpath
|
89
|
+
end
|
90
|
+
|
91
|
+
# Clear and return the stored location
|
92
|
+
def pop_stored_location
|
93
|
+
session.delete(:return_to)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Redirect to the URI stored by the most recent store_location call or
|
97
|
+
# to the passed default.
|
98
|
+
def redirect_back_or_default(default)
|
99
|
+
redirect_to(pop_stored_location || default)
|
90
100
|
end
|
91
101
|
end
|
92
102
|
end
|
@@ -1,68 +1,76 @@
|
|
1
|
+
require 'refinery/core/authorisation_manager'
|
2
|
+
|
1
3
|
module Refinery
|
2
4
|
module ApplicationController
|
3
5
|
|
4
6
|
def self.included(base) # Extend controller
|
5
|
-
base.helper_method :home_page?,
|
6
|
-
:
|
7
|
+
base.helper_method :home_page?,
|
8
|
+
:local_request?,
|
9
|
+
:from_dialog?,
|
10
|
+
:admin?,
|
11
|
+
:current_refinery_user,
|
12
|
+
:authorisation_manager, :authorization_manager
|
7
13
|
|
8
14
|
base.protect_from_forgery # See ActionController::RequestForgeryProtection
|
9
15
|
|
10
16
|
base.send :include, Refinery::Crud # basic create, read, update and delete methods
|
11
17
|
|
12
18
|
if Refinery::Core.rescue_not_found
|
13
|
-
base.rescue_from ActiveRecord::RecordNotFound,
|
19
|
+
base.rescue_from ::ActiveRecord::RecordNotFound,
|
14
20
|
::AbstractController::ActionNotFound,
|
15
|
-
ActionView::MissingTemplate,
|
21
|
+
::ActionView::MissingTemplate,
|
16
22
|
:with => :error_404
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
20
26
|
def admin?
|
21
|
-
%r{
|
27
|
+
%r{\Aadmin/} === controller_name
|
22
28
|
end
|
23
29
|
|
24
|
-
def error_404(exception=nil)
|
30
|
+
def error_404(exception = nil)
|
25
31
|
# fallback to the default 404.html page.
|
26
32
|
file = Rails.root.join 'public', '404.html'
|
27
|
-
file = Refinery.roots(
|
33
|
+
file = Refinery.roots('refinery/core').join('public', '404.html') unless file.exist?
|
28
34
|
render :file => file.cleanpath.to_s.gsub(%r{#{file.extname}$}, ''),
|
29
|
-
:layout
|
35
|
+
:layout => false, :status => 404, :formats => [:html]
|
30
36
|
return false
|
31
37
|
end
|
32
38
|
|
33
39
|
def from_dialog?
|
34
|
-
params[:dialog] == 'true'
|
40
|
+
params[:dialog] == 'true' || params[:modal] == 'true'
|
35
41
|
end
|
36
42
|
|
37
43
|
def home_page?
|
38
44
|
%r{^#{Regexp.escape(request.path)}} === refinery.root_path
|
39
45
|
end
|
40
46
|
|
41
|
-
def just_installed?
|
42
|
-
Refinery::Role[:refinery].users.empty?
|
43
|
-
end
|
44
|
-
|
45
47
|
def local_request?
|
46
48
|
Rails.env.development? || /(::1)|(127.0.0.1)|((192.168).*)/ === request.remote_ip
|
47
49
|
end
|
48
50
|
|
49
|
-
def
|
50
|
-
|
51
|
+
def current_refinery_user
|
52
|
+
authorisation_manager.current_user
|
51
53
|
end
|
52
54
|
|
53
|
-
|
55
|
+
protected
|
54
56
|
|
55
57
|
# use a different model for the meta information.
|
56
58
|
def present(model)
|
57
59
|
@meta = presenter_for(model).new(model)
|
58
60
|
end
|
59
61
|
|
60
|
-
def presenter_for(model, default=BasePresenter)
|
62
|
+
def presenter_for(model, default = BasePresenter)
|
61
63
|
return default if model.nil?
|
62
64
|
|
63
65
|
"#{model.class.name}Presenter".constantize
|
64
66
|
rescue NameError
|
65
67
|
default
|
66
68
|
end
|
69
|
+
|
70
|
+
def authorisation_manager
|
71
|
+
@authorisation_manager ||= ::Refinery::Core::AuthorisationManager.new
|
72
|
+
end
|
73
|
+
# We ❤ you, too ️
|
74
|
+
alias_method :authorization_manager, :authorisation_manager
|
67
75
|
end
|
68
76
|
end
|