startup for config

This commit is contained in:
Matthew K. Fu JuYuan 2012-09-13 18:31:44 +08:00
parent 01a8a9b5b6
commit f009a1c942
8 changed files with 155 additions and 0 deletions

10
lib/orbit_app.rb Normal file
View File

@ -0,0 +1,10 @@
require "orbit_app/summary"
require "orbit_app/dsl"
require "orbit_app/backend_side_bar"
require "orbit_app/plugin/plugin_summary"
require "orbit_app/module/module_summary"
module OrbitApp
extend DSL
end

View File

@ -0,0 +1,15 @@
module OrbitApp
class BackendSideBar
attr_reader :name
def initialize(name, &block)
@name = name
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
def item(*args)
end
end
end

16
lib/orbit_app/dsl.rb Normal file
View File

@ -0,0 +1,16 @@
module OrbitApp
module DSL
def backend_side_bar(name,&block)
BackendSideBar.new(name,&block)
end
def plugin_summary(name,&block)
# Plugin::PluginSummary.new(name,&block)
end
def module_summary(name,&block)
Module::ModuleSummary.new(name,&block)
end
end
end

View File

@ -0,0 +1,20 @@
#encoding: utf-8
require "orbit_app/summary"
module OrbitApp
module Module
module ModuleSummary
include Summary
class Item
def initialize()
@top = {:label => "全部內容有",:value=> "2071"}
@items = [{:label => "新聞",:value=> "20"}]
end
end
end
end
end

View File

@ -0,0 +1,10 @@
require "orbit_app/summary"
module OrbitApp
module Plugin
module PluginSummary
include OrbitApp::Summary
end
end
end

46
lib/orbit_app/summary.rb Normal file
View File

@ -0,0 +1,46 @@
module OrbitApp
module Summary
Version = "0.1"
module ClassMethods
@@summaries = []
def new( name ,&block)
@@summaries << Item.new(name,&block)
binding.pry
end
def all
return @@summaries
end
end
extend ClassMethods
def self.included( other )
other.extend( ClassMethods )
end
# def initialize( k )
# @@summaries += 1
# binding.pry
# end
class Item
@name =""
def initialize(name = "test",&block)
@name = name
block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
end
def get_name
return @name
end
end
end
end

View File

@ -0,0 +1,17 @@
OrbitApp.module_summary "Announcement" do
end
# OrbitApp.backend_side_bar 'News' do
# block :available_for => [:admin,:guest,:manager,:sub_manager],
# :active_for_controllers=> ['news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals'],
# :active_for_ob_auths_object => ['NewsBulletinCategory'],
# :head_link => panel_news_back_end_news_bulletins_path ,
# :head_label=> I18n.t('admin.news')
# context_link :link=>new_panel_news_back_end_news_bulletin_path ,
# :priority=>1,:label=>I18n.t('announcement.add_new'),
# :active_for_action=>{:news_bulletins=>:new}
# end

21
vendor/built_in_modules/news/init.rb vendored Normal file
View File

@ -0,0 +1,21 @@
# OrbitApp.module_summary "News" do
# end
# OrbitApp.plugin_summary "News" do
# end
# OrbitApp.backend_side_bar 'News' do
# block :available_for => [:admin,:guest,:manager,:sub_manager],
# :active_for_controllers=> ['news_bulletins', '/panel/news/back_end/tags', 'news_bulletin_categorys', 'news_approvals'],
# :active_for_ob_auths_object => ['NewsBulletinCategory'],
# :head_link => panel_news_back_end_news_bulletins_path ,
# :head_label=> I18n.t('admin.news')
# context_link :link=>new_panel_news_back_end_news_bulletin_path ,
# :priority=>1,:label=>I18n.t('announcement.add_new'),
# :active_for_action=>{:news_bulletins=>:new}
# end