forgeos_cms 1.9.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/LICENSE +2 -0
- data/README.textile +42 -0
- data/app/assets/images/forgeos/admin/favicon.gif +0 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/carousels.js +56 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/menus.js +93 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/overlay.js +86 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/trees.js +8 -0
- data/app/assets/javascripts/forgeos/admin/functions/forgeos_cms/widget_actualities.js +117 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/carousels.js +131 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/menus.js +294 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/overlays.js +71 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/trees.js +94 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/widget_actualities.js +23 -0
- data/app/assets/javascripts/forgeos/admin/inits/forgeos_cms/widget_faq.js +13 -0
- data/app/assets/stylesheets/forgeos/admin/base.css.sass +2 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_cms/_all.css.sass +1 -0
- data/app/assets/stylesheets/forgeos/admin/forgeos_cms/_blocks.css.sass +220 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/bubble-quantity-products.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/check-checked.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/check-unchecked.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/context.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/create.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/dark-blue-minus.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/dark-blue-plus.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/dot.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/f.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/fminus.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/fminus_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/folder.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/fplus.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/fplus_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/lastli.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/lastli_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/li.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/remove.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/rename.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/style.css.sass +219 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/association_page/throbber.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/brown-minus.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/brown-plus.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/bubble-quantity-products.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/context.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/create.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/dot.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/f.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/fminus.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/fminus_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/fplus.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/fplus_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/lastli.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/lastli_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/li.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/remove.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/rename.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/style.css.sass +138 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/block_category/throbber.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/big-drag-and-drop.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/bubble-quantity-products.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/check-checked.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/check-unchecked.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/context.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/create.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/dark-blue-minus.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/dark-blue-plus.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/dot.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/drag-drop.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/f.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/fminus.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/fminus_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/folder.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/fplus.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/fplus_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/lastli.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/lastli_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/li.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/remove.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/rename.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/style.css.sass +186 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/menu-tree/throbber.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/brown-minus.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/brown-plus.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/bubble-quantity-products.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/context.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/create.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/dot.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/f.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/fminus.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/fminus_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/fplus.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/fplus_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/lastli.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/lastli_rtl.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/li.gif +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/remove.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/rename.png +0 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/style.css.sass +138 -0
- data/app/assets/stylesheets/forgeos/jstree/themes/page_category/throbber.gif +0 -0
- data/app/controllers/actualities_controller.rb +11 -0
- data/app/controllers/admin/actualities_controller.rb +100 -0
- data/app/controllers/admin/base_controller.rb +11 -0
- data/app/controllers/admin/carousels_controller.rb +101 -0
- data/app/controllers/admin/import_controller.rb +20 -0
- data/app/controllers/admin/menus_controller.rb +104 -0
- data/app/controllers/admin/newsletters_controller.rb +110 -0
- data/app/controllers/admin/pages_controller.rb +169 -0
- data/app/controllers/admin/static_content_blocks_controller.rb +174 -0
- data/app/controllers/admin/statistics_controller.rb +29 -0
- data/app/controllers/admin/widget_actualities_controller.rb +101 -0
- data/app/controllers/admin/widget_faqs_controller.rb +71 -0
- data/app/controllers/admin/widgets_controller.rb +83 -0
- data/app/controllers/forgeos/application_controller.rb +21 -0
- data/app/controllers/newsletters_controller.rb +11 -0
- data/app/controllers/pages_controller.rb +24 -0
- data/app/controllers/search_controller.rb +7 -0
- data/app/helpers/application_helper.rb +43 -0
- data/app/helpers/menu_helper.rb +46 -0
- data/app/helpers/routes_helper.rb +19 -0
- data/app/models/actuality.rb +21 -0
- data/app/models/block.rb +65 -0
- data/app/models/block_category.rb +7 -0
- data/app/models/carousel.rb +14 -0
- data/app/models/carousel_item.rb +12 -0
- data/app/models/category_link.rb +2 -0
- data/app/models/comment.rb +6 -0
- data/app/models/external_link.rb +5 -0
- data/app/models/faq.rb +10 -0
- data/app/models/link_page.rb +2 -0
- data/app/models/menu.rb +30 -0
- data/app/models/menu_category.rb +7 -0
- data/app/models/menu_link.rb +57 -0
- data/app/models/newsletter.rb +5 -0
- data/app/models/page.rb +85 -0
- data/app/models/page_category.rb +11 -0
- data/app/models/page_col.rb +14 -0
- data/app/models/page_link.rb +17 -0
- data/app/models/page_sweeper.rb +54 -0
- data/app/models/static_content_block.rb +2 -0
- data/app/models/static_content_category.rb +2 -0
- data/app/models/widget.rb +2 -0
- data/app/models/widget_actuality.rb +19 -0
- data/app/models/widget_category.rb +2 -0
- data/app/models/widget_faq.rb +12 -0
- data/app/views/actualities/rss.rxml +20 -0
- data/app/views/admin/actualities/_form.html.haml +38 -0
- data/app/views/admin/actualities/_tabs.html.haml +5 -0
- data/app/views/admin/actualities/edit.html.haml +3 -0
- data/app/views/admin/actualities/index.html.haml +10 -0
- data/app/views/admin/actualities/index.json.erb +34 -0
- data/app/views/admin/actualities/new.html.haml +3 -0
- data/app/views/admin/blocks/_associated_pages.html.haml +33 -0
- data/app/views/admin/blocks/_tabs.html.haml +8 -0
- data/app/views/admin/carousels/_attachments_popups.html.haml +81 -0
- data/app/views/admin/carousels/_form.html.haml +95 -0
- data/app/views/admin/carousels/_form_item.html.haml +54 -0
- data/app/views/admin/carousels/_item.html.haml +25 -0
- data/app/views/admin/carousels/edit.html.haml +1 -0
- data/app/views/admin/carousels/new.html.haml +1 -0
- data/app/views/admin/carousels/show.html.haml +40 -0
- data/app/views/admin/categories/_block.html.haml +4 -0
- data/app/views/admin/categories/_list_blocks.html.haml +13 -0
- data/app/views/admin/categories/_list_pages.html.haml +13 -0
- data/app/views/admin/categories/_page.html.haml +2 -0
- data/app/views/admin/dashboard/index.html.haml +19 -0
- data/app/views/admin/menu_links/_show.html.haml +8 -0
- data/app/views/admin/menus/_empty_menu_link.html.haml +45 -0
- data/app/views/admin/menus/_form.html.haml +27 -0
- data/app/views/admin/menus/_form_menu_links.html.haml +60 -0
- data/app/views/admin/menus/_lang_switcher.html.haml +2 -0
- data/app/views/admin/menus/_tabs.html.haml +5 -0
- data/app/views/admin/menus/_types_popups.html.haml +21 -0
- data/app/views/admin/menus/edit.html.haml +1 -0
- data/app/views/admin/menus/index.html.haml +13 -0
- data/app/views/admin/menus/index.json.erb +31 -0
- data/app/views/admin/menus/new.html.haml +1 -0
- data/app/views/admin/menus/show.html.haml +22 -0
- data/app/views/admin/newsletters/_form.html.haml +19 -0
- data/app/views/admin/newsletters/_tabs.html.haml +3 -0
- data/app/views/admin/newsletters/edit.html.haml +2 -0
- data/app/views/admin/newsletters/index.html.haml +14 -0
- data/app/views/admin/newsletters/index.json.erb +22 -0
- data/app/views/admin/newsletters/new.html.haml +2 -0
- data/app/views/admin/pages/_block_popup.html.haml +18 -0
- data/app/views/admin/pages/_blocks.html.haml +29 -0
- data/app/views/admin/pages/_codes.html.haml +33 -0
- data/app/views/admin/pages/_form.html.haml +15 -0
- data/app/views/admin/pages/_general.html.haml +64 -0
- data/app/views/admin/pages/_seo.html.haml +31 -0
- data/app/views/admin/pages/_tabs.html.haml +5 -0
- data/app/views/admin/pages/_tabs_show.html.haml +9 -0
- data/app/views/admin/pages/edit.html.haml +1 -0
- data/app/views/admin/pages/index.html.haml +13 -0
- data/app/views/admin/pages/index.json.erb +37 -0
- data/app/views/admin/pages/new.html.haml +2 -0
- data/app/views/admin/pages/show.html.haml +100 -0
- data/app/views/admin/static_content_blocks/_form.html.haml +41 -0
- data/app/views/admin/static_content_blocks/edit.html.haml +1 -0
- data/app/views/admin/static_content_blocks/index.html.haml +16 -0
- data/app/views/admin/static_content_blocks/index.json.erb +28 -0
- data/app/views/admin/static_content_blocks/new.html.haml +1 -0
- data/app/views/admin/static_content_blocks/show.html.haml +23 -0
- data/app/views/admin/statistics/index.html.haml +57 -0
- data/app/views/admin/users/_tabs.html.haml +3 -0
- data/app/views/admin/widget_actualities/_form.html.haml +87 -0
- data/app/views/admin/widget_actualities/_form_item.html.haml +28 -0
- data/app/views/admin/widget_actualities/_item.html.haml +11 -0
- data/app/views/admin/widget_actualities/_tabs.html.haml +8 -0
- data/app/views/admin/widget_actualities/edit.html.haml +2 -0
- data/app/views/admin/widget_actualities/new.html.haml +2 -0
- data/app/views/admin/widget_actualities/show.html.haml +39 -0
- data/app/views/admin/widget_faqs/_form.html.haml +68 -0
- data/app/views/admin/widget_faqs/_tabs.html.haml +8 -0
- data/app/views/admin/widget_faqs/edit.html.haml +2 -0
- data/app/views/admin/widget_faqs/new.html.haml +2 -0
- data/app/views/admin/widgets/_tabs.html.haml +8 -0
- data/app/views/admin/widgets/index.html.haml +28 -0
- data/app/views/admin/widgets/index.json.erb +27 -0
- data/app/views/layouts/admin/_menu.html.haml +0 -0
- data/app/views/layouts/application.html.haml +21 -0
- data/app/views/pages/_linked_pages.html.haml +4 -0
- data/app/views/pages/_page.html.haml +15 -0
- data/app/views/pages/show.html.haml +9 -0
- data/app/views/search/index.html.haml +8 -0
- data/config/locales/activerecord/en.yml +48 -0
- data/config/locales/activerecord/fr.yml +77 -0
- data/config/locales/admin/actuality/en.yml +30 -0
- data/config/locales/admin/actuality/fr.yml +30 -0
- data/config/locales/admin/block/en.yml +38 -0
- data/config/locales/admin/block/fr.yml +38 -0
- data/config/locales/admin/carousel/en.yml +24 -0
- data/config/locales/admin/carousel/fr.yml +24 -0
- data/config/locales/admin/menu/en.yml +33 -0
- data/config/locales/admin/menu/fr.yml +38 -0
- data/config/locales/admin/newsletter/en.yml +30 -0
- data/config/locales/admin/newsletter/fr.yml +30 -0
- data/config/locales/admin/page/en.yml +77 -0
- data/config/locales/admin/page/fr.yml +77 -0
- data/config/locales/admin/section/en.yml +23 -0
- data/config/locales/admin/section/fr.yml +23 -0
- data/config/locales/admin/static_content_block/en.yml +43 -0
- data/config/locales/admin/static_content_block/fr.yml +42 -0
- data/config/locales/admin/widget/en.yml +34 -0
- data/config/locales/admin/widget/fr.yml +34 -0
- data/config/locales/admin/widget_actuality/en.yml +23 -0
- data/config/locales/admin/widget_actuality/fr.yml +23 -0
- data/config/locales/admin/widget_faq/en.yml +22 -0
- data/config/locales/admin/widget_faq/fr.yml +30 -0
- data/config/locales/common/en.yml +208 -0
- data/config/locales/common/fr.yml +209 -0
- data/config/routes.rb +73 -0
- data/db/fixtures/menu_link_translations.yml +5 -0
- data/db/fixtures/menu_links.yml +5 -0
- data/db/fixtures/menus.yml +3 -0
- data/db/fixtures/page_translations.yml +19 -0
- data/db/fixtures/pages.yml +5 -0
- data/db/fixtures/people.yml +11 -0
- data/db/migrate/20091009134405_create_actualities.rb +18 -0
- data/db/migrate/20091009134503_create_blocks.rb +15 -0
- data/db/migrate/20091009134510_create_blocks_pages.rb +13 -0
- data/db/migrate/20091009134518_create_carousel_items.rb +17 -0
- data/db/migrate/20091009134729_create_pages.rb +18 -0
- data/db/migrate/20091009134736_create_pages_links.rb +12 -0
- data/db/migrate/20091027153116_create_menus.rb +14 -0
- data/db/migrate/20091027153659_create_menu_links.rb +19 -0
- data/db/migrate/20091208113459_create_page_translations.rb +9 -0
- data/db/migrate/20091208113460_create_block_translations.rb +9 -0
- data/db/migrate/20091208113461_create_menu_link_translations.rb +9 -0
- data/db/migrate/20091208170256_remove_translations_to_page.rb +10 -0
- data/db/migrate/20091208170257_remove_translations_to_block.rb +9 -0
- data/db/migrate/20091208170258_remove_translations_to_menu_link.rb +9 -0
- data/db/migrate/20100203102853_add_actuality_translations.rb +9 -0
- data/db/migrate/20100203102914_add_carousel_item_translations.rb +9 -0
- data/db/migrate/20100203125804_remove_translated_columns_to_actualities.rb +9 -0
- data/db/migrate/20100203125820_remove_translated_columns_to_carousel_items.rb +10 -0
- data/db/migrate/20100405095844_create_page_cols_table.rb +12 -0
- data/db/migrate/20100405101416_create_blocks_page_cols.rb +13 -0
- data/db/migrate/20100407093551_create_table_translation_for_page_cols.rb +13 -0
- data/db/migrate/20100413134832_add_index_on_menu_links.rb +11 -0
- data/db/migrate/20100501150819_add_code_to_pages.rb +13 -0
- data/db/migrate/20100511161012_create_faqs.rb +13 -0
- data/db/migrate/20100526163534_add_popup_to_menu_link.rb +9 -0
- data/db/migrate/20100929183346_change_answer_type.rb +9 -0
- data/db/migrate/20101015095242_update_actualities.rb +11 -0
- data/db/migrate/20101216155044_create_newsletter.rb +12 -0
- data/db/migrate/20110310092311_add_indexes_to_menu.rb +9 -0
- data/db/migrate/20110408133955_add_summary_to_menu_link_translations.rb +7 -0
- data/lib/forgeos/admin_menu.rb +14 -0
- data/lib/forgeos/cms.rb +8 -0
- data/lib/forgeos/cms/engine.rb +8 -0
- data/lib/forgeos/cms/statistics.rb +16 -0
- data/lib/forgeos_cms.rb +3 -0
- data/lib/tasks/install.rake +9 -0
- data/lib/tasks/upgrade.rake +22 -0
- data/recipes/deploy.rb +14 -0
- metadata +375 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
class Admin::NewslettersController < Admin::BaseController
|
|
2
|
+
before_filter :get_newsletter, :only => [:edit, :destroy, :show, :update, :activate, :duplicate]
|
|
3
|
+
before_filter :new_newsletter, :only => [:new, :create]
|
|
4
|
+
|
|
5
|
+
def index
|
|
6
|
+
respond_to do |format|
|
|
7
|
+
format.html
|
|
8
|
+
format.json do
|
|
9
|
+
sort
|
|
10
|
+
render :layout => false
|
|
11
|
+
end
|
|
12
|
+
format.csv do
|
|
13
|
+
params[:iDisplayLength] = 1000000
|
|
14
|
+
sort
|
|
15
|
+
csv_string = FasterCSV.generate( {:force_quotes => true}) do |csv|
|
|
16
|
+
csv << @newsletters.first.attributes.keys
|
|
17
|
+
|
|
18
|
+
@newsletters.each do |record|
|
|
19
|
+
csv << record.attributes.values
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
send_data csv_string,
|
|
24
|
+
:type => 'text/csv; charset=utf-8; header=present',
|
|
25
|
+
:disposition => "attachment; filename=#{controller_name}.csv"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def edit
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def update
|
|
35
|
+
if @newsletter.update_attributes(params[:newsletter])
|
|
36
|
+
flash[:notice] = I18n.t('newsletter.update.success').capitalize
|
|
37
|
+
redirect_to([forgeos_cms, :edit, :admin, @newsletter])
|
|
38
|
+
else
|
|
39
|
+
flash[:error] = I18n.t('newsletter.update.failed').capitalize
|
|
40
|
+
render :action => 'edit'
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def new
|
|
45
|
+
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def create
|
|
49
|
+
if @newsletter.save
|
|
50
|
+
flash[:notice] = I18n.t('newsletter.create.success').capitalize
|
|
51
|
+
redirect_to([forgeos_cms, :edit, :admin, @newsletter])
|
|
52
|
+
else
|
|
53
|
+
flash[:error] = I18n.t('newsletter.create.failed').capitalize
|
|
54
|
+
render :new
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def destroy
|
|
59
|
+
@deleted = @newsletter.destroy
|
|
60
|
+
if @deleted
|
|
61
|
+
flash[:notice] = I18n.t('newsletter.destroy.success').capitalize
|
|
62
|
+
return redirect_to([forgeos_cms, :admin, :newsletters]) if !request.xhr?
|
|
63
|
+
else
|
|
64
|
+
flash[:error] = I18n.t('newsletter.destroy.failed').capitalize
|
|
65
|
+
end
|
|
66
|
+
render :nothing => true
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
private
|
|
70
|
+
|
|
71
|
+
def get_newsletter
|
|
72
|
+
unless @newsletter = Newsletter.find_by_id(params[:id])
|
|
73
|
+
flash[:error] = I18n.t('Newsletter non trouvée').capitalize
|
|
74
|
+
return redirect_to([forgeos_cms, :admin, :newsletters])
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def new_newsletter
|
|
80
|
+
@newsletter = Newsletter.new(params[:newsletter])
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def sort
|
|
84
|
+
columns = %w(email created_at)
|
|
85
|
+
|
|
86
|
+
per_page = params[:iDisplayLength] ? params[:iDisplayLength].to_i : 10
|
|
87
|
+
offset = params[:iDisplayStart] ? params[:iDisplayStart].to_i : 0
|
|
88
|
+
page = (offset / per_page) + 1
|
|
89
|
+
order = "#{columns[params[:iSortCol_0].to_i]} #{params[:iSortDir_0] ? params[:iSortDir_0].upcase : 'ASC'}"
|
|
90
|
+
|
|
91
|
+
conditions = {}
|
|
92
|
+
includes = []
|
|
93
|
+
options = { :page => page, :per_page => per_page }
|
|
94
|
+
joins = []
|
|
95
|
+
|
|
96
|
+
options[:conditions] = conditions unless conditions.empty?
|
|
97
|
+
options[:include] = includes unless includes.empty?
|
|
98
|
+
options[:order] = order unless order.squeeze.blank?
|
|
99
|
+
options[:joins] = joins
|
|
100
|
+
|
|
101
|
+
if params[:sSearch] && !params[:sSearch].blank?
|
|
102
|
+
options[:joins] += options.delete(:include)
|
|
103
|
+
options[:sql_order] = options.delete(:order)
|
|
104
|
+
options[:star] = true
|
|
105
|
+
@newsletters = Newsletter.search(params[:sSearch],options)
|
|
106
|
+
else
|
|
107
|
+
@newsletters = Newsletter.paginate(:all,options)
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
class Admin::PagesController < Admin::BaseController
|
|
2
|
+
cache_sweeper :page_sweeper, :only => [:create, :update, :destroy, :link, :activate]
|
|
3
|
+
before_filter :get_page, :only => [:edit, :destroy, :show, :update, :link, :activate, :duplicate]
|
|
4
|
+
before_filter :get_blocks_and_categories, :only => [:new, :create, :edit, :update]
|
|
5
|
+
before_filter :new_page, :only => [:new, :create]
|
|
6
|
+
before_filter :set_status, :only => [:create, :update]
|
|
7
|
+
before_filter :manage_tags, :only => [:create, :update]
|
|
8
|
+
|
|
9
|
+
def index
|
|
10
|
+
respond_to do |format|
|
|
11
|
+
format.html
|
|
12
|
+
format.json do
|
|
13
|
+
sort
|
|
14
|
+
render :layout => false
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def show; end
|
|
20
|
+
|
|
21
|
+
def new
|
|
22
|
+
number_of_cols = @page.min_cols_by_page - @page.page_cols.size
|
|
23
|
+
number_of_cols.times do
|
|
24
|
+
@page.page_cols.build
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def duplicate
|
|
29
|
+
@page = @page.clone
|
|
30
|
+
render :action => 'new'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def create
|
|
34
|
+
if @page.save
|
|
35
|
+
flash[:notice] = I18n.t('page.create.success').capitalize
|
|
36
|
+
redirect_to([forgeos_cms, :edit, :admin, @page])
|
|
37
|
+
else
|
|
38
|
+
flash[:error] = I18n.t('page.create.failed').capitalize
|
|
39
|
+
render :action => 'new'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def edit
|
|
44
|
+
number_of_cols = @page.min_cols_by_page - @page.page_cols.size
|
|
45
|
+
number_of_cols.times do
|
|
46
|
+
@page.page_cols.build
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def update
|
|
51
|
+
if @page.update_attributes(params[:page])
|
|
52
|
+
flash[:notice] = I18n.t('page.update.success').capitalize
|
|
53
|
+
redirect_to([forgeos_cms, :edit, :admin, @page])
|
|
54
|
+
else
|
|
55
|
+
flash[:error] = I18n.t('page.update.failed').capitalize
|
|
56
|
+
render :action => 'edit'
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def destroy
|
|
61
|
+
if @page.destroy
|
|
62
|
+
flash[:notice] = I18n.t('page.destroy.success').capitalize
|
|
63
|
+
else
|
|
64
|
+
flash[:error] = @page.errors if @page
|
|
65
|
+
flash[:error] = I18n.t('page.destroy.failed').capitalize
|
|
66
|
+
end
|
|
67
|
+
render :nothing => true
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def link
|
|
71
|
+
if request.post?
|
|
72
|
+
@page.update_attributes!(params[:page])
|
|
73
|
+
end
|
|
74
|
+
return redirect_to([forgeos_cms, :admin, @page])
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def url
|
|
78
|
+
render :text => Forgeos::url_generator(params[:url])
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def activate
|
|
82
|
+
render :text => @page.activate
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
private
|
|
86
|
+
|
|
87
|
+
def new_page
|
|
88
|
+
@page = Page.new(params[:page])
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def get_page
|
|
92
|
+
unless @page = Page.find_by_id(params[:id])
|
|
93
|
+
flash[:error] = I18n.t('page.not_exist').capitalize
|
|
94
|
+
return redirect_to([forgeos_cms, :admin, :pages])
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def get_block
|
|
99
|
+
unless block = Block.find_by_id(params[:block_id])
|
|
100
|
+
flash[:error] = I18n.t('block.link.not_exist').capitalize
|
|
101
|
+
return redirect_to([forgeos_cms, :admin, :pages])
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def get_blocks_and_categories
|
|
106
|
+
@static_block_categories = StaticContentCategory.find_all_by_parent_id(nil,:joins => :translations, :order => 'name')
|
|
107
|
+
@static_blocks = StaticContentBlock.all(:include => :categories, :conditions => { :categories => { :id => nil}})
|
|
108
|
+
|
|
109
|
+
@widget_categories = WidgetCategory.find_all_by_parent_id(nil,:joins => :translations, :order => 'name')
|
|
110
|
+
@widgets = Widget.all(:include => :categories, :conditions => { :categories => { :id => nil }})
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def manage_tags
|
|
114
|
+
#tag_list = params[:tags].join(',')
|
|
115
|
+
#@page.set_tag_list_on(:tags, tags_list)
|
|
116
|
+
#current_user.tag(@page, :with => tags_list, :on => :tags)
|
|
117
|
+
#params[:page][:tag_list]= params[:tag_list].join(',')
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def set_status
|
|
121
|
+
case params[:status]
|
|
122
|
+
when 'published'
|
|
123
|
+
# update publication date only if page wasn't already active or date is nil
|
|
124
|
+
@page.published_at = Time.now if !@page.active or @page.published_at.nil?
|
|
125
|
+
@page.active = true
|
|
126
|
+
when 'draft'
|
|
127
|
+
@page.active = false
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def sort
|
|
132
|
+
columns = %w(title title '' '' created_at active '')
|
|
133
|
+
|
|
134
|
+
per_page = params[:iDisplayLength].to_i
|
|
135
|
+
offset = params[:iDisplayStart].to_i
|
|
136
|
+
page = (offset / per_page) + 1
|
|
137
|
+
order = "#{columns[params[:iSortCol_0].to_i]} #{params[:iSortDir_0].upcase}"
|
|
138
|
+
|
|
139
|
+
conditions = {}
|
|
140
|
+
options = { :order => order, :page => page, :per_page => per_page }
|
|
141
|
+
|
|
142
|
+
includes = []
|
|
143
|
+
if params[:category_id]
|
|
144
|
+
conditions[:categories_elements] = { :category_id => params[:category_id] }
|
|
145
|
+
includes << :page_categories
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
if params[:ids]
|
|
149
|
+
conditions[:pages] = { :id => params[:ids].split(',') }
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
options[:conditions] = conditions unless conditions.empty?
|
|
153
|
+
options[:include] = includes unless includes.empty?
|
|
154
|
+
options[:order] = order unless order.squeeze.blank?
|
|
155
|
+
|
|
156
|
+
joins = []
|
|
157
|
+
joins << :translations
|
|
158
|
+
|
|
159
|
+
if params[:sSearch] && !params[:sSearch].blank?
|
|
160
|
+
options[:index] = "page_#{ActiveRecord::Base.locale}_core"
|
|
161
|
+
options[:star] = true
|
|
162
|
+
@pages = Page.search(params[:sSearch],options)
|
|
163
|
+
else
|
|
164
|
+
options[:joins] = joins
|
|
165
|
+
options[:group] = 'page_id'
|
|
166
|
+
@pages = Page.paginate(:all,options)
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
class Admin::StaticContentBlocksController < Admin::BaseController
|
|
2
|
+
cache_sweeper :page_sweeper, :only => [:create, :update, :destroy, :link, :unlink]
|
|
3
|
+
before_filter :new_block, :only => [:new, :create]
|
|
4
|
+
before_filter :get_block, :only => [:show, :edit, :update, :destroy, :duplicate, :link, :unlink]
|
|
5
|
+
before_filter :get_page, :only => [:destroy, :link, :unlink]
|
|
6
|
+
before_filter :get_pages_and_categories, :only => [:index, :new, :create, :edit, :update, :duplicate]
|
|
7
|
+
|
|
8
|
+
def index
|
|
9
|
+
respond_to do |format|
|
|
10
|
+
format.html
|
|
11
|
+
format.json do
|
|
12
|
+
sort
|
|
13
|
+
render :layout => false
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def show
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def new
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def duplicate
|
|
25
|
+
@static_content_block = @static_content_block.clone
|
|
26
|
+
render :action => 'new'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def edit
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def create
|
|
33
|
+
if @static_content_block.save
|
|
34
|
+
flash[:notice] = I18n.t('block.create.success').capitalize
|
|
35
|
+
redirect_to([forgeos_cms, :edit, :admin, @static_content_block])
|
|
36
|
+
else
|
|
37
|
+
flash[:error] = I18n.t('static_content_block.create.failed').capitalize
|
|
38
|
+
render :action => "new"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def update
|
|
43
|
+
if @static_content_block.update_attributes(params[:static_content_block])
|
|
44
|
+
flash[:notice] = I18n.t('static_content_block.update.success').capitalize
|
|
45
|
+
else
|
|
46
|
+
flash[:error] = I18n.t('static_content_block.update.failed').capitalize
|
|
47
|
+
end
|
|
48
|
+
render :action => "edit"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def destroy
|
|
52
|
+
if @static_content_block.destroy
|
|
53
|
+
flash[:notice] = I18n.t('static_content_block.destroy.success').capitalize
|
|
54
|
+
else
|
|
55
|
+
flash[:error] = @static_content_block.errors if @static_content_block
|
|
56
|
+
flash[:error] = I18n.t('static_content_block.destroy.failed').capitalize
|
|
57
|
+
end
|
|
58
|
+
redirect_to([forgeos_cms, :admin, :static_content_blocks])
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def link
|
|
62
|
+
unless @static_content_block.linked_with? @page
|
|
63
|
+
if @static_content_block.link_with @page
|
|
64
|
+
flash[:notice] = I18n.t('static_content_block.link.create.success').capitalize
|
|
65
|
+
else
|
|
66
|
+
flash[:error] = I18n.t('static_content_block.link.create.failed').capitalize
|
|
67
|
+
end
|
|
68
|
+
else
|
|
69
|
+
if @static_content_block.unlink_with @page
|
|
70
|
+
flash[:notice] = I18n.t('static_content_block.link.destroy.success').capitalize
|
|
71
|
+
else
|
|
72
|
+
flash[:error] = I18n.t('static_content_block.link.destroy.success').capitalize
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
if request.xhr?
|
|
77
|
+
return render :text => true
|
|
78
|
+
else
|
|
79
|
+
return redirect_to(:back)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def unlink
|
|
84
|
+
if @page.blocks.delete(@static_content_block)
|
|
85
|
+
@page.blocks.reset_positions
|
|
86
|
+
flash[:notice] = I18n.t('static_content_block.link.destroy.success').capitalize
|
|
87
|
+
else
|
|
88
|
+
flash[:notice] = I18n.t('static_content_block.link.destroy.success').capitalize
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
render :nothing => true
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
private
|
|
95
|
+
|
|
96
|
+
def new_block
|
|
97
|
+
@static_content_block = StaticContentBlock.new(params[:static_content_block])
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def get_block
|
|
101
|
+
unless @static_content_block = Block.find_by_id(params[:id])
|
|
102
|
+
flash[:error] = I18n.t('static_content_block.not_exist').capitalize
|
|
103
|
+
return redirect_to(@page ? [forgeos_cms, :admin, :static_content_blocks, @page] : [forgeos_cms, :admin, :blocks])
|
|
104
|
+
end
|
|
105
|
+
return redirect_to([forgeos_cms, :edit, :admin, @static_content_block]) unless @static_content_block.is_a?(StaticContentBlock)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def get_page
|
|
109
|
+
@page = Page.find_by_id(params[:page_id])
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def get_pages_and_categories
|
|
113
|
+
@page_categories = PageCategory.find_all_by_parent_id(nil,:joins => :translations, :order => 'name')
|
|
114
|
+
@pages = Page.all(:include => :categories, :conditions => { :categories_elements => { :category_id => nil }})
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def link_and_redirect_to_page
|
|
118
|
+
@page.blocks << @static_content_block
|
|
119
|
+
@page.blocks.reset_positions
|
|
120
|
+
|
|
121
|
+
if @static_content_block.save
|
|
122
|
+
return redirect_to([forgeos_cms, :admin, :static_content_blocks, @page])
|
|
123
|
+
else
|
|
124
|
+
@static_content_block.destroy
|
|
125
|
+
flash[:notice] = nil
|
|
126
|
+
flash[:error] = @static_content_block.errors
|
|
127
|
+
return
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def sort
|
|
132
|
+
columns = %w(blocks.id block_translations.title count(pages.id) blocks.id)
|
|
133
|
+
per_page = params[:iDisplayLength].to_i
|
|
134
|
+
offset = params[:iDisplayStart].to_i
|
|
135
|
+
page = (offset / per_page) + 1
|
|
136
|
+
order_column = params[:iSortCol_0].to_i
|
|
137
|
+
order = "#{columns[order_column]} #{params[:iSortDir_0].upcase}"
|
|
138
|
+
|
|
139
|
+
conditions = {}
|
|
140
|
+
includes = []
|
|
141
|
+
group_by = []
|
|
142
|
+
options = { :page => page, :per_page => per_page }
|
|
143
|
+
|
|
144
|
+
if params[:category_id]
|
|
145
|
+
conditions[:categories_elements] = { :category_id => params[:category_id] }
|
|
146
|
+
includes << :categories
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if order_column == 2
|
|
150
|
+
includes << :pages
|
|
151
|
+
group_by << 'blocks.id'
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
options[:conditions] = conditions unless conditions.empty?
|
|
155
|
+
options[:include] = includes unless includes.empty?
|
|
156
|
+
options[:group] = group_by.join(', ') unless group_by.empty?
|
|
157
|
+
# FIXME - order with globalize
|
|
158
|
+
options[:order] = order unless order.squeeze.blank?
|
|
159
|
+
|
|
160
|
+
joins = []
|
|
161
|
+
joins << :translations
|
|
162
|
+
|
|
163
|
+
if params[:sSearch] && !params[:sSearch].blank?
|
|
164
|
+
options[:index] = "block_#{ActiveRecord::Base.locale}_core"
|
|
165
|
+
options[:order_sql] = options.delete(:order)
|
|
166
|
+
options[:star] = true
|
|
167
|
+
@blocks = StaticContentBlock.search(params[:sSearch],options)
|
|
168
|
+
else
|
|
169
|
+
options[:joins] = joins
|
|
170
|
+
options[:group] = :block_id
|
|
171
|
+
@blocks = StaticContentBlock.paginate(:all,options)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|