2012-11-29 06:21:46 +00:00
|
|
|
module OrbitApp
|
|
|
|
module Module
|
|
|
|
module FrontendUtility
|
|
|
|
Version = "0.1"
|
|
|
|
|
|
|
|
module ClassMethods
|
2013-01-29 12:33:40 +00:00
|
|
|
@@frontend_pages = []
|
|
|
|
#Record all frontend pages of orbit
|
2012-11-29 06:21:46 +00:00
|
|
|
|
2013-01-29 12:33:40 +00:00
|
|
|
def add(var) #build @@frontend_pages
|
2012-11-29 06:21:46 +00:00
|
|
|
@@frontend_pages << var
|
|
|
|
end
|
|
|
|
|
2013-01-29 12:33:40 +00:00
|
|
|
def all #return all frontend_pages of orbit
|
2012-11-29 06:21:46 +00:00
|
|
|
return @@frontend_pages
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
extend ClassMethods
|
|
|
|
def self.included( other )
|
|
|
|
other.extend( ClassMethods )
|
|
|
|
end
|
|
|
|
|
2013-01-29 12:33:40 +00:00
|
|
|
class AppPageSet # From Registration
|
2012-11-29 06:21:46 +00:00
|
|
|
def initialize(&block)
|
2013-01-29 12:33:40 +00:00
|
|
|
@frontend_pages = []
|
2012-11-29 06:21:46 +00:00
|
|
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
|
|
|
end
|
|
|
|
|
2013-01-29 12:33:40 +00:00
|
|
|
def app_page(name,&block)
|
|
|
|
@frontend_pages << AppPage.new(name,&block)
|
2012-11-29 06:21:46 +00:00
|
|
|
end
|
|
|
|
|
2013-01-29 12:33:40 +00:00
|
|
|
def to_module_app_format #For ModuleApp to fetch data
|
|
|
|
@frontend_pages.collect{|t| [t.get_i18n,t.name]}
|
2012-11-29 06:21:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class AppPage
|
|
|
|
attr_reader :name
|
|
|
|
|
2013-01-29 12:33:40 +00:00
|
|
|
def initialize(name,&block)
|
2012-11-29 06:21:46 +00:00
|
|
|
@name = name
|
2013-01-29 12:33:40 +00:00
|
|
|
@frontend_i18n = 'rulingcom.errors.init.app_page_noname'
|
|
|
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
2012-11-29 06:21:46 +00:00
|
|
|
end
|
|
|
|
|
2013-01-29 12:33:40 +00:00
|
|
|
def frontend_i18n(i18n)
|
|
|
|
@frontend_i18n = i18n
|
|
|
|
end
|
|
|
|
|
|
|
|
def get_i18n
|
|
|
|
@frontend_i18n
|
|
|
|
end
|
|
|
|
|
2012-11-29 06:21:46 +00:00
|
|
|
def finalize!
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
end# of AppPage
|
|
|
|
end # of FrontendUtility
|
|
|
|
end # of Module
|
|
|
|
end # of OrbitApp
|