forked from railsadminteam/rails_admin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new action for photopanel in homepage.
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |