refinerycms-core 1.0.11 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{public → app/assets/images}/favicon.ico +0 -0
- data/{public → app/assets}/images/refinery/add.png +0 -0
- data/{public → app/assets}/images/refinery/admin_bg.png +0 -0
- data/{public → app/assets}/images/refinery/ajax-loader.gif +0 -0
- data/{public → app/assets}/images/refinery/branch-end.gif +0 -0
- data/{public → app/assets}/images/refinery/branch-start.gif +0 -0
- data/{public → app/assets}/images/refinery/branch.gif +0 -0
- data/{public → app/assets}/images/refinery/carousel-left.png +0 -0
- data/{public → app/assets}/images/refinery/carousel-right.png +0 -0
- data/{public → app/assets}/images/refinery/cross.png +0 -0
- data/{public → app/assets}/images/refinery/dialogLoadingAnimation.gif +0 -0
- data/{public → app/assets}/images/refinery/header_background.png +0 -0
- data/{public → app/assets}/images/refinery/hover-gradient.jpg +0 -0
- data/{public → app/assets}/images/refinery/icons/accept.png +0 -0
- data/{public → app/assets}/images/refinery/icons/add.png +0 -0
- data/{public → app/assets}/images/refinery/icons/ajax-loader.gif +0 -0
- data/{public → app/assets}/images/refinery/icons/application_edit.png +0 -0
- data/{public → app/assets}/images/refinery/icons/application_go.png +0 -0
- data/{public → app/assets}/images/refinery/icons/arrow_left.png +0 -0
- data/{public → app/assets}/images/refinery/icons/arrow_switch.png +0 -0
- data/{public → app/assets}/images/refinery/icons/arrow_up.png +0 -0
- data/{public → app/assets}/images/refinery/icons/bin.png +0 -0
- data/{public → app/assets}/images/refinery/icons/bin_closed.png +0 -0
- data/{public → app/assets}/images/refinery/icons/cancel.png +0 -0
- data/{public → app/assets}/images/refinery/icons/cog_add.png +0 -0
- data/{public → app/assets}/images/refinery/icons/cog_edit.png +0 -0
- data/{public → app/assets}/images/refinery/icons/cross.png +0 -0
- data/{public → app/assets}/images/refinery/icons/delete.png +0 -0
- data/{public → app/assets}/images/refinery/icons/doc.png +0 -0
- data/{public → app/assets}/images/refinery/icons/down.gif +0 -0
- data/{public → app/assets}/images/refinery/icons/edit.png +0 -0
- data/{public → app/assets}/images/refinery/icons/email.png +0 -0
- data/{public → app/assets}/images/refinery/icons/email_edit.png +0 -0
- data/{public → app/assets}/images/refinery/icons/email_go.png +0 -0
- data/{public → app/assets}/images/refinery/icons/email_open.png +0 -0
- data/{public → app/assets}/images/refinery/icons/eye.png +0 -0
- data/app/assets/images/refinery/icons/folder.png +0 -0
- data/app/assets/images/refinery/icons/folder_open.png +0 -0
- data/{public → app/assets}/images/refinery/icons/folder_page_white.png +0 -0
- data/{public → app/assets}/images/refinery/icons/image_add.png +0 -0
- data/{public → app/assets}/images/refinery/icons/image_edit.png +0 -0
- data/{public → app/assets}/images/refinery/icons/img.png +0 -0
- data/{public → app/assets}/images/refinery/icons/information.png +0 -0
- data/{public → app/assets}/images/refinery/icons/layout_add.png +0 -0
- data/{public → app/assets}/images/refinery/icons/layout_edit.png +0 -0
- data/{public → app/assets}/images/refinery/icons/music.png +0 -0
- data/app/assets/images/refinery/icons/page.png +0 -0
- data/{public → app/assets}/images/refinery/icons/page_add.png +0 -0
- data/{public → app/assets}/images/refinery/icons/page_edit.png +0 -0
- data/{public → app/assets}/images/refinery/icons/page_white_edit.png +0 -0
- data/{public → app/assets}/images/refinery/icons/page_white_gear.png +0 -0
- data/{public → app/assets}/images/refinery/icons/page_white_put.png +0 -0
- data/{public → app/assets}/images/refinery/icons/pdf.png +0 -0
- data/{public → app/assets}/images/refinery/icons/ppt.png +0 -0
- data/{public → app/assets}/images/refinery/icons/star.png +0 -0
- data/{public → app/assets}/images/refinery/icons/tick.png +0 -0
- data/{public → app/assets}/images/refinery/icons/up.gif +0 -0
- data/{public → app/assets}/images/refinery/icons/user_add.png +0 -0
- data/{public → app/assets}/images/refinery/icons/user_comment.png +0 -0
- data/{public → app/assets}/images/refinery/icons/user_edit.png +0 -0
- data/{public → app/assets}/images/refinery/icons/xls.png +0 -0
- data/{public → app/assets}/images/refinery/icons/zip.png +0 -0
- data/{public → app/assets}/images/refinery/icons/zoom.png +0 -0
- data/{public → app/assets}/images/refinery/logo-large.png +0 -0
- data/{public → app/assets}/images/refinery/logo-medium.png +0 -0
- data/{public → app/assets}/images/refinery/logo-site-bar.png +0 -0
- data/{public → app/assets}/images/refinery/logo-small-medium.png +0 -0
- data/{public → app/assets}/images/refinery/logo-small.png +0 -0
- data/{public → app/assets}/images/refinery/logo-tiny.png +0 -0
- data/{public → app/assets}/images/refinery/logo.png +0 -0
- data/{public → app/assets}/images/refinery/nav-3-background.gif +0 -0
- data/{public → app/assets}/images/refinery/nav_inactive_background.png +0 -0
- data/{public → app/assets}/images/refinery/orange_button.png +0 -0
- data/{public → app/assets}/images/refinery/page_bg.png +0 -0
- data/{public → app/assets}/images/refinery/resolve_digital_footer_logo.png +0 -0
- data/{public → app/assets}/images/refinery/text_field_background.png +0 -0
- data/{public → app/assets}/images/refinery/tooltip-nib.gif +0 -0
- data/{public → app/assets}/images/refinery/tooltip-nib.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/arrow_redo.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/arrow_undo.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/eye.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/article.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/aside.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/blockquote.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/command.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/details.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/figcaption.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/figure.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/footer.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/h1.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/h2.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/h3.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/h4.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/h5.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/h6.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/header.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/hgroup.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/mark.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/meter.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/nav.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/p.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/pre.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/progress.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/readme.md +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/rp.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/rt.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/ruby.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/section.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/summary.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/html5/time.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/iframe/lbl-blockquote.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/iframe/lbl-h1.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/iframe/lbl-h2.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/iframe/lbl-h3.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/iframe/lbl-h4.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/iframe/lbl-h5.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/iframe/lbl-h6.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/iframe/lbl-p.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/iframe/lbl-pre.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/link_add.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/link_break.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/page_code.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/page_paste.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/photo_add.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/right.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/style.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/table_add.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_align_center.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_align_justify.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_align_left.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_align_right.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_bold.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_heading_1.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_heading_2.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_heading_3.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_heading_4.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_heading_5.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_heading_6.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_indent.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_indent_remove.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_italic.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_list_bullets.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_list_numbers.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_paragraph.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_strikethrough.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_subscript.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_superscript.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/refinery/text_underline.png +0 -0
- data/{public → app/assets}/images/wymeditor/skins/wymeditor_icon.png +0 -0
- data/{public → app/assets}/javascripts/admin.js +1 -2
- data/{public → app/assets}/javascripts/application.js +0 -0
- data/{public → app/assets}/javascripts/dd_belatedpng.js +0 -0
- data/{public → app/assets}/javascripts/jquery/GPL-LICENSE.txt +0 -0
- data/{public → app/assets}/javascripts/jquery/MIT-LICENSE.txt +0 -0
- data/{public → app/assets}/javascripts/jquery/jquery.corner.js +0 -0
- data/{public → app/assets}/javascripts/jquery/jquery.html5-placeholder-shim.js +0 -0
- data/{public → app/assets}/javascripts/jquery/jquery.jcarousel.js +0 -0
- data/{public → app/assets}/javascripts/jquery/jquery.textTruncate.js +0 -0
- data/{public → app/assets}/javascripts/jquery/jquery.timers.js +0 -0
- data/app/assets/javascripts/modernizr-min.js +4 -0
- data/{public/javascripts/refinery/admin.js → app/assets/javascripts/refinery/admin.js.erb} +121 -209
- data/app/assets/javascripts/refinery/ajaxy_pagination.js.coffee +13 -0
- data/{public/javascripts/refinery/boot_wym.js → app/assets/javascripts/refinery/boot_wym.js.erb} +8 -8
- data/{public → app/assets}/javascripts/refinery/core.js +1 -1
- data/app/assets/javascripts/refinery/interface.js.coffee.erb +70 -0
- data/app/assets/javascripts/refinery/modal_dialogs.js.erb +142 -0
- data/app/assets/javascripts/refinery/nestedsortables.js +356 -0
- data/app/assets/javascripts/refinery/refinery.js.erb +20 -0
- data/app/assets/javascripts/refinery/serializelist.js +68 -0
- data/{public → app/assets}/javascripts/refinery/site_bar.js +0 -0
- data/app/assets/javascripts/refinery/sortable_menu.js.coffee +21 -0
- data/{public/javascripts/refinery/submenu.js → app/assets/javascripts/refinery/submenu.js.erb} +1 -1
- data/app/assets/javascripts/refinery/submit_continue.js.coffee.erb +8 -0
- data/app/assets/javascripts/refinery/tree.js +25 -0
- data/app/assets/javascripts/refinery/wymeditor.js +37 -0
- data/app/assets/javascripts/wymeditor/browsers/ie.js.erb +224 -0
- data/app/assets/javascripts/wymeditor/browsers/mozilla.js.erb +293 -0
- data/app/assets/javascripts/wymeditor/browsers/opera.js.erb +123 -0
- data/app/assets/javascripts/wymeditor/browsers/webkit.js.erb +284 -0
- data/app/assets/javascripts/wymeditor/classes.js.erb +1577 -0
- data/app/assets/javascripts/wymeditor/functions.js.erb +218 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/bg.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/ca.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/cs.js +12 -1
- data/{public → app/assets}/javascripts/wymeditor/lang/da.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/de.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/en.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/es.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/fa.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/fi.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/fr.js +13 -1
- data/{public → app/assets}/javascripts/wymeditor/lang/he.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/hu.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/it.js +0 -0
- data/{public/javascripts/wymeditor/lang/jp.js → app/assets/javascripts/wymeditor/lang/ja.js} +1 -1
- data/{public → app/assets}/javascripts/wymeditor/lang/lv.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/nb.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/nl.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/nn.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/pl.js +0 -0
- data/app/assets/javascripts/wymeditor/lang/pt-BR.js +58 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/pt.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/rs.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/ru.js +14 -3
- data/{public → app/assets}/javascripts/wymeditor/lang/sk.js +12 -1
- data/{public → app/assets}/javascripts/wymeditor/lang/sl.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/sv.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/tr.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/vi.js +0 -0
- data/{public → app/assets}/javascripts/wymeditor/lang/zh_cn.js +0 -0
- data/app/assets/javascripts/wymeditor/prototypes.js.erb +1106 -0
- data/app/assets/javascripts/wymeditor/setup.js.erb +622 -0
- data/{public → app/assets}/javascripts/wymeditor/skins/refinery/skin.js +0 -0
- data/app/assets/javascripts/wymeditor/validators.js.erb +776 -0
- data/{public/stylesheets/refinery/home.css → app/assets/stylesheets/.gitkeep} +0 -0
- data/app/assets/stylesheets/application.css.scss +55 -0
- data/{public/stylesheets/refinery/formatting.css → app/assets/stylesheets/formatting.css.scss} +20 -23
- data/{public/stylesheets/home.css → app/assets/stylesheets/home.css.scss} +1 -2
- data/{public/stylesheets/refinery/refinery.css → app/assets/stylesheets/refinery/refinery.css.scss} +616 -654
- data/app/assets/stylesheets/refinery/site_bar.css.scss +92 -0
- data/app/assets/stylesheets/refinery/submenu.css.scss +24 -0
- data/app/assets/stylesheets/refinery/tooltips.css.scss +34 -0
- data/{public/stylesheets/refinery/ui.css → app/assets/stylesheets/refinery/ui.css.scss} +50 -54
- data/{public/stylesheets/refinery/theme.css → app/assets/stylesheets/theme.css.scss} +1 -1
- data/{public/stylesheets/wymeditor/skins/refinery/skin.css → app/assets/stylesheets/wymeditor/skins/refinery/skin.css.scss} +58 -58
- data/{public/stylesheets/wymeditor/skins/refinery/wymiframe.css → app/assets/stylesheets/wymeditor/skins/refinery/wymiframe.css.scss} +29 -29
- data/app/controllers/application_controller.rb +0 -1
- data/app/controllers/refinery/admin/dialogs_controller.rb +24 -0
- data/app/controllers/refinery/admin/refinery_core_controller.rb +14 -0
- data/app/controllers/{admin/base_controller.rb → refinery/admin_controller.rb} +2 -3
- data/app/controllers/refinery/fast_controller.rb +5 -1
- data/app/controllers/refinery/sitemap_controller.rb +20 -0
- data/app/helpers/application_helper.rb +1 -1
- data/app/helpers/refinery/custom_assets_helper.rb +11 -0
- data/app/helpers/refinery/html_truncation_helper.rb +23 -0
- data/app/helpers/refinery/image_helper.rb +37 -0
- data/app/helpers/refinery/menu_helper.rb +66 -0
- data/app/helpers/refinery/meta_helper.rb +52 -0
- data/app/helpers/refinery/pagination_helper.rb +14 -0
- data/app/helpers/refinery/site_bar_helper.rb +30 -0
- data/app/helpers/refinery/tag_helper.rb +20 -0
- data/app/helpers/refinery/translation_helper.rb +15 -0
- data/app/models/refinery/core/base_model.rb +11 -0
- data/app/views/layouts/application.html.erb +9 -9
- data/app/views/layouts/refinery/admin.html.erb +23 -0
- data/app/views/layouts/refinery/admin_dialog.html.erb +17 -0
- data/app/views/layouts/refinery/flash.html.erb +2 -0
- data/app/views/refinery/_content_page.html.erb +2 -0
- data/app/views/{shared → refinery}/_draft_page_message.html.erb +0 -0
- data/app/views/refinery/_footer.html.erb +4 -0
- data/app/views/{shared → refinery}/_google_analytics.html.erb +2 -2
- data/app/views/refinery/_head.html.erb +18 -0
- data/app/views/refinery/_header.html.erb +7 -0
- data/app/views/{shared → refinery}/_html_tag.html.erb +0 -0
- data/app/views/{shared → refinery}/_ie6check.html.erb +2 -2
- data/app/views/{shared → refinery}/_javascripts.html.erb +0 -0
- data/app/views/refinery/_menu.html.erb +20 -0
- data/app/views/refinery/_menu_branch.html.erb +19 -0
- data/app/views/refinery/_message.html.erb +7 -0
- data/app/views/{shared → refinery}/_no_script.html.erb +0 -0
- data/app/views/{shared → refinery}/_site_bar.html.erb +3 -3
- data/app/views/{shared → refinery}/admin/_continue_editing.html.erb +0 -0
- data/app/views/refinery/admin/_dialog_success.html.erb +5 -0
- data/app/views/{shared → refinery}/admin/_error_messages.html.erb +0 -0
- data/app/views/{shared → refinery}/admin/_form_actions.html.erb +11 -15
- data/app/views/refinery/admin/_head.html.erb +13 -0
- data/app/views/{shared → refinery}/admin/_image_picker.html.erb +8 -7
- data/app/views/refinery/admin/_javascripts.html.erb +8 -0
- data/app/views/refinery/admin/_make_sortable.html.erb +16 -0
- data/app/views/{admin → refinery/admin}/_menu.html.erb +4 -4
- data/app/views/{shared → refinery}/admin/_resource_picker.html.erb +14 -23
- data/app/views/{shared → refinery}/admin/_search.html.erb +1 -1
- data/app/views/{shared → refinery}/admin/_sortable_list.html.erb +0 -0
- data/app/views/{shared → refinery}/admin/_tabbed_fields.html.erb +2 -2
- data/app/views/{admin → refinery/admin}/dialogs/show.html.erb +0 -0
- data/app/views/refinery/sitemap/index.xml.builder +25 -0
- data/app/views/{wymiframe.html.erb → refinery/wymiframe.html.erb} +2 -3
- data/config/initializers/will_paginate_monkeypatch.rb +21 -0
- data/config/locales/bg.yml +24 -29
- data/config/locales/cs.yml +20 -25
- data/config/locales/da.yml +19 -24
- data/config/locales/de.yml +19 -24
- data/config/locales/el.yml +19 -24
- data/config/locales/en.yml +25 -31
- data/config/locales/es.yml +12 -17
- data/config/locales/fi.yml +22 -27
- data/config/locales/fr.yml +19 -24
- data/config/locales/it.yml +19 -40
- data/config/locales/{jp.yml → ja.yml} +25 -28
- data/config/locales/ko.yml +76 -0
- data/config/locales/lt.yml +19 -24
- data/config/locales/lv.yml +21 -26
- data/config/locales/nb.yml +19 -24
- data/config/locales/nl.yml +19 -24
- data/config/locales/pl.yml +19 -24
- data/config/locales/pt-BR.yml +19 -24
- data/config/locales/rs.yml +19 -25
- data/config/locales/ru.yml +37 -38
- data/config/locales/sk.yml +19 -24
- data/config/locales/sl.yml +12 -21
- data/config/locales/sv.yml +19 -24
- data/config/locales/vi.yml +19 -24
- data/config/locales/zh-CN.yml +19 -24
- data/config/locales/zh-TW.yml +19 -24
- data/config/routes.rb +5 -10
- data/lib/generators/refinery/clash_keywords.yml +3 -0
- data/lib/generators/refinery/cms/cms_generator.rb +238 -0
- data/lib/generators/{templates → refinery/cms/templates}/.gitignore +3 -1
- data/lib/generators/refinery/cms/templates/app/decorators/controllers/refinery/.gitkeep +0 -0
- data/lib/generators/refinery/cms/templates/app/decorators/models/refinery/.gitkeep +0 -0
- data/lib/generators/{templates → refinery/cms/templates}/app/views/sitemap/index.xml.builder +1 -1
- data/lib/generators/{templates → refinery/cms/templates}/config/database.yml.mysql +5 -5
- data/lib/generators/{templates → refinery/cms/templates}/config/database.yml.postgresql +26 -25
- data/lib/generators/{templates → refinery/cms/templates}/config/database.yml.sqlite3 +1 -9
- data/lib/generators/refinery/cms/templates/config/initializers/devise.rb +229 -0
- data/lib/generators/refinery/core/core_generator.rb +9 -0
- data/lib/generators/refinery/core/templates/config/initializers/refinery/core.rb.erb +48 -0
- data/lib/generators/refinery/dummy/dummy_generator.rb +86 -0
- data/lib/generators/refinery/dummy/templates/rails/Rakefile +7 -0
- data/lib/generators/refinery/dummy/templates/rails/application.rb +14 -0
- data/lib/generators/refinery/dummy/templates/rails/boot.rb +6 -0
- data/lib/generators/refinery/dummy/templates/rails/database.yml +34 -0
- data/lib/generators/refinery/dummy/templates/rails/routes.rb +3 -0
- data/lib/generators/refinery/engine/USAGE +24 -0
- data/lib/generators/refinery/engine/engine_generator.rb +36 -0
- data/lib/generators/refinery/engine/templates/Gemfile +69 -0
- data/lib/generators/refinery/engine/templates/Guardfile +27 -0
- data/lib/generators/refinery/engine/templates/Rakefile +20 -0
- data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb +14 -0
- data/lib/generators/refinery/engine/templates/app/controllers/refinery/namespace/plural_name_controller.rb +34 -0
- data/lib/generators/refinery/engine/templates/app/models/refinery/namespace/singular_name.rb +28 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_actions.html.erb +25 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_form.html.erb +67 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_locale_picker.html.erb +11 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_plural_name.html.erb +2 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +18 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_singular_name.html.erb +32 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/_sortable_list.html.erb +5 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/edit.html.erb +1 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/index.html.erb +7 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/admin/plural_name/new.html.erb +1 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/plural_name/index.html.erb +11 -0
- data/lib/generators/refinery/engine/templates/app/views/refinery/namespace/plural_name/show.html.erb +39 -0
- data/lib/generators/refinery/engine/templates/config/locales/en.yml +28 -0
- data/lib/generators/refinery/engine/templates/config/locales/es.yml +29 -0
- data/lib/generators/refinery/engine/templates/config/locales/fr.yml +28 -0
- data/lib/generators/refinery/engine/templates/config/locales/nb.yml +28 -0
- data/lib/generators/refinery/engine/templates/config/locales/nl.yml +28 -0
- data/lib/generators/refinery/engine/templates/config/routes.rb +19 -0
- data/lib/generators/refinery/engine/templates/db/migrate/1_create_namespace_plural_name.rb +39 -0
- data/lib/generators/refinery/engine/templates/db/seeds.rb +23 -0
- data/lib/generators/refinery/engine/templates/lib/generators/refinery/extension_plural_name_generator.rb +18 -0
- data/lib/generators/refinery/engine/templates/lib/refinery/plural_name/engine.rb +30 -0
- data/lib/generators/refinery/engine/templates/lib/refinery/plural_name.rb +21 -0
- data/lib/generators/refinery/engine/templates/lib/refinerycms-extension_plural_name.rb +1 -0
- data/lib/generators/refinery/engine/templates/lib/tasks/refinery/extension_plural_name.rake +13 -0
- data/lib/generators/refinery/engine/templates/readme.md +10 -0
- data/lib/generators/refinery/engine/templates/refinerycms-extension_plural_name.gemspec +18 -0
- data/lib/generators/refinery/engine/templates/spec/models/refinery/namespace/singular_name_spec.rb +20 -0
- data/lib/generators/refinery/engine/templates/spec/requests/refinery/namespace/admin/plural_name_spec.rb +200 -0
- data/lib/generators/refinery/engine/templates/spec/spec_helper.rb +50 -0
- data/lib/generators/refinery/engine/templates/spec/support/factories/refinery/plural_name.rb +7 -0
- data/lib/generators/refinery/engine/templates/tasks/rspec.rake +6 -0
- data/lib/generators/refinery/engine/templates/tasks/testing.rake +8 -0
- data/lib/generators/refinery/form/USAGE +20 -0
- data/lib/generators/refinery/form/form_generator.rb +31 -0
- data/lib/generators/refinery/form/templates/.gitkeep +0 -0
- data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/admin/plural_name_controller.rb +54 -0
- data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/admin/settings_controller.rb +51 -0
- data/lib/generators/refinery/form/templates/app/controllers/refinery/namespace/plural_name_controller.rb +53 -0
- data/lib/generators/refinery/form/templates/app/mailers/refinery/namespace/mailer.rb +22 -0
- data/lib/generators/refinery/form/templates/app/models/refinery/namespace/setting.rb +34 -0
- data/lib/generators/refinery/form/templates/app/models/refinery/namespace/singular_name.rb +46 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_records.html.erb +23 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_singular_name.html.erb +25 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/_submenu.html.erb +29 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/index.html.erb +4 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/show.html.erb +52 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/plural_name/spam.html.erb +26 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/_confirmation_email_form.html.erb +51 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/_notification_recipients_form.html.erb +21 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/admin/settings/edit.html.erb +5 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/mailer/confirmation.html.erb +1 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/mailer/notification.html.erb +17 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/new.html.erb +43 -0
- data/lib/generators/refinery/form/templates/app/views/refinery/namespace/plural_name/thank_you.html.erb +1 -0
- data/lib/generators/refinery/form/templates/config/locales/da.yml +69 -0
- data/lib/generators/refinery/form/templates/config/locales/de.yml +78 -0
- data/lib/generators/refinery/form/templates/config/locales/en.yml +78 -0
- data/lib/generators/refinery/form/templates/config/locales/es.yml +70 -0
- data/lib/generators/refinery/form/templates/config/locales/fr.yml +78 -0
- data/lib/generators/refinery/form/templates/config/locales/it.yml +68 -0
- data/lib/generators/refinery/form/templates/config/locales/lv.yml +77 -0
- data/lib/generators/refinery/form/templates/config/locales/nb.yml +78 -0
- data/lib/generators/refinery/form/templates/config/locales/nl.yml +77 -0
- data/lib/generators/refinery/form/templates/config/locales/pt-BR.yml +78 -0
- data/lib/generators/refinery/form/templates/config/locales/ru.yml +80 -0
- data/lib/generators/refinery/form/templates/config/locales/sl.yml +69 -0
- data/lib/generators/refinery/form/templates/config/locales/zh-CN.yml +4 -0
- data/lib/generators/refinery/form/templates/config/routes.rb +26 -0
- data/lib/generators/refinery/form/templates/db/migrate/1_create_plural_name.rb +42 -0
- data/lib/generators/refinery/form/templates/db/seeds.rb +27 -0
- data/lib/generators/refinery/form/templates/lib/generators/refinery/plural_name_generator.rb +20 -0
- data/lib/generators/refinery/form/templates/lib/refinery/plural_name/engine.rb +30 -0
- data/lib/generators/refinery/form/templates/lib/refinery/plural_name.rb +17 -0
- data/lib/generators/refinery/form/templates/lib/refinerycms-plural_name.rb +1 -0
- data/lib/generators/refinery/form/templates/refinerycms-plural_name.gemspec +19 -0
- data/lib/refinery/activity.rb +75 -18
- data/lib/refinery/admin/base_controller.rb +49 -66
- data/lib/refinery/application_controller.rb +59 -79
- data/lib/refinery/base_presenter.rb +25 -23
- data/lib/refinery/catch_all_routes.rb +1 -1
- data/lib/refinery/cli.rb +162 -0
- data/lib/refinery/core/configuration.rb +57 -0
- data/lib/refinery/core/engine.rb +143 -0
- data/lib/refinery/core.rb +179 -0
- data/lib/refinery/crud.rb +74 -54
- data/lib/refinery/engine.rb +56 -12
- data/lib/refinery/errors.rb +13 -0
- data/lib/refinery/ext/action_view/helpers/form_builder.rb +7 -0
- data/lib/refinery/ext/action_view/helpers/form_helper.rb +20 -0
- data/lib/refinery/ext/action_view/helpers/form_tag_helper.rb +10 -0
- data/lib/refinery/extension_generation.rb +258 -0
- data/lib/refinery/menu.rb +0 -19
- data/lib/refinery/menu_item.rb +32 -14
- data/lib/refinery/plugin.rb +19 -43
- data/lib/refinery/plugins.rb +2 -2
- data/lib/refinery/version.rb +16 -0
- data/lib/refinerycms-core.rb +1 -175
- data/lib/tasks/refinery.rake +2 -191
- data/lib/tasks/yard.rake +1 -1
- data/refinerycms-core.gemspec +23 -422
- data/spec/controllers/refinery/admin/refinery_core_controller_spec.rb +20 -0
- data/spec/controllers/{fast_controller_spec.rb → refinery/fast_controller_spec.rb} +3 -1
- data/spec/controllers/refinery/sitemap_controller_spec.rb +28 -0
- data/spec/helpers/refinery/custom_assets_helper_spec.rb +53 -0
- data/spec/helpers/refinery/html_truncation_helper_spec.rb +26 -0
- data/spec/helpers/refinery/pagination_helper_spec.rb +35 -0
- data/spec/helpers/refinery/tag_helper_spec.rb +23 -0
- data/spec/helpers/refinery/translation_helper_spec.rb +14 -0
- data/spec/lib/generators/refinery/cms/cms_generator_spec.rb +47 -0
- data/spec/lib/generators/refinery/core/core_generator_spec.rb +29 -0
- data/spec/lib/generators/refinery/engine/engine_generator_spec.rb +84 -0
- data/spec/lib/generators/refinery/engine/engine_generator_with_i18n_spec.rb +85 -0
- data/spec/lib/generators/refinery/engine/engine_generator_without_frontend_spec.rb +77 -0
- data/spec/lib/generators/refinery/form/form_generator_spec.rb +91 -0
- data/spec/lib/refinery/activity_spec.rb +38 -0
- data/spec/lib/refinery/application_controller_spec.rb +28 -0
- data/spec/lib/refinery/core_spec.rb +176 -0
- data/spec/lib/refinery/plugin_spec.rb +36 -34
- data/spec/lib/refinery/plugins_spec.rb +42 -16
- data/spec/requests/refinery/admin/custom_assets_spec.rb +32 -0
- data/spec/requests/refinery/admin/dialogs_spec.rb +28 -0
- data/spec/requests/refinery/search_spec.rb +71 -0
- data/spec/requests/refinery/site_bar_spec.rb +49 -0
- data/spec/support/background_selenium_firefox_driver.rb +14 -0
- data/spec/support/database_cleaner.rb +15 -0
- data/spec/support/fixtures/invalid_engine.rb +6 -0
- data/spec/support/fixtures/valid_engine.rb +13 -0
- data/spec/support/refinery.rb +14 -0
- metadata +626 -439
- data/app/controllers/admin/dialogs_controller.rb +0 -23
- data/app/controllers/admin/refinery_core_controller.rb +0 -12
- data/app/controllers/sitemap_controller.rb +0 -18
- data/app/views/admin/_head.html.erb +0 -21
- data/app/views/admin/_javascripts.html.erb +0 -33
- data/app/views/layouts/admin.html.erb +0 -24
- data/app/views/layouts/admin_dialog.html.erb +0 -14
- data/app/views/shared/_content_page.html.erb +0 -63
- data/app/views/shared/_footer.html.erb +0 -4
- data/app/views/shared/_head.html.erb +0 -20
- data/app/views/shared/_header.html.erb +0 -7
- data/app/views/shared/_menu.html.erb +0 -19
- data/app/views/shared/_menu_branch.html.erb +0 -19
- data/app/views/shared/_message.html.erb +0 -10
- data/app/views/shared/admin/_make_sortable.html.erb +0 -13
- data/app/views/welcome.html.erb +0 -17
- data/config/locales/lolcat.yml +0 -71
- data/doc/included-jquery-ui-packages.jpg +0 -0
- data/features/dialogs.feature +0 -20
- data/features/search.feature +0 -55
- data/features/site_bar.feature +0 -27
- data/features/step_definitions/core_steps.rb +0 -59
- data/features/support/paths.rb +0 -18
- data/features/uploads/beach.jpeg +0 -0
- data/features/uploads/refinery_is_awesome.txt +0 -1
- data/lib/gemspec.rb +0 -44
- data/lib/generators/refinerycms_generator.rb +0 -124
- data/lib/generators/templates/autotest/autotest.rb +0 -17
- data/lib/generators/templates/autotest/discover.rb +0 -2
- data/lib/generators/templates/config/initializers/devise.rb +0 -144
- data/lib/generators/templates/db/seeds.rb +0 -5
- data/lib/refinery/admin_base_controller.rb +0 -5
- data/lib/refinery/application.rb +0 -47
- data/lib/refinery/application_helper.rb +0 -19
- data/lib/refinery/configuration.rb +0 -29
- data/lib/refinery/helpers/form_helper.rb +0 -66
- data/lib/refinery/helpers/head_helper.rb +0 -17
- data/lib/refinery/helpers/html_truncation_helper.rb +0 -25
- data/lib/refinery/helpers/image_helper.rb +0 -42
- data/lib/refinery/helpers/menu_helper.rb +0 -98
- data/lib/refinery/helpers/meta_helper.rb +0 -78
- data/lib/refinery/helpers/pagination_helper.rb +0 -16
- data/lib/refinery/helpers/script_helper.rb +0 -36
- data/lib/refinery/helpers/site_bar_helper.rb +0 -32
- data/lib/refinery/helpers/tag_helper.rb +0 -22
- data/lib/refinery/helpers/translation_helper.rb +0 -17
- data/lib/tasks/doc.rake +0 -29
- data/public/javascripts/i18n-messages.js +0 -2
- data/public/javascripts/jquery-min.js +0 -16
- data/public/javascripts/jquery-ui-custom-min.js +0 -252
- data/public/javascripts/jquery.js +0 -8374
- data/public/javascripts/modernizr-min.js +0 -2
- data/public/javascripts/rails.js +0 -297
- data/public/javascripts/refinery/i18n.js +0 -340
- data/public/javascripts/refinery/nestedsortables.js +0 -164
- data/public/javascripts/refinery/serializelist.js +0 -66
- data/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +0 -5262
- data/public/javascripts/wymeditor/lang/pt-BR.js +0 -47
- data/public/stylesheets/application.css +0 -4
- data/public/stylesheets/formatting.css +0 -4
- data/public/stylesheets/refinery/application.css +0 -76
- data/public/stylesheets/refinery/site_bar.css +0 -87
- data/public/stylesheets/refinery/submenu.css +0 -22
- data/public/stylesheets/refinery/tooltips.css +0 -34
- data/public/stylesheets/theme.css +0 -4
- data/spec/controllers/refinery_core_controller_spec.rb +0 -18
- data/spec/controllers/sitemap_controller_spec.rb +0 -27
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
require 'refinery/generators'
|
|
2
|
-
|
|
3
|
-
class RefinerycmsGenerator < ::Refinery::Generators::EngineInstaller
|
|
4
|
-
|
|
5
|
-
engine_name :refinerycms
|
|
6
|
-
source_root Pathname.new(File.expand_path('../templates', __FILE__))
|
|
7
|
-
|
|
8
|
-
class_option :update, :type => :boolean, :aliases => nil, :group => :runtime,
|
|
9
|
-
:desc => "Update an existing Refinery CMS based application"
|
|
10
|
-
|
|
11
|
-
def generate
|
|
12
|
-
# Ensure the generator doesn't output anything using 'puts'
|
|
13
|
-
self.silence_puts = true
|
|
14
|
-
|
|
15
|
-
# Only pretend to do the next actions if this is Refinery to stay DRY
|
|
16
|
-
if Rails.root == Refinery.root
|
|
17
|
-
say_status :'-- pretending to make changes that happen in an actual installation --', nil, :yellow
|
|
18
|
-
old_pretend = self.options[:pretend]
|
|
19
|
-
new_options = self.options.dup
|
|
20
|
-
new_options[:pretend] = true
|
|
21
|
-
self.options = new_options
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
unless self.options[:update]
|
|
25
|
-
# First, effectively move / rename files that get in the way of Refinery CMS
|
|
26
|
-
%w(public/index.html app/views/layouts/application.html.erb public/javascripts/rails.js).each do |roadblock|
|
|
27
|
-
if (roadblock_path = Rails.root.join(roadblock)).file?
|
|
28
|
-
create_file "#{roadblock}.backup",
|
|
29
|
-
:verbose => true do roadblock_path.read end
|
|
30
|
-
remove_file roadblock_path, :verbose => true
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# Copy asset files (JS, CSS) so they're ready to use.
|
|
35
|
-
%w(application.css formatting.css home.css theme.css).map{ |ss|
|
|
36
|
-
Refinery.roots('core').join('public', 'stylesheets', ss)
|
|
37
|
-
}.reject{|ss| !ss.file?}.each do |stylesheet|
|
|
38
|
-
copy_file stylesheet,
|
|
39
|
-
Rails.root.join('public', 'stylesheets', stylesheet.basename),
|
|
40
|
-
:verbose => true
|
|
41
|
-
end
|
|
42
|
-
copy_file Refinery.roots('core').join('public', 'javascripts', 'admin.js'),
|
|
43
|
-
Rails.root.join('public', 'javascripts', 'admin.js'),
|
|
44
|
-
:verbose => true
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
# Ensure the config.serve_static_assets setting is present and enabled
|
|
48
|
-
%w(development test production).map{|e| "config/environments/#{e}.rb"}.each do |env|
|
|
49
|
-
gsub_file env, %r{#.*config.serve_static_assets}, 'config.serve_static_assets', :verbose => false
|
|
50
|
-
|
|
51
|
-
gsub_file env, "serve_static_assets = false", "serve_static_assets = true # Refinery CMS requires this to be true", :verbose => false
|
|
52
|
-
|
|
53
|
-
unless (env_file_contents = Rails.root.join(env).read) =~ %r{Refinery.rescue_not_found}
|
|
54
|
-
append_file env, "Refinery.rescue_not_found = #{env.split('/').last.split('.rb').first == 'production'}\n"
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
unless env_file_contents =~ %r{Refinery.s3_backend}
|
|
58
|
-
s3_backend_string = ["# When true will use Amazon's Simple Storage Service on your production machine"]
|
|
59
|
-
s3_backend_string << "# instead of the default file system for resources and images"
|
|
60
|
-
s3_backend_string << "Refinery.s3_backend = !(ENV['S3_KEY'].nil? || ENV['S3_SECRET'].nil?)\n"
|
|
61
|
-
append_file env, s3_backend_string.join("\n")
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
# Stop pretending
|
|
66
|
-
if Rails.root == Refinery.root
|
|
67
|
-
say_status :'-- finished pretending --', nil, :yellow
|
|
68
|
-
new_options = self.options.dup
|
|
69
|
-
new_options[:pretend] = old_pretend
|
|
70
|
-
self.options = new_options
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
# Ensure .gitignore exists and append our rules to it.
|
|
74
|
-
create_file ".gitignore" unless Rails.root.join('.gitignore').file?
|
|
75
|
-
our_ignore_rules = self.class.source_root.join('.gitignore').read
|
|
76
|
-
our_ignore_rules = our_ignore_rules.split('# REFINERY CMS DEVELOPMENT').first if Rails.root != Refinery.root
|
|
77
|
-
append_file ".gitignore", our_ignore_rules
|
|
78
|
-
|
|
79
|
-
# If the admin/base_controller.rb file exists, ensure it does not do the old inheritance
|
|
80
|
-
if (admin_base = Rails.root.join('app', 'controllers', 'admin', 'base_controller.rb')).file?
|
|
81
|
-
gsub_file admin_base,
|
|
82
|
-
"# You can extend refinery backend with your own functions here and they will likely not get overriden in an update.",
|
|
83
|
-
"",
|
|
84
|
-
:verbose => self.options[:update]
|
|
85
|
-
|
|
86
|
-
gsub_file admin_base, "< Refinery::AdminBaseController", "< ActionController::Base",
|
|
87
|
-
:verbose => self.options[:update]
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
# Append seeds.
|
|
92
|
-
create_file "db/seeds.rb" unless Rails.root.join('db', 'seeds.rb').file?
|
|
93
|
-
append_file 'db/seeds.rb', :verbose => true do
|
|
94
|
-
self.class.source_root.join('db', 'seeds.rb').read
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
force_options = self.options.dup
|
|
98
|
-
force_options[:force] = self.options[:force] || self.options[:update]
|
|
99
|
-
self.options = force_options
|
|
100
|
-
# Seeds and migrations now need to be copied from their various engines.
|
|
101
|
-
existing_source_root = self.class.source_root
|
|
102
|
-
::Refinery::Plugins.registered.pathnames.reject{|p| !p.join('db').directory?}.each do |pathname|
|
|
103
|
-
self.class.source_root pathname
|
|
104
|
-
super
|
|
105
|
-
end
|
|
106
|
-
self.class.source_root existing_source_root
|
|
107
|
-
|
|
108
|
-
super
|
|
109
|
-
|
|
110
|
-
# The engine installer only installs database templates.
|
|
111
|
-
Pathname.glob(self.class.source_root.join('**', '*')).reject{|f|
|
|
112
|
-
f.directory? or f.to_s =~ /\/db\//
|
|
113
|
-
}.sort.each do |path|
|
|
114
|
-
copy_file path, path.to_s.gsub(self.class.source_root.to_s, Rails.root.to_s)
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
# Ensure i18n exists and is up to date.
|
|
118
|
-
if ::Refinery.i18n_enabled?
|
|
119
|
-
require 'generators/refinerycms_i18n_generator'
|
|
120
|
-
::RefinerycmsI18n.new.generate
|
|
121
|
-
end
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
### uncomment any of the following requires applicable for your system
|
|
2
|
-
### and then copy this to .autotest if you are using the ZenTest autotest.
|
|
3
|
-
# require "autotest/restart"
|
|
4
|
-
# require "test_notifier/runner/autotest"
|
|
5
|
-
# require "redgreen/autotest"
|
|
6
|
-
# require "autotest/timestamp"
|
|
7
|
-
|
|
8
|
-
# adds exceptions from .gitignore file, please modify exceptions there!
|
|
9
|
-
imported_exceptions = IO.readlines('.gitignore').inject([]) do |acc, line|
|
|
10
|
-
acc << line.strip if line.to_s[0] != '#' && line.strip != ''; acc
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
Autotest.add_hook :initialize do |autotest|
|
|
14
|
-
imported_exceptions.each do |exception|
|
|
15
|
-
autotest.add_exception(exception)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
require 'devise'
|
|
2
|
-
|
|
3
|
-
# Use this hook to configure devise mailer, warden hooks and so forth. The first
|
|
4
|
-
# four configuration values can also be set straight in your models.
|
|
5
|
-
::Devise.setup do |config|
|
|
6
|
-
# ==> Mailer Configuration
|
|
7
|
-
# Configure the e-mail address which will be shown in DeviseMailer.
|
|
8
|
-
config.mailer_sender = "please-change-me@config-initializers-devise.com"
|
|
9
|
-
|
|
10
|
-
# Configure the class responsible to send e-mails.
|
|
11
|
-
# config.mailer = "::Devise::Mailer"
|
|
12
|
-
|
|
13
|
-
# ==> ORM configuration
|
|
14
|
-
# Load and configure the ORM. Supports :active_record (default) and
|
|
15
|
-
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
|
16
|
-
# available as additional gems.
|
|
17
|
-
require 'devise/orm/active_record'
|
|
18
|
-
|
|
19
|
-
# ==> Configuration for any authentication mechanism
|
|
20
|
-
# Configure which keys are used when authenticating an user. By default is
|
|
21
|
-
# just :email. You can configure it to use [:username, :subdomain], so for
|
|
22
|
-
# authenticating an user, both parameters are required. Remember that those
|
|
23
|
-
# parameters are used only when authenticating and not when retrieving from
|
|
24
|
-
# session. If you need permissions, you should implement that in a before filter.
|
|
25
|
-
# config.authentication_keys = [ :email ]
|
|
26
|
-
|
|
27
|
-
# Tell if authentication through request.params is enabled. True by default.
|
|
28
|
-
# config.params_authenticatable = true
|
|
29
|
-
|
|
30
|
-
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
|
31
|
-
# config.http_authenticatable = false
|
|
32
|
-
|
|
33
|
-
# Set this to true to use Basic Auth for AJAX requests. True by default.
|
|
34
|
-
# config.http_authenticatable_on_xhr = true
|
|
35
|
-
|
|
36
|
-
# The realm used in Http Basic Authentication
|
|
37
|
-
# config.http_authentication_realm = "Application"
|
|
38
|
-
|
|
39
|
-
# ==> Configuration for :database_authenticatable
|
|
40
|
-
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
|
41
|
-
# using other encryptors, it sets how many times you want the password re-encrypted.
|
|
42
|
-
# config.stretches = 20
|
|
43
|
-
|
|
44
|
-
# Define which will be the encryption algorithm. Devise also supports encryptors
|
|
45
|
-
# from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
|
|
46
|
-
# you should set stretches above to 20 for default behavior) and :restful_authentication_sha1
|
|
47
|
-
# (then you should set stretches to 10, and copy REST_AUTH_SITE_KEY to pepper)
|
|
48
|
-
# config.encryptor = :bcrypt
|
|
49
|
-
|
|
50
|
-
# Setup a pepper to generate the encrypted password.
|
|
51
|
-
# config.pepper = "2e20a8abdd34d729ba6d05f679e513cfea9fbb1e83c81f84b29e9e4fdbd4ee59b56a32200064082a15a72b05a4d4a6a2c3784a09c0554b3a47a67cc8333ccbc7"
|
|
52
|
-
|
|
53
|
-
# ==> Configuration for :confirmable
|
|
54
|
-
# The time you want to give your user to confirm his account. During this time
|
|
55
|
-
# he will be able to access your application without confirming. Default is nil.
|
|
56
|
-
# When confirm_within is zero, the user won't be able to sign in without confirming.
|
|
57
|
-
# You can use this to let your user access some features of your application
|
|
58
|
-
# without confirming the account, but blocking it after a certain period
|
|
59
|
-
# (ie 2 days).
|
|
60
|
-
# config.confirm_within = 2.days
|
|
61
|
-
|
|
62
|
-
# ==> Configuration for :rememberable
|
|
63
|
-
# The time the user will be remembered without asking for credentials again.
|
|
64
|
-
# config.remember_for = 2.weeks
|
|
65
|
-
|
|
66
|
-
# If true, a valid remember token can be re-used between multiple browsers.
|
|
67
|
-
# config.remember_across_browsers = true
|
|
68
|
-
|
|
69
|
-
# If true, extends the user's remember period when remembered via cookie.
|
|
70
|
-
# config.extend_remember_period = false
|
|
71
|
-
|
|
72
|
-
# ==> Configuration for :validatable
|
|
73
|
-
# Range for password length
|
|
74
|
-
config.password_length = 4..20
|
|
75
|
-
|
|
76
|
-
# Regex to use to validate the email address
|
|
77
|
-
# config.email_regexp = /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i
|
|
78
|
-
|
|
79
|
-
# ==> Configuration for :timeoutable
|
|
80
|
-
# The time you want to timeout the user session without activity. After this
|
|
81
|
-
# time the user will be asked for credentials again.
|
|
82
|
-
# config.timeout_in = 10.minutes
|
|
83
|
-
|
|
84
|
-
# ==> Configuration for :lockable
|
|
85
|
-
# Defines which strategy will be used to lock an account.
|
|
86
|
-
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
|
87
|
-
# :none = No lock strategy. You should handle locking by yourself.
|
|
88
|
-
# config.lock_strategy = :failed_attempts
|
|
89
|
-
|
|
90
|
-
# Defines which strategy will be used to unlock an account.
|
|
91
|
-
# :email = Sends an unlock link to the user email
|
|
92
|
-
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
|
93
|
-
# :both = Enables both strategies
|
|
94
|
-
# :none = No unlock strategy. You should handle unlocking by yourself.
|
|
95
|
-
# config.unlock_strategy = :both
|
|
96
|
-
|
|
97
|
-
# Number of authentication tries before locking an account if lock_strategy
|
|
98
|
-
# is failed attempts.
|
|
99
|
-
# config.maximum_attempts = 20
|
|
100
|
-
|
|
101
|
-
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
|
102
|
-
# config.unlock_in = 1.hour
|
|
103
|
-
|
|
104
|
-
# ==> Configuration for :token_authenticatable
|
|
105
|
-
# Defines name of the authentication token params key
|
|
106
|
-
# config.token_authentication_key = :auth_token
|
|
107
|
-
|
|
108
|
-
# ==> Scopes configuration
|
|
109
|
-
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
|
110
|
-
# "users/sessions/new". It's turned off by default because it's slower if you
|
|
111
|
-
# are using only default views.
|
|
112
|
-
# config.scoped_views = true
|
|
113
|
-
|
|
114
|
-
# Configure the default scope given to Warden. By default it's the first
|
|
115
|
-
# devise role declared in your routes.
|
|
116
|
-
# config.default_scope = :user
|
|
117
|
-
|
|
118
|
-
# Configure sign_out behavior.
|
|
119
|
-
# By default sign_out is scoped (i.e. /users/sign_out affects only :user scope).
|
|
120
|
-
# In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
|
|
121
|
-
# config.sign_out_all_scopes = false
|
|
122
|
-
|
|
123
|
-
# ==> Navigation configuration
|
|
124
|
-
# Lists the formats that should be treated as navigational. Formats like
|
|
125
|
-
# :html, should redirect to the sign in page when the user does not have
|
|
126
|
-
# access, but formats like :xml or :json, should return 401.
|
|
127
|
-
# If you have any extra navigational formats, like :iphone or :mobile, you
|
|
128
|
-
# should add them to the navigational formats lists. Default is [:html]
|
|
129
|
-
# config.navigational_formats = [:html, :iphone]
|
|
130
|
-
|
|
131
|
-
# ==> Warden configuration
|
|
132
|
-
# If you want to use other strategies, that are not (yet) supported by Devise,
|
|
133
|
-
# you can configure them inside the config.warden block. The example below
|
|
134
|
-
# allows you to setup OAuth, using http://github.com/roman/warden_oauth
|
|
135
|
-
#
|
|
136
|
-
# config.warden do |manager|
|
|
137
|
-
# manager.oauth(:twitter) do |twitter|
|
|
138
|
-
# twitter.consumer_secret = <YOUR CONSUMER SECRET>
|
|
139
|
-
# twitter.consumer_key = <YOUR CONSUMER KEY>
|
|
140
|
-
# twitter.options :site => 'http://twitter.com'
|
|
141
|
-
# end
|
|
142
|
-
# manager.default_strategies(:scope => :user).unshift :twitter_oauth
|
|
143
|
-
# end
|
|
144
|
-
end
|
data/lib/refinery/application.rb
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
module Refinery
|
|
2
|
-
module Application
|
|
3
|
-
|
|
4
|
-
class << self
|
|
5
|
-
|
|
6
|
-
def refinery!
|
|
7
|
-
::Refinery.config.before_inclusion_procs.each(&:call)
|
|
8
|
-
|
|
9
|
-
::ApplicationHelper.send :include, ::Refinery::ApplicationHelper
|
|
10
|
-
|
|
11
|
-
[::ApplicationController, ::Admin::BaseController].each do |c|
|
|
12
|
-
c.send :include, ::Refinery::ApplicationController
|
|
13
|
-
c.send :helper, :application
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
::Admin::BaseController.send :include, ::Refinery::Admin::BaseController
|
|
17
|
-
|
|
18
|
-
::Refinery.config.after_inclusion_procs.each(&:call)
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def included(base)
|
|
22
|
-
self.instance_eval %(
|
|
23
|
-
def self.method_missing(method_sym, *arguments, &block)
|
|
24
|
-
#{base}.send(method_sym)
|
|
25
|
-
end
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
# JavaScript files you want as :defaults (application.js is always included).
|
|
29
|
-
base.config.action_view.javascript_expansions[:defaults] = %w()
|
|
30
|
-
|
|
31
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
|
32
|
-
base.config.encoding = 'utf-8'
|
|
33
|
-
|
|
34
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
|
35
|
-
base.config.filter_parameters += [:password, :password_confirmation]
|
|
36
|
-
|
|
37
|
-
# Specify a cache store to use
|
|
38
|
-
base.config.cache_store = :memory_store
|
|
39
|
-
|
|
40
|
-
# Include the refinery controllers and helpers dynamically
|
|
41
|
-
base.config.to_prepare do
|
|
42
|
-
::Refinery::Application.refinery!
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Methods added to this helper will be available to all templates in the application.
|
|
2
|
-
Dir[File.expand_path('../helpers/*.rb', __FILE__).to_s].each {|helper| require helper}
|
|
3
|
-
|
|
4
|
-
module Refinery
|
|
5
|
-
module ApplicationHelper
|
|
6
|
-
def self.included(base)
|
|
7
|
-
base.send :include, Refinery::Helpers::HeadHelper
|
|
8
|
-
base.send :include, Refinery::Helpers::HtmlTruncationHelper
|
|
9
|
-
base.send :include, Refinery::Helpers::ImageHelper
|
|
10
|
-
base.send :include, Refinery::Helpers::MenuHelper
|
|
11
|
-
base.send :include, Refinery::Helpers::MetaHelper
|
|
12
|
-
base.send :include, Refinery::Helpers::PaginationHelper
|
|
13
|
-
base.send :include, Refinery::Helpers::ScriptHelper
|
|
14
|
-
base.send :include, Refinery::Helpers::SiteBarHelper
|
|
15
|
-
base.send :include, Refinery::Helpers::TagHelper
|
|
16
|
-
base.send :include, Refinery::Helpers::TranslationHelper
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
module Refinery
|
|
2
|
-
class Configuration
|
|
3
|
-
|
|
4
|
-
def after_inclusion_procs
|
|
5
|
-
@@after_inclusion_procs ||= []
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def after_inclusion(&blk)
|
|
9
|
-
if blk && blk.respond_to?(:call)
|
|
10
|
-
after_inclusion_procs << blk
|
|
11
|
-
else
|
|
12
|
-
raise 'Anything added to be called before_inclusion must be callable.'
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def before_inclusion_procs
|
|
17
|
-
@@before_inclusion_procs ||= []
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def before_inclusion(&blk)
|
|
21
|
-
if blk && blk.respond_to?(:call)
|
|
22
|
-
before_inclusion_procs << blk
|
|
23
|
-
else
|
|
24
|
-
raise 'Anything added to be called before_inclusion must be callable.'
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
require 'action_view'
|
|
2
|
-
require 'action_view/helpers'
|
|
3
|
-
|
|
4
|
-
ActionView::Helpers::FormHelper.module_eval do
|
|
5
|
-
|
|
6
|
-
def required_label(object_name, method, text = nil, options = {})
|
|
7
|
-
options = {:class => "required"}.merge!(options)
|
|
8
|
-
|
|
9
|
-
label(object_name, method, "#{label_humanize_text(object_name, method, text)} *", options)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def label_humanize_text object_name, method, text = nil
|
|
14
|
-
content = text unless text.is_a?(Hash)
|
|
15
|
-
if content.blank?
|
|
16
|
-
content = object_name.classify.constantize.respond_to?(:human_attribute_name) ? object_name.classify.constantize.human_attribute_name(method) : method.to_s
|
|
17
|
-
else
|
|
18
|
-
content = content.to_s
|
|
19
|
-
end
|
|
20
|
-
content.humanize
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
ActionView::Helpers::FormBuilder.module_eval do
|
|
26
|
-
|
|
27
|
-
def required_label(method, text = nil, options = {})
|
|
28
|
-
@template.required_label(@object_name, method, text, objectify_options(options))
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
ActionView::Helpers::FormTagHelper.module_eval do
|
|
34
|
-
|
|
35
|
-
def required_label_tag(name, text = nil, options = {})
|
|
36
|
-
options = {:class => "required"}.merge!(options)
|
|
37
|
-
text ||= "#{name.to_s.humanize} *"
|
|
38
|
-
|
|
39
|
-
label_tag(name, text, options)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
# I18n labels automatically
|
|
45
|
-
module ActionView
|
|
46
|
-
module Helpers
|
|
47
|
-
class InstanceTag
|
|
48
|
-
def to_label_tag(text = nil, options = {})
|
|
49
|
-
options = options.stringify_keys
|
|
50
|
-
name_and_id = options.dup
|
|
51
|
-
add_default_name_and_id(name_and_id)
|
|
52
|
-
options.delete("index")
|
|
53
|
-
options["for"] ||= name_and_id["id"]
|
|
54
|
-
if text.blank?
|
|
55
|
-
content = method_name.humanize
|
|
56
|
-
if object.class.respond_to?(:human_attribute_name)
|
|
57
|
-
content = object.class.human_attribute_name(method_name)
|
|
58
|
-
end
|
|
59
|
-
else
|
|
60
|
-
content = text.to_s
|
|
61
|
-
end
|
|
62
|
-
label_tag(name_and_id["id"], content, options)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module Refinery
|
|
2
|
-
module Helpers
|
|
3
|
-
module HeadHelper
|
|
4
|
-
|
|
5
|
-
def stylesheets_for_head(stylesheets, theme = false)
|
|
6
|
-
# you can disable the use of the built-in refinery stylesheets by disabling the setting.
|
|
7
|
-
stylesheets.map! {|ss| ["refinery/#{ss}", ss] }.flatten! if RefinerySetting.find_or_set(:frontend_refinery_stylesheets_enabled, true)
|
|
8
|
-
|
|
9
|
-
# if theme is set, use themed stylesheet links.
|
|
10
|
-
stylesheets.map! {|ss| ss =~ /^refinery\// ? ss : "/theme/stylesheets/#{ss}" } if theme
|
|
11
|
-
|
|
12
|
-
stylesheets
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
require 'truncate_html'
|
|
2
|
-
|
|
3
|
-
module Refinery
|
|
4
|
-
module Helpers
|
|
5
|
-
module HtmlTruncationHelper
|
|
6
|
-
|
|
7
|
-
# Like the Rails _truncate_ helper but doesn't break HTML tags, entities, and words.
|
|
8
|
-
# <script> tags pass through and are not counted in the total.
|
|
9
|
-
# the omission specified _does_ count toward the total length count.
|
|
10
|
-
# use :link => link_to('more', post_path), or something to that effect
|
|
11
|
-
def truncate(text, options = {})
|
|
12
|
-
return unless text.present?
|
|
13
|
-
return super unless options.delete(:preserve_html_tags) == true # ensure preserve_html_tags doesn't pass through
|
|
14
|
-
|
|
15
|
-
max_length = options[:length] || 30
|
|
16
|
-
omission = options[:omission] || "..."
|
|
17
|
-
|
|
18
|
-
return truncate_html(text,
|
|
19
|
-
:length => max_length,
|
|
20
|
-
:word_boundary => true,
|
|
21
|
-
:omission => omission)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
require 'ostruct'
|
|
2
|
-
|
|
3
|
-
module Refinery
|
|
4
|
-
module Helpers
|
|
5
|
-
module ImageHelper
|
|
6
|
-
|
|
7
|
-
# replace all system images with a thumbnail version of them (handy for all images inside a page part)
|
|
8
|
-
# for example, <%= content_fu(@page[:body], '96x96#c') %> converts all /system/images to a 96x96 cropped thumbnail
|
|
9
|
-
def content_fu(content, thumbnail)
|
|
10
|
-
content.gsub(%r{<img.+?src=['"](/system/images/.+?)/.+?/>}) do |image_match|
|
|
11
|
-
begin
|
|
12
|
-
uid = Dragonfly::Job.from_path(
|
|
13
|
-
"#{image_match.match(%r{(/system/images/.+?)/})[1]}", Dragonfly[:images]
|
|
14
|
-
).uid
|
|
15
|
-
|
|
16
|
-
image_fu Image.where(:image_uid => uid).first, thumbnail
|
|
17
|
-
rescue
|
|
18
|
-
# FAIL, don't care why but return what we found initially.
|
|
19
|
-
image_match
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# image_fu is a helper for inserting an image that has been uploaded into a template.
|
|
25
|
-
# Say for example that we had a @model.image (@model having a belongs_to :image relationship)
|
|
26
|
-
# and we wanted to display a thumbnail cropped to 200x200 then we can use image_fu like this:
|
|
27
|
-
# <%= image_fu @model.image, '200x200' %> or with no thumbnail: <%= image_fu @model.image %>
|
|
28
|
-
def image_fu(image, geometry = nil, options={})
|
|
29
|
-
if image.present?
|
|
30
|
-
original_width = image.image_width
|
|
31
|
-
original_height = image.image_height
|
|
32
|
-
|
|
33
|
-
dimensions = (image.thumbnail_dimensions(geometry) rescue {})
|
|
34
|
-
|
|
35
|
-
image_tag(image.thumbnail(geometry).url, {
|
|
36
|
-
:alt => image.respond_to?(:title) ? image.title : image.image_name,
|
|
37
|
-
}.merge(dimensions).merge(options))
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
module Refinery
|
|
2
|
-
module Helpers
|
|
3
|
-
module MenuHelper
|
|
4
|
-
|
|
5
|
-
# Adds conditional caching
|
|
6
|
-
def cache_if(condition, name = {}, &block)
|
|
7
|
-
if condition
|
|
8
|
-
cache(name, &block)
|
|
9
|
-
else
|
|
10
|
-
yield
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# for <%= style helpers vs <% style
|
|
14
|
-
nil
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# This was extracted from app/views/shared/_menu_branch.html.erb
|
|
18
|
-
# to remove the complexity of that template by reducing logic in the view.
|
|
19
|
-
def css_for_menu_branch(item, counter, sibling_count = nil, collection = nil, selected_item = nil, warning = true)
|
|
20
|
-
|
|
21
|
-
Refinery.deprecate({
|
|
22
|
-
:what => 'css_for_menu_branch',
|
|
23
|
-
:when => '1.1',
|
|
24
|
-
:replacement => 'menu_branch_css(local_assigns)',
|
|
25
|
-
:caller => caller
|
|
26
|
-
}) if warning
|
|
27
|
-
|
|
28
|
-
Refinery.deprecate(:what => 'collection', :when => '1.1', :caller => caller) if collection
|
|
29
|
-
Refinery.deprecate(:what => 'selected_item', :when => '1.1', :caller => caller) if selected_item
|
|
30
|
-
|
|
31
|
-
css = []
|
|
32
|
-
css << "selected" if selected_page_or_descendant_page_selected?(item, collection, selected_item)
|
|
33
|
-
css << "first" if counter == 0
|
|
34
|
-
css << "last" if counter == (sibling_count ||= (item.shown_siblings.length - 1))
|
|
35
|
-
css
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
# New method which accepts the local_assigns hash.
|
|
39
|
-
# This maps to the older css_for_menu_branch method.
|
|
40
|
-
def menu_branch_css(local_assigns)
|
|
41
|
-
options = local_assigns.dup
|
|
42
|
-
options.update(:sibling_count => options[:menu_branch].shown_siblings.length) unless options[:sibling_count]
|
|
43
|
-
|
|
44
|
-
css_for_menu_branch(options[:menu_branch],
|
|
45
|
-
options[:menu_branch_counter],
|
|
46
|
-
options[:sibling_count],
|
|
47
|
-
options[:collection],
|
|
48
|
-
options[:selected_item], # TODO: DEPRECATED, remove at 1.1
|
|
49
|
-
false)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# Determines whether any page underneath the supplied page is the current page according to rails.
|
|
53
|
-
# Just calls selected_page? for each descendant of the supplied page.
|
|
54
|
-
# if you pass a collection it won't check its own descendants but use the collection supplied.
|
|
55
|
-
def descendant_page_selected?(page, collection = nil, selected_item = nil)
|
|
56
|
-
return false if page.rgt == page.lft + 1
|
|
57
|
-
return false unless selected_item.nil? or !selected_item.in_menu?
|
|
58
|
-
|
|
59
|
-
page.descendants.any? { |descendant|
|
|
60
|
-
!selected_item ? selected_page?(descendant) : selected_item == descendant
|
|
61
|
-
}
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def selected_page_or_descendant_page_selected?(page, collection = nil, selected_item = nil)
|
|
65
|
-
return true if selected_page?(page) || selected_item === page
|
|
66
|
-
return true if descendant_page_selected?(page, collection, selected_item)
|
|
67
|
-
false
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
# Determine whether the supplied page is the currently open page according to Refinery.
|
|
71
|
-
# Also checks whether Rails thinks it is selected after that using current_page?
|
|
72
|
-
def selected_page?(page)
|
|
73
|
-
path = request.path
|
|
74
|
-
path = path.force_encoding('utf-8') if path.respond_to?(:force_encoding)
|
|
75
|
-
|
|
76
|
-
# Ensure we match the path without the locale, if present.
|
|
77
|
-
if ::Refinery.i18n_enabled? and path =~ %r{^/#{::I18n.locale}/}
|
|
78
|
-
path = path.split(%r{^/#{::I18n.locale}}).last
|
|
79
|
-
path = "/" if path.blank?
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# First try to match against a "menu match" value, if available.
|
|
83
|
-
return true if page.try(:menu_match).present? && path =~ Regexp.new(page.menu_match)
|
|
84
|
-
|
|
85
|
-
# Find the first url that is a string.
|
|
86
|
-
url = [page.url]
|
|
87
|
-
url << ['', page.url[:path]].compact.flatten.join('/') if page.url.respond_to?(:keys)
|
|
88
|
-
url = url.detect{|u| u.is_a?(String)}
|
|
89
|
-
url.chomp!('/') if url.size > 1
|
|
90
|
-
|
|
91
|
-
# Now use all possible vectors to try to find a valid match,
|
|
92
|
-
# finally passing to rails' "current_page?" method.
|
|
93
|
-
[path, URI.decode(path)].include?(url) || path == "/#{page.id}" || current_page?(page)
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
end
|
|
97
|
-
end
|
|
98
|
-
end
|