From 6c01d517d2773cf2974a78f5c845ed0dbd0d6b97 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Thu, 12 Dec 2013 12:49:20 +0800 Subject: [PATCH] Fixed page data count --- app/models/module_app.rb | 5 +++++ app/views/admin/items/_form_page.html.erb | 3 +-- app/views/admin/pages/get_display_style.js.erb | 5 +++++ lib/orbit_app/module/registration.rb | 11 ++++++++++- vendor/built_in_modules/page_content/init.rb | 1 + 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/models/module_app.rb b/app/models/module_app.rb index 475dec86..61673ec2 100644 --- a/app/models/module_app.rb +++ b/app/models/module_app.rb @@ -31,6 +31,7 @@ class ModuleApp self[:get_widget_style] = reg.get_widgets self[:using_default_widget] = !reg.get_default_widget.blank? self[:enable_widget_data_count] = reg.get_enable_widget_data_count + self[:enable_page_data_count] = reg.get_enable_page_data_count self[:widgets] = reg.get_widgets self[:has_tag] = reg.get_has_tags self[:has_category] = reg.get_has_category @@ -64,6 +65,10 @@ class ModuleApp get_registration.get_enable_widget_data_count end + def get_enable_page_data_count + get_registration.get_enable_page_data_count + end + def get_widget_for_select widgets = get_widget_style diff --git a/app/views/admin/items/_form_page.html.erb b/app/views/admin/items/_form_page.html.erb index b3dcc371..e0b112e8 100644 --- a/app/views/admin/items/_form_page.html.erb +++ b/app/views/admin/items/_form_page.html.erb @@ -47,8 +47,7 @@
- -
+
<%= f.label :frontend_data_count, t(:frontend_data_count) %> <%= select_tag "page[frontend_data_count]", nil, class: "input-mini", id: "page_count" %>
diff --git a/app/views/admin/pages/get_display_style.js.erb b/app/views/admin/pages/get_display_style.js.erb index 552c33aa..e8151cf7 100644 --- a/app/views/admin/pages/get_display_style.js.erb +++ b/app/views/admin/pages/get_display_style.js.erb @@ -2,4 +2,9 @@ $("#pageslide .display-mode").html("<%= j render @partial %>") <% else %> $("#pageslide .display-mode").html('') +<% end %> +<% if @module_app.enable_page_data_count %> + $(".front_count").show() +<% else %> + $(".front_count").hide() <% end %> \ No newline at end of file diff --git a/lib/orbit_app/module/registration.rb b/lib/orbit_app/module/registration.rb index 66b1462a..a4846728 100644 --- a/lib/orbit_app/module/registration.rb +++ b/lib/orbit_app/module/registration.rb @@ -28,7 +28,7 @@ module OrbitApp end class DataSheet - attr_reader :name,:key,:base_path,:module_label,:data_count, :has_category, :has_tag, :approvable_models, :authorizable_models, :is_approvable, :is_authorizable, :enable_widget_data_count + attr_reader :name,:key,:base_path,:module_label,:data_count, :has_category, :has_tag, :approvable_models, :authorizable_models, :is_approvable, :is_authorizable, :enable_widget_data_count, :enable_page_data_count def initialize(name, &block) @name = name @@ -44,6 +44,7 @@ module OrbitApp @is_approvable = nil @is_authorizable = nil @enable_widget_data_count = true + @enable_page_data_count = true block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? setup_module_app end @@ -68,6 +69,10 @@ module OrbitApp @enable_widget_data_count end + def get_enable_page_data_count + @enable_page_data_count + end + def get_label_i18n @module_label end @@ -173,6 +178,10 @@ module OrbitApp @enable_widget_data_count = enable end + def enable_page_data_count(enable = true) + @enable_page_data_count = enable + end + def approvable_on(klass = 'Category') @approvable_models << klass end diff --git a/vendor/built_in_modules/page_content/init.rb b/vendor/built_in_modules/page_content/init.rb index 42f996e3..affa3b6b 100644 --- a/vendor/built_in_modules/page_content/init.rb +++ b/vendor/built_in_modules/page_content/init.rb @@ -11,6 +11,7 @@ module PageContent intro "I am intro" update_info 'some update_info' + enable_page_data_count false authorizable do authorizable_on('PageContext') end