Module: Anubis::Tenant::Data::Load
- Includes:
- Core::Data::Load
- Included in:
- Anubis::Tenant::DataController
- Defined in:
- app/controllers/anoubis/tenant/data/load.rb
Overview
Module loads data from external sources for Anubis::Tenant::DataController
Instance Method Summary collapse
-
#load_menu_data ⇒ Object
Loads current menu data.
Methods included from Core::Data::Load
#load_autocomplete_data, #load_data_by_id, #load_data_by_title, #load_new_data, #load_parent_data, #load_table_data, #load_table_data_count
Instance Method Details
#load_menu_data ⇒ Object
Loads current menu data. Procedure loads menu data from MySQL database or from Redis cache and places it in self.etc.menu Etc#menu
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/anoubis/tenant/data/load.rb', line 12 def = self.redis.get(self.redis_prefix + 'menu_' + params[:controller]) = self.redis.get(self.redis_prefix + 'menu_'+params[:controller]+'_'+self.locale) if ! || ! = Anubis::Tenant::MenuLocale.eager_load(menu: :menu).where(locale: Anubis::Tenant::MenuLocale.locales[self.locale.to_sym]).where(['menus.mode = ? AND menus.status = 0', params[:controller]]).first if = { mode: ..mode, menu_id: ., parent_menu_id: .., action: ..action, tab: ..tab, position: ..position, state: ..state } if .. [:parent_mode] = ...mode end = .to_json self.redis.set(self.redis_prefix + 'menu_'+params[:controller], ) = { title: .title, page_title: .page_title, short_title: .short_title }.to_json self.redis.set(self.redis_prefix + 'menu_'+params[:controller]+'_'+self.locale, ) end end if && self.etc. = Anubis::Etc::Menu.new JSON.parse(, {:symbolize_names => true}).merge(JSON.parse(, {:symbolize_names => true})) if self.writer self.etc..access = 'write' else self.etc..access = 'read' end end end |