From eed7a22dbeafe02c5e4562855911ec1fcd90ea57 Mon Sep 17 00:00:00 2001 From: Fu Matthew Date: Mon, 4 Feb 2013 18:14:00 +0800 Subject: [PATCH] fix sidebar icon for page. fix i18n on sidebar make sidebar sortable by changing db value. Need interface --- lib/orbit_app/module/side_bar.rb | 11 +++++++++++ .../calendar/config/locales/zh_tw.yml | 3 ++- vendor/built_in_modules/calendar/init.rb | 6 +++--- .../miss_module/config/locales/zh_tw.yml | 3 +-- vendor/built_in_modules/page_content/init.rb | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lib/orbit_app/module/side_bar.rb b/lib/orbit_app/module/side_bar.rb index 050df87a..60424ae0 100644 --- a/lib/orbit_app/module/side_bar.rb +++ b/lib/orbit_app/module/side_bar.rb @@ -24,6 +24,11 @@ module OrbitApp def all return @@side_bars end + + def all_get_ordered! + @@side_bars.sort! {|x,y| x.get_sidebar_order! <=> y.get_sidebar_order! } + end + end extend ClassMethods @@ -52,12 +57,18 @@ module OrbitApp @app_base_path = '' @module_app_key = key @get_module_app = get_module_app + @sidebar_order = 0 block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given? # setup_module_app(module_app_key) finalize! SideBarRegisition.add(self) + SideBarRegisition.all_get_ordered! end + def get_sidebar_order! + @sidebar_order = get_module_app.sidebar_order + end + def get_module_app @get_module_app.call end diff --git a/vendor/built_in_modules/calendar/config/locales/zh_tw.yml b/vendor/built_in_modules/calendar/config/locales/zh_tw.yml index 1e7df002..ff6e49c8 100644 --- a/vendor/built_in_modules/calendar/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/calendar/config/locales/zh_tw.yml @@ -1,7 +1,8 @@ zh_tw: calendar: + calendar_: 行事曆 calendar: 日曆 - calendars: Calendars + categories: 類別 color: Color name: Name save: Save diff --git a/vendor/built_in_modules/calendar/init.rb b/vendor/built_in_modules/calendar/init.rb index fc318e6c..beef7ca9 100644 --- a/vendor/built_in_modules/calendar/init.rb +++ b/vendor/built_in_modules/calendar/init.rb @@ -1,6 +1,6 @@ module Calendar OrbitApp.registration "Calendar",:type=> 'ModuleApp' do - module_label 'miss_module_i18n.calendar' + module_label 'calendar.calendar_' base_url File.expand_path File.dirname(__FILE__) # personal_plugin :enable => true,:path=>"panel/calendar/plugin/profile",:i18n=>'admin.calendar' @@ -11,14 +11,14 @@ module Calendar update_info 'some update_info' side_bar do - head_label_i18n 'miss_module_i18n.calendar',:icon_class=>"icons-calendar" + head_label_i18n 'calendar.calendar_',:icon_class=>"icons-calendar" available_for [:admin,:guest,:manager,:sub_manager] active_for_controllers ({:private=>['cals','calendar_categories'],:public=>['panel/calendar/back_end/tags']}) head_link_path "panel_calendar_back_end_cals_path" - context_link 'calendar.calendars', + context_link 'calendar.categories', :link_path=>"new_panel_calendar_back_end_cal_path" , :priority=>1, :active_for_action=>{:cals=>:new}, diff --git a/vendor/built_in_modules/miss_module/config/locales/zh_tw.yml b/vendor/built_in_modules/miss_module/config/locales/zh_tw.yml index aeea83c6..3b727355 100644 --- a/vendor/built_in_modules/miss_module/config/locales/zh_tw.yml +++ b/vendor/built_in_modules/miss_module/config/locales/zh_tw.yml @@ -4,10 +4,9 @@ zh_tw: archive: 檔案室 _archive: all: 全部檔案 - calendar: 日曆模組 calendars: 日曆 gallery: 相簿 - location: (未命名)Location + location: 地標 ad_banner: 廣告輪播 miss_plugin_i18n: diff --git a/vendor/built_in_modules/page_content/init.rb b/vendor/built_in_modules/page_content/init.rb index 73199b18..5d779836 100644 --- a/vendor/built_in_modules/page_content/init.rb +++ b/vendor/built_in_modules/page_content/init.rb @@ -16,7 +16,7 @@ module PageContent end side_bar do - head_label_i18n 'page',:icon_class=>"icons-page" + head_label_i18n 'page',:icon_class=>"icons-newspaper" available_for [:admin,:guest,:manager,:sub_manager] active_for_controllers ({:private=>['page_contexts']}) active_for_object_auth ['PageContext']