From 1c966701f29a0390b9342af14c3d228adf550fde Mon Sep 17 00:00:00 2001 From: Islam Date: Mon, 10 Mar 2014 00:19:38 +0200 Subject: [PATCH] Adding Education Content --- app/views/rails_admin/main/photopanel.html.erb | 10 ++++++++-- lib/rails_admin/config/actions/photopanel.rb | 10 ++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/views/rails_admin/main/photopanel.html.erb b/app/views/rails_admin/main/photopanel.html.erb index 3fcd2213fd..aebceb8b14 100644 --- a/app/views/rails_admin/main/photopanel.html.erb +++ b/app/views/rails_admin/main/photopanel.html.erb @@ -1,5 +1,10 @@
- <% if !@entries.nil? %> + <% if @entry_id.nil? && @entries.nil? %> + + <% elsif !@entries.nil? %> <% if @entries.count == 0 %>

No entries with photos to review today. You are good to go :)

<% else %> @@ -9,7 +14,7 @@ <% item = entry.item %> <% item_name = item.name + " " + item.disambiguation_label_cache %> - <%= link_to item_name, photopanel_path('entry_id' => entry.id, 'item_name' => item_name) %> + <%= link_to item_name, photopanel_path('entry_id' => entry.id, 'item_name' => item_name, tag: @tag) %> <% end %> @@ -21,6 +26,7 @@

> + <% @photos.each do |photo| %>
style="width: 100%; height: 80%;"> diff --git a/lib/rails_admin/config/actions/photopanel.rb b/lib/rails_admin/config/actions/photopanel.rb index 79148277a2..be83954ea0 100644 --- a/lib/rails_admin/config/actions/photopanel.rb +++ b/lib/rails_admin/config/actions/photopanel.rb @@ -14,18 +14,20 @@ class Photopanel < RailsAdmin::Config::Actions::Base register_instance_option :controller do Proc.new do - if params['entry_id'].nil? - @entries = AdminPhotoPanelManager.get_entries_with_pending_photos - else + if !params['entry_id'].nil? @entry_id = params['entry_id'] + @tag = params['tag'] 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 + @entries = AdminPhotoPanelManager.get_entries_with_pending_photos params['tag'] flash[:success] = 'Reviews for the selected images submitted succesfully.' end + elsif !params['tag'].nil? + @entries = AdminPhotoPanelManager.get_entries_with_pending_photos params['tag'] + @tag = params['tag'] end render "photopanel" end