From b51d56159ae5aa42e887c22776d04ac4d9125ef1 Mon Sep 17 00:00:00 2001 From: Ben Halpern Date: Thu, 21 May 2020 12:10:02 -0400 Subject: [PATCH] [deploy] Implement web-monetization/payment pointer (#6345) * WIP payment pointer * Add payment pointer config * Add proper siteconfig var to view * Finalize * Fix typo Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com> --- app/controllers/internal/configs_controller.rb | 1 + app/models/site_config.rb | 5 ++++- app/views/internal/configs/show.html.erb | 16 ++++++++++++---- app/views/shell/_top.html.erb | 7 +++++++ spec/requests/internal/configs_spec.rb | 7 +++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/app/controllers/internal/configs_controller.rb b/app/controllers/internal/configs_controller.rb index 7040926ec..630f11d6c 100644 --- a/app/controllers/internal/configs_controller.rb +++ b/app/controllers/internal/configs_controller.rb @@ -46,6 +46,7 @@ class Internal::ConfigsController < Internal::ApplicationController twitter_hashtag suggested_users tagline + payment_pointer ] allowed_params = allowed_params | diff --git a/app/models/site_config.rb b/app/models/site_config.rb index 50ceecd44..ce5909fcc 100644 --- a/app/models/site_config.rb +++ b/app/models/site_config.rb @@ -73,7 +73,10 @@ class SiteConfig < RailsSettings::Base field :logo_svg, type: :string, default: "" field :primary_sticker_image_url, type: :string, default: "https://practicaldev-herokuapp-com.freetls.fastly.net/assets/rainbowdev.svg" - # Rate Limits + # Monetization + field :payment_pointer, type: :string, default: "$ilp.uphold.com/24HhrUGG7ekn" # Experimental + + # Rate limits field :rate_limit_follow_count_daily, type: :integer, default: 500 field :rate_limit_comment_creation, type: :integer, default: 9 field :rate_limit_listing_creation, type: :integer, default: 1 diff --git a/app/views/internal/configs/show.html.erb b/app/views/internal/configs/show.html.erb index 0b7884f9f..4ffc5ba1c 100644 --- a/app/views/internal/configs/show.html.erb +++ b/app/views/internal/configs/show.html.erb @@ -565,12 +565,12 @@
<%= render partial: "card_header", locals: { - header: "Shop", + header: "Monetization", state: "collapse", - target: "shopBodyContainer", + target: "monetizationBodyContainer", expanded: "false" } %> -
+
<%= f.label :shop_url %> <%= f.text_field :shop_url, @@ -579,9 +579,17 @@ placeholder: "Shop url" %>
Used as the shop url of the community
+ +
+ <%= f.label :payment_pointer %> + <%= f.text_field :payment_pointer, + class: "form-control", + value: SiteConfig.payment_pointer, + placeholder: "$pay.somethinglikethis.co/value" %> +
Used for site-wide web monetization (experimental)
+
- <% if current_user.has_role?(:single_resource_admin, Config) %>
Confirm and Submit
diff --git a/app/views/shell/_top.html.erb b/app/views/shell/_top.html.erb index e7e36cd26..bdc929826 100644 --- a/app/views/shell/_top.html.erb +++ b/app/views/shell/_top.html.erb @@ -7,6 +7,13 @@ <% unless internal_navigation? %> + + + + + + + <%= render "layouts/styles" %>