startup for config
This commit is contained in:
		
							parent
							
								
									01a8a9b5b6
								
							
						
					
					
						commit
						f009a1c942
					
				|  | @ -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 | ||||||
|  | @ -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 | ||||||
|  | @ -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 | ||||||
|  | @ -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 | ||||||
|  | @ -0,0 +1,10 @@ | ||||||
|  | require  "orbit_app/summary" | ||||||
|  | 
 | ||||||
|  | module OrbitApp | ||||||
|  |   module Plugin | ||||||
|  |     module PluginSummary   | ||||||
|  |       include OrbitApp::Summary | ||||||
|  |   | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  | end | ||||||
|  | @ -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 | ||||||
|  | @ -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 | ||||||
|  | @ -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 | ||||||
		Reference in New Issue