add emails for newsletter
This commit is contained in:
parent
0797f9798d
commit
6c358e757a
|
@ -89,6 +89,9 @@
|
||||||
<orderEntry type="library" scope="PROVIDED" name="rails (v6.0.5, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="rails (v6.0.5, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="rails-dom-testing (v2.0.3, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.4.2, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="rails-html-sanitizer (v1.4.2, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="rails_12factor (v0.0.3, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="rails_serve_static_assets (v0.0.5, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="rails_stdout_logging (v0.0.5, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="railties (v6.0.5, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="railties (v6.0.5, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="rake (v13.0.6, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="ransack (v3.1.0, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="ransack (v3.1.0, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
|
@ -103,6 +106,7 @@
|
||||||
<orderEntry type="library" scope="PROVIDED" name="sassc (v2.4.0, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="sassc (v2.4.0, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="sassc-rails (v2.1.2, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="sassc-rails (v2.1.2, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="selenium-webdriver (v4.1.0, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="selenium-webdriver (v4.1.0, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
|
<orderEntry type="library" scope="PROVIDED" name="semantic_range (v3.0.0, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="spring (v2.1.1, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="spring (v2.1.1, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="spring-watcher-listen (v2.0.1, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="spring-watcher-listen (v2.0.1, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="sprockets (v4.0.3, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="sprockets (v4.0.3, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
|
@ -117,7 +121,7 @@
|
||||||
<orderEntry type="library" scope="PROVIDED" name="warden (v1.2.9, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="warden (v1.2.9, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="web-console (v4.2.0, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="web-console (v4.2.0, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="webdrivers (v5.0.0, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="webdrivers (v5.0.0, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="webpacker (v4.3.0, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="webpacker (v5.4.3, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.5, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="websocket-driver (v0.7.5, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="websocket-extensions (v0.1.5, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="xpath (v3.2.0, rbenv: 2.7.1) [gem]" level="application" />
|
<orderEntry type="library" scope="PROVIDED" name="xpath (v3.2.0, rbenv: 2.7.1) [gem]" level="application" />
|
||||||
|
|
|
@ -70,7 +70,7 @@ GEM
|
||||||
arbre (1.5.0)
|
arbre (1.5.0)
|
||||||
activesupport (>= 3.0.0, < 7.1)
|
activesupport (>= 3.0.0, < 7.1)
|
||||||
ruby2_keywords (>= 0.0.2, < 1.0)
|
ruby2_keywords (>= 0.0.2, < 1.0)
|
||||||
bcrypt (3.1.17)
|
bcrypt (3.1.18)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
bootsnap (1.11.1)
|
bootsnap (1.11.1)
|
||||||
msgpack (~> 1.2)
|
msgpack (~> 1.2)
|
||||||
|
@ -114,7 +114,7 @@ GEM
|
||||||
jbuilder (2.11.5)
|
jbuilder (2.11.5)
|
||||||
actionview (>= 5.0.0)
|
actionview (>= 5.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
jquery-rails (4.4.0)
|
jquery-rails (4.5.0)
|
||||||
rails-dom-testing (>= 1, < 3)
|
rails-dom-testing (>= 1, < 3)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
thor (>= 0.14, < 2.0)
|
thor (>= 0.14, < 2.0)
|
||||||
|
|
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>
|
|
@ -2,5 +2,6 @@ Rails.application.routes.draw do
|
||||||
devise_for :admin_users, ActiveAdmin::Devise.config
|
devise_for :admin_users, ActiveAdmin::Devise.config
|
||||||
ActiveAdmin.routes(self)
|
ActiveAdmin.routes(self)
|
||||||
resources :messages, controller: 'messages'
|
resources :messages, controller: 'messages'
|
||||||
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
|
resources :emails, controller: 'email'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
7
db/migrate/20230501112440_create_emails.rb
Normal file
7
db/migrate/20230501112440_create_emails.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class CreateEmails < ActiveRecord::Migration[6.0]
|
||||||
|
def change
|
||||||
|
create_table :emails do |t|
|
||||||
|
t.string :email, null: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2022_05_12_140948) do
|
ActiveRecord::Schema.define(version: 2023_05_01_112440) do
|
||||||
|
|
||||||
create_table "active_admin_comments", force: :cascade do |t|
|
create_table "active_admin_comments", force: :cascade do |t|
|
||||||
t.string "namespace"
|
t.string "namespace"
|
||||||
|
@ -38,6 +38,10 @@ ActiveRecord::Schema.define(version: 2022_05_12_140948) do
|
||||||
t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
|
t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "emails", force: :cascade do |t|
|
||||||
|
t.string "email", null: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "messages", force: :cascade do |t|
|
create_table "messages", force: :cascade do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
|
@ -45,6 +49,7 @@ ActiveRecord::Schema.define(version: 2022_05_12_140948) do
|
||||||
t.string "phone"
|
t.string "phone"
|
||||||
t.datetime "created_at", precision: 6, null: false
|
t.datetime "created_at", precision: 6, null: false
|
||||||
t.datetime "updated_at", precision: 6, null: false
|
t.datetime "updated_at", precision: 6, null: false
|
||||||
|
t.string "name"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
9
test/controllers/email_controller_test.rb
Normal file
9
test/controllers/email_controller_test.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
require 'test_helper'
|
||||||
|
|
||||||
|
class EmailControllerTest < ActionDispatch::IntegrationTest
|
||||||
|
test "should get index" do
|
||||||
|
get email_index_url
|
||||||
|
assert_response :success
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user