Skip to content

Commit

Permalink
certificate list campaign UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Floppy committed Sep 22, 2014
1 parent 3447806 commit 30532b5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 6 deletions.
7 changes: 7 additions & 0 deletions app/controllers/campaigns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ def index
end

def show
@published_count = @campaign.certificate_generators.inject(0) do |total, cert|
if cert.certificate.published?
total += 1
else
total
end
end
end

private
Expand Down
50 changes: 44 additions & 6 deletions app/views/campaigns/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
<h1>Campaigns#show</h1>
<p>Find me in app/views/campaigns/show.html.erb</p>

<p>
<%= @campaign.certificate_generators.count %>
</p>
<h1>Campaign Details</h1>
<h2><%= @campaign.name %></h2>
<ul>
<li><%= @campaign.certificate_generators.count %> datasets loaded</li>
<li><%= @published_count %> certificates published</li>
</ul>
<table class='table table-striped'>
<tr>
<td>
Success
</td>
<td>
Published
</td>
<td>
Source
</td>
<td>
Certificate
</td>
<td>
User
</td>
</tr>
<% @campaign.certificate_generators.each do |generator| %>
<tr>
<td>
&check;
</td>
<td>
<%= generator.certificate.published? ? "&check;".html_safe : "" %>
</td>
<td>
<%= link_to generator.dataset.title, generator.dataset.documentation_url %>
</td>
<td>
<%= link_to t("levels.#{generator.certificate.attained_level}.title"), dataset_certificate_path(generator.dataset, generator.certificate) if generator.certificate.published?%>
</td>
<td>
<%= generator.dataset.user.email %>
</td>
</tr>
<% end %>
</table>

0 comments on commit 30532b5

Please sign in to comment.