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