57 lines
1.1 KiB
Ruby
57 lines
1.1 KiB
Ruby
|
module OrbitApp
|
||
|
module Module
|
||
|
module FrontendUtility
|
||
|
Version = "0.1"
|
||
|
|
||
|
module ClassMethods
|
||
|
@@frontend_pages = []
|
||
|
|
||
|
def add(var)
|
||
|
@@frontend_pages << var
|
||
|
end
|
||
|
|
||
|
def all
|
||
|
return @@frontend_pages
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
extend ClassMethods
|
||
|
def self.included( other )
|
||
|
other.extend( ClassMethods )
|
||
|
end
|
||
|
|
||
|
class AppPageSet
|
||
|
def initialize(&block)
|
||
|
@frontend_pages = []
|
||
|
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
|
||
|
end
|
||
|
|
||
|
def app_page(name,options ={})
|
||
|
@frontend_pages << AppPage.new(name,options)
|
||
|
end
|
||
|
|
||
|
def to_module_app_format
|
||
|
@frontend_pages.collect{|t| t.name}
|
||
|
end
|
||
|
|
||
|
end
|
||
|
|
||
|
class AppPage
|
||
|
attr_reader :name
|
||
|
|
||
|
def initialize(name,options ={})
|
||
|
@name = name
|
||
|
end
|
||
|
|
||
|
def finalize!
|
||
|
|
||
|
end
|
||
|
|
||
|
protected
|
||
|
|
||
|
end# of AppPage
|
||
|
end # of FrontendUtility
|
||
|
end # of Module
|
||
|
end # of OrbitApp
|