module Gallery
  OrbitApp.registration "Gallery",:type=> 'ModuleApp' do
    module_label 'gallery.gallery'
    base_url File.expand_path File.dirname(__FILE__)    
    # personal_plugin :enable => true,:path=>"panel/gallery/plugin/profile",:i18n=>'admin.gallery'
    
    version "0.1"
    organization "Rulingcom"
    author "Visual dep"
    intro "A simple and amazing gallery"
    update_info 'some update_info'

    front_end do
      app_page 'albums' do
        frontend_i18n "gallery.front_end.albums"
      end
    end

    authorizable
    categorizable
    taggable

    widgets do
      # default_widget do
      #   query 'Bulletin.all'
      #   image :image
      # end

      categories_query 'GalleryCategory.all'
      # tags_query 'GalleryTag.all'

      #* customize_widget "albums","gallery.widget.albums",:fields=>[],:style=>[],:options=>{"widget1"=>{"vertical"=>[1, 2], "horizontal"=>[1, 2, 3, 4, 5, 6], "album_id"=>{"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}}} 
      #* customize_widget_options_fields_i18n({"widget1"=>{"vertical"=>"gallery.widget_option.vertical", "horizontal"=>"gallery.widget_option.horizontal", "album_id"=>"gallery.album"}} )

      customize_widget "widget1" do 
        widget_i18n "gallery.widget.widget1"
        style []
        options "vertical",:i18n => "gallery.widget_option.vertical",:options_item=>[1, 2]
        options "horizontal",:i18n => "gallery.widget_option.horizontal",:options_item=>[1, 2,3,4,5,6]
        options "album_id",:i18n =>"gallery.album",:options_item => {"query"=>"GalleryAlbum.all", "value"=>:id, "label"=>:name}
      end

    end
    
    side_bar do
      head_label_i18n  'gallery.gallery',:icon_class=>"icons-pictures"
      available_for [:admin,:guest,:manager,:sub_manager]
      active_for_controllers ({:private=>['albums','album_images','gallery_categories','/panel/gallery/back_end/tags']})
      active_for_object_auth ['GalleryCategory'] 

      head_link_path "panel_gallery_back_end_albums_path"

      context_link 'gallery.all',
                            :link_path=>"panel_gallery_back_end_albums_path" ,
                            :priority=>3,
                            :active_for_category => 'Gallery',
                            :active_for_action=>{:albums=>:index},
                            :available_for => [:manager]

      context_link 'gallery.new',
                            :link_path=>"new_panel_gallery_back_end_album_path" ,
                            :priority=>3,
                            :active_for_category => 'Gallery',
                            :active_for_action=>{:albums=>:new},
                            :available_for => [:manager]
      
      context_link 'gallery.categories',
                            :link_path=>"admin_module_app_categories_path(get_module_app)" ,
                            :priority=>3,
                            :active_for_category => 'Gallery',
                            :available_for => [:manager]

      context_link 'tags',
                            :link_path=>"admin_module_tags_path(module_app_id: get_module_app)" ,
                            :priority=>4,
                            :active_for_tag => 'Gallery',
                            :available_for => [:manager]
    end
  end
end