add emails for newsletter

This commit is contained in:
2023-05-01 15:11:01 +03:30
parent 0797f9798d
commit 6c358e757a
12 changed files with 77 additions and 5 deletions

22
app/admin/emails.rb Normal file
View File

@ -0,0 +1,22 @@
ActiveAdmin.register Email do
csv do
column :email
# preserve case
end
# See permitted parameters documentation:
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
#
# Uncomment all parameters which should be permitted for assignment
#
permit_params :email
#
# or
#
# permit_params do
# permitted = [:title, :description, :email, :phone]
# permitted << :other if params[:action] == 'create' && current_user.admin?
# permitted
# end
end

View File

@ -0,0 +1,3 @@
// Place all the styles related to the email controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: https://sass-lang.com/

View File

@ -0,0 +1,15 @@
class EmailController < ApplicationController
skip_before_action :verify_authenticity_token
def index
end
def create
@email = Email.create(message_params)
render json: {}, status: :created
end
private
def message_params
params.permit(:email)
end
end

View File

@ -0,0 +1,2 @@
module EmailHelper
end

2
app/models/email.rb Normal file
View File

@ -0,0 +1,2 @@
class Email < ApplicationRecord
end

View File

@ -0,0 +1,2 @@
<h1>Email#index</h1>
<p>Find me in app/views/email/index.html.erb</p>