Skip to content

Commit

Permalink
Issue universityofcalifornia#384 cleaned up ideas page
Browse files Browse the repository at this point in the history
  • Loading branch information
shaun965 committed Apr 25, 2016
1 parent 8679129 commit c950e90
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
11 changes: 8 additions & 3 deletions app/controllers/ideas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class IdeasController < ApplicationController
end

def index

results = perform_search do |query|
query.type 'ideas'
query.limit 5
Expand All @@ -40,10 +41,14 @@ def index
@top_ideas = results
.map(&:model)
.select(&:global)
.sort_by { |idea| idea.idea_votes.count }
.reverse!
# .sort_by { |idea| idea.idea_votes.count }
# .reverse!
@organizations = Organization.all
@ideas = Idea.order(created_at: :desc).paginate(page: params[:page], per_page: 15)

@ideas = perform_search { |query|
query.type 'ideas'
}.map(&:model).select(&:global).paginate(page: params[:page], per_page: 15)

end

def new
Expand Down
10 changes: 6 additions & 4 deletions app/views/ideas/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@

<h1>Trending UC-Wide Ideas</h1>
<ul class="list-group list-group-secondary">
<li class="list-group-item row tight-row">
<div class="col-xs-8 col-sm-10 col-md-9 tight-col-left">Rank</div>
<li class="list-group-item row tight-row idea-trending-margin">
<div class="col-xs-8 col-sm-10 col-md-9 tight-col-left" style="padding-left: 0px;">Rank</div>
<div class="col-xs-4 col-sm-2 col-md-3 tight-col text-right">Votes</div>
</li>
<% @top_ideas.each_with_index do |idea, i| %>
<li class="list-group-item row tight-row">
<div class="col-xs-8 col-sm-10 col-md-9 tight-col-left">
<li class="list-group-item row tight-row idea-trending-margin">
<div class="col-xs-8 col-sm-10 col-md-9 tight-col-left" style="padding-left: 0px;" >
<%= i + 1 %>.
<%= link_to_idea idea %>
</div>
Expand Down Expand Up @@ -172,3 +172,5 @@
<% end %>

<%= will_paginate @ideas %>

<div style="height: 20px;"></div>
5 changes: 5 additions & 0 deletions blocks/site/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,8 @@ body > main {
padding-top: 21px;
}
}

.idea-trending-margin{
margin-left: 0px;
margin-right: 0px;
}
1 change: 1 addition & 0 deletions config/initializers/will_paginate_array.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'will_paginate/array'

0 comments on commit c950e90

Please sign in to comment.