Skip to content

Commit

Permalink
display more recent changes (#508)
Browse files Browse the repository at this point in the history
  • Loading branch information
michielbdejong authored Jun 26, 2018
1 parent dd5c665 commit c571882
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 44 deletions.
2 changes: 1 addition & 1 deletion app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PagesController < ApplicationController
def home
@services = Service.includes(:points).with_points_featured.sample(3)
@versions = Version.order("created_at DESC").limit(5) # .joins('INNER JOIN users ON "whodunnit"= cast(users."id" as text)')
@versions = Version.order("created_at DESC").limit(50) # .joins('INNER JOIN users ON "whodunnit"= cast(users."id" as text)')
end
end
87 changes: 44 additions & 43 deletions app/views/pages/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,49 @@
<p>Then you need to wait for a curator to approve your changes, after which your review will show up on <a href="https://tosdr.org">https://tosdr.org</a>, will be picked up by the ToS;DR browser extensions, and included in DuckDuckGo's Privacy Grade, for which our API is one of several input factors. For services whose terms and policies are tracked by <a href="https://tosback.org">ToSBack</a>, you can try out our experimental <a href="/services/331/annotate">annotate view</a>.</p>
<p>This tool is still very much under construction, and has bugs. Please <a href="https://github.com/tosdr/phoenix/issues/new">open a github issue</a> for anything you think should be improved.</p>


<h2>Examples (<%= link_to "see all", services_path %>):</h2>
<div class="row" id="service-container">
<% @services.each do |s| %>
<div class="col-xs-12 col-sm-6 col-lg-4 serviceDiv" data-rating="<%= s.service_ratings %>">
<!--CARD -->
<div class="card">
<h2 class="card-header card-service" title="<%= s.name %>">
<%= s.name %>
</h2>
<div class="card-body card-block">
<div class="card-text">
<ul>
<% s.points.each do |p| %>
<% if p.is_featured? %>
<% if p.rating.between?(7,10) %>
<% point_icon = "point-good" %>
<% elsif p.rating.between?(4,6) %>
<% point_icon = "point-neutral" %>
<% elsif p.rating.between?(2,3) %>
<% point_icon = "point-bad" %>
<% elsif p.rating.between?(0,2) %>
<% point_icon = "point-blocker" %>
<% end %>
<li class="<%= point_icon %> xs-icon">
<%= p.title %>
</li>
<% end %>
<% end %>
</ul>
<div class="card-badge <%= s.rating_for_view %>">
<%= s.service_ratings %>
</div>
</div>
</div>
<div class="card-footer">
<%= link_to "More", service_path(s.id), class: "btn btn-primary box-shadow-for-button" %>
</div>
</div>
</div>
<% end %>
</div>

<h2>Recent changes:</h2>
<div class="panel-group" id="accordion">
<% counter = 1 %>
Expand All @@ -38,7 +81,7 @@
</div>
<div class="col-sm-4">
<h5>
<%= version.event %>
<%= version.event %>d <!-- FIXME for i18n: make this literal 'd' a function to_past_tense in app/helpers/ -->
<a
href="/<%= version.item_type.downcase %>s/<%= version.item_id %>" class="collapsed">
<%= version.item_type %>
Expand Down Expand Up @@ -72,45 +115,3 @@
</div>
<% end %>
</div>

<h2>Examples:</h2>
<div class="row" id="service-container">
<% @services.each do |s| %>
<div class="col-xs-12 col-sm-6 col-lg-4 serviceDiv" data-rating="<%= s.service_ratings %>">
<!--CARD -->
<div class="card">
<h2 class="card-header card-service" title="<%= s.name %>">
<%= s.name %>
</h2>
<div class="card-body card-block">
<div class="card-text">
<ul>
<% s.points.each do |p| %>
<% if p.is_featured? %>
<% if p.rating.between?(7,10) %>
<% point_icon = "point-good" %>
<% elsif p.rating.between?(4,6) %>
<% point_icon = "point-neutral" %>
<% elsif p.rating.between?(2,3) %>
<% point_icon = "point-bad" %>
<% elsif p.rating.between?(0,2) %>
<% point_icon = "point-blocker" %>
<% end %>
<li class="<%= point_icon %> xs-icon">
<%= p.title %>
</li>
<% end %>
<% end %>
</ul>
<div class="card-badge <%= s.rating_for_view %>">
<%= s.service_ratings %>
</div>
</div>
</div>
<div class="card-footer">
<%= link_to "More", service_path(s.id), class: "btn btn-primary box-shadow-for-button" %>
</div>
</div>
</div>
<% end %>
</div>

1 comment on commit c571882

@d066z

This comment was marked as spam.

Please sign in to comment.