added newsletter controller
This commit is contained in:
parent
b93ed71e5f
commit
a5e7d1c828
|
|
@ -0,0 +1,3 @@
|
|||
# Place all the behaviors and hooks related to the matching controller here.
|
||||
# All this logic will automatically be available in application.js.
|
||||
# You can use CoffeeScript in this file: http://coffeescript.org/
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the Newsletter controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Getting Newsletter emails
|
||||
class NewsletterController < ApplicationController
|
||||
def index; end
|
||||
|
||||
def new
|
||||
@new_email = NewEmail.new
|
||||
end
|
||||
|
||||
def create
|
||||
@new_email = NewEmail.new
|
||||
end
|
||||
|
||||
def destroy; end
|
||||
end
|
||||
|
|
@ -74,8 +74,6 @@ class SiteController < ApplicationController
|
|||
else
|
||||
return head(:bad_request)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
module NewsletterHelper
|
||||
end
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
class NewEmail < ApplicationRecord
|
||||
end
|
||||
|
|
@ -36,8 +36,8 @@
|
|||
|
||||
<%= yield %>
|
||||
<!-- Copyright -->
|
||||
<div id="copyright">
|
||||
© Akademia Technologii 2018. | Design:
|
||||
<div id="copyright">© Akademia Technologii
|
||||
<%= Time.now.year %>. | Design:
|
||||
<a href="http://html5up.net">HTML5 UP</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
<h1>Newsletter#create</h1>
|
||||
<p>Find me in app/views/newsletter/create.html.erb</p>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<h1>Newsletter#index</h1>
|
||||
<p>Find me in app/views/newsletter/index.html.erb</p>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<h1>Newsletter#new</h1>
|
||||
<p>Find me in app/views/newsletter/new.html.erb</p>
|
||||
|
|
@ -10,12 +10,12 @@
|
|||
Już niedługo powstanie tu <b>pierwszy w Polsce</b> internetowy kurs wzmacniania konstrukcji włóknami węglowymi CFRP. Jeżeli nie jesteś zainteresowany <b>nowoczesnymi metodami</b> wzmacniania budowli, <b>innowacyjnymi</b> materiałami, nie jesteś inżynierem albo technikiem budownictwa, architektem, bądź <b>wschodzącą gwiazdą</b> budowlanki na studiach, to nie klikaj w przycisk.
|
||||
</p>
|
||||
<a href="#" class="button-large" style="color:white;">JESTEM CIEKAW</a>
|
||||
<a href="?wer=1">Wersja 1</a>|<a href="?wer=2">Wersja 2</a>
|
||||
<!--<a href="?wer=1">Wersja 1</a>|<a href="?wer=2">Wersja 2</a>-->
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
<iframe width="520" height="315" src="https://www.youtube.com/embed/tgbNymZ7vqY?controls=0" class="col-6 col-12-medium imp-medium">
|
||||
<iframe width="520" src="https://www.youtube.com/embed/oL_Y1UEjKfo?controls=0" class="col-6 col-12-medium imp-medium">
|
||||
</iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
Rails.application.routes.draw do
|
||||
resources :newsletter, only: %i[index new create destroy]
|
||||
namespace :admin do
|
||||
namespace :articles do
|
||||
get 'all_page/publish'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
class CreateNewEmails < ActiveRecord::Migration[5.1]
|
||||
def change
|
||||
create_table :new_emails do |t|
|
||||
t.string :email
|
||||
t.boolean :active
|
||||
t.datetime :accepted
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :new_emails, :email
|
||||
add_index :new_emails, :active
|
||||
end
|
||||
end
|
||||
23
db/schema.rb
23
db/schema.rb
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20180119145343) do
|
||||
ActiveRecord::Schema.define(version: 20191202132743) do
|
||||
|
||||
create_table "admins", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci" do |t|
|
||||
t.string "email", default: "", null: false
|
||||
|
|
@ -67,6 +67,16 @@ ActiveRecord::Schema.define(version: 20180119145343) do
|
|||
t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type"
|
||||
end
|
||||
|
||||
create_table "new_emails", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci" do |t|
|
||||
t.string "email"
|
||||
t.boolean "active"
|
||||
t.datetime "accepted"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["active"], name: "index_new_emails_on_active"
|
||||
t.index ["email"], name: "index_new_emails_on_email"
|
||||
end
|
||||
|
||||
create_table "published_pages", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci" do |t|
|
||||
t.string "name", limit: 40, null: false
|
||||
t.string "title", null: false
|
||||
|
|
@ -74,6 +84,7 @@ ActiveRecord::Schema.define(version: 20180119145343) do
|
|||
t.string "meta_description"
|
||||
t.integer "all_page_id", null: false
|
||||
t.boolean "nofollow", default: false, null: false
|
||||
t.integer "number_of_views", default: 0, null: false
|
||||
t.integer "type_of", null: false
|
||||
t.integer "article_id"
|
||||
t.integer "priority", default: 0, null: false
|
||||
|
|
@ -83,6 +94,16 @@ ActiveRecord::Schema.define(version: 20180119145343) do
|
|||
t.integer "created_by"
|
||||
t.timestamp "updated_at"
|
||||
t.integer "updated_by"
|
||||
t.index ["all_page_id"], name: "all_page_id"
|
||||
t.index ["created_at"], name: "created_at"
|
||||
t.index ["number_of_views"], name: "number_of_views"
|
||||
t.index ["slug"], name: "slug"
|
||||
t.index ["type_of"], name: "type_of"
|
||||
end
|
||||
|
||||
create_table "sc_settings", id: :integer, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci" do |t|
|
||||
t.integer "index_number_of_views", default: 0, null: false
|
||||
t.integer "contact_number_of_views", default: 0, null: false
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NewsletterControllerTest < ActionDispatch::IntegrationTest
|
||||
test "should get index" do
|
||||
get newsletter_index_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get new" do
|
||||
get newsletter_new_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get create" do
|
||||
get newsletter_create_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
email: MyString
|
||||
active: false
|
||||
accepted: 2019-12-02 14:27:43
|
||||
|
||||
two:
|
||||
email: MyString
|
||||
active: false
|
||||
accepted: 2019-12-02 14:27:43
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NewEmailTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Loading…
Reference in New Issue