Module: Anoubis::Data::Set
- Included in:
- Anoubis::DataController
- Defined in:
- app/controllers/anoubis/data/set.rb
Overview
Module sets system data for Anoubis::DataController
Instance Method Summary collapse
-
#set_current_tab ⇒ Object
Gets tab for current controller and place it into self.etc.tab system variable.
-
#set_new_action(action) ⇒ Object
Defines new action and clears defined for old action variables.
-
#set_parent_model(action = '') ⇒ Object
Sets parent model according by type.
Instance Method Details
#set_current_tab ⇒ Object
Gets tab for current controller and place it into self.etc.tab system variable. If params absent or incorrect then self.etc.tab is set as first value of Defaults#tabs hash.
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/anoubis/data/set.rb', line 24 def set_current_tab if !self.etc.tab tabs = self.tabs if params.key? :tab if params[:tab].to_s != '' if tabs.key? params[:tab].to_s.to_sym self.etc.tab = Etc::TabItem.new(self.get_tab(params[:tab].to_s, tabs[params[:tab].to_s.to_sym])) end end end self.etc.tab = Etc::TabItem.new(self.get_tab(tabs.keys[0].to_s, tabs.values[0])) if !self.etc.tab end end |
#set_new_action(action) ⇒ Object
Defines new action and clears defined for old action variables
41 42 43 44 |
# File 'app/controllers/anoubis/data/set.rb', line 41 def set_new_action(action) self.etc.action = action self.etc.data.model = nil end |
#set_parent_model(action = '') ⇒ Object
Sets parent model according by type. Resulting data placed in self.etc.data.parent
15 16 17 18 19 |
# File 'app/controllers/anoubis/data/set.rb', line 15 def set_parent_model(action = '') self.etc.data = Anoubis::Etc::Data.new if !self.etc.data self.etc.action = action if action != '' self.set_current_tab end |