module Archive
  OrbitApp.registration "Archive",:type=> 'ModuleApp' do
    module_label 'archive.archive'
    base_url File.expand_path File.dirname(__FILE__)    

    # personal_plugin :enable => true,:path=>"panel/archive/plugin/profile",:i18n=>'archive.archive'
    
    version "0.1"
    organization "Rulingcom"
    author "RD dep"
    intro "I am intro"
    update_info 'some update_info'

    front_end do
      app_page 'archive_files'  do 
        frontend_i18n "archive.frontend.archive"
        style ["1","2"]
      end
    end

    # category ["ArchiveFileCategory"]

    authorizable
    categorizable
    taggable

    widgets do
      # default_widget do
      #   query 'ArchiveFile.all'
      #   field :category
      #   link_field :title,{:method => 'panel_archive_front_end_archive_file_path',:args=>:self}
      #   link_field :archive_file_category_with_title,{:method => 'panel_archive_front_end_archive_files_path',:args=>{:category_id => [:archive_file_category,:id]}}
      # end

      categories_query 'ArchiveFileCategory.all'
      tags_query 'ArchiveTag.all'

      customize_widget "index" do 
        widget_i18n "archive.widget.index"
        style ["1","2"]
      end

      customize_widget "archive_search_block" do
        widget_i18n "announcement.widget.search"
      end

      # item "index","announcement.widget.index",:default_template=>true,:fields=>["title","category","postdate"]
      # item "bulletins_and_web_links","announcement.widget.bulletins_and_web_links"
    end

    
    side_bar do
      head_label_i18n  'archive.archive',:icon_class=>"icons-archive"
      available_for [:admin,:guest,:manager,:sub_manager]
      # active_for_controllers ({:private=>['archive_file_categorys','archive_files'],:public=>['panel/archive/back_end/tags']})
      active_for_controllers ({:private=>['archive_file_categorys','archive_files','module_tags', 'categories']})
      active_for_object_auth ['ArchiveFileCategory'] 

      head_link_path "panel_archive_back_end_archive_files_path"

      context_link 'all',
                            :link_path=>"panel_archive_back_end_archive_files_path" ,
                            :priority=>1,
                            :active_for_action=>{:archive_files=>:index},
                            :available_for => [:all]
      context_link 'add', 
                            :link_path=>"new_panel_archive_back_end_archive_file_path" ,
                            :priority=>2,
                            :active_for_action=>{:archive_files=>:new},
                            :available_for => [:sub_manager]
      context_link 'categories',
                            :link_path=>"admin_module_app_categories_path(get_module_app)" ,
                            :priority=>3,
                            :active_for_category => 'Archive',
                            :available_for => [:manager]
      context_link 'tags',
                            :link_path=>"admin_module_tags_path(module_app_id: get_module_app)" ,
                            :priority=>4,
                            :active_for_tag => 'Archive',
                            :available_for => [:manager]

    end
  end
end
