forked from saurabh/orbit4-5
update ModuleApp and OrbitWidget registration
This commit is contained in:
parent
43e1a669d6
commit
14bfbe2d8a
|
@ -43,8 +43,8 @@ class PagePartsController < ApplicationController
|
||||||
app = OrbitWidget.find_by_key(module_name) if app.nil?
|
app = OrbitWidget.find_by_key(module_name) if app.nil?
|
||||||
@categories = app.categories rescue []
|
@categories = app.categories rescue []
|
||||||
@tags = app.tags rescue []
|
@tags = app.tags rescue []
|
||||||
@widget_methods = app.get_registration.get_widget_methods
|
@widget_methods = app.widget_methods
|
||||||
@widget_settings = app.get_registration.get_widget_settings
|
@widget_settings = app.widget_settings
|
||||||
@data_count = nil
|
@data_count = nil
|
||||||
if !@widget_settings.blank?
|
if !@widget_settings.blank?
|
||||||
@data_count = @widget_settings["data_count"] rescue nil
|
@data_count = @widget_settings["data_count"] rescue nil
|
||||||
|
@ -102,8 +102,8 @@ class PagePartsController < ApplicationController
|
||||||
app = OrbitWidget.find_by_key(module_name) if app.nil?
|
app = OrbitWidget.find_by_key(module_name) if app.nil?
|
||||||
@categories = app.categories rescue []
|
@categories = app.categories rescue []
|
||||||
@tags = app.tags rescue []
|
@tags = app.tags rescue []
|
||||||
@widget_methods = app.get_registration.get_widget_methods
|
@widget_methods = app.widget_methods
|
||||||
@widget_settings = app.get_registration.get_widget_settings
|
@widget_settings = app.widget_settings
|
||||||
@data_count = nil
|
@data_count = nil
|
||||||
if !@widget_settings.blank?
|
if !@widget_settings.blank?
|
||||||
@data_count = @widget_settings["data_count"] rescue nil
|
@data_count = @widget_settings["data_count"] rescue nil
|
||||||
|
|
|
@ -11,6 +11,8 @@ class ModuleApp
|
||||||
field :sidebar_order,type: Integer,default: 0
|
field :sidebar_order,type: Integer,default: 0
|
||||||
field :authorizable_models, type: Array
|
field :authorizable_models, type: Array
|
||||||
field :widget_enable, type: Boolean, default: false
|
field :widget_enable, type: Boolean, default: false
|
||||||
|
field :widget_methods
|
||||||
|
field :widget_settings
|
||||||
|
|
||||||
has_many :categories, dependent: :destroy, :autosave => true
|
has_many :categories, dependent: :destroy, :autosave => true
|
||||||
has_and_belongs_to_many :tags, dependent: :destroy, :autosave => true
|
has_and_belongs_to_many :tags, dependent: :destroy, :autosave => true
|
||||||
|
@ -26,6 +28,8 @@ class ModuleApp
|
||||||
self[:authorizable_models] = reg.get_authorizable_models
|
self[:authorizable_models] = reg.get_authorizable_models
|
||||||
self[:frontend_enable] = reg.is_frontend_enabled
|
self[:frontend_enable] = reg.is_frontend_enabled
|
||||||
self[:widget_enable] = reg.is_widget_enabled
|
self[:widget_enable] = reg.is_widget_enabled
|
||||||
|
self[:widget_methods] = reg.get_widget_methods
|
||||||
|
self[:widget_settings] = reg.get_widget_settings
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_registration
|
def get_registration
|
||||||
|
|
|
@ -4,6 +4,13 @@ class OrbitWidget
|
||||||
|
|
||||||
field :title, type: String
|
field :title, type: String
|
||||||
field :key, type: String
|
field :key, type: String
|
||||||
|
field :widget_methods
|
||||||
|
field :widget_settings
|
||||||
|
|
||||||
|
def refetch_setting!(reg)
|
||||||
|
self[:widget_methods] = reg.get_widget_methods
|
||||||
|
self[:widget_settings] = reg.get_widget_settings
|
||||||
|
end
|
||||||
|
|
||||||
def get_registration
|
def get_registration
|
||||||
OrbitApp::Widget::Registration.find_by_key(key)
|
OrbitApp::Widget::Registration.find_by_key(key)
|
||||||
|
|
|
@ -51,7 +51,7 @@ module OrbitApp
|
||||||
def setup_module_app
|
def setup_module_app
|
||||||
orbit_widget = get_orbit_widget
|
orbit_widget = get_orbit_widget
|
||||||
orbit_widget = OrbitWidget.new(:key=>@key,:title=>name) if orbit_widget.nil?
|
orbit_widget = OrbitWidget.new(:key=>@key,:title=>name) if orbit_widget.nil?
|
||||||
# orbit_widget.refetch_setting!(self)
|
orbit_widget.refetch_setting!(self)
|
||||||
orbit_widget.save(:validate=>false)
|
orbit_widget.save(:validate=>false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue