From f009a1c942a2d26a8844e557fe9f26d3ac7907e4 Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Thu, 13 Sep 2012 18:31:44 +0800 Subject: [PATCH] startup for config --- lib/orbit_app.rb | 10 +++++ lib/orbit_app/backend_side_bar.rb | 15 +++++++ lib/orbit_app/dsl.rb | 16 +++++++ lib/orbit_app/module/module_summary.rb | 20 +++++++++ lib/orbit_app/plugin/plugin_summary.rb | 10 +++++ lib/orbit_app/summary.rb | 46 ++++++++++++++++++++ vendor/built_in_modules/announcement/init.rb | 17 ++++++++ vendor/built_in_modules/news/init.rb | 21 +++++++++ 8 files changed, 155 insertions(+) create mode 100644 lib/orbit_app.rb create mode 100644 lib/orbit_app/backend_side_bar.rb create mode 100644 lib/orbit_app/dsl.rb create mode 100644 lib/orbit_app/module/module_summary.rb create mode 100644 lib/orbit_app/plugin/plugin_summary.rb create mode 100644 lib/orbit_app/summary.rb create mode 100644 vendor/built_in_modules/announcement/init.rb create mode 100644 vendor/built_in_modules/news/init.rb diff --git a/lib/orbit_app.rb b/lib/orbit_app.rb new file mode 100644 index 00000000..d171a5a6 --- /dev/null +++ b/lib/orbit_app.rb @@ -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 diff --git a/lib/orbit_app/backend_side_bar.rb b/lib/orbit_app/backend_side_bar.rb new file mode 100644 index 00000000..a4f3728e --- /dev/null +++ b/lib/orbit_app/backend_side_bar.rb @@ -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 \ No newline at end of file diff --git a/lib/orbit_app/dsl.rb b/lib/orbit_app/dsl.rb new file mode 100644 index 00000000..c414d663 --- /dev/null +++ b/lib/orbit_app/dsl.rb @@ -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 \ No newline at end of file diff --git a/lib/orbit_app/module/module_summary.rb b/lib/orbit_app/module/module_summary.rb new file mode 100644 index 00000000..746e1205 --- /dev/null +++ b/lib/orbit_app/module/module_summary.rb @@ -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 \ No newline at end of file diff --git a/lib/orbit_app/plugin/plugin_summary.rb b/lib/orbit_app/plugin/plugin_summary.rb new file mode 100644 index 00000000..55e05120 --- /dev/null +++ b/lib/orbit_app/plugin/plugin_summary.rb @@ -0,0 +1,10 @@ +require "orbit_app/summary" + +module OrbitApp + module Plugin + module PluginSummary + include OrbitApp::Summary + + end + end +end \ No newline at end of file diff --git a/lib/orbit_app/summary.rb b/lib/orbit_app/summary.rb new file mode 100644 index 00000000..05c22f89 --- /dev/null +++ b/lib/orbit_app/summary.rb @@ -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 \ No newline at end of file diff --git a/vendor/built_in_modules/announcement/init.rb b/vendor/built_in_modules/announcement/init.rb new file mode 100644 index 00000000..a9a24c5f --- /dev/null +++ b/vendor/built_in_modules/announcement/init.rb @@ -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 \ No newline at end of file diff --git a/vendor/built_in_modules/news/init.rb b/vendor/built_in_modules/news/init.rb new file mode 100644 index 00000000..ec20495f --- /dev/null +++ b/vendor/built_in_modules/news/init.rb @@ -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 \ No newline at end of file