Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

latest bounties in welcome page #26

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gem 'typhoeus'#, git: 'https://github.com/typhoeus/typhoeus.git', branch: 'maste
gem 'draper'
gem 'awesome_print'
gem 'hashie'
#gem 'friendly_id', github: 'norman/friendly_id', branch: 'rails4'
# gem 'friendly_id', github: 'FriendlyId/friendly_id', branch: 'rails4'
gem 'data_migration', github: 'ashmckenzie/data_migration'
gem 'rest-client'
gem 'coffee-rails', '~> 4.0.0'
Expand Down
46 changes: 46 additions & 0 deletions app/assets/stylesheets/welcome.css.sass
Original file line number Diff line number Diff line change
@@ -1,2 +1,48 @@
/* I dont think I should import whatever application imports but not sure why it cant find the mixins*/

@import "utils"
@import "common/widgets"
@import "common/**/*"

#main-container
margin-top: -182px

.latest-bounties
margin-top: 40px
background: palette(2, lighten, 2, true)

h3
font-weight: bold

ul
+clearfix
list-style: none
padding: 0
margin: 0 0 10px
display: inline-block

li
float: left
height: 45px
line-height: 45px
width: 250px
margin: 0 2em

a
+hl-button
color: white
width: 100%
overflow: hidden
$palette-cheat-color: darken(palette(2) + palette(2),25)
background: $palette-cheat-color
&:hover
background: lighten($palette-cheat-color,15)

+media($phone)
.latest-bounties
width: 0px
height: 0px
display: none



8 changes: 7 additions & 1 deletion app/controllers/welcome_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
class WelcomeController < ApplicationController

def index
@users = Queries::RunningLeaderboard.new.query.decorate
@users = Queries::RunningLeaderboard.new.query.decorate
@latest_bounties = latest_bounties(3)
end

private
def latest_bounties(limit_no)
Bounty.unclaimed.last(limit_no)
end
end
2 changes: 1 addition & 1 deletion app/views/bounties/_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<tr>
<td>
<%- if can? :show, Bounty %>
<%= link_to bounty.description, bounty.slug %>
<%= link_to bounty.description, bounty_path(bounty) %>
<%- else %>
<%= bounty.description %>
<%- end %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/bounties/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@
<%= @bounty.claimed_at %>
</p>

<%= link_to 'Edit', edit_bounty_path(@bounty) %> |
<%- if can? :edit, @bounty %>
<%= link_to 'Edit', edit_bounty_path(@bounty) %> |
<%- end %>
<%= link_to 'Back', bounties_path %>
10 changes: 10 additions & 0 deletions app/views/welcome/_latest_bounties.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%# once this is done, hero need to be bigger %>

<div class="latest-bounties container">
<h3> Claim a bounty! The latest and greatest: </h3>
<ul>
<% bounties.each do |bounty| %>
<li><div class="bounty-button"><%= link_to bounty.name, bounty_path(bounty) %></div>
<% end %>
</ul>
</div>
5 changes: 5 additions & 0 deletions app/views/welcome/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
<div class="container">
<h2>Highlander turns work into a game. Be awesome, earn badges and become the leader!</h2>
</div>

<%- unless @latest_bounties.empty? %>
<%= render partial: 'latest_bounties', locals: { bounties: @latest_bounties, type: 'unclaimed' } %>
<%- end %>

</div>
<%- end -%>

Expand Down
4 changes: 2 additions & 2 deletions db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
bounty_name = bounties.sample
created_at = Time.zone.now - (rand(21)+1).days

bounty_params = { name: "#{bounty_name} hunt #{user.name} (#{count})",
description: "Hunt down #{bounty_name}, #{user.name} (#{count})",
bounty_params = { name: "#{user.name} hunt #{bounty_name}!",
description: "Hunt down #{bounty_name}, #{user.name}. For glory!",
created_by_id: user.id,
created_at: created_at}

Expand Down