added enabling and disabling feature of widget count in module init
This commit is contained in:
parent
2a41e90bc1
commit
800f108be3
|
@ -39,7 +39,6 @@ class Admin::PagePartsController < OrbitBackendController
|
|||
else
|
||||
@tag_objects = @r_tag.classify.constantize.all rescue nil
|
||||
end
|
||||
|
||||
@html_class = "page-parts"
|
||||
end
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ class ModuleApp
|
|||
self[:enable_frontend] = reg.get_enable_frontend
|
||||
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[:widgets] = reg.get_widgets
|
||||
self[:has_tag] = reg.get_has_tags
|
||||
self[:has_category] = reg.get_has_category
|
||||
|
@ -59,6 +60,10 @@ class ModuleApp
|
|||
get_registration.get_default_widget
|
||||
end
|
||||
|
||||
def get_enable_widget_data_count
|
||||
get_registration.get_enable_widget_data_count
|
||||
end
|
||||
|
||||
|
||||
def get_widget_for_select
|
||||
widgets = get_widget_style
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
<div class="display-mode">
|
||||
<%= render @partial if @partial %>
|
||||
</div>
|
||||
<div class="control-group input-content <%= 'hide' if @module_app.blank? %>">
|
||||
<div class="control-group input-content <%= 'hide' if @module_app.blank? || !@module_app.enable_widget_data_count %>">
|
||||
<%= f.label :widget_data_count, t(:widget_data_count), class: "control-label muted" %>
|
||||
<div class="controls">
|
||||
<%= f.select :widget_data_count, options_for_select(@data_count, @part.widget_data_count), {}, class: "input-mini", id: "page_count" %>
|
||||
|
|
|
@ -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
|
||||
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
|
||||
|
||||
def initialize(name, &block)
|
||||
@name = name
|
||||
|
@ -43,6 +43,7 @@ module OrbitApp
|
|||
@authorizable_models = []
|
||||
@is_approvable = nil
|
||||
@is_authorizable = nil
|
||||
@enable_widget_data_count = true
|
||||
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||||
setup_module_app
|
||||
end
|
||||
|
@ -63,6 +64,10 @@ module OrbitApp
|
|||
|
||||
end
|
||||
|
||||
def get_enable_widget_data_count
|
||||
@enable_widget_data_count
|
||||
end
|
||||
|
||||
def get_label_i18n
|
||||
@module_label
|
||||
end
|
||||
|
@ -164,6 +169,10 @@ module OrbitApp
|
|||
end
|
||||
end
|
||||
|
||||
def enable_widget_data_count(enable = true)
|
||||
@enable_widget_data_count = enable
|
||||
end
|
||||
|
||||
def approvable_on(klass = 'Category')
|
||||
@approvable_models << klass
|
||||
end
|
||||
|
|
|
@ -15,7 +15,7 @@ module Gallery
|
|||
frontend_i18n "gallery.front_end.albums"
|
||||
end
|
||||
end
|
||||
|
||||
enable_widget_data_count false
|
||||
authorizable
|
||||
categorizable
|
||||
taggable
|
||||
|
|
Loading…
Reference in New Issue