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
@@ -1,170 +0,0 @@
|
|
1
|
-
module ElementsHelper
|
2
|
-
|
3
|
-
include EssencesHelper
|
4
|
-
|
5
|
-
# Renders all elements from @page.
|
6
|
-
# ---
|
7
|
-
# == Options are:
|
8
|
-
# :only => [] A list of element names to be rendered only. Very usefull if you want to render a specific element type in a special html part (e.g.. <div>) of your page and all other elements in another part.
|
9
|
-
# :except => [] A list of element names to be rendered. The opposite of the only option.
|
10
|
-
# :from_page The Page.page_layout string from which the elements are rendered from, or you even pass a Page object.
|
11
|
-
# :count The amount of elements to be rendered (beginns with first element found)
|
12
|
-
# :fallback => {:for => 'ELEMENT_NAME', :with => 'ELEMENT_NAME', :from => 'PAGE_LAYOUT'} when no element from this name is found on page, then use this element from that page
|
13
|
-
# :sort_by => Content#name A Content name to sort the elements by
|
14
|
-
# :reverse => boolean Reverse the rendering order
|
15
|
-
#
|
16
|
-
# This helper also stores all pages where elements gets rendered on, so we can sweep them later if caching expires!
|
17
|
-
#
|
18
|
-
def render_elements(options = {})
|
19
|
-
default_options = {
|
20
|
-
:except => [],
|
21
|
-
:only => [],
|
22
|
-
:from_page => "",
|
23
|
-
:from_cell => "",
|
24
|
-
:count => nil,
|
25
|
-
:offset => nil,
|
26
|
-
:locals => {},
|
27
|
-
:render_format => "html",
|
28
|
-
:fallback => nil
|
29
|
-
}
|
30
|
-
options = default_options.merge(options)
|
31
|
-
if options[:from_page].blank?
|
32
|
-
page = @page
|
33
|
-
else
|
34
|
-
if options[:from_page].class == Page
|
35
|
-
page = options[:from_page]
|
36
|
-
else
|
37
|
-
page = Page.find_all_by_page_layout_and_language_id(options[:from_page], session[:language_id])
|
38
|
-
end
|
39
|
-
end
|
40
|
-
if page.blank?
|
41
|
-
warning('Page is nil')
|
42
|
-
return ""
|
43
|
-
else
|
44
|
-
show_non_public = configuration(:cache_pages) ? false : defined?(current_user)
|
45
|
-
if page.class == Array
|
46
|
-
all_elements = page.collect { |p| p.find_elements(options, show_non_public) }.flatten
|
47
|
-
else
|
48
|
-
all_elements = page.find_elements(options, show_non_public)
|
49
|
-
end
|
50
|
-
unless options[:sort_by].blank?
|
51
|
-
all_elements = all_elements.sort_by { |e| e.contents.detect { |c| c.name == options[:sort_by] }.ingredient }
|
52
|
-
end
|
53
|
-
all_elements.reverse! if options[:reverse_sort] || options[:reverse]
|
54
|
-
element_string = ""
|
55
|
-
if options[:fallback]
|
56
|
-
unless all_elements.detect { |e| e.name == options[:fallback][:for] }
|
57
|
-
if from = Page.find_by_page_layout_and_language_id(options[:fallback][:from], session[:language_id])
|
58
|
-
all_elements += from.elements.find_all_by_name(options[:fallback][:with].blank? ? options[:fallback][:for] : options[:fallback][:with])
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
all_elements.each_with_index do |element, i|
|
63
|
-
element_string += render_element(element, :view, options, i+1)
|
64
|
-
end
|
65
|
-
element_string.html_safe
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
# This helper renders the Element partial for either the view or the editor part.
|
70
|
-
# Generate element partials with ./script/generate elements
|
71
|
-
def render_element(element, part = :view, options = {}, i = 1)
|
72
|
-
begin
|
73
|
-
if element.blank?
|
74
|
-
warning('Element is nil')
|
75
|
-
render :partial => "elements/#{part}_not_found", :locals => {:name => 'nil'}
|
76
|
-
else
|
77
|
-
default_options = {
|
78
|
-
:shorten_to => nil,
|
79
|
-
:render_format => "html"
|
80
|
-
}
|
81
|
-
options = default_options.merge(options)
|
82
|
-
element.store_page(@page) if part == :view
|
83
|
-
path1 = "#{Rails.root}/app/views/elements/"
|
84
|
-
path2 = "#{Rails.root}/vendor/plugins/alchemy/app/views/elements/"
|
85
|
-
partial_name = "_#{element.name.underscore}_#{part}.html.erb"
|
86
|
-
locals = options.delete(:locals)
|
87
|
-
render(
|
88
|
-
:partial => "elements/#{element.name.underscore}_#{part}.#{options[:render_format]}.erb",
|
89
|
-
:locals => {
|
90
|
-
:element => element,
|
91
|
-
:options => options,
|
92
|
-
:counter => i
|
93
|
-
}.merge(locals || {})
|
94
|
-
)
|
95
|
-
end
|
96
|
-
rescue ActionView::MissingTemplate
|
97
|
-
warning(%(
|
98
|
-
Element #{part} partial not found for #{element.name}.\n
|
99
|
-
Looking for #{partial_name}, but not found
|
100
|
-
neither in #{path1}
|
101
|
-
nor in #{path2}
|
102
|
-
Use rails generate alchemy:elements to generate them.
|
103
|
-
Maybe you still have old style partial names? (like .rhtml). Then please rename them in .html.erb'
|
104
|
-
))
|
105
|
-
render :partial => "elements/#{part}_not_found", :locals => {:name => element.name, :error => "Element #{part} partial not found. Use rails generate alchemy:elements to generate them."}
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
# Returns all public elements found by Element.name.
|
110
|
-
# Pass a count to return only an limited amount of elements.
|
111
|
-
def all_elements_by_name(name, options = {})
|
112
|
-
warning('options[:language] option not allowed any more in all_elements_by_name helper') unless options[:language].blank?
|
113
|
-
default_options = {
|
114
|
-
:count => :all,
|
115
|
-
:from_page => :all
|
116
|
-
}
|
117
|
-
options = default_options.merge(options)
|
118
|
-
if options[:from_page] == :all
|
119
|
-
elements = Element.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])
|
120
|
-
elsif options[:from_page].class == String
|
121
|
-
page = Page.find_by_page_layout_and_language_id(options[:from_page], session[:language_id])
|
122
|
-
return [] if page.blank?
|
123
|
-
elements = page.elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])
|
124
|
-
else
|
125
|
-
elements = options[:from_page].elements.find_all_by_name_and_public(name, true, :limit => options[:count] == :all ? nil : options[:count])
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
# Returns the public element found by Element.name from the given public Page, either by Page.id or by Page.urlname
|
130
|
-
def element_from_page(options = {})
|
131
|
-
default_options = {
|
132
|
-
:page_urlname => "",
|
133
|
-
:page_id => nil,
|
134
|
-
:element_name => ""
|
135
|
-
}
|
136
|
-
options = default_options.merge(options)
|
137
|
-
if options[:page_id].blank?
|
138
|
-
page = Page.find_by_urlname_and_public(options[:page_urlname], true)
|
139
|
-
else
|
140
|
-
page = Page.find_by_id_and_public(options[:page_id], true)
|
141
|
-
end
|
142
|
-
return "" if page.blank?
|
143
|
-
element = page.elements.find_by_name_and_public(options[:element_name], true)
|
144
|
-
return element
|
145
|
-
end
|
146
|
-
|
147
|
-
# Renders all element partials from given cell.
|
148
|
-
def render_cell_elements(cell)
|
149
|
-
return warning("No cell given.") if cell.blank?
|
150
|
-
render_elements({:from_cell => cell})
|
151
|
-
end
|
152
|
-
|
153
|
-
# Returns a string for the id attribute of a html element for the given element
|
154
|
-
def element_dom_id(element)
|
155
|
-
return "" if element.nil?
|
156
|
-
"#{element.name}_#{element.id}"
|
157
|
-
end
|
158
|
-
|
159
|
-
# Renders the data-alchemy-element HTML attribut used for the preview window hover effect.
|
160
|
-
def element_preview_code(element)
|
161
|
-
return "" if element.nil?
|
162
|
-
" data-alchemy-element='#{element.id}'" if @preview_mode && element.page == @page
|
163
|
-
end
|
164
|
-
|
165
|
-
# Returns the full url containing host, page and anchor for the given element
|
166
|
-
def full_url_for_element(element)
|
167
|
-
"http://" + request.env["HTTP_HOST"] + "/" + element.page.urlname + "##{element.name}_#{element.id}"
|
168
|
-
end
|
169
|
-
|
170
|
-
end
|
@@ -1,167 +0,0 @@
|
|
1
|
-
module EssencesHelper
|
2
|
-
|
3
|
-
include ContentsHelper
|
4
|
-
|
5
|
-
# Renders the Content view partial from the passed Element for passed content name.
|
6
|
-
# For options see -> render_essence
|
7
|
-
def render_essence_view_by_name(element, name, options = {}, html_options = {})
|
8
|
-
if element.blank?
|
9
|
-
warning('Element is nil')
|
10
|
-
return ""
|
11
|
-
end
|
12
|
-
content = element.content_by_name(name)
|
13
|
-
render_essence(content, :view, {:for_view => options}, html_options)
|
14
|
-
end
|
15
|
-
|
16
|
-
# Renders the Content partial that is given (:editor, or :view).
|
17
|
-
# You can pass several options that are used by the different contents.
|
18
|
-
#
|
19
|
-
# For the view partial:
|
20
|
-
# :image_size => "111x93" Used by EssencePicture to render the image via RMagick to that size.
|
21
|
-
# :css_class => "" This css class gets attached to the content view.
|
22
|
-
# :date_format => "Am %d. %m. %Y, um %H:%Mh" Espacially fot the EssenceDate. See Date.strftime for date formatting.
|
23
|
-
# :caption => true Pass true to enable that the EssencePicture.caption value gets rendered.
|
24
|
-
# :blank_value => "" Pass a String that gets rendered if the content.essence is blank.
|
25
|
-
#
|
26
|
-
# For the editor partial:
|
27
|
-
# :css_class => "" This css class gets attached to the content editor.
|
28
|
-
# :last_image_deletable => false Pass true to enable that the last image of an imagecollection (e.g. image gallery) is deletable.
|
29
|
-
def render_essence(content, part = :view, options = {}, html_options = {})
|
30
|
-
if content.nil?
|
31
|
-
return part == :view ? "" : warning('Content is nil', _("content_not_found"))
|
32
|
-
elsif content.essence.nil?
|
33
|
-
return part == :view ? "" : warning('Essence is nil', _("content_essence_not_found"))
|
34
|
-
end
|
35
|
-
defaults = {
|
36
|
-
:for_editor => {
|
37
|
-
:as => 'text_field',
|
38
|
-
:css_class => 'long',
|
39
|
-
:render_format => "html"
|
40
|
-
},
|
41
|
-
:for_view => {
|
42
|
-
:image_size => "120x90",
|
43
|
-
:css_class => "",
|
44
|
-
:date_format => "%d. %m. %Y, %H:%Mh",
|
45
|
-
:caption => true,
|
46
|
-
:blank_value => "",
|
47
|
-
:render_format => "html"
|
48
|
-
}
|
49
|
-
}
|
50
|
-
if options["for_#{part}".to_sym].nil?
|
51
|
-
options_for_partial = defaults["for_#{part}".to_sym]
|
52
|
-
else
|
53
|
-
options_for_partial = defaults.fetch("for_#{part}".to_sym).merge(options["for_#{part}".to_sym])
|
54
|
-
end
|
55
|
-
options = options.merge(defaults)
|
56
|
-
render(
|
57
|
-
:partial => "essences/#{content.essence.class.name.underscore}_#{part.to_s}.#{options_for_partial[:render_format]}.erb",
|
58
|
-
:locals => {
|
59
|
-
:content => content,
|
60
|
-
:options => options_for_partial,
|
61
|
-
:html_options => html_options
|
62
|
-
}
|
63
|
-
)
|
64
|
-
end
|
65
|
-
|
66
|
-
# Renders the Content view partial from the given Content.
|
67
|
-
# For options see -> render_essence
|
68
|
-
def render_essence_view(content, options = {}, html_options = {})
|
69
|
-
render_essence(content, :view, {:for_view => options}, html_options)
|
70
|
-
end
|
71
|
-
|
72
|
-
# Renders the Content view partial from the given Element for the essence_type (e.g. EssenceRichtext).
|
73
|
-
# For multiple contents of same kind inside one element just pass a position so that will be rendered.
|
74
|
-
# Otherwise the first content found for this type will be rendered.
|
75
|
-
# For options see -> render_essence
|
76
|
-
def render_essence_view_by_type(element, type, position = 1, options = {}, html_options = {})
|
77
|
-
if element.blank?
|
78
|
-
warning('Element is nil')
|
79
|
-
return ""
|
80
|
-
end
|
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
|
-
# Renders the Content editor partial from the given Content.
|
101
|
-
# For options see -> render_essence
|
102
|
-
def render_essence_editor(content, options = {})
|
103
|
-
render_essence(content, :editor, :for_editor => options)
|
104
|
-
end
|
105
|
-
|
106
|
-
# Renders the Content editor partial from essence_type.
|
107
|
-
#
|
108
|
-
# Options are:
|
109
|
-
# * element (Element) - the Element the contents are in (obligatory)
|
110
|
-
# * type (String) - the type of Essence (obligatory)
|
111
|
-
# * options (Hash):
|
112
|
-
# ** :position (Integer) - The position of the Content inside the Element. I.E. for getting the n-th EssencePicture. Default is 1 (the first)
|
113
|
-
# ** :all (String) - Pass :all to get all Contents of that name. Default false
|
114
|
-
# * editor_options (Hash) - Will be passed to the render_essence_editor partial renderer
|
115
|
-
#
|
116
|
-
def render_essence_editor_by_type(element, essence_type, options = {}, editor_options = {})
|
117
|
-
return warning('Element is nil', _("no_element_given")) if element.blank?
|
118
|
-
return warning('EssenceType is blank', _("No EssenceType given")) if essence_type.blank?
|
119
|
-
defaults = {
|
120
|
-
:position => 1,
|
121
|
-
:all => false
|
122
|
-
}
|
123
|
-
options = defaults.merge(options)
|
124
|
-
return_string = ""
|
125
|
-
if options[:all]
|
126
|
-
contents = element.contents.find_all_by_essence_type_and_name(essence_type, options[:all])
|
127
|
-
contents.each do |content|
|
128
|
-
return_string << render_essence(content, :editor, :for_editor => editor_options)
|
129
|
-
end
|
130
|
-
else
|
131
|
-
content = element.contents.find_by_essence_type_and_position(essence_type, options[:position])
|
132
|
-
return_string = render_essence(content, :editor, :for_editor => editor_options)
|
133
|
-
end
|
134
|
-
return_string
|
135
|
-
end
|
136
|
-
|
137
|
-
# Renders the Content editor partial from the given Element by position (e.g. 1).
|
138
|
-
# For options see -> render_essence
|
139
|
-
def render_essence_editor_by_position(element, position, options = {})
|
140
|
-
if element.blank?
|
141
|
-
warning('Element is nil')
|
142
|
-
return ""
|
143
|
-
end
|
144
|
-
content = element.contents.find_by_position(position)
|
145
|
-
render_essence(content, :editor, :for_editor => options)
|
146
|
-
end
|
147
|
-
|
148
|
-
# Renders the Content editor partial found in views/contents/ for the content with name inside the passed Element.
|
149
|
-
# For options see -> render_essence
|
150
|
-
#
|
151
|
-
# Content creation on the fly:
|
152
|
-
#
|
153
|
-
# If you update the elements.yml file after creating an element this helper displays a error message with an option to create the content.
|
154
|
-
#
|
155
|
-
def render_essence_editor_by_name(element, name, options = {})
|
156
|
-
if element.blank?
|
157
|
-
return warning('Element is nil', _("no_element_given"))
|
158
|
-
end
|
159
|
-
content = element.content_by_name(name)
|
160
|
-
if content.blank?
|
161
|
-
render :partial => 'admin/contents/missing', :locals => {:element => element, :name => name}
|
162
|
-
else
|
163
|
-
render_essence(content, :editor, :for_editor => options)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# These helper methods can be called in your template to set variables to be used in the layout
|
2
|
-
# This module should be included in all views globally,
|
3
|
-
# to do so you may need to add this line to your ApplicationController
|
4
|
-
# helper :layout
|
5
|
-
module LayoutHelper
|
6
|
-
def title(page_title, show_title = true)
|
7
|
-
@content_for_title = page_title.to_s
|
8
|
-
@show_title = show_title
|
9
|
-
end
|
10
|
-
|
11
|
-
def show_title?
|
12
|
-
@show_title
|
13
|
-
end
|
14
|
-
|
15
|
-
def stylesheet(*args)
|
16
|
-
content_for(:stylesheets) { stylesheet_link_tag(*args.map(&:to_s)) }
|
17
|
-
end
|
18
|
-
|
19
|
-
def javascript(*args)
|
20
|
-
args = args.map { |arg| arg == :defaults ? arg : "/plugin_assets/alchemy/javascripts/" + arg.to_s }
|
21
|
-
content_for(:javascripts) { javascript_include_tag(*args) }
|
22
|
-
end
|
23
|
-
|
24
|
-
def merged_javascript(merged_set)
|
25
|
-
content_for(:merged_javascripts) { javascript_include_merged(merged_set) }
|
26
|
-
end
|
27
|
-
|
28
|
-
def new_asset_path_with_session_information(asset_type)
|
29
|
-
session_key = Rails.application.config.session_options[:key]
|
30
|
-
if asset_type == "picture"
|
31
|
-
admin_pictures_path(session_key => cookies[session_key], request_forgery_protection_token => form_authenticity_token, :format => :js)
|
32
|
-
elsif asset_type == "attachment"
|
33
|
-
admin_attachments_path(session_key => cookies[session_key], request_forgery_protection_token => form_authenticity_token, :format => :js)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
data/app/helpers/pages_helper.rb
DELETED
@@ -1,503 +0,0 @@
|
|
1
|
-
module PagesHelper
|
2
|
-
|
3
|
-
include ElementsHelper
|
4
|
-
|
5
|
-
def render_classes(classes=[])
|
6
|
-
s = classes.uniq.delete_if { |x| x.blank? }.join(" ")
|
7
|
-
s.blank? ? "" : "class='#{s}'"
|
8
|
-
end
|
9
|
-
|
10
|
-
def picture_essence_caption(content)
|
11
|
-
return "" if content.nil?
|
12
|
-
return "" if content.essence.nil?
|
13
|
-
content.essence.caption
|
14
|
-
end
|
15
|
-
|
16
|
-
def alchemy_form_select(name, select_options, options={})
|
17
|
-
select "mail_data", name, select_options, :selected => (session[:mail_data][name.to_sym] rescue "")
|
18
|
-
end
|
19
|
-
|
20
|
-
def alchemy_form_input_field(name, options = {})
|
21
|
-
if options[:value].blank? && session[:mail_data].blank?
|
22
|
-
value = nil
|
23
|
-
elsif options[:value].blank? && !session[:mail_data].blank?
|
24
|
-
value = session[:mail_data][name.to_sym]
|
25
|
-
else
|
26
|
-
value = options[:value]
|
27
|
-
end
|
28
|
-
text_field("mail_data", name, {:value => value}.merge(options))
|
29
|
-
end
|
30
|
-
|
31
|
-
def alchemy_form_text_area(name, options={})
|
32
|
-
text_area "mail_data", name, :class => options[:class], :value => (session[:mail_data][name.to_sym] rescue "")
|
33
|
-
end
|
34
|
-
|
35
|
-
def alchemy_form_check_box(name, options={})
|
36
|
-
box = hidden_field_tag "mail_data[#{name}]", 0, :id => nil
|
37
|
-
box += check_box_tag("mail_data[#{name}]", 1, (session[:mail_data] && session[:mail_data][name.to_sym] == "1"))
|
38
|
-
box
|
39
|
-
end
|
40
|
-
|
41
|
-
def alchemy_form_label(element, name, options={})
|
42
|
-
label_tag "mail_data_#{name}", render_essence_view_by_name(element, name), options
|
43
|
-
end
|
44
|
-
|
45
|
-
def alchemy_form_reset_button(name, options={})
|
46
|
-
button_to_function(
|
47
|
-
name,
|
48
|
-
remote_function(
|
49
|
-
:url => {
|
50
|
-
:controller => "contact_form",
|
51
|
-
:action => "clear_session"
|
52
|
-
},
|
53
|
-
:before => %(
|
54
|
-
this.form.reset();
|
55
|
-
this.form.descendants().each(
|
56
|
-
function(d){
|
57
|
-
if ((d.type!='button') && (d.type!='submit') && (d.type!='hidden') && !d.disabled) {
|
58
|
-
d.value = '';
|
59
|
-
if (d.type == 'checkbox') {
|
60
|
-
d.checked = false;
|
61
|
-
}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
)
|
65
|
-
)
|
66
|
-
),
|
67
|
-
options
|
68
|
-
)
|
69
|
-
end
|
70
|
-
|
71
|
-
# helper for language switching
|
72
|
-
# returns a string with links or nil
|
73
|
-
def language_switches(options={})
|
74
|
-
default_options = {
|
75
|
-
:linkname => :name,
|
76
|
-
:spacer => "",
|
77
|
-
:link_to_public_child => configuration(:redirect_to_public_child),
|
78
|
-
:link_to_page_with_layout => nil,
|
79
|
-
:show_title => true,
|
80
|
-
:reverse => false,
|
81
|
-
:as_select_box => false
|
82
|
-
}
|
83
|
-
options = default_options.merge(options)
|
84
|
-
if multi_language?
|
85
|
-
language_links = []
|
86
|
-
pages = (options[:link_to_public_child] == true) ? Page.language_roots : Page.public_language_roots
|
87
|
-
return nil if (pages.blank? || pages.length == 1)
|
88
|
-
pages.each_with_index do |page, i|
|
89
|
-
if(options[:link_to_page_with_layout] != nil)
|
90
|
-
page_found_by_layout = Page.where(:page_layout => options[:link_to_page_with_layout].to_s, :language_id => page.language_id)
|
91
|
-
end
|
92
|
-
page = page_found_by_layout || page
|
93
|
-
page = (options[:link_to_public_child] ? (page.first_public_child.blank? ? nil : page.first_public_child) : nil) if !page.public?
|
94
|
-
if !page.blank?
|
95
|
-
active = session[:language_id] == page.language.id
|
96
|
-
linkname = page.language.label(options[:linkname])
|
97
|
-
if options[:as_select_box]
|
98
|
-
language_links << [linkname, show_page_url(:urlname => page.urlname, :lang => page.language.code)]
|
99
|
-
else
|
100
|
-
language_links << link_to(
|
101
|
-
"#{content_tag(:span, '', :class => "flag")}#{ content_tag(:span, linkname)}".html_safe,
|
102
|
-
show_page_path(:urlname => page.urlname, :lang => page.language.code),
|
103
|
-
:class => "#{(active ? 'active ' : nil)}#{page.language.code} #{(i == 0) ? 'first' : (i==pages.length-1) ? 'last' : nil}",
|
104
|
-
:title => options[:show_title] ? I18n.t("alchemy.language_links.#{page.language.code}.title", :default => page.language.name) : nil
|
105
|
-
)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
# when last iteration and we have just one language_link,
|
109
|
-
# we dont need to render it.
|
110
|
-
if (i==pages.length-1) && language_links.length == 1
|
111
|
-
return nil
|
112
|
-
end
|
113
|
-
end
|
114
|
-
return nil if language_links.empty? || language_links.length == 1
|
115
|
-
language_links.reverse! if options[:reverse]
|
116
|
-
if options[:as_select_box]
|
117
|
-
return select_tag(
|
118
|
-
'language',
|
119
|
-
options_for_select(
|
120
|
-
language_links,
|
121
|
-
show_page_url(:urlname => @page.urlname, :lang => @page.language.code)
|
122
|
-
),
|
123
|
-
:onchange => "window.location=this.value"
|
124
|
-
)
|
125
|
-
else
|
126
|
-
raw(language_links.join(options[:spacer]))
|
127
|
-
end
|
128
|
-
else
|
129
|
-
nil
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
# Renders the layout from @page.page_layout. File resists in /app/views/page_layouts/_LAYOUT-NAME.html.erb
|
134
|
-
def render_page_layout(options={})
|
135
|
-
default_options = {
|
136
|
-
:render_format => "html"
|
137
|
-
}
|
138
|
-
options = default_options.merge(options)
|
139
|
-
render :partial => "page_layouts/#{@page.page_layout.downcase}.#{options[:render_format]}.erb"
|
140
|
-
rescue ActionView::MissingTemplate
|
141
|
-
warning("PageLayout: '#{@page.page_layout}' not found. Rendering standard page_layout.")
|
142
|
-
render :partial => "page_layouts/standard"
|
143
|
-
end
|
144
|
-
|
145
|
-
def sitename_from_header_page
|
146
|
-
header_page = Page.find_by_page_layout_and_layoutpage('layout_header', true)
|
147
|
-
return "" if header_page.nil?
|
148
|
-
page_title = header_page.elements.find_by_name('sitename')
|
149
|
-
return "" if page_title.nil?
|
150
|
-
page_title.ingredient('name')
|
151
|
-
end
|
152
|
-
|
153
|
-
# == This helper renders the navigation.
|
154
|
-
#
|
155
|
-
# 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.
|
156
|
-
# I.E. dropdown-navigations, simple mainnavigations or even complex nested ones.
|
157
|
-
#
|
158
|
-
# === En detail:
|
159
|
-
#
|
160
|
-
# <ul class="navigation_level_1">
|
161
|
-
# <li class="first home"><a href="/home" class="active" title="Homepage" lang="en" data-page-id="1">Homepage</a></li>
|
162
|
-
# <li class="contact"><a href="/contact" title="Contact" lang="en" data-page-id="2">Contact</a></li>
|
163
|
-
# <li class="last imprint"><a href="/imprint" title="Imprint" lang="en" data-page-id="3">Imprint</a></li>
|
164
|
-
# </ul>
|
165
|
-
#
|
166
|
-
# As you can see: Everything you need.
|
167
|
-
#
|
168
|
-
# Not pleased with the way Alchemy produces the navigation structure?
|
169
|
-
# 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+.
|
170
|
-
#
|
171
|
-
# === The options are:
|
172
|
-
#
|
173
|
-
# :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.
|
174
|
-
# :all_sub_menues => false
|
175
|
-
# :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.
|
176
|
-
# :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 :)
|
177
|
-
# :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 ^_^
|
178
|
-
# :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.
|
179
|
-
# :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.
|
180
|
-
# :show_title => true For our beloved SEOs :). Appends a title attribute to all links and places the page.title content into it.
|
181
|
-
# :restricted_only => nil Render only restricted pages.
|
182
|
-
# :show_title => true Show a title on navigation links. Title attribute from page.
|
183
|
-
# :reverse => false Reverse the navigation
|
184
|
-
# :reverse_children => false Reverse the nested children
|
185
|
-
#
|
186
|
-
def render_navigation(options = {})
|
187
|
-
default_options = {
|
188
|
-
:submenu => false,
|
189
|
-
:all_sub_menues => false,
|
190
|
-
:from_page => @root_page || Page.language_root_for(session[:language_id]),
|
191
|
-
:spacer => "",
|
192
|
-
:navigation_partial => "navigation/renderer",
|
193
|
-
:navigation_link_partial => "navigation/link",
|
194
|
-
:show_nonactive => false,
|
195
|
-
:restricted_only => nil,
|
196
|
-
:show_title => true,
|
197
|
-
:reverse => false,
|
198
|
-
:reverse_children => false
|
199
|
-
}
|
200
|
-
options = default_options.merge(options)
|
201
|
-
if options[:from_page].is_a?(String)
|
202
|
-
page = Page.find_by_page_layout_and_language_id(options[:from_page], session[:language_id])
|
203
|
-
else
|
204
|
-
page = options[:from_page]
|
205
|
-
end
|
206
|
-
if page.blank?
|
207
|
-
warning("No Page found for #{options[:from_page]}")
|
208
|
-
return ""
|
209
|
-
end
|
210
|
-
conditions = {
|
211
|
-
:parent_id => page.id,
|
212
|
-
:restricted => options[:restricted_only] || false,
|
213
|
-
:visible => true
|
214
|
-
}
|
215
|
-
if options[:restricted_only].nil?
|
216
|
-
conditions.delete(:restricted)
|
217
|
-
end
|
218
|
-
pages = Page.where(conditions).order("lft ASC")
|
219
|
-
if options[:reverse]
|
220
|
-
pages.reverse!
|
221
|
-
end
|
222
|
-
render :partial => options[:navigation_partial], :locals => {:options => options, :pages => pages}
|
223
|
-
end
|
224
|
-
|
225
|
-
# 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.
|
226
|
-
# 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.
|
227
|
-
# 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
|
228
|
-
# 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.
|
229
|
-
# Normally there is no need to change the level parameter, just in a few special cases.
|
230
|
-
def render_subnavigation(options = {})
|
231
|
-
default_options = {
|
232
|
-
:from_page => @page,
|
233
|
-
:level => 2
|
234
|
-
}
|
235
|
-
options = default_options.merge(options)
|
236
|
-
if !options[:from_page].nil?
|
237
|
-
if (options[:from_page].children.blank? && options[:from_page].level > options[:level])
|
238
|
-
options = options.merge(:from_page => Page.find(options[:from_page].parent_id))
|
239
|
-
end
|
240
|
-
render_navigation(options)
|
241
|
-
else
|
242
|
-
return nil
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
# returns true if page is in the active branch
|
247
|
-
def page_active?(page)
|
248
|
-
@breadcrumb ||= breadcrumb(@page)
|
249
|
-
@breadcrumb.include?(page)
|
250
|
-
end
|
251
|
-
|
252
|
-
# Returns a HTML string for a linked breadcrumb from root to current page.
|
253
|
-
#
|
254
|
-
# == Options:
|
255
|
-
#
|
256
|
-
# :seperator => %(<span class="seperator">></span>) Maybe you don't want this seperator. Pass another one.
|
257
|
-
# :page => @page Pass a different Page instead of the default (@page).
|
258
|
-
# :without => nil Pass Pageobject or array of Pages that must not be displayed.
|
259
|
-
# :public_only => false Pass boolean for displaying hidden pages only.
|
260
|
-
# :visible_only => true Pass boolean for displaying (in navigation) visible pages only.
|
261
|
-
# :restricted_only => false Pass boolean for displaying restricted pages only.
|
262
|
-
# :reverse => false Pass boolean for displaying reversed breadcrumb.
|
263
|
-
#
|
264
|
-
def render_breadcrumb(options={})
|
265
|
-
default_options = {
|
266
|
-
:seperator => %(<span class="seperator">></span>),
|
267
|
-
:page => @page,
|
268
|
-
:without => nil,
|
269
|
-
:public_only => false,
|
270
|
-
:visible_only => true,
|
271
|
-
:restricted_only => false,
|
272
|
-
:reverse => false
|
273
|
-
}
|
274
|
-
options = default_options.merge(options)
|
275
|
-
pages = breadcrumb(options[:page])
|
276
|
-
pages.delete(Page.root)
|
277
|
-
unless options[:without].nil?
|
278
|
-
unless options[:without].class == Array
|
279
|
-
pages.delete(options[:without])
|
280
|
-
else
|
281
|
-
pages = pages - options[:without]
|
282
|
-
end
|
283
|
-
end
|
284
|
-
if options[:visible_only]
|
285
|
-
pages.reject! { |p| !p.visible? }
|
286
|
-
end
|
287
|
-
if options[:public_only]
|
288
|
-
pages.reject! { |p| !p.public? }
|
289
|
-
end
|
290
|
-
if options[:restricted_only]
|
291
|
-
pages.reject! { |p| !p.restricted? }
|
292
|
-
end
|
293
|
-
if options[:reverse]
|
294
|
-
pages.reverse!
|
295
|
-
end
|
296
|
-
bc = []
|
297
|
-
pages.each do |page|
|
298
|
-
urlname = page.urlname
|
299
|
-
css_class = page.name == @page.name ? "active" : nil
|
300
|
-
if page == pages.last
|
301
|
-
css_class = css_class.blank? ? "last" : [css_class, "last"].join(" ")
|
302
|
-
elsif page == pages.first
|
303
|
-
css_class = css_class.blank? ? "first" : [css_class, "first"].join(" ")
|
304
|
-
end
|
305
|
-
url = show_page_path(:urlname => urlname, :lang => multi_language? ? page.language_code : nil)
|
306
|
-
bc << link_to(h(page.name), url, :class => css_class, :title => page.title)
|
307
|
-
end
|
308
|
-
bc.join(options[:seperator]).html_safe
|
309
|
-
end
|
310
|
-
|
311
|
-
# Returns an array of all pages in the same branch from current.
|
312
|
-
# I.e. used to find the active page in navigation.
|
313
|
-
def breadcrumb(current)
|
314
|
-
return [] if current.nil?
|
315
|
-
result = Array.new
|
316
|
-
result << current
|
317
|
-
while current = current.parent
|
318
|
-
result << current
|
319
|
-
end
|
320
|
-
return result.reverse
|
321
|
-
end
|
322
|
-
|
323
|
-
# Returns @page.title
|
324
|
-
#
|
325
|
-
# The options are:
|
326
|
-
#
|
327
|
-
# :prefix => ""
|
328
|
-
# :seperator => "|"
|
329
|
-
#
|
330
|
-
# == Webdevelopers:
|
331
|
-
#
|
332
|
-
# Please use the render_meta_data() helper. There all important meta information gets rendered in one helper.
|
333
|
-
# So you dont have to worry about anything.
|
334
|
-
#
|
335
|
-
def render_page_title(options={})
|
336
|
-
default_options = {
|
337
|
-
:prefix => "",
|
338
|
-
:seperator => "|"
|
339
|
-
}
|
340
|
-
default_options.update(options)
|
341
|
-
unless @page.title.blank?
|
342
|
-
h("#{default_options[:prefix]} #{default_options[:seperator]} #{@page.title}")
|
343
|
-
else
|
344
|
-
h("")
|
345
|
-
end
|
346
|
-
end
|
347
|
-
|
348
|
-
# Returns a complete html <title> tag for the <head> part of the html document.
|
349
|
-
#
|
350
|
-
# == Webdevelopers:
|
351
|
-
#
|
352
|
-
# Please use the render_meta_data() helper. There all important meta information gets rendered in one helper.
|
353
|
-
# So you dont have to worry about anything.
|
354
|
-
#
|
355
|
-
def render_title_tag(options={})
|
356
|
-
default_options = {
|
357
|
-
:prefix => "",
|
358
|
-
:seperator => "|"
|
359
|
-
}
|
360
|
-
options = default_options.merge(options)
|
361
|
-
title = render_page_title(options)
|
362
|
-
%(<title>#{title}</title>).html_safe
|
363
|
-
end
|
364
|
-
|
365
|
-
# Renders a html <meta> tag for :name => "" and :content => ""
|
366
|
-
#
|
367
|
-
# == Webdevelopers:
|
368
|
-
#
|
369
|
-
# Please use the render_meta_data() helper. There all important meta information gets rendered in one helper.
|
370
|
-
# So you dont have to worry about anything.
|
371
|
-
#
|
372
|
-
def render_meta_tag(options={})
|
373
|
-
default_options = {
|
374
|
-
:name => "",
|
375
|
-
:default_language => "de",
|
376
|
-
:content => ""
|
377
|
-
}
|
378
|
-
options = default_options.merge(options)
|
379
|
-
lang = (@page.language.blank? ? options[:default_language] : @page.language.code)
|
380
|
-
%(<meta name="#{options[:name]}" content="#{options[:content]}" lang="#{lang}" />).html_safe
|
381
|
-
end
|
382
|
-
|
383
|
-
# Renders a html <meta http-equiv="Content-Language" content="#{lang}" /> for @page.language.
|
384
|
-
#
|
385
|
-
# == Webdevelopers:
|
386
|
-
#
|
387
|
-
# Please use the render_meta_data() helper. There all important meta information gets rendered in one helper.
|
388
|
-
# So you dont have to worry about anything.
|
389
|
-
#
|
390
|
-
def render_meta_content_language_tag(options={})
|
391
|
-
default_options = {
|
392
|
-
:default_language => "de"
|
393
|
-
}
|
394
|
-
options = default_options.merge(options)
|
395
|
-
lang = (@page.language_code.blank? ? options[:default_language] : @page.language_code)
|
396
|
-
%(<meta http-equiv="Content-Language" content="#{lang}" />).html_safe
|
397
|
-
end
|
398
|
-
|
399
|
-
# = This helper takes care of all important meta tags for your @page.
|
400
|
-
#
|
401
|
-
# 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.
|
402
|
-
#
|
403
|
-
# 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:
|
404
|
-
#
|
405
|
-
# Title = Homepage
|
406
|
-
# Description = Your page description
|
407
|
-
# Keywords: cms, ruby, rubyonrails, rails, software, development, html, javascript, ajax
|
408
|
-
#
|
409
|
-
# Then placing +render_meta_data(:title_prefix => "company", :title_seperator => "-")+ into the <head> part of the +pages.html.erb+ layout produces:
|
410
|
-
#
|
411
|
-
# <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
412
|
-
# <meta http-equiv="Content-Language" content="de" />
|
413
|
-
# <title>Company - #{@page.title}</title>
|
414
|
-
# <meta name="description" content="Your page description" />
|
415
|
-
# <meta name="keywords" content="cms, ruby, rubyonrails, rails, software, development, html, javascript, ajax" />
|
416
|
-
# <meta name="generator" content="Alchemy VERSION" />
|
417
|
-
# <meta name="date" content="Tue Dec 16 10:21:26 +0100 2008" />
|
418
|
-
# <meta name="robots" content="index, follow" />
|
419
|
-
#
|
420
|
-
def render_meta_data options={}
|
421
|
-
if @page.blank?
|
422
|
-
warning("No Page found!")
|
423
|
-
return nil
|
424
|
-
end
|
425
|
-
default_options = {
|
426
|
-
:title_prefix => "",
|
427
|
-
:title_seperator => "|",
|
428
|
-
:default_lang => "de"
|
429
|
-
}
|
430
|
-
options = default_options.merge(options)
|
431
|
-
#render meta description of the root page from language if the current meta description is empty
|
432
|
-
if @page.meta_description.blank?
|
433
|
-
description = Page.find_by_language_root_and_language_id(true, session[:language_id]).meta_description rescue ""
|
434
|
-
else
|
435
|
-
description = @page.meta_description
|
436
|
-
end
|
437
|
-
#render meta keywords of the root page from language if the current meta keywords is empty
|
438
|
-
if @page.meta_keywords.blank?
|
439
|
-
keywords = Page.find_by_language_root_and_language_id(true, session[:language_id]).meta_keywords rescue ""
|
440
|
-
else
|
441
|
-
keywords = @page.meta_keywords
|
442
|
-
end
|
443
|
-
robot = "#{@page.robot_index? ? "" : "no"}index, #{@page.robot_follow? ? "" : "no"}follow"
|
444
|
-
meta_string = %(
|
445
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
446
|
-
#{render_meta_content_language_tag}
|
447
|
-
#{render_title_tag( :prefix => options[:title_prefix], :seperator => options[:title_seperator])}
|
448
|
-
#{render_meta_tag( :name => "description", :content => description)}
|
449
|
-
#{render_meta_tag( :name => "keywords", :content => keywords)}
|
450
|
-
<meta name="generator" content="Alchemy #{Alchemy::VERSION}" />
|
451
|
-
<meta name="date" content="#{@page.updated_at}" />
|
452
|
-
<meta name="robots" content="#{robot}" />
|
453
|
-
)
|
454
|
-
if @page.contains_feed?
|
455
|
-
meta_string += %(
|
456
|
-
<link rel="alternate" type="application/rss+xml" title="RSS" href="#{multi_language? ? show_page_url(:protocol => 'feed', :urlname => @page.urlname, :lang => @page.language_code, :format => :rss) : show_page_url(:protocol => 'feed', :urlname => @page.urlname, :format => :rss)}" />
|
457
|
-
)
|
458
|
-
end
|
459
|
-
return meta_string.html_safe
|
460
|
-
end
|
461
|
-
|
462
|
-
# This helper returns a path for use inside a link_to helper.
|
463
|
-
#
|
464
|
-
# You may pass a page_layout or an urlname.
|
465
|
-
# Any additional options are passed to the url_helper, so you can add arguments to your url.
|
466
|
-
#
|
467
|
-
# Example:
|
468
|
-
#
|
469
|
-
# <%= link_to '» order now', page_path_for(:page_layout => 'orderform', :product_id => element.id) %>
|
470
|
-
#
|
471
|
-
def page_path_for(options={})
|
472
|
-
return warning("No page_layout, or urlname given. I got #{options.inspect} ") if options[:page_layout].blank? && options[:urlname].blank?
|
473
|
-
if options[:urlname].blank?
|
474
|
-
page = Page.find_by_page_layout(options[:page_layout])
|
475
|
-
return warning("No page found for #{options.inspect} ") if page.blank?
|
476
|
-
urlname = page.urlname
|
477
|
-
else
|
478
|
-
urlname = options[:urlname]
|
479
|
-
end
|
480
|
-
show_page_path({:urlname => urlname, :lang => multi_language? ? session[:language_code] : nil}.merge(options.except(:page_layout, :urlname, :lang)))
|
481
|
-
end
|
482
|
-
|
483
|
-
# Renders the partial for the cell with the given name of the current page.
|
484
|
-
# Cell partials are located in +app/views/cells/+ of your project.
|
485
|
-
def render_cell(name)
|
486
|
-
cell = @page.cells.find_by_name(name)
|
487
|
-
return "" if cell.blank?
|
488
|
-
render :partial => "cells/#{name}", :locals => {:cell => cell}
|
489
|
-
end
|
490
|
-
|
491
|
-
# Returns true or false if no elements are in the cell found by name.
|
492
|
-
def cell_empty?(name)
|
493
|
-
cell = @page.cells.find_by_name(name)
|
494
|
-
return true if cell.blank?
|
495
|
-
cell.elements.blank?
|
496
|
-
end
|
497
|
-
|
498
|
-
# Include this in your layout file to have element selection magic in the page edit preview window.
|
499
|
-
def alchemy_preview_mode_code
|
500
|
-
javascript_include_tag("alchemy/alchemy.preview") if @preview_mode
|
501
|
-
end
|
502
|
-
|
503
|
-
end
|