From 12c99e1b69fe62ca4f7964e1633a69dac1e204e2 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 31 May 2018 11:21:34 -0500 Subject: [PATCH 1/3] Add initial terms and conditions support --- .../boot/google-webfonts.css.scss.erb | 69 ++++++++++--------- .../stylesheets/common/minimal.css.scss | 10 ++- app/controllers/static_controller.rb | 24 +++++++ app/views/layouts/_apified_footer.html.erb | 2 +- app/views/layouts/apified.html.erb | 12 ++-- app/views/layouts/page.html.erb | 2 +- app/views/layouts/static.html.erb | 21 ++++++ app/views/static/terms_and_privacy.html.erb | 25 +++++++ config/environment.rb | 15 ++++ config/locales/en.yml | 7 +- config/routes.rb | 3 + spec/controllers/static_controller_spec.rb | 45 ++++++++++++ 12 files changed, 187 insertions(+), 48 deletions(-) create mode 100644 app/controllers/static_controller.rb create mode 100644 app/views/layouts/static.html.erb create mode 100644 app/views/static/terms_and_privacy.html.erb create mode 100644 spec/controllers/static_controller_spec.rb diff --git a/app/assets/stylesheets/boot/google-webfonts.css.scss.erb b/app/assets/stylesheets/boot/google-webfonts.css.scss.erb index b5a5b6a6..5c01e8fb 100644 --- a/app/assets/stylesheets/boot/google-webfonts.css.scss.erb +++ b/app/assets/stylesheets/boot/google-webfonts.css.scss.erb @@ -1,5 +1,41 @@ <% # 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 */ $condensed: '<%= asset_path('Open_Sans_Condensed') %>'; @@ -38,37 +74,4 @@ $condensed: '<%= asset_path('Open_Sans_Condensed') %>'; 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; -} diff --git a/app/assets/stylesheets/common/minimal.css.scss b/app/assets/stylesheets/common/minimal.css.scss index 0e6c551b..1f4ee9bc 100644 --- a/app/assets/stylesheets/common/minimal.css.scss +++ b/app/assets/stylesheets/common/minimal.css.scss @@ -21,12 +21,16 @@ display: flex; height: 100%; - * { + > * { opacity: 0.5; - margin: auto 0; - margin-right:10px; + margin: auto 10px auto 0; } } + + a { + color:$charcoal + } + } .site-content { diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb new file mode 100644 index 00000000..5d2dd7ff --- /dev/null +++ b/app/controllers/static_controller.rb @@ -0,0 +1,24 @@ +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 diff --git a/app/views/layouts/_apified_footer.html.erb b/app/views/layouts/_apified_footer.html.erb index e2fd9bcd..af4d7afa 100644 --- a/app/views/layouts/_apified_footer.html.erb +++ b/app/views/layouts/_apified_footer.html.erb @@ -5,7 +5,7 @@
© 2018 <%= Settings.general.name %> About - Terms & Privacy + <%= link_to "Terms & Privacy", controller: :static, action: :terms_and_privacy %>
diff --git a/app/views/layouts/apified.html.erb b/app/views/layouts/apified.html.erb index c9a82e57..3a16b398 100644 --- a/app/views/layouts/apified.html.erb +++ b/app/views/layouts/apified.html.erb @@ -14,18 +14,18 @@ <%= render 'layouts/stylesheets' %> - <%= IncludeAsset.css 'client/css/global/page.css' %> - <%= IncludeAsset.css 'client/css/bootstrap.css' %> + <%= IncludeAsset.css '/client/css/global/page.css' %> + <%= IncludeAsset.css '/client/css/bootstrap.css' %> <%= render 'layouts/apified_header' %> -<%= IncludeAsset.js 'app/loading_indicator.js' %> -<%= IncludeAsset.js 'app/react.js' %> -<%= IncludeAsset.js 'app/react-dom.js' %> -<%= IncludeAsset.js 'app/vendor.js' %> +<%= IncludeAsset.js '/app/loading_indicator.js' %> +<%= IncludeAsset.js '/app/react.js' %> +<%= IncludeAsset.js '/app/react-dom.js' %> +<%= IncludeAsset.js '/app/vendor.js' %> <%= yield :javascripts %>
<%= yield %> diff --git a/app/views/layouts/page.html.erb b/app/views/layouts/page.html.erb index d1348c9c..9f31c083 100644 --- a/app/views/layouts/page.html.erb +++ b/app/views/layouts/page.html.erb @@ -12,7 +12,7 @@ <%= yield %> <%= render 'components/global_loading' %> - <%= render 'layouts/page_modals' %gi + <%= render 'layouts/page_modals' %> <%= render 'layouts/javascripts' %> diff --git a/app/views/layouts/static.html.erb b/app/views/layouts/static.html.erb new file mode 100644 index 00000000..93b6e90a --- /dev/null +++ b/app/views/layouts/static.html.erb @@ -0,0 +1,21 @@ +<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%> + + + + + <%= render 'layouts/stylesheets' %> + <%= IncludeAsset.css '/client/css/global/page.css' %> + <%= IncludeAsset.css '/client/css/bootstrap.css' %> + + + +<%= render 'layouts/apified_header' %> +
+ <%= yield %> +
+<%= render 'layouts/apified_footer' %> + + + \ No newline at end of file diff --git a/app/views/static/terms_and_privacy.html.erb b/app/views/static/terms_and_privacy.html.erb new file mode 100644 index 00000000..3265b177 --- /dev/null +++ b/app/views/static/terms_and_privacy.html.erb @@ -0,0 +1,25 @@ +

Terms and Privacy

+ +<% if Settings.terms_and_privacy&.terms_url %> +

Terms of Use

+<% end %> + +<% if Settings.terms_and_privacy&.privacy_url %> +

Privacy Policy

+<% end %> + +

Software Licensing

+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 %>. + +
+ +

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 the Houdini Project repository and + in its LICENSE file.

+ +

Please look above for any additional permissions or restrictions for this instance of the Houdini Project.

+ + + +
\ No newline at end of file diff --git a/config/environment.rb b/config/environment.rb index 07b96ad6..4c10d070 100755 --- a/config/environment.rb +++ b/config/environment.rb @@ -220,6 +220,21 @@ Config.schema do # whether nonprofits must be vetted before they can use the service. 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)) + optional(:options) + end + end Settings.reload! diff --git a/config/locales/en.yml b/config/locales/en.yml index 96021235..92a70a7c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -163,7 +163,6 @@ en: phone: "Your Phone (for account recovery)" save_and_finish: "Save & Finish" next: "Next" - - - - + footer: + terms_and_privacy: "Terms & Privacy" + about: "About" \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 0fc7236b..26214066 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -255,6 +255,9 @@ Commitchange::Application.routes.draw do post '/webhooks/stripe_subscription_payment' => 'webhooks#subscription_payment' post '/webhooks/stripe' => 'webhooks#stripe' + get '/static/terms_and_privacy' => 'static#terms_and_privacy' + get '/static/ccs' => 'static#ccs' + root :to => 'front#index' diff --git a/spec/controllers/static_controller_spec.rb b/spec/controllers/static_controller_spec.rb new file mode 100644 index 00000000..b4b9107a --- /dev/null +++ b/spec/controllers/static_controller_spec.rb @@ -0,0 +1,45 @@ +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 From ba856ee975257766c3bd75c2301db782065004cb Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 31 May 2018 12:20:49 -0500 Subject: [PATCH 2/3] correct footer terms and privacy link on multiple pages --- app/views/components/_footer_sub.html.erb | 4 ++-- app/views/layouts/_apified_footer.html.erb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/components/_footer_sub.html.erb b/app/views/components/_footer_sub.html.erb index 382709a4..cce410c3 100644 --- a/app/views/components/_footer_sub.html.erb +++ b/app/views/components/_footer_sub.html.erb @@ -8,7 +8,7 @@ - © <%= Time.current.year %> CommitChange + © <%= Time.current.year %> <%= Settings.general.name %> <% if current_user %> @@ -18,7 +18,7 @@ <% end %> - <%= 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) %> diff --git a/app/views/layouts/_apified_footer.html.erb b/app/views/layouts/_apified_footer.html.erb index af4d7afa..52c507b5 100644 --- a/app/views/layouts/_apified_footer.html.erb +++ b/app/views/layouts/_apified_footer.html.erb @@ -3,9 +3,9 @@ <% if @theme == 'minimal' %>
- © 2018 <%= Settings.general.name %> + © <%= Time.current.year %> <%= Settings.general.name %> About - <%= link_to "Terms & Privacy", controller: :static, action: :terms_and_privacy %> + <%= link_to( t("footer.terms_and_privacy"), controller: :static, action: :terms_and_privacy) %>
From f8c54e98849669f9686b3c167b582293299a2bd0 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 31 May 2018 12:39:16 -0500 Subject: [PATCH 3/3] Add the missing licenses --- .../stylesheets/common/minimal.css.scss | 1 + app/controllers/static_controller.rb | 1 + app/views/static/terms_and_privacy.html.erb | 1 + config/commitchange.yml | 72 +++++++++++++++++++ config/environment.rb | 12 +++- spec/controllers/static_controller_spec.rb | 1 + 6 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 config/commitchange.yml diff --git a/app/assets/stylesheets/common/minimal.css.scss b/app/assets/stylesheets/common/minimal.css.scss index 1f4ee9bc..70c912bb 100644 --- a/app/assets/stylesheets/common/minimal.css.scss +++ b/app/assets/stylesheets/common/minimal.css.scss @@ -1,3 +1,4 @@ +/* License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later */ .minimalHeader { background-color: whitesmoke; height: 90px; diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index 5d2dd7ff..0d4a28c2 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -1,3 +1,4 @@ +# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later class StaticController < ApplicationController layout 'layouts/static' diff --git a/app/views/static/terms_and_privacy.html.erb b/app/views/static/terms_and_privacy.html.erb index 3265b177..b64f117b 100644 --- a/app/views/static/terms_and_privacy.html.erb +++ b/app/views/static/terms_and_privacy.html.erb @@ -1,3 +1,4 @@ +<%- # License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later -%>

Terms and Privacy

<% if Settings.terms_and_privacy&.terms_url %> diff --git a/config/commitchange.yml b/config/commitchange.yml new file mode 100644 index 00000000..295b5ec7 --- /dev/null +++ b/config/commitchange.yml @@ -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 " + 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 + diff --git a/config/environment.rb b/config/environment.rb index 4c10d070..ab220457 100755 --- a/config/environment.rb +++ b/config/environment.rb @@ -28,6 +28,8 @@ Config.schema do required(:general).schema do # the name of your website. Default in Settings is "Houdini Project" required(:name).filled(:str?) + + end required(:default).schema do @@ -232,7 +234,15 @@ Config.schema do # complete, corresponding source optional(:ccs).schema do optional(:ccs_method).value(included_in?: %w(local_tar_gz github)) - optional(:options) + + # 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 diff --git a/spec/controllers/static_controller_spec.rb b/spec/controllers/static_controller_spec.rb index b4b9107a..a22347a1 100644 --- a/spec/controllers/static_controller_spec.rb +++ b/spec/controllers/static_controller_spec.rb @@ -1,3 +1,4 @@ +# 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