Merge pull request #58 from houdiniproject/fix_for_12

Add in basic Terms & Privacy page - Closes #12
This commit is contained in:
Eric Schultz 2018-05-31 12:57:01 -05:00 committed by GitHub
commit 5958d8458a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 276 additions and 51 deletions

View file

@ -1,5 +1,41 @@
<% # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later %> <% # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later %>
/* Open Sans */
@font-face {
font-family: 'Open Sans';
src: url('<%= asset_path('Open_Sans/opensans-regular-webfont.eot') %>');
src: url('<%= asset_path('Open_Sans/opensans-regular-webfont.eot?#iefix') %>') format('embedded-opentype'),
url('<%= asset_path('Open_Sans/opensans-regular-webfont.woff') %>') format('woff'),
url('<%= asset_path('Open_Sans/opensans-regular-webfont.ttf') %>') format('truetype'),
url('<%= asset_path('Open_Sans/opensans-regular-webfont.svg#open_sansregular') %>') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Open Sans';
src: url('<%= asset_path('Open_Sans/opensans-light-webfont.eot') %>');
src: url('<%= asset_path('Open_Sans/opensans-light-webfont.eot?#iefix') %>') format('embedded-opentype'),
url('<%= asset_path('Open_Sans/opensans-light-webfont.woff') %>') format('woff'),
url('<%= asset_path('Open_Sans/opensans-light-webfont.ttf') %>') format('truetype'),
url('<%= asset_path('Open_Sans/opensans-light-webfont.svg#open_sanslight') %>') format('svg');
font-weight: 200;
font-style: normal;
}
@font-face {
font-family: 'Open Sans';
src: url('<%= asset_path('Open_Sans/opensans-bold-webfont.eot') %>');
src: url('<%= asset_path('Open_Sans/opensans-bold-webfont.eot?#iefix') %>') format('embedded-opentype'),
url('<%= asset_path('Open_Sans/opensans-bold-webfont.woff') %>') format('woff'),
url('<%= asset_path('Open_Sans/opensans-bold-webfont.ttf') %>') format('truetype'),
url('<%= asset_path('Open_Sans/opensans-bold-webfont.svg#open_sansbold') %>') format('svg');
font-weight: bold;
font-style: normal;
}
/* Bitter */ /* Bitter */
$condensed: '<%= asset_path('Open_Sans_Condensed') %>'; $condensed: '<%= asset_path('Open_Sans_Condensed') %>';
@ -38,37 +74,4 @@ $condensed: '<%= asset_path('Open_Sans_Condensed') %>';
font-style: normal; font-style: normal;
} }
/* Open Sans */
@font-face {
font-family: 'Open Sans';
src: url('<%= asset_path('Open_Sans/opensans-regular-webfont.eot') %>');
src: url('<%= asset_path('Open_Sans/opensans-regular-webfont.eot?#iefix') %>') format('embedded-opentype'),
url('<%= asset_path('Open_Sans/opensans-regular-webfont.woff') %>') format('woff'),
url('<%= asset_path('Open_Sans/opensans-regular-webfont.ttf') %>') format('truetype'),
url('<%= asset_path('Open_Sans/opensans-regular-webfont.svg#open_sansregular') %>') format('svg');
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: 'Open Sans';
src: url('<%= asset_path('Open_Sans/opensans-light-webfont.eot') %>');
src: url('<%= asset_path('Open_Sans/opensans-light-webfont.eot?#iefix') %>') format('embedded-opentype'),
url('<%= asset_path('Open_Sans/opensans-light-webfont.woff') %>') format('woff'),
url('<%= asset_path('Open_Sans/opensans-light-webfont.ttf') %>') format('truetype'),
url('<%= asset_path('Open_Sans/opensans-light-webfont.svg#open_sanslight') %>') format('svg');
font-weight: 200;
font-style: normal;
}
@font-face {
font-family: 'Open Sans';
src: url('<%= asset_path('Open_Sans/opensans-bold-webfont.eot') %>');
src: url('<%= asset_path('Open_Sans/opensans-bold-webfont.eot?#iefix') %>') format('embedded-opentype'),
url('<%= asset_path('Open_Sans/opensans-bold-webfont.woff') %>') format('woff'),
url('<%= asset_path('Open_Sans/opensans-bold-webfont.ttf') %>') format('truetype'),
url('<%= asset_path('Open_Sans/opensans-bold-webfont.svg#open_sansbold') %>') format('svg');
font-weight: bold;
font-style: normal;
}

View file

@ -1,3 +1,4 @@
/* License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later */
.minimalHeader { .minimalHeader {
background-color: whitesmoke; background-color: whitesmoke;
height: 90px; height: 90px;
@ -21,12 +22,16 @@
display: flex; display: flex;
height: 100%; height: 100%;
* { > * {
opacity: 0.5; opacity: 0.5;
margin: auto 0; margin: auto 10px auto 0;
margin-right:10px;
} }
} }
a {
color:$charcoal
}
} }
.site-content { .site-content {

View file

@ -0,0 +1,25 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class StaticController < ApplicationController
layout 'layouts/static'
def terms_and_privacy
@theme = 'minimal'
end
def ccs
ccs_method = !Settings.ccs ? 'local_tar_gz' : Settings.ccs.ccs_method
if (ccs_method == 'local_tar_gz')
temp_file = "#{$RAILS_ROOT}/tmp/#{Time.current.to_i}.tar.gz"
result = Kernel.system("git archive --format=tar.gz -o #{temp_file} HEAD")
if result
send_file(temp_file, :type => "application/gzip")
else
render :nothing => true, :status => 500
end
elsif (ccs_method == 'github')
git_hash = File.read("#{$RAILS_ROOT}/CCS_HASH")
redirect_to "https://github.com/#{Settings.ccs.options.account}/#{Settings.ccs.options.repo}/tree/#{git_hash}"
end
end
end

View file

@ -8,7 +8,7 @@
<span> <span>
<span class='globalFooter-sub-item'>&copy; <%= Time.current.year %> CommitChange</span> <span class='globalFooter-sub-item'>&copy; <%= Time.current.year %> <%= Settings.general.name %></span>
<span class='globalFooter-sub-item'> <span class='globalFooter-sub-item'>
<% if current_user %> <% if current_user %>
@ -18,7 +18,7 @@
<% end %> <% end %>
</span> </span>
<span class='globalFooter-sub-item'> <span class='globalFooter-sub-item'>
<%= link_to "Terms & Privacy", Format::Url.concat(root_url, "help/terms-of-service-and-privacy-policy") %> <%= link_to( t("footer.terms_and_privacy"), controller: :static, action: :terms_and_privacy) %>
</span> </span>
</span> </span>
</span> </span>

View file

@ -3,9 +3,9 @@
<% if @theme == 'minimal' %> <% if @theme == 'minimal' %>
<div class="minimalFooter"> <div class="minimalFooter">
<div class="container"> <div class="container">
<span>&copy; 2018 <%= Settings.general.name %></span> <span>&copy; <%= Time.current.year %> <%= Settings.general.name %></span>
<span>About</span> <span>About</span>
<span>Terms &amp; Privacy</span> <span><%= link_to( t("footer.terms_and_privacy"), controller: :static, action: :terms_and_privacy) %></span>
</div> </div>
</div> </div>

View file

@ -14,18 +14,18 @@
<%= render 'layouts/stylesheets' %> <%= render 'layouts/stylesheets' %>
<%= IncludeAsset.css 'client/css/global/page.css' %> <%= IncludeAsset.css '/client/css/global/page.css' %>
<%= IncludeAsset.css 'client/css/bootstrap.css' %> <%= IncludeAsset.css '/client/css/bootstrap.css' %>
<style> <style>
body {padding-left: 0} body {padding-left: 0}
</style> </style>
</head> </head>
<body> <body>
<%= render 'layouts/apified_header' %> <%= render 'layouts/apified_header' %>
<%= IncludeAsset.js 'app/loading_indicator.js' %> <%= IncludeAsset.js '/app/loading_indicator.js' %>
<%= IncludeAsset.js 'app/react.js' %> <%= IncludeAsset.js '/app/react.js' %>
<%= IncludeAsset.js 'app/react-dom.js' %> <%= IncludeAsset.js '/app/react-dom.js' %>
<%= IncludeAsset.js 'app/vendor.js' %> <%= IncludeAsset.js '/app/vendor.js' %>
<%= yield :javascripts %> <%= yield :javascripts %>
<div class="site-content"> <div class="site-content">
<%= yield %> <%= yield %>

View file

@ -12,7 +12,7 @@
<body> <body>
<%= yield %> <%= yield %>
<%= render 'components/global_loading' %> <%= render 'components/global_loading' %>
<%= render 'layouts/page_modals' %gi <%= render 'layouts/page_modals' %>
<%= render 'layouts/javascripts' %> <%= render 'layouts/javascripts' %>
</body> </body>

View file

@ -0,0 +1,21 @@
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
<!doctype html>
<html>
<head>
<%= render 'layouts/stylesheets' %>
<%= IncludeAsset.css '/client/css/global/page.css' %>
<%= IncludeAsset.css '/client/css/bootstrap.css' %>
<style>
body {padding-left: 0}
</style>
</head>
<body>
<%= render 'layouts/apified_header' %>
<div class="site-content">
<%= yield %>
</div>
<%= render 'layouts/apified_footer' %>
</body>
</html>

View file

@ -0,0 +1,26 @@
<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>
<div class="container"><h1>Terms and Privacy</h1>
<% if Settings.terms_and_privacy&.terms_url %>
<h2><a href="<%= Settings.terms_and_privacy.terms_url %>">Terms of Use</a></h2>
<% end %>
<% if Settings.terms_and_privacy&.privacy_url %>
<h2><a href="<%= Settings.terms_and_privacy.terms_url %>">Privacy Policy</a></h2>
<% end %>
<h2>Software Licensing</h2>
This site uses software from the Houdini Project. In compliance with the requirements of the Houdini Project's licenses, you may access the source code corresponding to the current
version of this site <%= link_to "here", action: :ccs %>.
<hr/>
<p>The Houdini Project is released under a set of free and open source software licenses. The full details of
what code is released under which license can be reviewed in source code in <a href="https://github.com/houdiniproject/houdini">the Houdini Project repository</a> and
in its <a href="https://github.com/houdiniproject/houdini/blob/master/LICENSE">LICENSE</a> file.</p>
<p>Please look above for any additional permissions or restrictions for this instance of the Houdini Project.</p>
</div>

72
config/commitchange.yml Normal file
View file

@ -0,0 +1,72 @@
# License: CC0-1.0
general:
name: Houdini Project
logo: "logos/houdini_project_bug.svg"
logo_full: "logos/houdini_project_full.svg"
default:
image:
profile: "/images/fallback/default-profile.png"
nonprofit: "/images/fallback/default-nonprofit.png"
campaign: "/fallback/default-campaign-background.jpg"
cache_store: dalli_store
aws:
access_key_id: <%= ENV['AWS_ACCESS_KEY'] %>
secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
region: us-west-1
bucket: commitchange
mailer:
delivery_method: "sendmail"
address: "localhost"
port: 25
host: "http://localhost"
default_from: "CommitChange Team <support@commitchange.com>"
email: "support@commitchange.com"
cdn:
url: "http://localhost"
port: 5000
payment_provider:
stripe_connect: true
stripe_public_key: <%= ENV['STRIPE_API_PUBLIC'] %>
stripe_private_key: <%= ENV['STRIPE_API_KEY'] %>
stripe_proprietary_v2_js: true
default_bp:
id: 40
percentage_fee: 0.020
devise:
mailer_sender: 'fake@fake.fake'
page_editor:
editor: 'froala'
editor_options:
froala_key: <%= ENV['FROALA_KEY'] %>
language: 'en'
available_locales: ['en']
intntl:
currencies: ["usd"]
all_currencies:
- unit: "dollars"
subunit: "cents"
symbol: "$"
abbv: "usd"
format: "%u%n"
source_tokens:
max_uses: 1
expiration_time: 1200
event_donation_source:
time_after_event: 1728000
max_uses: 20
nonprofits_must_be_vetted: false

View file

@ -28,6 +28,8 @@ Config.schema do
required(:general).schema do required(:general).schema do
# the name of your website. Default in Settings is "Houdini Project" # the name of your website. Default in Settings is "Houdini Project"
required(:name).filled(:str?) required(:name).filled(:str?)
end end
required(:default).schema do required(:default).schema do
@ -220,6 +222,29 @@ Config.schema do
# whether nonprofits must be vetted before they can use the service. # whether nonprofits must be vetted before they can use the service.
optional(:nonprofits_must_be_vetted).filled(:bool?) optional(:nonprofits_must_be_vetted).filled(:bool?)
optional(:terms_and_privacy).schema do
# the url to the terms of use of this Houdini Project instance
optional(:terms_url).filled(:str?)
# the url to the privacy policy of this Houdini Project instance
optional(:privacy_url).filled(:str?)
end
# complete, corresponding source
optional(:ccs).schema do
optional(:ccs_method).value(included_in?: %w(local_tar_gz github))
# only used for github
# NOTE: for github you need to have the hash of the corresponding source in $RAILS_ROOT/CCS_HASH
optional(:options).schema do
# the account of the repository to find the code
required(:account).filled(:str?)
# the name of the repo to find the code
required(:repo).filled(:str?)
end
end
end end
Settings.reload! Settings.reload!

View file

@ -163,7 +163,6 @@ en:
phone: "Your Phone (for account recovery)" phone: "Your Phone (for account recovery)"
save_and_finish: "Save & Finish" save_and_finish: "Save & Finish"
next: "Next" next: "Next"
footer:
terms_and_privacy: "Terms & Privacy"
about: "About"

View file

@ -255,6 +255,9 @@ Commitchange::Application.routes.draw do
post '/webhooks/stripe_subscription_payment' => 'webhooks#subscription_payment' post '/webhooks/stripe_subscription_payment' => 'webhooks#subscription_payment'
post '/webhooks/stripe' => 'webhooks#stripe' post '/webhooks/stripe' => 'webhooks#stripe'
get '/static/terms_and_privacy' => 'static#terms_and_privacy'
get '/static/ccs' => 'static#ccs'
root :to => 'front#index' root :to => 'front#index'

View file

@ -0,0 +1,46 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
require 'rails_helper'
RSpec.describe StaticController, :type => :controller do
describe ".ccs" do
around(:each) do |example|
example.run
Settings.reload!
end
describe 'local_tar_gz' do
before (:each) do
Settings.merge!(
{
ccs: {
ccs_method: 'local_tar_gz',
}
})
end
it 'fails on git archive' do
expect(Kernel).to receive(:system).and_return(false)
get('ccs')
expect(response.status).to eq 500
end
end
it 'setup github' do
Settings.merge!(
{
ccs: {
ccs_method: 'github',
options: {
account: 'account',
repo: 'repo'
}
}
})
expect(File).to receive(:read).with("#{$RAILS_ROOT}/CCS_HASH").and_return("hash")
get('ccs')
expect(response).to redirect_to "https://github.com/account/repo/tree/hash"
end
end
end