Skip to content

Commit

Permalink
Merge branch 'master' of github.com:concerto/concerto
Browse files Browse the repository at this point in the history
  • Loading branch information
augustf committed Jul 9, 2012
2 parents 4bc1eef + f1b0469 commit cae8084
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 11 deletions.
9 changes: 5 additions & 4 deletions app/controllers/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ def get_feed

def index
@can_moderate_feed = can?(:update, @feed)
@submissions = @feed.submissions
if !@can_moderate_feed
@submissions = @submissions.approved
@approved_submissions = @feed.submissions.approved
if @can_moderate_feed
@pending_submissions = @feed.submissions.pending
end
auth!
#brzNote: did appears to result in a redirect when it is uncommented:
#auth!

respond_to do |format|
format.js { }
Expand Down
79 changes: 72 additions & 7 deletions app/views/submissions/_index_body.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,82 @@

</div>

<% if @submissions.empty? %>
<% if @can_moderate_feed and @pending_submissions.count > 0 %>
<div class="default-padding">
<h3><%= @pending_submissions.count %> content<% if @pending_submissions.count != 1 %>s<% end %> pending your moderation</h3>
</div>
<ul class="GL">
<% @pending_submissions.each do |submission| %>
<li>
<div class="cont">
<%= link_to [submission.feed, submission], :remote => true do %>
<%= render_content(submission.content, {:type => 'grid'}) %>
<% end %>
<b><%= link_to submission.content.name, [submission.feed, submission], :remote => true %></b>
<br />
<%= submission.content.start_time.strftime("%m/%d") %> to <%= submission.content.end_time.strftime("%m/%d") %>
<br />
<p>
<%= link_to "#", :class => "dropdown-control dd-moderate", :title => "Moderate '#{ submission.content.name }'", :rel => "#moderate_#{ submission.id }" do %>
<% if submission.is_approved? %>
Approved
<% elsif submission.is_denied? %>
Denied
<% else %>
Pending Moderation
<% end %>
<% end %>
</p>


<div id="moderate_<%= submission.id %>" style="display:none;">
<% if submission.is_approved? %>
<p>Currently <b style="color: green;">Approved</b></p>
<p>Change to Denied</p>
<%= render :partial => "submissions/moderate_form", :locals => { :submission => submission, :moderate => false } %>
<% elsif submission.is_denied? %>
<p>Currently <b style="color: red;">Denied</b></p>
<p>Change to Approved</p>
<%= render :partial => "submissions/moderate_form", :locals => { :submission => submission, :moderate => true } %>
<% else %>
<p>Currently <b>Pending Moderation</b></p>
<div class="form-stacked">
<h4>Moderate Content</h4>
<div id="moderate-select" class="btn-toolbar">
<div class="btn-group" data-toggle="buttons-radio">
<button class="btn approve">Approve</button>
<button class="btn deny">Deny</button>
</div>
</div>

<div id="moderate-true">
<%= render :partial => "submissions/moderate_form", :locals => { :submission => submission, :moderate => true } %>
</div>
<div id="moderate-false">
<%= render :partial => "submissions/moderate_form", :locals => { :submission => submission, :moderate => false } %>
</div>
</div>
<% end %>
<br />
</div>

</div>
</li>
<% end %>
</ul>
<div class="clear"></div>
<% end %>
<% if @approved_submissions.empty? %>
<div class="content-holder default-padding">
<h3>Oops - there's no content inside this feed.</h3>
<h3>Oops! This feed has no approved content.</h3>
</div>
<% else %>
<div class="default-padding">
<h3><%= @approved_submissions.count %> active content<% if @approved_submissions.count != 1 %>s<% end %></h3>
</div>
<ul class="GL">
<% @submissions.each do |submission| %>
<% @approved_submissions.each do |submission| %>
<li>
<div class="cont">
<%= link_to [submission.feed, submission], :remote => true do %>
Expand All @@ -53,7 +122,6 @@
<br />
<%= submission.content.start_time.strftime("%m/%d") %> to <%= submission.content.end_time.strftime("%m/%d") %>
<br />
<% if @can_moderate_feed %>
<p>
<%= link_to "#", :class => "dropdown-control dd-moderate", :title => "Moderate '#{ submission.content.name }'", :rel => "#moderate_#{ submission.id }" do %>
<% if submission.is_approved? %>
Expand Down Expand Up @@ -97,17 +165,14 @@
<% end %>
<br />
</div>
<% end %>

</div>
</li>

<% end %>
</ul>
<div class="clear"></div>
<% end %>


<script type="text/javascript">

$(document).ready(function() {
Expand Down

0 comments on commit cae8084

Please sign in to comment.