add emails for newsletter
This commit is contained in:
22
app/admin/emails.rb
Normal file
22
app/admin/emails.rb
Normal 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
|
||||
|
3
app/assets/stylesheets/email.scss
Normal file
3
app/assets/stylesheets/email.scss
Normal 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/
|
15
app/controllers/email_controller.rb
Normal file
15
app/controllers/email_controller.rb
Normal 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
|
2
app/helpers/email_helper.rb
Normal file
2
app/helpers/email_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module EmailHelper
|
||||
end
|
2
app/models/email.rb
Normal file
2
app/models/email.rb
Normal file
@ -0,0 +1,2 @@
|
||||
class Email < ApplicationRecord
|
||||
end
|
2
app/views/email/index.html.erb
Normal file
2
app/views/email/index.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<h1>Email#index</h1>
|
||||
<p>Find me in app/views/email/index.html.erb</p>
|
Reference in New Issue
Block a user