Skip to content

Commit

Permalink
v1.3.5
Browse files Browse the repository at this point in the history
Merge pull request #401 from TechforgoodCAST/develop
  • Loading branch information
suninthesky authored Aug 29, 2017
2 parents 5587bd4 + bd43ca7 commit c57ef8c
Show file tree
Hide file tree
Showing 22 changed files with 292 additions and 19 deletions.
Empty file.
5 changes: 0 additions & 5 deletions app/assets/stylesheets/base.sass
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ hr
.primary:hover
color: $cta-hover !important

.blue
color: $blue-base !important
.blue:hover
color: $blue-hover !important

.red
color: $red-base !important

Expand Down
15 changes: 14 additions & 1 deletion app/assets/stylesheets/v2/custom.sass
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
display: inline-block
vertical-align: middle
.bread
max-width: 120px
max-width: 140px
@media screen and (max-width: 46.875rem)
max-width: 125px
@media screen and (max-width: 25rem)
max-width: 120px
@media screen and (max-width: 46.875rem)
.bread, .crumb
display: none
Expand Down Expand Up @@ -112,6 +116,15 @@
background: image-url('logo-hex.svg') no-repeat
background-size: 24px 20px

.pagination a
color: map-get($colors, blue)

@font-face
font-family: 'Redacted'
src: font-url('redacted-script-bold.eot') format('eot'), font-url('redacted-script-bold.woff2') format('woff2'), font-url('redacted-script-bold.woff') format('woff'), font-url('redacted-script-bold.otf') format('opentype'), font-url('redacted-script-bold.svg#filename') format('svg')
.redacted
font-family: 'Redacted' !important

#supporter
background: image-url('supporters-logos-sprites.png') no-repeat
background-size: 200px 1500px
Expand Down
3 changes: 2 additions & 1 deletion app/assets/stylesheets/v2/modules/base.sass
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ html
overflow-y: scroll
text-rendering: optimizeLegibility

a
a, button
text-decoration: none
transition: opacity .2s
&:hover
opacity: .6
cursor: pointer
&.disabled
pointer-events: none
cursor: default
Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/v2/modules/border-color.sass
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
@each $var, $val in $colors
.border-#{$var}
border-color: $val
border-color: $val !important
4 changes: 4 additions & 0 deletions app/assets/stylesheets/v2/modules/border.sass
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
border-radius: $base-radius
-moz-border-radius: $base-radius
-webkit-border-radius: $base-radius
.rounded-top
border-radius: $base-radius $base-radius 0 0
-moz-border-radius: $base-radius $base-radius 0 0
-webkit-border-radius: $base-radius $base-radius 0 0

@each $side in border, border-top, border-right, border-bottom, border-left
.#{$side}
Expand Down
4 changes: 3 additions & 1 deletion app/assets/stylesheets/v2/modules/button.sass
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
.button, .button-wide
font-size: map-get($scales, 16)
text-decoration: none
cursor: pointer
display: inline-block
line-height: map-get($scales, 16)
padding: map-get($scales, 10) map-get($scales, 40)
Expand All @@ -30,3 +29,6 @@

.button-wide
width: 100%

.button-bottom
border-radius: 0 0 $base-radius $base-radius
4 changes: 4 additions & 0 deletions app/assets/stylesheets/v2/modules/layout.sass
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ $widths: (200: 12.5rem, 250: 15.625rem, 340: 21.25rem, 500: 31.25rem, 750: 46.87
.divider
border-left: 2px solid map-get($colors, lightest-gray)

.perc25
width: 25%
.perc33
width: 33%
.perc50
width: 50%
.perc66
width: 66%
.perc75
width: 75%
.sm
@media screen and (max-width: 25rem)
width: 100%
Expand Down
2 changes: 2 additions & 0 deletions app/assets/stylesheets/v2/modules/typography.sass
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ blockquote
// Utility
// =========================================================================
.nowrap
white-space: nowrap
.truncate
max-width: 100%
overflow: hidden
Expand Down
2 changes: 1 addition & 1 deletion app/cells/fund_insight/amount.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
li
li.mb5
' Grants available for
strong
= message
2 changes: 1 addition & 1 deletion app/cells/fund_insight/duration.slim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
li
li.mb5
' Awards grants for
strong
= message
4 changes: 2 additions & 2 deletions app/cells/fund_insight/grant_example.slim
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
li
- if g[:amount]
- if g[:amount]
strong> = g[:amount]
- else
' Grant
' to
strong>
- if g[:url]
a> href=g[:url] target="_blank" onclick="trackOutboundLink('#{g[:url]}'); return false;"
a.blue> href=g[:url] target="_blank" onclick="trackOutboundLink('#{g[:url]}'); return false;"
= g[:recipient]
- else
= g[:recipient]
Expand Down
1 change: 1 addition & 0 deletions app/cells/v2_navbar/show.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
nav.flex.items-center
= link_to 'Beehive', root_path, id: 'navbar-logo', alt: 'Beehive logo', class: type
= link_to 'About', about_path, class: "#{type} ml35"
= link_to 'Funds', public_funds_path, class: "#{type} ml35"
= link_to 'Sign in', sign_in_path, class: "#{type} ml35"
2 changes: 1 addition & 1 deletion app/controllers/funds_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class FundsController < ApplicationController
before_action :ensure_logged_in, :update_legacy_suitability
before_action :ensure_logged_in, :update_legacy_suitability, except: :sources

def show
@fund = Fund.includes(:funder).find_by(slug: params[:id])
Expand Down
24 changes: 24 additions & 0 deletions app/controllers/public_funds_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
class PublicFundsController < ApplicationController
before_action :ensure_logged_out

def index
@funds = Fund.includes(:funder).order(:name).page(params[:page])
end

def show
return redirect_to public_funds_path unless public_fund?(params[:slug])
@fund = Fund.find_by(slug: params[:slug])
return redirect_to public_funds_path unless @fund
@restrictions = @fund.restrictions.pluck(:category, :details)
end

private

def ensure_logged_out
redirect_to root_path if logged_in?
end

def public_fund?(slug)
Fund.order(:name).limit(3).pluck(:slug).include?(slug)
end
end
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def v2_layout? # TODO: remove @ v2
articles: %i[index show],
pages: %i[about faq forfunders privacy terms],
password_resets: %i[new create edit update],
public_funds: %i[index show],
signup: %i[user create_user]
}
controller = params[:controller].to_sym
Expand Down
6 changes: 1 addition & 5 deletions app/helpers/funds_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ def period(fund = @fund, date_format="%b %Y")
else
period_desc = fund.period_start.strftime(date_format) + ' - ' + fund.period_end.strftime(date_format)
end
content_tag(
:span,
period_desc,
class: 'year muted'
)
content_tag :span, period_desc
end

def amount_awarded_distribution
Expand Down
41 changes: 41 additions & 0 deletions app/views/public_funds/index.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
= content_for :title, 'Funds preview'

%header
= cell :v2_navbar, @current_user
= cell :breadcrumb, 'Funds' => public_funds_path

%main.maxw1080.mx-auto.px20.flex.flex-wrap
%aside.perc25.md.px20.mb40
.bg-mint.white.px10.py15.rounded-top
%h3 Check your eligibility and suitability for funds in seconds.
%a.button-wide.button-bottom.white.bg-olive.caps.shadow{ href: root_path } Sign up

%section.perc75.md.mb80.px20
%h1.light.mb30 Funds

- @funds.each_with_index do |fund, i|
%article.mb40

- if i < 3 && params[:page].to_i < 2
.mb5
= link_to fund.name, public_fund_path(fund), class: 'blue fs22 lh30'
.mb5.fs15.lh20.mid-gray
= fund.funder.name

- else
.muted
.mb5.blue.fs22.lh30.redacted= scramble_name fund.name
.mb5.fs15.lh20.mid-gray.redacted= scramble_name fund.funder.name

.mb5.fs15.lh20
%p
= raw fund.description_html.truncate_words(24)

- if i == 2 && params[:page].to_i < 2
.flex.mb40
%a.fs14.white.bg-darken-blue.circle.shadow.inline-block.py5.pr14.pl5.truncate{ href: root_path }
.fs12.bg-green.caps.bold.circle.inline-block.py3.px5 Preview
Sign in or create a free account to see more

.center
= paginate @funds
111 changes: 111 additions & 0 deletions app/views/public_funds/show.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
= content_for :title, "Preview #{@fund.name}"

%header
= cell :v2_navbar, @current_user
= cell :breadcrumb, 'Funds' => public_funds_path, @fund.name => public_fund_path

%main
.maxw1080.mx-auto.px20.flex.flex-wrap
%aside.perc25.md.px20.mb40
.bg-mint.white.px10.py15.rounded-top
%h3 Check your eligibility and suitability for funds in seconds.
%a.button-wide.button-bottom.white.bg-olive.caps.truncate.shadow{ href: root_path } Sign up

%section.perc75.md.px20.mb40

%section
%h1.light= @fund.name
.fs15.lh20.mid-gray= @fund.funder.name

%hr.my40

%section
.mb20
%h2.light Summary

.mb20
= raw @fund.description_html

- if @fund.period_end.present? && @fund.period_end > 3.years.ago
%small.slate
Powered by open data
&middot;
= link_to 'Sources', fund_sources_path(@fund), target: '_blank', class: 'blue'
.slate.fs15.my10
= period(@fund)

- unless @fund.open_call?
%div.cta Please note this fund does not accept unsolicited applications. Please read the fund guidance for more information.

%ul.list.pl30
= cell(:fund_insight, @fund).call(:amount)
= cell(:fund_insight, @fund).call(:duration)

- if @fund.open_data && @fund.grant_count
%li.mb5
Awarded
%span.bold= number_with_delimiter(@fund.grant_count)
= "grant".pluralize(@fund.grant_count) + '.'

- if @fund.open_data? && @fund.award_month_distribution?
%li.mb5<
Awarded the most funding in
= succeed '.' do
%strong= top_award_months(@fund)

- if @fund.open_data? && @fund.country_distribution?
%li.mb5<
Awarded most funding in the
= succeed '.' do
%strong= top_countries(@fund)

= cell(:fund_insight, @fund).call(:grant_examples)

%hr.my40

%section.muted
.mb20
%h2.light Eligibility

%p.mb40
The following questions have been set by
= succeed '.' do
= @fund.funder.name

%p.bold.mb20 Are you seeking funding for?

%h5.mb20 Your organisation

- @restrictions.select { |i| i[0] == 'Organisation' }.each do |r|
.mb20.flex.items-center.fs15.lh20
.blue.nowrap.mr30 Yes &nbsp;&nbsp; No
= r[1].capitalize

%h5.mb20 Your proposal

- @restrictions.select { |i| i[0] == 'Proposal' }.each do |r|
.mb20.flex.items-center.fs15.lh20
.blue.nowrap.mr30 Yes &nbsp;&nbsp; No
= r[1].capitalize

.bg-silver.rounded.shadow.fs14.p10.mb20
.bold.caps.mb10 Good to know
Eligibility checks for location, the amount you are seeking and other factors will been done automatically.

.button.white.bg-blue.caps.shadow Check eligibility

%hr.my40

%section.muted
.mb40
%h2.light Apply

.button.white.bg-blue.caps.shadow.mb40 Application form

%h5.mb20 Status

.button.blue.border-blue.caps.mb10 Submitted
.button.green.border-green.caps.mb10 Successful
.button.red.border-red.caps.mb10 Declined

= render partial: 'layouts/sign_up_cta'
1 change: 1 addition & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class Application < Rails::Application
pages.js
password_resets.js
proposals.js
public_funds.js
recipients.js
signup.js
sessions.js
Expand Down
5 changes: 5 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
resources :articles, only: [:index, :show]
resources :password_resets, except: [:show, :index, :destroy]

get '/funds', to: 'public_funds#index', as: 'public_funds'
get '/funds/:slug', to: 'public_funds#show', as: 'public_fund'

get '/funds/:id/sources', to: 'funds#sources', as: 'fund_sources' # TODO: refactor

resources :proposals, except: [:show, :destroy] do
resources :funds, only: [:show, :index] do
collection do
Expand Down
Loading

0 comments on commit c57ef8c

Please sign in to comment.