Fixed page data count

This commit is contained in:
saurabhbhatia 2013-12-12 12:49:20 +08:00
parent 85778224a1
commit 6c01d517d2
5 changed files with 22 additions and 3 deletions

View File

@ -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

View File

@ -47,8 +47,7 @@
</div>
<div class="display-mode"></div>
<div id="front_count" class="hide">
<div id="front_count" class="front_count hide">
<%= f.label :frontend_data_count, t(:frontend_data_count) %>
<%= select_tag "page[frontend_data_count]", nil, class: "input-mini", id: "page_count" %>
</div>

View File

@ -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 %>

View File

@ -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

View File

@ -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