From d03a8cda3ce84a52ceb83aab0c81cd5cd02b94a2 Mon Sep 17 00:00:00 2001 From: Gabriel Rotbart Date: Thu, 13 Jun 2013 22:55:50 +1000 Subject: [PATCH 1/6] user should hunt bounty, not the other way around. sheesh --- db/seeds.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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} From 8719ef054bc5e87d63d85b7c6d6126f7a2e182eb Mon Sep 17 00:00:00 2001 From: Gabriel Rotbart Date: Thu, 13 Jun 2013 23:40:35 +1000 Subject: [PATCH 2/6] first go at getting the bounties on the welcome page --- app/assets/stylesheets/welcome.css.sass | 31 +++++++++++++++++++++ app/controllers/welcome_controller.rb | 8 +++++- app/views/welcome/_latest_bounties.html.erb | 10 +++++++ app/views/welcome/index.html.erb | 5 ++++ 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 app/views/welcome/_latest_bounties.html.erb diff --git a/app/assets/stylesheets/welcome.css.sass b/app/assets/stylesheets/welcome.css.sass index f1d43228..d3da4686 100644 --- a/app/assets/stylesheets/welcome.css.sass +++ b/app/assets/stylesheets/welcome.css.sass @@ -1,2 +1,33 @@ +/* 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) + + ul + +clearfix + list-style: none + + li + float: left + height: 45px + line-height: 45px + width: 250px + margin: 0 2em + + .bounty-button + +hl-button + overflow: hidden + $palette-cheat-color: darken(palette(2) + palette(2),25) + background: $palette-cheat-color + &:hover + background: lighten($palette-cheat-color,15) + + 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/welcome/_latest_bounties.html.erb b/app/views/welcome/_latest_bounties.html.erb new file mode 100644 index 00000000..1d6b1c9d --- /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:

+
    + <% bounties.each do |bounty| %> +
  • <%= bounty.name %>
    + <% end %> +
+
\ 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 -%> From 1b6a66fdecc794f68fca4632c3d855cce319abae Mon Sep 17 00:00:00 2001 From: Gabriel Rotbart Date: Thu, 13 Jun 2013 23:51:21 +1000 Subject: [PATCH 3/6] some stylin --- app/assets/stylesheets/welcome.css.sass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/stylesheets/welcome.css.sass b/app/assets/stylesheets/welcome.css.sass index d3da4686..0f8398b2 100644 --- a/app/assets/stylesheets/welcome.css.sass +++ b/app/assets/stylesheets/welcome.css.sass @@ -11,6 +11,9 @@ margin-top: 40px background: palette(2, lighten, 2, true) + h3 + font-weight: bold + ul +clearfix list-style: none From 645b5aa2a0db6133a18a205d15c2f01f37120262 Mon Sep 17 00:00:00 2001 From: Gabriel Rotbart Date: Sun, 16 Jun 2013 14:25:54 +1000 Subject: [PATCH 4/6] finished bounty in welcome page. need to link them to a fixed show --- app/assets/stylesheets/welcome.css.sass | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/assets/stylesheets/welcome.css.sass b/app/assets/stylesheets/welcome.css.sass index 0f8398b2..fb2b64cc 100644 --- a/app/assets/stylesheets/welcome.css.sass +++ b/app/assets/stylesheets/welcome.css.sass @@ -17,6 +17,9 @@ ul +clearfix list-style: none + padding: 0 + margin: 0 0 10px + display: inline-block li float: left From 2e9b4b399209040fd24a78e4c013bdf77e844079 Mon Sep 17 00:00:00 2001 From: Gabriel Rotbart Date: Sun, 16 Jun 2013 14:55:36 +1000 Subject: [PATCH 5/6] 1. fixed bounties show route. 2. fixed edit button showing for unauthorised. 3. friendly_id gem path is now correct but still commented out for now --- Gemfile | 2 +- app/views/bounties/_table.html.erb | 2 +- app/views/bounties/show.html.erb | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) 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/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..6d93390c 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 %> From fd96bd25a811945d6474b35bba1c096d997f6f74 Mon Sep 17 00:00:00 2001 From: Gabriel Rotbart Date: Sun, 16 Jun 2013 15:17:07 +1000 Subject: [PATCH 6/6] latest bounties now link to individual bounties. not showing latest bounties on mobile - will talk to dan about possible solutions --- app/assets/stylesheets/welcome.css.sass | 11 ++++++++++- app/views/bounties/show.html.erb | 4 ++-- app/views/welcome/_latest_bounties.html.erb | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/assets/stylesheets/welcome.css.sass b/app/assets/stylesheets/welcome.css.sass index fb2b64cc..c072f7f8 100644 --- a/app/assets/stylesheets/welcome.css.sass +++ b/app/assets/stylesheets/welcome.css.sass @@ -28,12 +28,21 @@ width: 250px margin: 0 2em - .bounty-button + 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/views/bounties/show.html.erb b/app/views/bounties/show.html.erb index 6d93390c..c4d6a8d5 100644 --- a/app/views/bounties/show.html.erb +++ b/app/views/bounties/show.html.erb @@ -36,6 +36,6 @@

<%- if can? :edit, @bounty %> - <%= link_to 'Edit', edit_bounty_path(@bounty) %> -<%- end %> | + <%= 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 index 1d6b1c9d..64e600ae 100644 --- a/app/views/welcome/_latest_bounties.html.erb +++ b/app/views/welcome/_latest_bounties.html.erb @@ -4,7 +4,7 @@

Claim a bounty! The latest and greatest:

    <% bounties.each do |bounty| %> -
  • <%= bounty.name %>
    +
  • <%= link_to bounty.name, bounty_path(bounty) %>
    <% end %>
\ No newline at end of file