Skip to content

Commit

Permalink
Add new action for photopanel in homepage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Islam authored and Islam committed Dec 26, 2013
1 parent e0d5df8 commit 905a6ae
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions lib/rails_admin/config/actions/photopanel.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module RailsAdmin
module Config
module Actions
class Photopanel < RailsAdmin::Config::Actions::Base
RailsAdmin::Config::Actions.register(self)

register_instance_option :root? do
true
end

register_instance_option :breadcrumb_parent do
nil
end

register_instance_option :controller do
Proc.new do
if params['entry_id'].nil?
@entries = AdminPhotoPanelManager.get_entries_with_pending_photos
else
@entry_id = params['entry_id']
if params['reviews'].nil?
@photos = AdminPhotoPanelManager.get_pending_photos_from_entry(@entry_id)
@item_name = params['item_name']
else
AdminPhotoPanelManager.update_photos_states(@entry_id, params)
@entries = AdminPhotoPanelManager.get_entries_with_pending_photos
flash[:success] = 'Reviews for the selected images submitted succesfully.'
end
end
render "photopanel"
end
end

register_instance_option :route_fragment do
'photopanel'
end

register_instance_option :link_icon do
'icon-wrench'
end

register_instance_option :statistics? do
true
end
end
end
end
end

0 comments on commit 905a6ae

Please sign in to comment.