diff --git a/Gemfile b/Gemfile index d57c9fc5..ca8211db 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/app/assets/stylesheets/welcome.css.sass b/app/assets/stylesheets/welcome.css.sass index f1d43228..c072f7f8 100644 --- a/app/assets/stylesheets/welcome.css.sass +++ b/app/assets/stylesheets/welcome.css.sass @@ -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 + + + diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 536361f9..a155891a 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -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 diff --git a/app/views/bounties/_table.html.erb b/app/views/bounties/_table.html.erb index d42ab6a7..e2da9d3e 100644 --- a/app/views/bounties/_table.html.erb +++ b/app/views/bounties/_table.html.erb @@ -19,7 +19,7 @@ <%- if can? :show, Bounty %> - <%= link_to bounty.description, bounty.slug %> + <%= link_to bounty.description, bounty_path(bounty) %> <%- else %> <%= bounty.description %> <%- end %> diff --git a/app/views/bounties/show.html.erb b/app/views/bounties/show.html.erb index d899e496..c4d6a8d5 100644 --- a/app/views/bounties/show.html.erb +++ b/app/views/bounties/show.html.erb @@ -35,5 +35,7 @@ <%= @bounty.claimed_at %>

-<%= link_to 'Edit', edit_bounty_path(@bounty) %> | +<%- if can? :edit, @bounty %> + <%= link_to 'Edit', edit_bounty_path(@bounty) %> | +<%- end %> <%= link_to 'Back', bounties_path %> diff --git a/app/views/welcome/_latest_bounties.html.erb b/app/views/welcome/_latest_bounties.html.erb new file mode 100644 index 00000000..64e600ae --- /dev/null +++ b/app/views/welcome/_latest_bounties.html.erb @@ -0,0 +1,10 @@ +<%# once this is done, hero need to be bigger %> + +
+

Claim a bounty! The latest and greatest:

+ +
\ No newline at end of file diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb index fb3b9dd2..32ede989 100644 --- a/app/views/welcome/index.html.erb +++ b/app/views/welcome/index.html.erb @@ -7,6 +7,11 @@

Highlander turns work into a game. Be awesome, earn badges and become the leader!

+ + <%- unless @latest_bounties.empty? %> + <%= render partial: 'latest_bounties', locals: { bounties: @latest_bounties, type: 'unclaimed' } %> + <%- end %> + <%- end -%> diff --git a/db/seeds.rb b/db/seeds.rb index 008fba08..eaab0e86 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -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}