add developer newsletters form
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class NewslettersController < ApplicationController
|
||||||
|
def show; end
|
||||||
|
|
||||||
|
def update
|
||||||
|
Faraday.post(Docuseal::NEWSLETTER_URL, newsletter_params.to_json, 'Content-Type' => 'application/json')
|
||||||
|
rescue StandardError => e
|
||||||
|
Rails.logger.error(e)
|
||||||
|
ensure
|
||||||
|
redirect_to root_path
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def newsletter_params
|
||||||
|
params.require(:user).permit(:email)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -30,7 +30,7 @@ class SetupController < ApplicationController
|
|||||||
|
|
||||||
sign_in(@user)
|
sign_in(@user)
|
||||||
|
|
||||||
redirect_to root_path
|
redirect_to newsletter_path
|
||||||
else
|
else
|
||||||
render :index, status: :unprocessable_entity
|
render :index, status: :unprocessable_entity
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
<div class="max-w-xl mx-auto px-2">
|
||||||
|
<h1 class="text-4xl font-bold text-center my-8">👨💻 Developer Newsletters</h1>
|
||||||
|
<%= form_for current_user, url: newsletter_path do |f| %>
|
||||||
|
<div class="form-control">
|
||||||
|
<%= f.email_field :email, placeholder: 'Email', required: true, class: 'base-input' %>
|
||||||
|
</div>
|
||||||
|
<div class="form-control mt-4">
|
||||||
|
<%= f.button button_title, class: 'base-button' %>
|
||||||
|
</div>
|
||||||
|
<div class="text-center mt-2">
|
||||||
|
<a href="/" class="link">Skip</a>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
@@ -28,6 +28,7 @@ Rails.application.routes.draw do
|
|||||||
|
|
||||||
resources :dashboard, only: %i[index]
|
resources :dashboard, only: %i[index]
|
||||||
resources :setup, only: %i[index create]
|
resources :setup, only: %i[index create]
|
||||||
|
resource :newsletter, only: %i[show update]
|
||||||
resources :users, only: %i[new create edit update destroy]
|
resources :users, only: %i[new create edit update destroy]
|
||||||
resources :submissions, only: %i[show destroy]
|
resources :submissions, only: %i[show destroy]
|
||||||
resources :templates, only: %i[new create edit show destroy] do
|
resources :templates, only: %i[new create edit show destroy] do
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
module Docuseal
|
module Docuseal
|
||||||
PRODUCT_URL = 'https://www.docuseal.co'
|
PRODUCT_URL = 'https://www.docuseal.co'
|
||||||
|
NEWSLETTER_URL = "#{PRODUCT_URL}/newsletters".freeze
|
||||||
PRODUCT_NAME = 'DocuSeal'
|
PRODUCT_NAME = 'DocuSeal'
|
||||||
DEFAULT_APP_URL = 'http://localhost:3000'
|
DEFAULT_APP_URL = 'http://localhost:3000'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user