Skip to content

Commit

Permalink
Merge pull request railsadminteam#5 from islam-al-aarag/master
Browse files Browse the repository at this point in the history
Adding Education Content
  • Loading branch information
Saher El-Neklawy committed Mar 11, 2014
2 parents 4add2e1 + 1c96670 commit 34c4d3e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 8 additions & 2 deletions app/views/rails_admin/main/photopanel.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<div>
<% if !@entries.nil? %>
<% if @entry_id.nil? && @entries.nil? %>
<ul>
<li> <%= link_to 'Restaurants Photos', photopanel_path(tag: 'restaurants') %>
<li> <%= link_to 'Education Photos', photopanel_path(tag: 'education') %>
</ul>
<% elsif !@entries.nil? %>
<% if @entries.count == 0 %>
<h1> No entries with photos to review today. You are good to go :) </h1>
<% else %>
Expand All @@ -9,7 +14,7 @@
<td>
<% 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) %>
</td>
</tr>
<% end %>
Expand All @@ -21,6 +26,7 @@
<input type="submit" value="Submit" style="margin-left: 600px"></br></br>
<input type="hidden" name="reviews" value="true">
<input type="hidden" name="entry_id" value=<%= @entry_id %>>
<input type="hidden" name="tag" value="<%=@tag%>">
<% @photos.each do |photo| %>
<div style="display: inline-block; width: 400px; height: 400px;">
<img src=<%= photo.url %> style="width: 100%; height: 80%;">
Expand Down
10 changes: 6 additions & 4 deletions lib/rails_admin/config/actions/photopanel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 34c4d3e

Please sign in to comment.