forgeos_cms 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,29 @@
|
|
1
|
+
load File.join(Gem.loaded_specs['forgeos_core'].full_gem_path, 'app', 'controllers', 'admin', 'statistics_controller.rb')
|
2
|
+
Admin::StatisticsController.class_eval do
|
3
|
+
before_filter :pages_most_viewed, :only => :index
|
4
|
+
|
5
|
+
# generates the ofc2 graph
|
6
|
+
def graph
|
7
|
+
get_date
|
8
|
+
# visitors
|
9
|
+
visitors = @date.collect{|day| Forgeos::Statistics.total_of_visitors(day)}
|
10
|
+
|
11
|
+
# Bar for visitors
|
12
|
+
bar = OpenFlashChart::Bar.new
|
13
|
+
bar.values = visitors
|
14
|
+
bar.tooltip = "#val# #{I18n.t('visitor', :count => 2)}"
|
15
|
+
bar.colour = '#F2B833'
|
16
|
+
|
17
|
+
# Conf for Y left axis
|
18
|
+
# calculates max number of visitors
|
19
|
+
max_visitors = visitors.flatten.compact.max.to_i
|
20
|
+
max_count_visitors = max_visitors > 0 ? max_visitors : 5
|
21
|
+
|
22
|
+
return render :json => generate_graph([bar], [max_count_visitors], '#F7BD2E')
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
def pages_most_viewed
|
27
|
+
@pages_most_viewed = Forgeos::Cms::Statistics.pages_most_viewed(@date,10)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
class Admin::WidgetActualitiesController < Admin::BaseController
|
2
|
+
|
3
|
+
#cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
|
4
|
+
before_filter :get_widget_actuality, :only => [:show, :edit, :update, :destroy, :duplicate]
|
5
|
+
before_filter :new_widget_actuality, :only => [:new, :create]
|
6
|
+
before_filter :get_pages_and_categories, :only => [:index, :show, :new, :create, :edit, :update, :duplicate]
|
7
|
+
|
8
|
+
def index
|
9
|
+
return redirect_to([forgeos_cms, :admin, :widgets])
|
10
|
+
end
|
11
|
+
|
12
|
+
def show; end
|
13
|
+
|
14
|
+
def new; end
|
15
|
+
|
16
|
+
def edit; end
|
17
|
+
|
18
|
+
def duplicate
|
19
|
+
@widget_actuality = @widget_actuality.clone
|
20
|
+
render :action => 'new'
|
21
|
+
end
|
22
|
+
|
23
|
+
def create
|
24
|
+
# check that the linked page exists if page_id is specified
|
25
|
+
=begin
|
26
|
+
if params[:page_id] && !get_page
|
27
|
+
flash[:error] = I18n.t('widget.link.create.failed').capitalize
|
28
|
+
return
|
29
|
+
end
|
30
|
+
=end
|
31
|
+
|
32
|
+
if @widget_actuality.save
|
33
|
+
flash[:notice] = I18n.t('widget_actuality.create.success').capitalize
|
34
|
+
redirect_to([forgeos_cms, :edit, :admin, @widget_actuality])
|
35
|
+
else
|
36
|
+
flash[:error] = I18n.t('widget_actuality.create.failed').capitalize
|
37
|
+
render :action => 'new'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def update
|
42
|
+
if updated = @widget_actuality.update_attributes(params[:widget_actuality])
|
43
|
+
flash[:notice] = I18n.t('widget_actuality.update.success').capitalize
|
44
|
+
else
|
45
|
+
flash[:error] = I18n.t('widget_actuality.update.failed').capitalize
|
46
|
+
end
|
47
|
+
|
48
|
+
respond_to do |format|
|
49
|
+
format.html {
|
50
|
+
return render :action => "edit"
|
51
|
+
}
|
52
|
+
|
53
|
+
format.js { return render :nothing => true }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def destroy
|
58
|
+
if @widget_actuality.destroy
|
59
|
+
flash[:notice] = I18n.t('widget_actuality.destroy.success').capitalize
|
60
|
+
else
|
61
|
+
flash[:error] = I18n.t('widget_actuality.destroy.failed').capitalize
|
62
|
+
end
|
63
|
+
redirect_to([forgeos_cms, :admin, :widgets])
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def get_widget_actuality
|
69
|
+
unless @widget_actuality = WidgetActuality.find_by_id(params[:id])
|
70
|
+
flash[:error] = I18n.t('widget_actuality.not_exist').capitalize
|
71
|
+
return redirect_to([forgeos_cms, :admin, :actualities])
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def new_widget_actuality
|
76
|
+
@widget_actuality = WidgetActuality.new params[:widget_actuality]
|
77
|
+
end
|
78
|
+
|
79
|
+
def get_page
|
80
|
+
@page = Page.find_by_id(params[:page_id])
|
81
|
+
end
|
82
|
+
|
83
|
+
def get_pages_and_categories
|
84
|
+
@page_categories = PageCategory.find_all_by_parent_id(nil,:joins => :translations, :order => 'name')
|
85
|
+
@pages = Page.all(:include => :categories, :conditions => { :categories_elements => { :category_id => nil }})
|
86
|
+
end
|
87
|
+
|
88
|
+
def link_and_redirect_to_page
|
89
|
+
@page.blocks << @widget_actuality
|
90
|
+
@page.blocks.reset_positions
|
91
|
+
|
92
|
+
if @widget_actuality.save
|
93
|
+
return redirect_to([forgeos_cms, :admin, @page, :widgets])
|
94
|
+
else
|
95
|
+
@widget_actuality.destroy
|
96
|
+
flash[:notice] = nil
|
97
|
+
flash[:error] = @widget_actuality.errors
|
98
|
+
return
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
class Admin::WidgetFaqsController < Admin::BaseController
|
2
|
+
cache_sweeper :page_sweeper, :only => [:create, :update, :destroy]
|
3
|
+
before_filter :get_widget_faq, :only => [:show, :edit, :update, :destroy, :duplicate]
|
4
|
+
before_filter :new_widget_faq, :only => [:new, :create]
|
5
|
+
before_filter :get_pages_and_categories, :only => [:new, :create, :edit, :update, :duplicate]
|
6
|
+
|
7
|
+
def index
|
8
|
+
return redirect_to([forgeos_cms, :admin, :widgets])
|
9
|
+
end
|
10
|
+
|
11
|
+
def create
|
12
|
+
if @widget_faq.save
|
13
|
+
flash[:notice] = t('destination.create.success').capitalize
|
14
|
+
redirect_to([forgeos_cms, :admin, :widgets])
|
15
|
+
else
|
16
|
+
flash[:error] = @widget_faq.errors.first.inspect
|
17
|
+
render :action => 'new'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def new
|
22
|
+
end
|
23
|
+
|
24
|
+
def edit
|
25
|
+
end
|
26
|
+
|
27
|
+
def duplicate
|
28
|
+
@widget_faq = @widget_faq.clone
|
29
|
+
render :action => 'new'
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def update
|
34
|
+
if @widget_faq.update_attributes(params[:widget_faq])
|
35
|
+
flash[:notice] = t('widget_faq.update.success').capitalize
|
36
|
+
redirect_to([forgeos_cms, :admin, :widgets])
|
37
|
+
else
|
38
|
+
flash[:error] = t('widget_faq.update.failed').capitalize
|
39
|
+
render :action => 'edit'
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def destroy
|
44
|
+
if @widget_faq.destroy
|
45
|
+
flash[:notice] = I18n.t('widget.destroy.success').capitalize
|
46
|
+
else
|
47
|
+
flash[:error] = @widget_faq.errors if @widget_faq
|
48
|
+
flash[:error] = I18n.t('widget.destroy.failed').capitalize
|
49
|
+
end
|
50
|
+
render :nothing => true
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
private
|
55
|
+
def get_widget_faq
|
56
|
+
unless @widget_faq = WidgetFaq.find_by_id(params[:id])
|
57
|
+
flash[:error] = t('widget_faq.not_exist').capitalize
|
58
|
+
return redirect_to([forgeos_cms, :admin, :widgets])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def new_widget_faq
|
63
|
+
@widget_faq = WidgetFaq.new(params[:widget_faq])
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_pages_and_categories
|
67
|
+
@page_categories = PageCategory.find_all_by_parent_id(nil,:joins => :translations, :order => 'name')
|
68
|
+
@pages = Page.all(:include => :categories, :conditions => { :categories_elements => { :category_id => nil }})
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class Admin::WidgetsController < Admin::BaseController
|
2
|
+
cache_sweeper :page_sweeper, :only => [:destroy]
|
3
|
+
before_filter :get_widget, :only => :destroy
|
4
|
+
before_filter :get_pages_and_categories, :only => :index
|
5
|
+
|
6
|
+
def index
|
7
|
+
respond_to do |format|
|
8
|
+
format.html
|
9
|
+
format.json do
|
10
|
+
sort
|
11
|
+
render :layout => false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def destroy
|
17
|
+
if request.delete?
|
18
|
+
@widget.destroy
|
19
|
+
flash[:notice] = I18n.t('widget.destroy.success').capitalize
|
20
|
+
else
|
21
|
+
flash[:error] = @widget.errors if @widget
|
22
|
+
flash[:error] = I18n.t('widget.destroy.failed').capitalize
|
23
|
+
end
|
24
|
+
render :nothing => true
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def get_widget
|
30
|
+
unless @widget = Widget.find_by_id(params[:id])
|
31
|
+
flash[:error] = I18n.t('widget.not_exist').capitalize
|
32
|
+
redirect_to([forgeos_cms, :admin, :widgets])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_pages_and_categories
|
37
|
+
@page_categories = PageCategory.find_all_by_parent_id(nil,:joins => :translations, :order => 'name')
|
38
|
+
@pages = Page.all(:include => :categories, :conditions => { :categories_elements => { :category_id => nil }})
|
39
|
+
end
|
40
|
+
|
41
|
+
def sort
|
42
|
+
columns = %w(blocks.id blocks.type blocks.title count(pages.id))
|
43
|
+
per_page = params[:iDisplayLength].to_i
|
44
|
+
offset = params[:iDisplayStart].to_i
|
45
|
+
page = (offset / per_page) + 1
|
46
|
+
order_column = params[:iSortCol_0].to_i
|
47
|
+
order = "#{columns[order_column]} #{params[:iSortDir_0].upcase}"
|
48
|
+
|
49
|
+
conditions = {}
|
50
|
+
includes = []
|
51
|
+
group_by = []
|
52
|
+
options = { :page => page, :per_page => per_page }
|
53
|
+
|
54
|
+
if params[:category_id]
|
55
|
+
conditions[:categories_elements] = { :category_id => params[:category_id] }
|
56
|
+
includes << :categories
|
57
|
+
end
|
58
|
+
|
59
|
+
if order_column == 3
|
60
|
+
group_by << 'blocks.id'
|
61
|
+
includes << :pages
|
62
|
+
end
|
63
|
+
|
64
|
+
options[:conditions] = conditions unless conditions.empty?
|
65
|
+
options[:include] = includes unless includes.empty?
|
66
|
+
options[:group] = group_by.join(', ') unless group_by.empty?
|
67
|
+
options[:order] = order unless order.squeeze.blank?
|
68
|
+
|
69
|
+
joins = []
|
70
|
+
joins << :translations
|
71
|
+
|
72
|
+
if params[:sSearch] && !params[:sSearch].blank?
|
73
|
+
options[:index] = "block_#{ActiveRecord::Base.locale}_core"
|
74
|
+
options[:order_sql] = options.delete(:order)
|
75
|
+
options[:star] = true
|
76
|
+
@widgets = Widget.search(params[:sSearch],options)
|
77
|
+
else
|
78
|
+
options[:joins] = joins
|
79
|
+
options[:group] = :block_id
|
80
|
+
@widgets = Widget.paginate(:all,options)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
load File.join(Gem.loaded_specs['forgeos_core'].full_gem_path, 'app', 'controllers', 'forgeos', 'application_controller.rb')
|
2
|
+
|
3
|
+
Forgeos::ApplicationController.class_eval do
|
4
|
+
include RoutesHelper
|
5
|
+
|
6
|
+
private
|
7
|
+
|
8
|
+
def page_not_found
|
9
|
+
if @page = Page.find_by_single_key(404)
|
10
|
+
return render(@page, :layout => true, :status => 404)
|
11
|
+
else
|
12
|
+
return render(:text => (I18n.t('page_not_found') || 'page not found'), :layout => false, :status => 404)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Rails Bug fix on Nested inheritance models : Load nested models to use it parent class
|
18
|
+
#Carousel
|
19
|
+
#WidgetActuality
|
20
|
+
#WidgetFaq
|
21
|
+
#LinkPage
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class NewslettersController < Forgeos::ApplicationController
|
2
|
+
skip_before_filter :verify_authenticity_token, :only => [:create]
|
3
|
+
def create
|
4
|
+
if Newsletter.find_or_create_by_email(params[:newsletter])
|
5
|
+
flash[:notice] = t('newsletter.subscribe.success')
|
6
|
+
else
|
7
|
+
flash[:error] = t('newsletter.subscribe.failed')
|
8
|
+
end
|
9
|
+
redirect_to :back
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class PagesController < Forgeos::ApplicationController
|
2
|
+
before_filter :get_page, :only => [ :show ]
|
3
|
+
caches_page :page, :if => :get_page
|
4
|
+
|
5
|
+
def index
|
6
|
+
if @page = Page.find_by_single_key('home')
|
7
|
+
redirect_to(@page)
|
8
|
+
else
|
9
|
+
page_not_found
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def show
|
14
|
+
return page_not_found unless @page
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def get_page
|
20
|
+
url = params[:url].last.gsub(/\.\w+$/,'')
|
21
|
+
@format = params[:url].last.split('.').last || request.format
|
22
|
+
@page = Page.find_by_url(url, :conditions => { :active => true })
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Methods added to this helper will be available to all templates in the application.
|
2
|
+
module ApplicationHelper
|
3
|
+
include MenuHelper
|
4
|
+
def meta_info(page, meta)
|
5
|
+
if page && page.meta_info
|
6
|
+
case meta
|
7
|
+
when :title
|
8
|
+
return page.meta_info.title
|
9
|
+
when :keywords
|
10
|
+
return page.meta_info.keywords
|
11
|
+
when :description
|
12
|
+
return page.meta_info.description
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def page_by_key(single_key)
|
18
|
+
page = Page.find_by_single_key(single_key)
|
19
|
+
return page ? page : @page
|
20
|
+
end
|
21
|
+
|
22
|
+
def block_content_by_key(single_key)
|
23
|
+
block = Block.find_by_single_key(single_key)
|
24
|
+
block.content if block
|
25
|
+
end
|
26
|
+
|
27
|
+
def page_category_path(object)
|
28
|
+
super(:id => nil, :category_name => object.name)
|
29
|
+
end
|
30
|
+
|
31
|
+
def render_block(id)
|
32
|
+
block = case id
|
33
|
+
when Integer
|
34
|
+
Block.find_by_id(id)
|
35
|
+
when Block
|
36
|
+
id
|
37
|
+
when String, Symbol
|
38
|
+
Block.find_by_single_key(id)
|
39
|
+
end
|
40
|
+
|
41
|
+
block ? block.content : nil
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module MenuHelper
|
2
|
+
def display_menu_front(menu, options = {}, &block)
|
3
|
+
if !menu.nil? and menu.active?
|
4
|
+
lis = get_menu_li(menu.menu_links, options, &block)
|
5
|
+
content_tag :ul, lis.join , :class => options[:ul_class]
|
6
|
+
end
|
7
|
+
end
|
8
|
+
alias_method :display_menu, :display_menu_front
|
9
|
+
|
10
|
+
private
|
11
|
+
def get_li_class(menu_link, options)
|
12
|
+
if options[:li_current_class] &&
|
13
|
+
# request uri equals menu_link url or one of its children url
|
14
|
+
(menu_link.url_match?(request.request_uri) ||
|
15
|
+
# request page equals page link target or one of its children page link targe
|
16
|
+
(options[:page] && menu_link.is_a?(PageLink) && menu_link.url_match?(options[:page])))
|
17
|
+
options[:li_current_class]
|
18
|
+
else
|
19
|
+
options[:li_class]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_menu_li(menu_links, options, &block)
|
24
|
+
lis = []
|
25
|
+
links = menu_links.find_all_by_active(true)
|
26
|
+
links.each_with_index do |menu_link,index|
|
27
|
+
if menu_link.active?
|
28
|
+
li_class = get_li_class(menu_link, options)
|
29
|
+
li_class = li_class ? [li_class] : []
|
30
|
+
li_class << 'first' if index == 0
|
31
|
+
li_class << 'last' if index == links.size - 1
|
32
|
+
li_link = if block_given?
|
33
|
+
capture(menu_link,&block)
|
34
|
+
else
|
35
|
+
link_to(menu_link.title,menu_link.url, :popup => menu_link.popup)
|
36
|
+
end
|
37
|
+
children = menu_link.children
|
38
|
+
unless children.empty?
|
39
|
+
li_link += content_tag :ul, get_menu_li(children, options, &block).join , :class => options[:ul_class]
|
40
|
+
end
|
41
|
+
lis << content_tag(:li, li_link, :class => (li_class.empty? ? nil : li_class.join(' ')) )
|
42
|
+
end
|
43
|
+
end
|
44
|
+
return lis
|
45
|
+
end
|
46
|
+
end
|