alchemy_cms 2.1.beta1 → 2.1.beta5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.rspec +2 -2
- data/.travis.yml +2 -1
- data/Gemfile +8 -9
- data/README.md +10 -10
- data/Rakefile +0 -1
- data/alchemy_cms.gemspec +7 -9
- data/app/assets/images/alchemy/icons.png +0 -0
- data/app/assets/javascripts/alchemy/alchemy.base.js +8 -2
- data/app/assets/javascripts/alchemy/{alchemy.dragndrop.js → alchemy.dragndrop.js.erb} +3 -3
- data/app/assets/javascripts/alchemy/alchemy.element_editor_selector.js +1 -1
- data/app/assets/javascripts/alchemy/alchemy.growler.js +3 -3
- data/app/assets/javascripts/alchemy/alchemy.js +10 -15
- data/app/assets/javascripts/alchemy/alchemy.link_overlay.js +6 -2
- data/app/assets/javascripts/alchemy/alchemy.page_sorter.js +1 -1
- data/app/assets/javascripts/alchemy/alchemy.preview.js +1 -1
- data/app/assets/javascripts/alchemy/alchemy.routes.js.erb +38 -0
- data/app/assets/javascripts/alchemy/alchemy.swf_upload.js +360 -0
- data/app/assets/javascripts/alchemy/alchemy.windows.js +32 -17
- data/app/assets/javascripts/alchemy/preview.js +1 -0
- data/{vendor → app}/assets/javascripts/tiny_mce/plugins/alchemy_link/editor_plugin.js +0 -0
- data/{vendor → app}/assets/javascripts/tiny_mce/plugins/alchemy_link/langs/de.js +0 -0
- data/{vendor → app}/assets/javascripts/tiny_mce/plugins/alchemy_link/langs/en.js +0 -0
- data/{vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.erb → app/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/alchemy/window.css.scss} +15 -33
- data/app/assets/stylesheets/alchemy/_defaults.scss +4 -16
- data/app/assets/stylesheets/alchemy/alchemy.css +2 -2
- data/app/assets/stylesheets/alchemy/base.css.scss +161 -205
- data/app/assets/stylesheets/alchemy/elements.css.scss +15 -8
- data/app/assets/stylesheets/alchemy/{jquery-ui.alchemy.css → jquery-ui.alchemy.css.scss} +41 -45
- data/app/assets/stylesheets/alchemy/jquery.sb.css.scss +14 -10
- data/app/assets/stylesheets/alchemy/{tinymce_content.css → tinymce_content.css.scss} +7 -6
- data/app/assets/stylesheets/alchemy/{tinymce_dialog.css → tinymce_dialog.css.scss} +7 -7
- data/app/controllers/alchemy/admin/attachments_controller.rb +131 -0
- data/app/controllers/alchemy/admin/base_controller.rb +118 -0
- data/app/controllers/alchemy/admin/clipboard_controller.rb +46 -0
- data/app/controllers/alchemy/admin/contents_controller.rb +55 -0
- data/app/controllers/alchemy/admin/dashboard_controller.rb +15 -0
- data/app/controllers/alchemy/admin/elements_controller.rb +123 -0
- data/app/controllers/alchemy/admin/essence_audios_controller.rb +12 -0
- data/app/controllers/alchemy/admin/essence_files_controller.rb +27 -0
- data/app/controllers/alchemy/admin/essence_flashes_controller.rb +12 -0
- data/app/controllers/alchemy/admin/essence_pictures_controller.rb +91 -0
- data/app/controllers/alchemy/admin/essence_videos_controller.rb +12 -0
- data/app/controllers/alchemy/admin/languages_controller.rb +7 -0
- data/app/controllers/alchemy/admin/layoutpages_controller.rb +13 -0
- data/app/controllers/alchemy/admin/pages_controller.rb +253 -0
- data/app/controllers/alchemy/admin/pictures_controller.rb +139 -0
- data/app/controllers/alchemy/admin/resources_controller.rb +132 -0
- data/app/controllers/alchemy/admin/trash_controller.rb +24 -0
- data/app/controllers/alchemy/admin/users_controller.rb +81 -0
- data/app/controllers/alchemy/attachments_controller.rb +30 -0
- data/app/controllers/alchemy/base_controller.rb +137 -0
- data/app/controllers/alchemy/elements_controller.rb +18 -0
- data/app/controllers/alchemy/messages_controller.rb +115 -0
- data/app/controllers/alchemy/pages_controller.rb +169 -0
- data/app/controllers/alchemy/pictures_controller.rb +62 -0
- data/app/controllers/alchemy/user_sessions_controller.rb +80 -0
- data/app/helpers/alchemy/admin/attachments_helper.rb +11 -0
- data/app/helpers/alchemy/admin/base_helper.rb +423 -0
- data/app/helpers/alchemy/admin/contents_helper.rb +75 -0
- data/app/helpers/alchemy/admin/elements_helper.rb +118 -0
- data/app/helpers/alchemy/admin/essences_helper.rb +78 -0
- data/app/helpers/alchemy/admin/pages_helper.rb +46 -0
- data/app/helpers/alchemy/admin/pictures_helper.rb +30 -0
- data/app/helpers/alchemy/base_helper.rb +65 -0
- data/app/helpers/alchemy/elements_helper.rb +173 -0
- data/app/helpers/alchemy/essences_helper.rb +101 -0
- data/app/helpers/alchemy/pages_helper.rb +550 -0
- data/app/mailers/alchemy/messages.rb +17 -0
- data/app/mailers/alchemy/notifications.rb +25 -0
- data/app/models/alchemy.rb +7 -0
- data/app/models/alchemy/attachment.rb +82 -0
- data/app/models/alchemy/cell.rb +61 -0
- data/app/models/alchemy/content.rb +163 -0
- data/app/models/alchemy/element.rb +479 -0
- data/app/models/alchemy/essence_audio.rb +19 -0
- data/app/models/alchemy/essence_date.rb +22 -0
- data/app/models/alchemy/essence_file.rb +19 -0
- data/app/models/alchemy/essence_flash.rb +17 -0
- data/app/models/alchemy/essence_html.rb +21 -0
- data/app/models/alchemy/essence_picture.rb +29 -0
- data/app/models/alchemy/essence_richtext.rb +63 -0
- data/app/models/alchemy/essence_text.rb +40 -0
- data/app/models/alchemy/essence_video.rb +19 -0
- data/app/models/alchemy/folded_page.rb +5 -0
- data/app/models/alchemy/language.rb +90 -0
- data/app/models/alchemy/message.rb +71 -0
- data/app/models/alchemy/page.rb +548 -0
- data/app/models/alchemy/picture.rb +100 -0
- data/app/models/alchemy/user.rb +72 -0
- data/app/models/alchemy/user_session.rb +12 -0
- data/app/sweepers/alchemy/content_sweeper.rb +22 -0
- data/app/sweepers/alchemy/pages_sweeper.rb +49 -0
- data/app/sweepers/alchemy/pictures_sweeper.rb +23 -0
- data/app/views/{admin → alchemy/admin}/attachments/_archive_overlay.html.erb +6 -6
- data/app/views/{admin → alchemy/admin}/attachments/_attachment.html.erb +14 -14
- data/app/views/{admin → alchemy/admin}/attachments/_file_to_assign.html.erb +0 -0
- data/app/views/alchemy/admin/attachments/_files_list.html.erb +25 -0
- data/app/views/{admin → alchemy/admin}/attachments/create.js.erb +0 -0
- data/app/views/{admin → alchemy/admin}/attachments/destroy.js.erb +0 -0
- data/app/views/{admin → alchemy/admin}/attachments/edit.html.erb +2 -2
- data/app/views/alchemy/admin/attachments/index.html.erb +18 -0
- data/app/views/{admin → alchemy/admin}/attachments/new.html.erb +3 -3
- data/app/views/{admin → alchemy/admin}/clipboard/clear.js.erb +1 -1
- data/app/views/alchemy/admin/clipboard/index.html.erb +19 -0
- data/app/views/alchemy/admin/clipboard/insert.js.erb +14 -0
- data/app/views/alchemy/admin/clipboard/remove.js.erb +10 -0
- data/app/views/{admin → alchemy/admin}/contents/_missing.html.erb +4 -4
- data/app/views/{admin → alchemy/admin}/contents/create.js.erb +10 -10
- data/app/views/{admin → alchemy/admin}/contents/destroy.js.erb +0 -0
- data/app/views/{admin → alchemy/admin}/contents/new.html.erb +1 -1
- data/app/views/{admin → alchemy/admin}/contents/order.js.erb +0 -0
- data/app/views/alchemy/admin/dashboard/index.html.erb +96 -0
- data/app/views/{admin → alchemy/admin}/elements/_add_content.html.erb +2 -2
- data/app/views/{admin → alchemy/admin}/elements/_element.html.erb +3 -3
- data/app/views/{admin → alchemy/admin}/elements/_element_foot.html.erb +8 -8
- data/app/views/{admin → alchemy/admin}/elements/_element_head.html.erb +4 -4
- data/app/views/{admin → alchemy/admin}/elements/_elements_select.html.erb +2 -2
- data/app/views/alchemy/admin/elements/_new_element_form.html.erb +30 -0
- data/app/views/{admin → alchemy/admin}/elements/_picture_editor.html.erb +3 -3
- data/app/views/{admin → alchemy/admin}/elements/create.js.erb +2 -2
- data/app/views/{admin → alchemy/admin}/elements/destroy.js.erb +1 -1
- data/app/views/{admin → alchemy/admin}/elements/fold.js.erb +2 -2
- data/app/views/{admin → alchemy/admin}/elements/index.html.erb +1 -10
- data/app/views/{admin → alchemy/admin}/elements/list.js.erb +2 -2
- data/app/views/alchemy/admin/elements/new.html.erb +41 -0
- data/app/views/{admin → alchemy/admin}/elements/order.js.erb +1 -1
- data/app/views/{admin → alchemy/admin}/elements/trash.js.erb +1 -1
- data/app/views/{admin → alchemy/admin}/elements/update.js.erb +1 -1
- data/app/views/{admin → alchemy/admin}/essence_files/assign.js.erb +1 -1
- data/app/views/{admin → alchemy/admin}/essence_files/edit.html.erb +23 -23
- data/app/views/{admin → alchemy/admin}/essence_pictures/assign.js.erb +2 -2
- data/app/views/{admin → alchemy/admin}/essence_pictures/crop.html.erb +15 -6
- data/app/views/{admin → alchemy/admin}/essence_pictures/destroy.js.erb +1 -1
- data/app/views/{admin → alchemy/admin}/essence_pictures/edit.html.erb +11 -11
- data/app/views/{admin → alchemy/admin}/essence_pictures/save_link.js.erb +0 -0
- data/app/views/{admin → alchemy/admin}/essence_pictures/update.js.erb +2 -2
- data/app/views/alchemy/admin/languages/_language.html.erb +36 -0
- data/app/views/{admin → alchemy/admin}/layoutpages/_layoutpage.html.erb +18 -18
- data/app/views/alchemy/admin/layoutpages/index.html.erb +65 -0
- data/app/views/{admin → alchemy/admin}/pages/_contactform_links.html.erb +6 -6
- data/app/views/alchemy/admin/pages/_create_language_form.html.erb +38 -0
- data/app/views/{admin → alchemy/admin}/pages/_external_link.html.erb +9 -9
- data/app/views/{admin → alchemy/admin}/pages/_file_link.html.erb +13 -13
- data/app/views/{admin → alchemy/admin}/pages/_internal_link.html.erb +8 -8
- data/app/views/{admin → alchemy/admin}/pages/_new_page_form.html.erb +6 -6
- data/app/views/{admin → alchemy/admin}/pages/_page.html.erb +25 -25
- data/app/views/{admin → alchemy/admin}/pages/_page_for_links.html.erb +6 -6
- data/app/views/{admin → alchemy/admin}/pages/_page_infos.html.erb +3 -3
- data/app/views/{admin → alchemy/admin}/pages/_page_status.html.erb +4 -4
- data/app/views/{admin → alchemy/admin}/pages/_sitemap.html.erb +21 -21
- data/app/views/alchemy/admin/pages/configure.html.erb +71 -0
- data/app/views/{admin → alchemy/admin}/pages/configure_external.html.erb +9 -9
- data/app/views/{admin → alchemy/admin}/pages/destroy.js.erb +2 -2
- data/app/views/alchemy/admin/pages/edit.html.erb +181 -0
- data/app/views/alchemy/admin/pages/flush.js.erb +2 -0
- data/app/views/{admin → alchemy/admin}/pages/fold.js.erb +0 -0
- data/app/views/alchemy/admin/pages/index.html.erb +104 -0
- data/app/views/{admin → alchemy/admin}/pages/link.html.erb +4 -4
- data/app/views/alchemy/admin/pages/locked.html.erb +3 -0
- data/app/views/{admin → alchemy/admin}/pages/new.html.erb +8 -8
- data/app/views/{admin → alchemy/admin}/pages/show.html.erb +0 -0
- data/app/views/{admin → alchemy/admin}/pages/sort.js.erb +0 -0
- data/app/views/{admin → alchemy/admin}/pages/unlock.js.erb +1 -1
- data/app/views/{admin → alchemy/admin}/pages/update.js.erb +5 -5
- data/app/views/{admin → alchemy/admin}/partials/_flash.html.erb +0 -0
- data/app/views/{admin → alchemy/admin}/partials/_flash_notices.html.erb +1 -1
- data/app/views/alchemy/admin/partials/_main_navigation_entry.html.erb +14 -0
- data/app/views/alchemy/admin/partials/_pagination_links.html.erb +5 -0
- data/app/views/{admin → alchemy/admin}/partials/_remote_pagination_links.html.erb +2 -2
- data/app/views/{admin → alchemy/admin}/partials/_remote_search_form.html.erb +2 -2
- data/app/views/{admin → alchemy/admin}/partials/_search_form.html.erb +6 -7
- data/app/views/alchemy/admin/partials/_sub_navigation_tab.html.erb +8 -0
- data/app/views/alchemy/admin/partials/_upload_form.html.erb +129 -0
- data/app/views/{admin → alchemy/admin}/pictures/_archive_overlay.html.erb +3 -3
- data/app/views/{admin → alchemy/admin}/pictures/_filter_and_size_bar.html.erb +15 -15
- data/app/views/{admin → alchemy/admin}/pictures/_picture.html.erb +7 -7
- data/app/views/{admin → alchemy/admin}/pictures/_picture_to_assign.html.erb +2 -2
- data/app/views/alchemy/admin/pictures/_pictures_list.html.erb +14 -0
- data/app/views/{admin → alchemy/admin}/pictures/archive_overlay.js.erb +0 -0
- data/app/views/{admin → alchemy/admin}/pictures/create.js.erb +3 -3
- data/app/views/{admin → alchemy/admin}/pictures/flush.js.erb +0 -0
- data/app/views/alchemy/admin/pictures/index.html.erb +83 -0
- data/app/views/{admin → alchemy/admin}/pictures/new.html.erb +3 -3
- data/app/views/alchemy/admin/pictures/show_in_window.html.erb +1 -0
- data/app/views/{admin → alchemy/admin}/pictures/update.js.erb +0 -0
- data/app/views/alchemy/admin/resources/_form.html.erb +20 -0
- data/app/views/alchemy/admin/resources/_resource.html.erb +35 -0
- data/app/views/alchemy/admin/resources/_table.html.erb +23 -0
- data/app/views/alchemy/admin/resources/destroy.js.erb +1 -0
- data/app/views/{admin/languages → alchemy/admin/resources}/edit.html.erb +0 -0
- data/app/views/alchemy/admin/resources/index.html.erb +19 -0
- data/app/views/{admin/languages → alchemy/admin/resources}/new.html.erb +0 -0
- data/app/views/{admin → alchemy/admin}/trash/clear.js.erb +1 -1
- data/app/views/{admin → alchemy/admin}/trash/index.html.erb +4 -4
- data/app/views/alchemy/admin/users/_table.html.erb +54 -0
- data/app/views/{admin → alchemy/admin}/users/_user.html.erb +14 -12
- data/app/views/{admin → alchemy/admin}/users/edit.html.erb +0 -0
- data/app/views/alchemy/admin/users/index.html.erb +41 -0
- data/app/views/{admin → alchemy/admin}/users/new.html.erb +1 -1
- data/app/views/{attachments → alchemy/attachments}/show.html.erb +0 -0
- data/app/views/alchemy/base/500.html.erb +5 -0
- data/app/views/alchemy/base/error_notice.js.erb +2 -0
- data/app/views/alchemy/base/permission_denied.js.erb +2 -0
- data/app/views/alchemy/{redirect.js.erb → base/redirect.js.erb} +0 -0
- data/app/views/alchemy/{remote_errors.js.erb → base/remote_errors.js.erb} +0 -0
- data/app/views/alchemy/{update.js.erb → base/update.js.erb} +0 -0
- data/app/views/{elements → alchemy/elements}/_article_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_article_view.html.erb +1 -1
- data/app/views/{elements → alchemy/elements}/_bild_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_bild_text_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_bild_text_view.html.erb +1 -1
- data/app/views/{elements → alchemy/elements}/_bild_view.html.erb +1 -1
- data/app/views/{elements → alchemy/elements}/_claim_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_claim_view.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_contactform_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_contactform_view.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_editor_not_found.html.erb +1 -1
- data/app/views/{elements → alchemy/elements}/_footnote_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_footnote_view.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_header_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_header_view.html.erb +1 -1
- data/app/views/{elements → alchemy/elements}/_headline_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_headline_view.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_image_mosaic_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_image_mosaic_view.html.erb +1 -1
- data/app/views/{elements → alchemy/elements}/_intro_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_intro_image_text_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_intro_image_text_view.html.erb +1 -1
- data/app/views/{elements → alchemy/elements}/_intro_view.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_news_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_news_view.html.erb +0 -0
- data/app/views/alchemy/elements/_searchresult_editor.html.erb +1 -0
- data/app/views/alchemy/elements/_searchresult_view.html.erb +4 -0
- data/app/views/alchemy/elements/_sitemap_editor.html.erb +3 -0
- data/app/views/{elements → alchemy/elements}/_sitemap_view.html.erb +2 -2
- data/app/views/{elements → alchemy/elements}/_sitename_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_sitename_view.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_subheadline_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_subheadline_view.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_text_editor.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_text_view.html.erb +0 -0
- data/app/views/{elements → alchemy/elements}/_view_not_found.html.erb +0 -0
- data/app/views/alchemy/elements/show.html.erb +6 -0
- data/app/views/{elements → alchemy/elements}/show.js.erb +1 -1
- data/app/views/alchemy/essences/_essence_audio_editor.html.erb +1 -0
- data/app/views/{essences → alchemy/essences}/_essence_audio_view.html.erb +0 -0
- data/app/views/{essences → alchemy/essences}/_essence_date_editor.html.erb +0 -0
- data/app/views/{essences → alchemy/essences}/_essence_date_view.html.erb +0 -0
- data/app/views/{essences → alchemy/essences}/_essence_file_editor.html.erb +9 -9
- data/app/views/{essences → alchemy/essences}/_essence_file_view.html.erb +1 -1
- data/app/views/alchemy/essences/_essence_flash_editor.html.erb +1 -0
- data/app/views/{essences → alchemy/essences}/_essence_flash_view.html.erb +0 -0
- data/app/views/{essences → alchemy/essences}/_essence_html_editor.html.erb +0 -0
- data/app/views/{essences → alchemy/essences}/_essence_html_view.html.erb +0 -0
- data/app/views/{essences → alchemy/essences}/_essence_picture_editor.html.erb +8 -8
- data/app/views/{essences → alchemy/essences}/_essence_picture_tools.html.erb +11 -11
- data/app/views/{essences → alchemy/essences}/_essence_picture_view.html.erb +2 -4
- data/app/views/alchemy/essences/_essence_richtext_editor.html.erb +11 -0
- data/app/views/{essences → alchemy/essences}/_essence_richtext_view.html.erb +0 -0
- data/app/views/{essences → alchemy/essences}/_essence_text_editor.html.erb +6 -6
- data/app/views/{essences → alchemy/essences}/_essence_text_view.html.erb +0 -0
- data/app/views/alchemy/essences/_essence_video_editor.html.erb +1 -0
- data/app/views/{essences → alchemy/essences}/_essence_video_view.html.erb +1 -1
- data/app/views/{messages → alchemy/messages}/contact_form_mail.html.erb +0 -0
- data/app/views/{messages → alchemy/messages}/contact_form_mail.text.erb +0 -0
- data/app/views/{messages → alchemy/messages}/new.html.erb +0 -0
- data/app/views/{navigation → alchemy/navigation}/_image_link.html.erb +0 -0
- data/app/views/{navigation → alchemy/navigation}/_link.html.erb +1 -1
- data/app/views/{navigation → alchemy/navigation}/_renderer.html.erb +0 -0
- data/app/views/alchemy/notifications/admin_user_created.text.erb +13 -0
- data/app/views/alchemy/notifications/registered_user_created.text.erb +10 -0
- data/app/views/{page_layouts → alchemy/page_layouts}/_contact.html.erb +0 -0
- data/app/views/{page_layouts → alchemy/page_layouts}/_external.html.erb +0 -0
- data/app/views/{page_layouts → alchemy/page_layouts}/_intro.html.erb +0 -0
- data/app/views/{page_layouts → alchemy/page_layouts}/_layout_footer.html.erb +0 -0
- data/app/views/{page_layouts → alchemy/page_layouts}/_layout_header.html.erb +0 -0
- data/app/views/{page_layouts → alchemy/page_layouts}/_news.html.erb +0 -0
- data/app/views/{_newsletter_layout.html.erb → alchemy/page_layouts/_newsletter_layout.html.erb} +0 -0
- data/app/views/{page_layouts → alchemy/page_layouts}/_search.html.erb +0 -0
- data/app/views/{page_layouts → alchemy/page_layouts}/_standard.html.erb +0 -0
- data/app/views/{pages → alchemy/pages}/show.html.erb +0 -0
- data/app/views/{pages → alchemy/pages}/show.rss.builder +0 -0
- data/app/views/{pages → alchemy/pages}/sitemap.xml.erb +0 -0
- data/app/views/{pictures → alchemy/pictures}/show.gif.flexi +0 -0
- data/app/views/{pictures → alchemy/pictures}/show.jpg.flexi +0 -0
- data/app/views/{pictures → alchemy/pictures}/show.png.flexi +0 -0
- data/app/views/{pictures → alchemy/pictures}/thumbnail.png.flexi +0 -0
- data/app/views/{pictures → alchemy/pictures}/zoom.png.flexi +0 -0
- data/app/views/alchemy/search/_result.html.erb +9 -0
- data/app/views/alchemy/user_sessions/leave.html.erb +11 -0
- data/app/views/alchemy/user_sessions/login.html.erb +47 -0
- data/app/views/alchemy/user_sessions/logout.html.erb +3 -0
- data/app/views/alchemy/user_sessions/signup.html.erb +14 -0
- data/app/views/layouts/{alchemy.html.erb → alchemy/admin.html.erb} +23 -17
- data/app/views/layouts/alchemy/login.html.erb +37 -0
- data/app/views/layouts/alchemy/pages.html.erb +29 -0
- data/app/views/layouts/{sitemap.xml.erb → alchemy/sitemap.xml.erb} +0 -0
- data/config/alchemy/config.yml +2 -80
- data/config/alchemy/modules.yml +70 -0
- data/config/alchemy/page_layouts.yml +2 -0
- data/config/authorization_rules.rb +32 -39
- data/config/locales/alchemy.de.yml +789 -0
- data/config/locales/alchemy.en.yml +587 -0
- data/config/routes.rb +144 -142
- data/db/migrate/20111116125112_namespace_models.rb +23 -0
- data/lib/alchemy/auth_engine.rb +7 -0
- data/lib/alchemy/capistrano.rb +4 -1
- data/lib/alchemy/engine.rb +39 -25
- data/lib/alchemy/essence.rb +5 -1
- data/lib/alchemy/i18n.rb +47 -0
- data/lib/alchemy/modules.rb +38 -0
- data/lib/alchemy/page_layout.rb +98 -56
- data/lib/alchemy/seeder.rb +60 -110
- data/lib/alchemy/tinymce.rb +2 -2
- data/lib/alchemy/version.rb +3 -3
- data/lib/alchemy_cms.rb +23 -23
- data/lib/rails/generators/alchemy/elements/elements_generator.rb +1 -1
- data/lib/rails/generators/alchemy/elements/templates/editor.html.erb +1 -1
- data/lib/rails/generators/alchemy/elements/templates/view.html.erb +2 -2
- data/lib/rails/generators/alchemy/page_layouts/page_layouts_generator.rb +1 -1
- data/lib/rails/generators/alchemy/plugin/plugin_generator.rb +0 -1
- data/lib/rails/generators/alchemy/scaffold/files/pages.html.erb +1 -1
- data/lib/rails/generators/alchemy/scaffold/scaffold_generator.rb +34 -34
- data/lib/tasks/install.rake +2 -9
- data/lib/tasks/upgrade.rake +69 -208
- data/spec/controllers/admin/clipboard_controller_spec.rb +33 -35
- data/spec/controllers/admin/contents_controller_spec.rb +5 -5
- data/spec/controllers/admin/elements_controller_spec.rb +22 -0
- data/spec/controllers/admin/trash_controller_spec.rb +5 -5
- data/spec/controllers/base_controller_spec.rb +67 -0
- data/spec/controllers/pages_controller_spec.rb +6 -6
- data/spec/dummy/config/application.rb +1 -8
- data/spec/dummy/config/routes.rb +2 -57
- data/spec/dummy/db/schema.rb +27 -27
- data/spec/factories.rb +8 -8
- data/spec/helpers/{alchemy_helper_spec.rb → admin/base_helper_spec.rb} +8 -1
- data/spec/helpers/admin/contents_helper_spec.rb +25 -0
- data/spec/helpers/admin/elements_helper_spec.rb +31 -3
- data/spec/helpers/admin/essences_helper_spec.rb +27 -0
- data/spec/helpers/elements_helper_spec.rb +99 -21
- data/spec/helpers/essences_helper_spec.rb +1 -18
- data/spec/helpers/pages_helper_spec.rb +212 -26
- data/spec/integration/admin/pages_controller_spec.rb +56 -0
- data/spec/integration/navigation_spec.rb +1 -1
- data/spec/integration/pages_controller_spec.rb +85 -68
- data/spec/integration/security_spec.rb +49 -22
- data/spec/models/content_spec.rb +3 -3
- data/spec/models/element_spec.rb +19 -11
- data/spec/models/essence_richtext_spec.rb +2 -2
- data/spec/models/language_spec.rb +36 -7
- data/spec/models/page_spec.rb +57 -13
- data/spec/models/user_spec.rb +1 -1
- data/spec/page_layout_spec.rb +13 -3
- data/spec/routing_spec.rb +12 -8
- data/spec/spec_helper.rb +8 -9
- data/spec/support/controller_hacks.rb +37 -0
- data/vendor/assets/javascripts/swfupload/SWFObject License.txt +4 -0
- data/vendor/assets/javascripts/swfupload/swfupload.cookies.js +53 -0
- data/vendor/assets/javascripts/swfupload/swfupload.js +1 -1
- data/vendor/assets/javascripts/swfupload/{queue.js → swfupload.queue.js} +97 -97
- data/vendor/assets/javascripts/swfupload/swfupload.speed.js +342 -0
- data/vendor/assets/javascripts/swfupload/swfupload.swfobject.js +111 -0
- data/vendor/assets/javascripts/tiny_mce/license.txt +504 -504
- data/vendor/assets/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -1
- data/vendor/assets/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +110 -110
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
- data/vendor/assets/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -387
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -36
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -51
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/pastetext.htm +26 -26
- data/vendor/assets/javascripts/tiny_mce/plugins/paste/pasteword.htm +21 -21
- data/vendor/assets/javascripts/tiny_mce/plugins/table/cell.htm +180 -180
- data/vendor/assets/javascripts/tiny_mce/plugins/table/css/cell.css +16 -16
- data/vendor/assets/javascripts/tiny_mce/plugins/table/css/row.css +25 -25
- data/vendor/assets/javascripts/tiny_mce/plugins/table/css/table.css +13 -13
- data/vendor/assets/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -1
- data/vendor/assets/javascripts/tiny_mce/plugins/table/js/cell.js +319 -319
- data/vendor/assets/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -27
- data/vendor/assets/javascripts/tiny_mce/plugins/table/js/row.js +237 -237
- data/vendor/assets/javascripts/tiny_mce/plugins/table/js/table.js +484 -450
- data/vendor/assets/javascripts/tiny_mce/plugins/table/merge_cells.htm +32 -32
- data/vendor/assets/javascripts/tiny_mce/plugins/table/row.htm +158 -158
- data/vendor/assets/javascripts/tiny_mce/plugins/table/table.htm +188 -188
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/about.htm +52 -52
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/anchor.htm +26 -26
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/charmap.htm +55 -51
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/color_picker.htm +74 -74
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -1
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/image.htm +80 -80
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/about.js +73 -73
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/anchor.js +43 -43
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/charmap.js +363 -355
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/color_picker.js +329 -329
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/image.js +251 -251
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/link.js +153 -153
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/js/source_editor.js +56 -56
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +1 -1
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/link.htm +57 -57
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/shortcuts.htm +47 -47
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/content.css +50 -50
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +117 -117
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +214 -214
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/highcontrast/content.css +24 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +105 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/highcontrast/ui.css +102 -0
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +48 -48
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +117 -117
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +217 -217
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +7 -7
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -5
- data/vendor/assets/javascripts/tiny_mce/themes/advanced/source_editor.htm +25 -25
- data/vendor/assets/javascripts/tiny_mce/tiny_mce.js +1 -1
- data/vendor/assets/javascripts/tiny_mce/utils/editable_selects.js +70 -70
- data/vendor/assets/javascripts/tiny_mce/utils/form_utils.js +210 -210
- data/vendor/assets/javascripts/tiny_mce/utils/mctabs.js +161 -161
- data/vendor/assets/javascripts/tiny_mce/utils/validate.js +252 -252
- metadata +432 -465
- data/app/controllers/admin/attachments_controller.rb +0 -136
- data/app/controllers/admin/clipboard_controller.rb +0 -43
- data/app/controllers/admin/contents_controller.rb +0 -60
- data/app/controllers/admin/elements_controller.rb +0 -134
- data/app/controllers/admin/essence_audios_controller.rb +0 -10
- data/app/controllers/admin/essence_files_controller.rb +0 -25
- data/app/controllers/admin/essence_flashes_controller.rb +0 -10
- data/app/controllers/admin/essence_pictures_controller.rb +0 -84
- data/app/controllers/admin/essence_videos_controller.rb +0 -10
- data/app/controllers/admin/languages_controller.rb +0 -64
- data/app/controllers/admin/layoutpages_controller.rb +0 -12
- data/app/controllers/admin/pages_controller.rb +0 -251
- data/app/controllers/admin/pictures_controller.rb +0 -143
- data/app/controllers/admin/trash_controller.rb +0 -28
- data/app/controllers/admin/users_controller.rb +0 -73
- data/app/controllers/admin_controller.rb +0 -76
- data/app/controllers/alchemy_controller.rb +0 -245
- data/app/controllers/attachments_controller.rb +0 -28
- data/app/controllers/elements_controller.rb +0 -16
- data/app/controllers/messages_controller.rb +0 -113
- data/app/controllers/pages_controller.rb +0 -150
- data/app/controllers/pictures_controller.rb +0 -63
- data/app/helpers/admin/attachments_helper.rb +0 -7
- data/app/helpers/admin/elements_helper.rb +0 -112
- data/app/helpers/admin/pages_helper.rb +0 -38
- data/app/helpers/admin/pictures_helper.rb +0 -26
- data/app/helpers/alchemy_helper.rb +0 -379
- data/app/helpers/contents_helper.rb +0 -69
- data/app/helpers/elements_helper.rb +0 -170
- data/app/helpers/essences_helper.rb +0 -167
- data/app/helpers/layout_helper.rb +0 -37
- data/app/helpers/pages_helper.rb +0 -503
- data/app/mailers/messages.rb +0 -15
- data/app/mailers/notifications.rb +0 -23
- data/app/models/attachment.rb +0 -80
- data/app/models/cell.rb +0 -59
- data/app/models/content.rb +0 -145
- data/app/models/element.rb +0 -476
- data/app/models/essence_audio.rb +0 -17
- data/app/models/essence_date.rb +0 -20
- data/app/models/essence_file.rb +0 -17
- data/app/models/essence_flash.rb +0 -15
- data/app/models/essence_html.rb +0 -19
- data/app/models/essence_picture.rb +0 -27
- data/app/models/essence_richtext.rb +0 -61
- data/app/models/essence_text.rb +0 -38
- data/app/models/essence_video.rb +0 -17
- data/app/models/folded_page.rb +0 -3
- data/app/models/language.rb +0 -83
- data/app/models/message.rb +0 -69
- data/app/models/page.rb +0 -545
- data/app/models/picture.rb +0 -98
- data/app/models/user.rb +0 -70
- data/app/models/user_session.rb +0 -10
- data/app/sweepers/content_sweeper.rb +0 -20
- data/app/sweepers/pages_sweeper.rb +0 -47
- data/app/sweepers/pictures_sweeper.rb +0 -21
- data/app/views/_contact.html.erb +0 -3
- data/app/views/_intro.html.erb +0 -3
- data/app/views/_news.html.erb +0 -3
- data/app/views/_search.html.erb +0 -3
- data/app/views/_standard.html.erb +0 -1
- data/app/views/admin/attachments/_files_list.html.erb +0 -24
- data/app/views/admin/attachments/index.html.erb +0 -30
- data/app/views/admin/clipboard/index.html.erb +0 -19
- data/app/views/admin/clipboard/insert.js.erb +0 -14
- data/app/views/admin/clipboard/remove.js.erb +0 -10
- data/app/views/admin/elements/_new_element_form.html.erb +0 -25
- data/app/views/admin/elements/new.html.erb +0 -33
- data/app/views/admin/index.html.erb +0 -102
- data/app/views/admin/infos.html.erb +0 -5
- data/app/views/admin/languages/_form.html.erb +0 -34
- data/app/views/admin/languages/_language.html.erb +0 -35
- data/app/views/admin/languages/destroy.js.erb +0 -1
- data/app/views/admin/languages/index.html.erb +0 -41
- data/app/views/admin/layoutpages/index.html.erb +0 -75
- data/app/views/admin/leave.html.erb +0 -11
- data/app/views/admin/login.html.erb +0 -46
- data/app/views/admin/logout.html.erb +0 -5
- data/app/views/admin/pages/_create_language_form.html.erb +0 -43
- data/app/views/admin/pages/configure.html.erb +0 -71
- data/app/views/admin/pages/edit.html.erb +0 -185
- data/app/views/admin/pages/flush.js.erb +0 -2
- data/app/views/admin/pages/index.html.erb +0 -108
- data/app/views/admin/pages/locked.html.erb +0 -3
- data/app/views/admin/partials/_mainnavigation_entry.html.erb +0 -27
- data/app/views/admin/partials/_pagination_links.html.erb +0 -5
- data/app/views/admin/partials/_per_page_links.html.erb +0 -17
- data/app/views/admin/partials/_sub_navigation.html.erb +0 -14
- data/app/views/admin/partials/_upload_form.html.erb +0 -119
- data/app/views/admin/pictures/_pictures_list.html.erb +0 -12
- data/app/views/admin/pictures/index.html.erb +0 -89
- data/app/views/admin/pictures/show_in_window.html.erb +0 -1
- data/app/views/admin/signup.html.erb +0 -16
- data/app/views/admin/users/_table.html.erb +0 -54
- data/app/views/admin/users/index.html.erb +0 -41
- data/app/views/alchemy/error_notice.js.erb +0 -1
- data/app/views/alchemy/permission_denied.js.erb +0 -2
- data/app/views/elements/_searchresult_editor.html.erb +0 -1
- data/app/views/elements/_searchresult_view.html.erb +0 -49
- data/app/views/elements/_sitemap_editor.html.erb +0 -3
- data/app/views/elements/show.html.erb +0 -6
- data/app/views/essences/_essence_audio_editor.html.erb +0 -1
- data/app/views/essences/_essence_flash_editor.html.erb +0 -1
- data/app/views/essences/_essence_richtext_editor.html.erb +0 -9
- data/app/views/essences/_essence_video_editor.html.erb +0 -1
- data/app/views/layouts/login.html.erb +0 -59
- data/app/views/layouts/pages.html.erb +0 -29
- data/app/views/notifications/admin_user_created.text.erb +0 -13
- data/app/views/notifications/registered_user_created.text.erb +0 -10
- data/app/views/page_layouts/_newsletter_layout.html.erb +0 -1
- data/config/initializers/authorization.rb +0 -4
- data/config/initializers/fast_gettext.rb +0 -3
- data/config/locales/de.yml +0 -377
- data/config/locales/en.yml +0 -371
- data/lib/alchemy/controller.rb +0 -79
- data/lib/rails/generators/alchemy/plugin/templates/gettext.rb +0 -2
- data/lib/tasks/gettext.rake +0 -120
- data/lib/translation_extras/alchemy_core_modules.rb +0 -11
- data/locale/alchemy.pot +0 -1749
- data/locale/de/alchemy.po +0 -1795
- data/locale/en/alchemy.po +0 -1745
- data/locale/missing_translations.rb +0 -4
- data/locale/model_attributes.rb +0 -56
- data/spec/helpers/contents_helper_spec.rb +0 -27
- data/vendor/assets/javascripts/jquery-1.6.2.min.js +0 -18
- data/vendor/assets/javascripts/jquery-ui-custom-1.8.16.min.js +0 -550
- data/vendor/assets/javascripts/swfupload/fileprogress.js +0 -203
- data/vendor/assets/javascripts/swfupload/handlers.js +0 -171
- data/vendor/assets/javascripts/tiny_mce/jquery.tinymce.js +0 -1
@@ -0,0 +1,101 @@
|
|
1
|
+
module Alchemy
|
2
|
+
module EssencesHelper
|
3
|
+
|
4
|
+
# Renders the Content view partial from the passed Element for passed content name.
|
5
|
+
# For options see -> render_essence
|
6
|
+
def render_essence_view_by_name(element, name, options = {}, html_options = {})
|
7
|
+
if element.blank?
|
8
|
+
warning('Element is nil')
|
9
|
+
return ""
|
10
|
+
end
|
11
|
+
content = element.content_by_name(name)
|
12
|
+
render_essence(content, :view, {:for_view => options}, html_options)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Renders the Content partial that is given (:editor, or :view).
|
16
|
+
# You can pass several options that are used by the different contents.
|
17
|
+
#
|
18
|
+
# For the view partial:
|
19
|
+
# :image_size => "111x93" Used by EssencePicture to render the image via RMagick to that size.
|
20
|
+
# :css_class => "" This css class gets attached to the content view.
|
21
|
+
# :date_format => "Am %d. %m. %Y, um %H:%Mh" Espacially fot the EssenceDate. See Date.strftime for date formatting.
|
22
|
+
# :caption => true Pass true to enable that the EssencePicture.caption value gets rendered.
|
23
|
+
# :blank_value => "" Pass a String that gets rendered if the content.essence is blank.
|
24
|
+
#
|
25
|
+
# For the editor partial:
|
26
|
+
# :css_class => "" This css class gets attached to the content editor.
|
27
|
+
# :last_image_deletable => false Pass true to enable that the last image of an imagecollection (e.g. image gallery) is deletable.
|
28
|
+
def render_essence(content, part = :view, options = {}, html_options = {})
|
29
|
+
if content.nil?
|
30
|
+
return part == :view ? "" : warning('Content is nil', t("content_not_found"))
|
31
|
+
elsif content.essence.nil?
|
32
|
+
return part == :view ? "" : warning('Essence is nil', t("content_essence_not_found"))
|
33
|
+
end
|
34
|
+
defaults = {
|
35
|
+
:for_editor => {
|
36
|
+
:as => 'text_field',
|
37
|
+
:css_class => 'long',
|
38
|
+
:render_format => "html"
|
39
|
+
},
|
40
|
+
:for_view => {
|
41
|
+
:image_size => "120x90",
|
42
|
+
:css_class => "",
|
43
|
+
:date_format => "%d. %m. %Y, %H:%Mh",
|
44
|
+
:caption => true,
|
45
|
+
:blank_value => "",
|
46
|
+
:render_format => "html"
|
47
|
+
}
|
48
|
+
}
|
49
|
+
if options["for_#{part}".to_sym].nil?
|
50
|
+
options_for_partial = defaults["for_#{part}".to_sym]
|
51
|
+
else
|
52
|
+
options_for_partial = defaults.fetch("for_#{part}".to_sym).merge(options["for_#{part}".to_sym])
|
53
|
+
end
|
54
|
+
options = options.merge(defaults)
|
55
|
+
render(
|
56
|
+
:partial => "alchemy/essences/#{content.essence_partial_name}_#{part.to_s}.#{options_for_partial[:render_format]}.erb",
|
57
|
+
:locals => {
|
58
|
+
:content => content,
|
59
|
+
:options => options_for_partial,
|
60
|
+
:html_options => html_options
|
61
|
+
}
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Renders the Content view partial from the given Content.
|
66
|
+
# For options see -> render_essence
|
67
|
+
def render_essence_view(content, options = {}, html_options = {})
|
68
|
+
render_essence(content, :view, {:for_view => options}, html_options)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Renders the Content view partial from the given Element for the essence_type (e.g. EssenceRichtext).
|
72
|
+
# For multiple contents of same kind inside one element just pass a position so that will be rendered.
|
73
|
+
# Otherwise the first content found for this type will be rendered.
|
74
|
+
# For options see -> render_essence
|
75
|
+
def render_essence_view_by_type(element, type, position = 1, options = {}, html_options = {})
|
76
|
+
if element.blank?
|
77
|
+
warning('Element is nil')
|
78
|
+
return ""
|
79
|
+
end
|
80
|
+
type = normalized_essence_type(type)
|
81
|
+
if position == 1
|
82
|
+
content = element.content_by_type(type)
|
83
|
+
else
|
84
|
+
content = element.contents.find_by_essence_type_and_position(type, position)
|
85
|
+
end
|
86
|
+
render_essence(content, :view, :for_view => options)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Renders the Content view partial from the given Element by position (e.g. 1).
|
90
|
+
# For options see -> render_essence
|
91
|
+
def render_essence_view_by_position(element, position, options = {}, html_options = {})
|
92
|
+
if element.blank?
|
93
|
+
warning('Element is nil')
|
94
|
+
return ""
|
95
|
+
end
|
96
|
+
content = element.contents.find_by_position(position)
|
97
|
+
render_essence(content, :view, {:for_view => options}, html_options)
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,550 @@
|
|
1
|
+
module Alchemy
|
2
|
+
module PagesHelper
|
3
|
+
|
4
|
+
include Alchemy::ElementsHelper
|
5
|
+
|
6
|
+
def render_classes(classes=[])
|
7
|
+
s = classes.uniq.delete_if { |x| x.blank? }.join(" ")
|
8
|
+
s.blank? ? "" : "class='#{s}'"
|
9
|
+
end
|
10
|
+
|
11
|
+
def picture_essence_caption(content)
|
12
|
+
return "" if content.nil?
|
13
|
+
return "" if content.essence.nil?
|
14
|
+
content.essence.caption
|
15
|
+
end
|
16
|
+
|
17
|
+
def alchemy_form_select(name, select_options, options={})
|
18
|
+
select "mail_data", name, select_options, :selected => (session[:mail_data][name.to_sym] rescue "")
|
19
|
+
end
|
20
|
+
|
21
|
+
def alchemy_form_input_field(name, options = {})
|
22
|
+
if options[:value].blank? && session[:mail_data].blank?
|
23
|
+
value = nil
|
24
|
+
elsif options[:value].blank? && !session[:mail_data].blank?
|
25
|
+
value = session[:mail_data][name.to_sym]
|
26
|
+
else
|
27
|
+
value = options[:value]
|
28
|
+
end
|
29
|
+
text_field("mail_data", name, {:value => value}.merge(options))
|
30
|
+
end
|
31
|
+
|
32
|
+
def alchemy_form_text_area(name, options={})
|
33
|
+
text_area "mail_data", name, :class => options[:class], :value => (session[:mail_data][name.to_sym] rescue "")
|
34
|
+
end
|
35
|
+
|
36
|
+
def alchemy_form_check_box(name, options={})
|
37
|
+
box = hidden_field_tag "mail_data[#{name}]", 0, :id => nil
|
38
|
+
box += check_box_tag("mail_data[#{name}]", 1, (session[:mail_data] && session[:mail_data][name.to_sym] == "1"))
|
39
|
+
box
|
40
|
+
end
|
41
|
+
|
42
|
+
def alchemy_form_label(element, name, options={})
|
43
|
+
label_tag "mail_data_#{name}", render_essence_view_by_name(element, name), options
|
44
|
+
end
|
45
|
+
|
46
|
+
def alchemy_form_reset_button(name, options={})
|
47
|
+
button_to_function(
|
48
|
+
name,
|
49
|
+
remote_function(
|
50
|
+
:url => {
|
51
|
+
:controller => "contact_form",
|
52
|
+
:action => "clear_session"
|
53
|
+
},
|
54
|
+
:before => %(
|
55
|
+
this.form.reset();
|
56
|
+
this.form.descendants().each(
|
57
|
+
function(d){
|
58
|
+
if ((d.type!='button') && (d.type!='submit') && (d.type!='hidden') && !d.disabled) {
|
59
|
+
d.value = '';
|
60
|
+
if (d.type == 'checkbox') {
|
61
|
+
d.checked = false;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
)
|
66
|
+
)
|
67
|
+
),
|
68
|
+
options
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
# helper for language switching
|
73
|
+
# returns a string with links or nil
|
74
|
+
def language_switcher(options={})
|
75
|
+
default_options = {
|
76
|
+
:linkname => :name,
|
77
|
+
:spacer => "",
|
78
|
+
:link_to_public_child => configuration(:redirect_to_public_child),
|
79
|
+
:link_to_page_with_layout => nil,
|
80
|
+
:show_title => true,
|
81
|
+
:reverse => false,
|
82
|
+
:as_select_box => false
|
83
|
+
}
|
84
|
+
options = default_options.merge(options)
|
85
|
+
if multi_language?
|
86
|
+
language_links = []
|
87
|
+
pages = (options[:link_to_public_child] == true) ? Page.language_roots : Page.public_language_roots
|
88
|
+
return nil if (pages.blank? || pages.length == 1)
|
89
|
+
pages.each_with_index do |page, i|
|
90
|
+
if(options[:link_to_page_with_layout] != nil)
|
91
|
+
page_found_by_layout = Page.where(:page_layout => options[:link_to_page_with_layout].to_s, :language_id => page.language_id)
|
92
|
+
end
|
93
|
+
page = page_found_by_layout || page
|
94
|
+
page = (options[:link_to_public_child] ? (page.first_public_child.blank? ? nil : page.first_public_child) : nil) if !page.public?
|
95
|
+
if !page.blank?
|
96
|
+
active = session[:language_id] == page.language.id
|
97
|
+
linkname = page.language.label(options[:linkname])
|
98
|
+
if options[:as_select_box]
|
99
|
+
language_links << [linkname, show_page_url(:urlname => page.urlname, :lang => page.language.code)]
|
100
|
+
else
|
101
|
+
language_links << link_to(
|
102
|
+
"#{content_tag(:span, '', :class => "flag")}#{ content_tag(:span, linkname)}".html_safe,
|
103
|
+
alchemy.show_page_path(:urlname => page.urlname, :lang => page.language.code),
|
104
|
+
:class => "#{(active ? 'active ' : nil)}#{page.language.code} #{(i == 0) ? 'first' : (i==pages.length-1) ? 'last' : nil}",
|
105
|
+
:title => options[:show_title] ? Alchemy::I18n.t("alchemy.language_links.#{page.language.code}.title", :default => page.language.name) : nil
|
106
|
+
)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
# when last iteration and we have just one language_link,
|
110
|
+
# we dont need to render it.
|
111
|
+
if (i==pages.length-1) && language_links.length == 1
|
112
|
+
return nil
|
113
|
+
end
|
114
|
+
end
|
115
|
+
return nil if language_links.empty? || language_links.length == 1
|
116
|
+
language_links.reverse! if options[:reverse]
|
117
|
+
if options[:as_select_box]
|
118
|
+
return select_tag(
|
119
|
+
'language',
|
120
|
+
options_for_select(
|
121
|
+
language_links,
|
122
|
+
show_page_url(:urlname => @page.urlname, :lang => @page.language.code)
|
123
|
+
),
|
124
|
+
:onchange => "window.location=this.value"
|
125
|
+
)
|
126
|
+
else
|
127
|
+
raw(language_links.join(options[:spacer]))
|
128
|
+
end
|
129
|
+
else
|
130
|
+
nil
|
131
|
+
end
|
132
|
+
end
|
133
|
+
alias_method :language_switches, :language_switcher
|
134
|
+
|
135
|
+
# Renders the layout from @page.page_layout. File resists in /app/views/page_layouts/_LAYOUT-NAME.html.erb
|
136
|
+
def render_page_layout(options={})
|
137
|
+
default_options = {
|
138
|
+
:render_format => "html"
|
139
|
+
}
|
140
|
+
options = default_options.merge(options)
|
141
|
+
render :partial => "alchemy/page_layouts/#{@page.page_layout.downcase}.#{options[:render_format]}.erb"
|
142
|
+
rescue ActionView::MissingTemplate
|
143
|
+
warning("PageLayout: '#{@page.page_layout}' not found. Rendering standard page_layout.")
|
144
|
+
render :partial => "alchemy/page_layouts/standard"
|
145
|
+
end
|
146
|
+
|
147
|
+
def sitename_from_header_page
|
148
|
+
header_page = Page.find_by_page_layout_and_layoutpage('layout_header', true)
|
149
|
+
return "" if header_page.nil?
|
150
|
+
page_title = header_page.elements.find_by_name('sitename')
|
151
|
+
return "" if page_title.nil?
|
152
|
+
page_title.ingredient('name')
|
153
|
+
end
|
154
|
+
|
155
|
+
# == This helper renders the navigation.
|
156
|
+
#
|
157
|
+
# It produces a html <ul><li></li></ul> structure with all necessary classes and ids so you can produce every navigation the web uses today.
|
158
|
+
# I.E. dropdown-navigations, simple mainnavigations or even complex nested ones.
|
159
|
+
#
|
160
|
+
# === En detail:
|
161
|
+
#
|
162
|
+
# <ul class="navigation_level_1">
|
163
|
+
# <li class="first home"><a href="/home" class="active" title="Homepage" lang="en" data-page-id="1">Homepage</a></li>
|
164
|
+
# <li class="contact"><a href="/contact" title="Contact" lang="en" data-page-id="2">Contact</a></li>
|
165
|
+
# <li class="last imprint"><a href="/imprint" title="Imprint" lang="en" data-page-id="3">Imprint</a></li>
|
166
|
+
# </ul>
|
167
|
+
#
|
168
|
+
# As you can see: Everything you need.
|
169
|
+
#
|
170
|
+
# Not pleased with the way Alchemy produces the navigation structure?
|
171
|
+
# Then feel free to overwrite the partials (_renderer.html.erb and _link.html.erb) found in +views/navigation/+ or pass different partials via the options +:navigation_partial+ and +:navigation_link_partial+.
|
172
|
+
#
|
173
|
+
# === The options are:
|
174
|
+
#
|
175
|
+
# :submenu => false Do you want a nested <ul> <li> structure for the deeper levels of your navigation, or not? Used to display the subnavigation within the mainnaviagtion. E.g. for dropdown menues.
|
176
|
+
# :all_sub_menues => false
|
177
|
+
# :from_page => @root_page Do you want to render a navigation from a different page then the current page? Then pass an Page instance or a Alchemy::PageLayout name as string.
|
178
|
+
# :spacer => "" Yeah even a spacer for the entries can be passed. Simple string, or even a complex html structure. E.g: "<span class='spacer'>|</spacer>". Only your imagination is the limit. And the W3C of course :)
|
179
|
+
# :navigation_partial => "navigation/renderer" Pass a different partial to be taken for the navigation rendering. CAUTION: Only for the advanced Alchemy webdevelopers. The standard partial takes care of nearly everything. But maybe you are an adventures one ^_^
|
180
|
+
# :navigation_link_partial => "navigation/link" Alchemy places an <a> html link in <li> tags. The tag automatically has an active css class if necessary. So styling is everything. But maybe you don't want this. So feel free to make you own partial and pass the filename here.
|
181
|
+
# :show_nonactive => false Commonly Alchemy only displays the submenu of the active page (if :submenu => true). If you want to display all child pages then pass true (together with :submenu => true of course). E.g. for the popular css-driven dropdownmenues these days.
|
182
|
+
# :show_title => true For our beloved SEOs :). Appends a title attribute to all links and places the page.title content into it.
|
183
|
+
# :restricted_only => nil Render only restricted pages.
|
184
|
+
# :show_title => true Show a title on navigation links. Title attribute from page.
|
185
|
+
# :reverse => false Reverse the navigation
|
186
|
+
# :reverse_children => false Reverse the nested children
|
187
|
+
#
|
188
|
+
def render_navigation(options = {})
|
189
|
+
default_options = {
|
190
|
+
:submenu => false,
|
191
|
+
:all_sub_menues => false,
|
192
|
+
:from_page => @root_page || Page.language_root_for(session[:language_id]),
|
193
|
+
:spacer => "",
|
194
|
+
:navigation_partial => "alchemy/navigation/renderer",
|
195
|
+
:navigation_link_partial => "alchemy/navigation/link",
|
196
|
+
:show_nonactive => false,
|
197
|
+
:restricted_only => nil,
|
198
|
+
:show_title => true,
|
199
|
+
:reverse => false,
|
200
|
+
:reverse_children => false
|
201
|
+
}
|
202
|
+
options = default_options.merge(options)
|
203
|
+
if options[:from_page].is_a?(String)
|
204
|
+
page = Page.find_by_page_layout_and_language_id(options[:from_page], session[:language_id])
|
205
|
+
else
|
206
|
+
page = options[:from_page]
|
207
|
+
end
|
208
|
+
if page.blank?
|
209
|
+
warning("No Page found for #{options[:from_page]}")
|
210
|
+
return ""
|
211
|
+
end
|
212
|
+
conditions = {
|
213
|
+
:parent_id => page.id,
|
214
|
+
:restricted => options[:restricted_only] || false,
|
215
|
+
:visible => true
|
216
|
+
}
|
217
|
+
if options[:restricted_only].nil?
|
218
|
+
conditions.delete(:restricted)
|
219
|
+
end
|
220
|
+
pages = Page.where(conditions).order("lft ASC")
|
221
|
+
if options[:reverse]
|
222
|
+
pages.reverse!
|
223
|
+
end
|
224
|
+
render :partial => options[:navigation_partial], :locals => {:options => options, :pages => pages}
|
225
|
+
end
|
226
|
+
|
227
|
+
# Renders the children of the given page (standard is the current page), the given page and its siblings if there are no children, or it renders just nil.
|
228
|
+
# Use this helper if you want to render the subnavigation independent from the mainnavigation. E.g. to place it in a different layer on your website.
|
229
|
+
# If :from_page's level in the site-hierarchy is greater than :level (standard is 2) and the given page has no children, the returned output will be the :from_page and it's siblings
|
230
|
+
# This method will assign all its options to the the render_navigation method, so you are able to assign the same options as to the render_navigation method.
|
231
|
+
# Normally there is no need to change the level parameter, just in a few special cases.
|
232
|
+
def render_subnavigation(options = {})
|
233
|
+
default_options = {
|
234
|
+
:from_page => @page,
|
235
|
+
:level => 2
|
236
|
+
}
|
237
|
+
options = default_options.merge(options)
|
238
|
+
if !options[:from_page].nil?
|
239
|
+
if (options[:from_page].children.blank? && options[:from_page].level > options[:level])
|
240
|
+
options = options.merge(:from_page => Page.find(options[:from_page].parent_id))
|
241
|
+
end
|
242
|
+
render_navigation(options)
|
243
|
+
else
|
244
|
+
return nil
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
# returns true if page is in the active branch
|
249
|
+
def page_active?(page)
|
250
|
+
@breadcrumb ||= breadcrumb(@page)
|
251
|
+
@breadcrumb.include?(page)
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns a HTML string for a linked breadcrumb from root to current page.
|
255
|
+
#
|
256
|
+
# == Options:
|
257
|
+
#
|
258
|
+
# :seperator => %(<span class="seperator">></span>) Maybe you don't want this seperator. Pass another one.
|
259
|
+
# :page => @page Pass a different Page instead of the default (@page).
|
260
|
+
# :without => nil Pass Pageobject or array of Pages that must not be displayed.
|
261
|
+
# :public_only => false Pass boolean for displaying published pages only.
|
262
|
+
# :visible_only => true Pass boolean for displaying (in navigation) visible pages only.
|
263
|
+
# :restricted_only => false Pass boolean for displaying restricted pages only.
|
264
|
+
# :reverse => false Pass boolean for displaying reversed breadcrumb.
|
265
|
+
#
|
266
|
+
def render_breadcrumb(options={})
|
267
|
+
default_options = {
|
268
|
+
:seperator => %(<span class="seperator">></span>),
|
269
|
+
:page => @page,
|
270
|
+
:without => nil,
|
271
|
+
:public_only => true,
|
272
|
+
:visible_only => true,
|
273
|
+
:restricted_only => false,
|
274
|
+
:reverse => false
|
275
|
+
}
|
276
|
+
options = default_options.merge(options)
|
277
|
+
pages = breadcrumb(options[:page])
|
278
|
+
pages.delete(Page.root)
|
279
|
+
unless options[:without].nil?
|
280
|
+
unless options[:without].class == Array
|
281
|
+
pages.delete(options[:without])
|
282
|
+
else
|
283
|
+
pages = pages - options[:without]
|
284
|
+
end
|
285
|
+
end
|
286
|
+
if options[:visible_only]
|
287
|
+
pages.reject! { |p| !p.visible? }
|
288
|
+
end
|
289
|
+
if options[:public_only]
|
290
|
+
pages.reject! { |p| !p.public? }
|
291
|
+
end
|
292
|
+
if options[:restricted_only]
|
293
|
+
pages.reject! { |p| !p.restricted? }
|
294
|
+
end
|
295
|
+
if options[:reverse]
|
296
|
+
pages.reverse!
|
297
|
+
end
|
298
|
+
bc = []
|
299
|
+
pages.each do |page|
|
300
|
+
urlname = page.urlname
|
301
|
+
css_class = page.name == @page.name ? "active" : nil
|
302
|
+
if page == pages.last
|
303
|
+
css_class = css_class.blank? ? "last" : [css_class, "last"].join(" ")
|
304
|
+
elsif page == pages.first
|
305
|
+
css_class = css_class.blank? ? "first" : [css_class, "first"].join(" ")
|
306
|
+
end
|
307
|
+
url = alchemy.show_page_path(:urlname => urlname, :lang => multi_language? ? page.language_code : nil)
|
308
|
+
bc << link_to(h(page.name), url, :class => css_class, :title => page.title)
|
309
|
+
end
|
310
|
+
bc.join(options[:seperator]).html_safe
|
311
|
+
end
|
312
|
+
|
313
|
+
# Returns an array of all pages in the same branch from current.
|
314
|
+
# I.e. used to find the active page in navigation.
|
315
|
+
def breadcrumb(current)
|
316
|
+
return [] if current.nil?
|
317
|
+
result = Array.new
|
318
|
+
result << current
|
319
|
+
while current = current.parent
|
320
|
+
result << current
|
321
|
+
end
|
322
|
+
return result.reverse
|
323
|
+
end
|
324
|
+
|
325
|
+
# Returns @page.title
|
326
|
+
#
|
327
|
+
# The options are:
|
328
|
+
#
|
329
|
+
# :prefix => ""
|
330
|
+
# :seperator => "|"
|
331
|
+
#
|
332
|
+
# == Webdevelopers:
|
333
|
+
#
|
334
|
+
# Please use the render_meta_data() helper. There all important meta information gets rendered in one helper.
|
335
|
+
# So you dont have to worry about anything.
|
336
|
+
#
|
337
|
+
def render_page_title(options={})
|
338
|
+
default_options = {
|
339
|
+
:prefix => "",
|
340
|
+
:seperator => "|"
|
341
|
+
}
|
342
|
+
default_options.update(options)
|
343
|
+
unless @page.title.blank?
|
344
|
+
h("#{default_options[:prefix]} #{default_options[:seperator]} #{@page.title}")
|
345
|
+
else
|
346
|
+
h("")
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
# Returns a complete html <title> tag for the <head> part of the html document.
|
351
|
+
#
|
352
|
+
# == Webdevelopers:
|
353
|
+
#
|
354
|
+
# Please use the render_meta_data() helper. There all important meta information gets rendered in one helper.
|
355
|
+
# So you dont have to worry about anything.
|
356
|
+
#
|
357
|
+
def render_title_tag(options={})
|
358
|
+
default_options = {
|
359
|
+
:prefix => "",
|
360
|
+
:seperator => "|"
|
361
|
+
}
|
362
|
+
options = default_options.merge(options)
|
363
|
+
title = render_page_title(options)
|
364
|
+
%(<title>#{title}</title>).html_safe
|
365
|
+
end
|
366
|
+
|
367
|
+
# Renders a html <meta> tag for :name => "" and :content => ""
|
368
|
+
#
|
369
|
+
# == Webdevelopers:
|
370
|
+
#
|
371
|
+
# Please use the render_meta_data() helper. There all important meta information gets rendered in one helper.
|
372
|
+
# So you dont have to worry about anything.
|
373
|
+
#
|
374
|
+
def render_meta_tag(options={})
|
375
|
+
default_options = {
|
376
|
+
:name => "",
|
377
|
+
:default_language => "de",
|
378
|
+
:content => ""
|
379
|
+
}
|
380
|
+
options = default_options.merge(options)
|
381
|
+
lang = (@page.language.blank? ? options[:default_language] : @page.language.code)
|
382
|
+
%(<meta name="#{options[:name]}" content="#{options[:content]}" lang="#{lang}">).html_safe
|
383
|
+
end
|
384
|
+
|
385
|
+
# = This helper takes care of all important meta tags for your @page.
|
386
|
+
#
|
387
|
+
# The meta data is been taken from the @page.title, @page.meta_description, @page.meta_keywords, @page.updated_at and @page.language database entries managed by the Alchemy user via the Alchemy cockpit.
|
388
|
+
#
|
389
|
+
# Assume that the user has entered following data into the Alchemy cockpit of the Page "home" and that the user wants that the searchengine (aka. google) robot should index the page and should follow all links on this page:
|
390
|
+
#
|
391
|
+
# Title = Homepage
|
392
|
+
# Description = Your page description
|
393
|
+
# Keywords: cms, ruby, rubyonrails, rails, software, development, html, javascript, ajax
|
394
|
+
#
|
395
|
+
# Then placing +render_meta_data(:title_prefix => "company", :title_seperator => "-")+ into the <head> part of the +pages.html.erb+ layout produces:
|
396
|
+
#
|
397
|
+
# <meta charset="UTF-8">
|
398
|
+
# <title>Company - #{@page.title}</title>
|
399
|
+
# <meta name="description" content="Your page description">
|
400
|
+
# <meta name="keywords" content="cms, ruby, rubyonrails, rails, software, development, html, javascript, ajax">
|
401
|
+
# <meta name="generator" content="Alchemy VERSION">
|
402
|
+
# <meta name="date" content="Tue Dec 16 10:21:26 +0100 2008">
|
403
|
+
# <meta name="robots" content="index, follow">
|
404
|
+
#
|
405
|
+
def render_meta_data options={}
|
406
|
+
if @page.blank?
|
407
|
+
warning("No Page found!")
|
408
|
+
return nil
|
409
|
+
end
|
410
|
+
default_options = {
|
411
|
+
:title_prefix => "",
|
412
|
+
:title_seperator => "|",
|
413
|
+
:default_lang => "de"
|
414
|
+
}
|
415
|
+
options = default_options.merge(options)
|
416
|
+
#render meta description of the root page from language if the current meta description is empty
|
417
|
+
if @page.meta_description.blank?
|
418
|
+
description = Page.find_by_language_root_and_public_and_language_id(true, true, session[:language_id]).meta_description rescue ""
|
419
|
+
else
|
420
|
+
description = @page.meta_description
|
421
|
+
end
|
422
|
+
#render meta keywords of the root page from language if the current meta keywords is empty
|
423
|
+
if @page.meta_keywords.blank?
|
424
|
+
keywords = Page.find_by_language_root_and_public_and_language_id(true, true, session[:language_id]).meta_keywords rescue ""
|
425
|
+
else
|
426
|
+
keywords = @page.meta_keywords
|
427
|
+
end
|
428
|
+
robot = "#{@page.robot_index? ? "" : "no"}index, #{@page.robot_follow? ? "" : "no"}follow"
|
429
|
+
meta_string = %(
|
430
|
+
<meta charset=UTF-8">
|
431
|
+
#{render_title_tag(:prefix => options[:title_prefix], :seperator => options[:title_seperator])}
|
432
|
+
#{render_meta_tag(:name => "description", :content => description)}
|
433
|
+
#{render_meta_tag(:name => "keywords", :content => keywords)}
|
434
|
+
<meta name="generator" content="Alchemy #{Alchemy::VERSION}">
|
435
|
+
<meta name="date" content="#{@page.updated_at}">
|
436
|
+
<meta name="robots" content="#{robot}">
|
437
|
+
)
|
438
|
+
if @page.contains_feed?
|
439
|
+
meta_string += %(
|
440
|
+
<link rel="alternate" type="application/rss+xml" title="RSS" href="#{multi_language? ? alchemy.show_page_url(:protocol => 'feed', :urlname => @page.urlname, :lang => @page.language_code, :format => :rss) : show_page_url(:protocol => 'feed', :urlname => @page.urlname, :format => :rss)}">
|
441
|
+
)
|
442
|
+
end
|
443
|
+
return meta_string.html_safe
|
444
|
+
end
|
445
|
+
|
446
|
+
# This helper returns a path for use inside a link_to helper.
|
447
|
+
#
|
448
|
+
# You may pass a page_layout or an urlname.
|
449
|
+
# Any additional options are passed to the url_helper, so you can add arguments to your url.
|
450
|
+
#
|
451
|
+
# Example:
|
452
|
+
#
|
453
|
+
# <%= link_to '» order now', page_path_for(:page_layout => 'orderform', :product_id => element.id) %>
|
454
|
+
#
|
455
|
+
def page_path_for(options={})
|
456
|
+
return warning("No page_layout, or urlname given. I got #{options.inspect} ") if options[:page_layout].blank? && options[:urlname].blank?
|
457
|
+
if options[:urlname].blank?
|
458
|
+
page = Page.find_by_page_layout(options[:page_layout])
|
459
|
+
return warning("No page found for #{options.inspect} ") if page.blank?
|
460
|
+
urlname = page.urlname
|
461
|
+
else
|
462
|
+
urlname = options[:urlname]
|
463
|
+
end
|
464
|
+
alchemy.show_page_path({:urlname => urlname, :lang => multi_language? ? session[:language_code] : nil}.merge(options.except(:page_layout, :urlname, :lang)))
|
465
|
+
end
|
466
|
+
|
467
|
+
# Renders the partial for the cell with the given name of the current page.
|
468
|
+
# Cell partials are located in +app/views/cells/+ of your project.
|
469
|
+
def render_cell(name)
|
470
|
+
cell = @page.cells.find_by_name(name)
|
471
|
+
return "" if cell.blank?
|
472
|
+
render :partial => "alchemy/cells/#{name}", :locals => {:cell => cell}
|
473
|
+
end
|
474
|
+
|
475
|
+
# Returns true or false if no elements are in the cell found by name.
|
476
|
+
def cell_empty?(name)
|
477
|
+
cell = @page.cells.find_by_name(name)
|
478
|
+
return true if cell.blank?
|
479
|
+
cell.elements.blank?
|
480
|
+
end
|
481
|
+
|
482
|
+
# Include this in your layout file to have element selection magic in the page edit preview window.
|
483
|
+
def alchemy_preview_mode_code
|
484
|
+
javascript_include_tag("alchemy/preview") if @preview_mode
|
485
|
+
end
|
486
|
+
|
487
|
+
# Renders the search form
|
488
|
+
def render_search_form(options={})
|
489
|
+
default_options = {
|
490
|
+
:page => @search_result_page,
|
491
|
+
:html5 => false
|
492
|
+
}
|
493
|
+
options = default_options.merge(options)
|
494
|
+
return warning(t("No page found for #{options[:page].inspect}")) if options[:page].class.name != "Alchemy::Page"
|
495
|
+
form_tag(show_alchemy_page_path(options[:page]), :method => :get, :class => 'fulltext_search') do
|
496
|
+
if options[:html5]
|
497
|
+
search_field_tag(:query, params[:query])
|
498
|
+
else
|
499
|
+
text_field_tag(:query, params[:query]) + submit_tag(:search)
|
500
|
+
end
|
501
|
+
end
|
502
|
+
end
|
503
|
+
|
504
|
+
# Renders the search-results
|
505
|
+
def render_search_results(options={})
|
506
|
+
default_options = {
|
507
|
+
:partial => 'alchemy/search/result',
|
508
|
+
:show_language => true,
|
509
|
+
:show_result_count => true,
|
510
|
+
:show_heading => true
|
511
|
+
}
|
512
|
+
options = default_options.merge(options)
|
513
|
+
return content_tag :h2, t('alchemy.search.no_results') if @search_results.blank?
|
514
|
+
results = ""
|
515
|
+
@search_results.each do |essence|
|
516
|
+
result = essence.highlight(
|
517
|
+
"*#{params[:query]}*", {
|
518
|
+
:field => (essence.class.name == "Alchemy::EssenceRichtext" ? :stripped_body : :body)
|
519
|
+
})
|
520
|
+
results << render(:partial => options[:partial], :locals => {:result => result, :options => options, :page => essence.page}) if essence.page
|
521
|
+
end
|
522
|
+
output = ""
|
523
|
+
output << content_tag(:h1, t("alchemy.search.result_heading", :query => h(params[:query])), :class => 'search_results_heading') if options[:show_heading]
|
524
|
+
output << content_tag(:h2, t("alchemy.search.result_count", :result_count => @search_results.length), :class => 'search_result_count') if options[:show_result_count]
|
525
|
+
output << content_tag(:ul, results.html_safe, :class => 'search_result_list')
|
526
|
+
content_tag :div, :class => 'search_results' do
|
527
|
+
output.html_safe
|
528
|
+
end
|
529
|
+
end
|
530
|
+
|
531
|
+
# Returns the correct params-hash for passing to show_page_path
|
532
|
+
def show_page_path_params(page=nil, optional_params={})
|
533
|
+
return nil if page.class.name != "Alchemy::Page"
|
534
|
+
url_params = {:urlname => page.urlname}
|
535
|
+
url_params.update(optional_params) if optional_params.class.name == "Hash"
|
536
|
+
return multi_language? ? url_params.update(:lang => page.language_code) : url_params
|
537
|
+
end
|
538
|
+
|
539
|
+
#
|
540
|
+
def show_alchemy_page_path(page=nil, optional_params={})
|
541
|
+
alchemy.show_page_path(show_page_path_params(page, optional_params))
|
542
|
+
end
|
543
|
+
|
544
|
+
#
|
545
|
+
def show_alchemy_page_url(page=nil, optional_params={})
|
546
|
+
alchemy.show_page_url(show_page_path_params(page, optional_params))
|
547
|
+
end
|
548
|
+
|
549
|
+
end
|
550
|
+
end
|