pages_core 3.9.0 → 3.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -3
- data/VERSION +1 -0
- data/app/assets/builds/pages_core/admin-dist.js +13 -13
- data/app/assets/stylesheets/pages/admin/controllers/pages.scss +6 -0
- data/app/controllers/admin/categories_controller.rb +3 -3
- data/app/controllers/admin/invites_controller.rb +1 -1
- data/app/controllers/admin/pages_controller.rb +1 -1
- data/app/controllers/admin/password_resets_controller.rb +7 -7
- data/app/controllers/admin/users_controller.rb +1 -1
- data/app/controllers/concerns/pages_core/error_reporting.rb +2 -0
- data/app/controllers/concerns/pages_core/ranged_response.rb +40 -0
- data/app/controllers/pages_core/attachments_controller.rb +6 -4
- data/app/controllers/pages_core/frontend/pages_controller.rb +1 -1
- data/app/controllers/sessions_controller.rb +5 -6
- data/app/javascript/components/ImageEditor/Form.jsx +1 -1
- data/app/javascript/components/ImageGrid.jsx +1 -1
- data/app/mailers/admin_mailer.rb +1 -1
- data/app/models/attachment.rb +1 -1
- data/app/models/concerns/pages_core/page_model/pathable.rb +1 -1
- data/app/models/invite.rb +0 -2
- data/app/models/page_category.rb +0 -1
- data/app/models/page_exporter.rb +2 -2
- data/app/models/password_reset_token.rb +0 -2
- data/app/models/tagging.rb +0 -2
- data/app/models/user.rb +1 -13
- data/app/views/admin/users/login.html.erb +2 -2
- data/app/views/admin/users/new_password.html.erb +1 -1
- data/app/views/admin_mailer/invite.text.erb +0 -2
- data/app/views/admin_mailer/password_reset.text.erb +0 -2
- data/app/views/feeds/pages.rss.builder +1 -1
- data/config/locales/en.yml +40 -14
- data/db/migrate/20220615160300_remove_username.rb +7 -0
- data/lib/pages_core/static_cache/page_cache_handler.rb +1 -1
- data/lib/pages_core/static_cache.rb +7 -3
- data/lib/rails/generators/pages_core/frontend/frontend_generator.rb +34 -34
- data/lib/rails/generators/pages_core/frontend/templates/{layout.html.erb → application.html.erb} +3 -0
- data/lib/rails/generators/pages_core/frontend/templates/javascript/lib/GridOverlay.js +66 -0
- data/lib/rails/generators/pages_core/frontend/templates/javascript/lib/ResponsiveEmbeds.js +72 -0
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/application.sass.scss +15 -0
- data/lib/rails/generators/pages_core/frontend/templates/{base.scss.erb → stylesheets/components/base.scss} +9 -0
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/config.scss +26 -0
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/framework/breakpoints.scss +42 -0
- data/lib/rails/generators/pages_core/frontend/templates/{clearfix.scss.erb → stylesheets/framework/clearfix.scss} +0 -0
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/framework/fonts.scss +32 -0
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/framework/grid.scss +168 -0
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/framework/grid_overlay.scss +44 -0
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/colors.scss +8 -0
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/global/typography.scss +90 -0
- data/lib/rails/generators/pages_core/frontend/templates/stylesheets/vendor/normalize.css +349 -0
- metadata +26 -14
- data/lib/rails/generators/pages_core/frontend/templates/application.scss.erb +0 -3
- data/lib/rails/generators/pages_core/frontend/templates/breakpoints.scss.erb +0 -24
- data/lib/rails/generators/pages_core/frontend/templates/normalize.css.erb +0 -425
@@ -19,7 +19,7 @@ module Admin
|
|
19
19
|
def create
|
20
20
|
@category = Category.create(category_params)
|
21
21
|
if @category.valid?
|
22
|
-
flash[:notice] = "
|
22
|
+
flash[:notice] = t("pages_core.categories_controller.created")
|
23
23
|
redirect_to admin_pages_url(@locale)
|
24
24
|
else
|
25
25
|
render action: :new
|
@@ -30,7 +30,7 @@ module Admin
|
|
30
30
|
|
31
31
|
def update
|
32
32
|
if @category.update(category_params)
|
33
|
-
flash[:notice] = "
|
33
|
+
flash[:notice] = t("pages_core.categories_controller.updated")
|
34
34
|
redirect_to admin_pages_url(@locale)
|
35
35
|
else
|
36
36
|
render action: :edit
|
@@ -39,7 +39,7 @@ module Admin
|
|
39
39
|
|
40
40
|
def destroy
|
41
41
|
@category.destroy
|
42
|
-
flash[:notice] = "
|
42
|
+
flash[:notice] = t("pages_core.categories_controller.deleted")
|
43
43
|
redirect_to admin_pages_url(@locale)
|
44
44
|
end
|
45
45
|
|
@@ -61,7 +61,7 @@ module Admin
|
|
61
61
|
@invite = Invite.find_by(id: params[:id])
|
62
62
|
return if @invite && secure_compare(@invite.token, params[:token])
|
63
63
|
|
64
|
-
flash[:notice] = "
|
64
|
+
flash[:notice] = t("pages_core.invite_expired")
|
65
65
|
redirect_to(login_admin_users_url) && return
|
66
66
|
end
|
67
67
|
|
@@ -52,7 +52,7 @@ module Admin
|
|
52
52
|
if @page.update(page_params)
|
53
53
|
@page.categories = param_categories
|
54
54
|
respond_with_page(@page) do
|
55
|
-
flash[:notice] = "
|
55
|
+
flash[:notice] = t("pages_core.changes_saved")
|
56
56
|
redirect_to edit_admin_page_url(@locale, @page)
|
57
57
|
end
|
58
58
|
else
|
@@ -9,13 +9,13 @@ module Admin
|
|
9
9
|
layout "admin"
|
10
10
|
|
11
11
|
def create
|
12
|
-
@user = find_user_by_email(params[:
|
12
|
+
@user = find_user_by_email(params[:email])
|
13
13
|
if @user
|
14
14
|
@password_reset_token = @user.password_reset_tokens.create
|
15
15
|
deliver_password_reset(@user, @password_reset_token)
|
16
|
-
flash[:notice] = "
|
16
|
+
flash[:notice] = t("pages_core.password_reset.sent")
|
17
17
|
else
|
18
|
-
flash[:notice] =
|
18
|
+
flash[:notice] = t("pages_core.password_reset.not_found")
|
19
19
|
end
|
20
20
|
redirect_to login_admin_users_url
|
21
21
|
end
|
@@ -29,7 +29,7 @@ module Admin
|
|
29
29
|
if user_params[:password].present? && @user.update(user_params)
|
30
30
|
@password_reset_token.destroy
|
31
31
|
authenticate!(@user)
|
32
|
-
flash[:notice] = "
|
32
|
+
flash[:notice] = t("pages_core.password_reset.changed")
|
33
33
|
redirect_to login_admin_users_url
|
34
34
|
else
|
35
35
|
render action: :show
|
@@ -50,7 +50,7 @@ module Admin
|
|
50
50
|
def find_user_by_email(email)
|
51
51
|
return unless email
|
52
52
|
|
53
|
-
User.
|
53
|
+
User.find_by_email(params[:email])
|
54
54
|
end
|
55
55
|
|
56
56
|
def user_params
|
@@ -70,7 +70,7 @@ module Admin
|
|
70
70
|
|
71
71
|
return if valid_token?(@password_reset_token)
|
72
72
|
|
73
|
-
flash[:notice] = "
|
73
|
+
flash[:notice] = t("pages_core.password_reset.invalid_request")
|
74
74
|
redirect_to(login_admin_users_url) && return
|
75
75
|
end
|
76
76
|
|
@@ -78,7 +78,7 @@ module Admin
|
|
78
78
|
return unless @password_reset_token.expired?
|
79
79
|
|
80
80
|
@password_reset_token.destroy
|
81
|
-
flash[:notice] = "
|
81
|
+
flash[:notice] = t("pages_core.password_reset.expired")
|
82
82
|
redirect_to(login_admin_users_url)
|
83
83
|
end
|
84
84
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PagesCore
|
4
|
+
module RangedResponse
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
def send_ranged_data(data, options = {})
|
8
|
+
response.header["Content-Length"] = data.length
|
9
|
+
response.header["Accept-Ranges"] = "bytes"
|
10
|
+
|
11
|
+
content_range_headers(data.length) if ranged_request?
|
12
|
+
|
13
|
+
send_data(ranged_data(data),
|
14
|
+
options.merge(status: ranged_request? ? 206 : 200))
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def content_range(length)
|
20
|
+
Rack::Utils.byte_ranges(request.headers, length)[0]
|
21
|
+
end
|
22
|
+
|
23
|
+
def content_range_headers(size)
|
24
|
+
bytes = content_range(size)
|
25
|
+
response.header["Content-Length"] = bytes.end - bytes.begin + 1
|
26
|
+
response.header["Content-Range"] =
|
27
|
+
"bytes #{bytes.begin}-#{bytes.end}/#{size}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def ranged_data(data)
|
31
|
+
return data unless ranged_request?
|
32
|
+
|
33
|
+
data[content_range(data.length)]
|
34
|
+
end
|
35
|
+
|
36
|
+
def ranged_request?
|
37
|
+
request.headers["HTTP_RANGE"]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module PagesCore
|
4
4
|
class AttachmentsController < ::ApplicationController
|
5
|
+
include PagesCore::RangedResponse
|
6
|
+
|
5
7
|
before_action :verify_signed_params
|
6
8
|
before_action :find_attachment, only: %i[show download]
|
7
9
|
|
@@ -26,10 +28,10 @@ module PagesCore
|
|
26
28
|
return
|
27
29
|
end
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
send_ranged_data(@attachment.data,
|
32
|
+
filename: @attachment.filename,
|
33
|
+
type: @attachment.content_type,
|
34
|
+
disposition: disposition)
|
33
35
|
end
|
34
36
|
|
35
37
|
def verify_signed_params
|
@@ -2,27 +2,26 @@
|
|
2
2
|
|
3
3
|
class SessionsController < ::ApplicationController
|
4
4
|
def create
|
5
|
-
user = find_user(params[:
|
5
|
+
user = find_user(params[:email], params[:password])
|
6
6
|
authenticate!(user) if user
|
7
7
|
|
8
8
|
if logged_in?
|
9
9
|
redirect_to admin_default_url
|
10
10
|
else
|
11
|
-
flash[:notice] = "
|
12
|
-
"was not valid"
|
11
|
+
flash[:notice] = t("pages_core.invalid_login")
|
13
12
|
redirect_to login_admin_users_url
|
14
13
|
end
|
15
14
|
end
|
16
15
|
|
17
16
|
def destroy
|
18
|
-
flash[:notice] = "
|
17
|
+
flash[:notice] = t("pages_core.logged_out")
|
19
18
|
deauthenticate!
|
20
19
|
redirect_to login_admin_users_url
|
21
20
|
end
|
22
21
|
|
23
22
|
protected
|
24
23
|
|
25
|
-
def find_user(
|
26
|
-
User.authenticate(
|
24
|
+
def find_user(email, password)
|
25
|
+
User.authenticate(email, password: password) if email && password
|
27
26
|
end
|
28
27
|
end
|
@@ -249,7 +249,7 @@ export default function ImageGrid(props) {
|
|
249
249
|
ImageGrid.propTypes = {
|
250
250
|
attribute: PropTypes.string,
|
251
251
|
locale: PropTypes.string,
|
252
|
-
locales: PropTypes.
|
252
|
+
locales: PropTypes.object,
|
253
253
|
records: PropTypes.array,
|
254
254
|
enablePrimary: PropTypes.bool,
|
255
255
|
primaryAttribute: PropTypes.string,
|
data/app/mailers/admin_mailer.rb
CHANGED
data/app/models/attachment.rb
CHANGED
@@ -67,7 +67,7 @@ class Attachment < ApplicationRecord
|
|
67
67
|
# Includes a timestamp fingerprint in the URL param, so
|
68
68
|
# that rendered images can be cached indefinitely.
|
69
69
|
def to_param
|
70
|
-
[id, updated_at.utc.
|
70
|
+
[id, updated_at.utc.to_fs(cache_timestamp_format)].join("-")
|
71
71
|
end
|
72
72
|
|
73
73
|
private
|
data/app/models/invite.rb
CHANGED
data/app/models/page_category.rb
CHANGED
data/app/models/page_exporter.rb
CHANGED
@@ -74,7 +74,7 @@ class PageExporter
|
|
74
74
|
|
75
75
|
def page_file_name(page)
|
76
76
|
[page.path_segment,
|
77
|
-
page.to_param[0..250]].
|
77
|
+
page.to_param[0..250]].compact_blank.first
|
78
78
|
end
|
79
79
|
|
80
80
|
def page_path_segment(page)
|
@@ -95,6 +95,6 @@ class PageExporter
|
|
95
95
|
|
96
96
|
def write_file(path, data)
|
97
97
|
FileUtils.mkdir_p(File.dirname(path))
|
98
|
-
File.
|
98
|
+
File.binwrite(path, data)
|
99
99
|
end
|
100
100
|
end
|
@@ -5,8 +5,6 @@ class PasswordResetToken < ApplicationRecord
|
|
5
5
|
before_create :ensure_token
|
6
6
|
before_create :ensure_expiration
|
7
7
|
|
8
|
-
validates :user_id, presence: true
|
9
|
-
|
10
8
|
scope :active, -> { where("expires_at >= ?", Time.now.utc) }
|
11
9
|
scope :expired, -> { where("expires_at < ?", Time.now.utc) }
|
12
10
|
|
data/app/models/tagging.rb
CHANGED
@@ -4,10 +4,8 @@ class Tagging < ApplicationRecord
|
|
4
4
|
belongs_to :tag
|
5
5
|
belongs_to :taggable, polymorphic: true, touch: true
|
6
6
|
|
7
|
-
validates :taggable_id, presence: true
|
8
7
|
validates :taggable_type, presence: true
|
9
8
|
validates :tag_id,
|
10
|
-
presence: true,
|
11
9
|
uniqueness: { scope: %i[taggable_type taggable_id] }
|
12
10
|
|
13
11
|
def self.tagged_class(taggable)
|
data/app/models/user.rb
CHANGED
@@ -23,8 +23,6 @@ class User < ApplicationRecord
|
|
23
23
|
|
24
24
|
serialize :persistent_data
|
25
25
|
|
26
|
-
validates :username, presence: true, uniqueness: { case_sensitive: false }
|
27
|
-
|
28
26
|
validates :name, presence: true
|
29
27
|
|
30
28
|
validates :email,
|
@@ -37,7 +35,6 @@ class User < ApplicationRecord
|
|
37
35
|
|
38
36
|
validate :confirm_password_must_match
|
39
37
|
|
40
|
-
before_validation :ensure_username
|
41
38
|
before_validation :hash_password
|
42
39
|
before_create :ensure_first_user_has_all_roles
|
43
40
|
|
@@ -47,18 +44,13 @@ class User < ApplicationRecord
|
|
47
44
|
|
48
45
|
class << self
|
49
46
|
def authenticate(email, password:)
|
50
|
-
user = User.
|
47
|
+
user = User.find_by_email(email)
|
51
48
|
user if user.try { |u| u.authenticate!(password) }
|
52
49
|
end
|
53
50
|
|
54
51
|
def find_by_email(str)
|
55
52
|
find_by("LOWER(email) = ?", str.to_s.downcase)
|
56
53
|
end
|
57
|
-
|
58
|
-
# Finds a user by either username or email address.
|
59
|
-
def login_name(string)
|
60
|
-
find_by(username: string.to_s) || find_by_email(string)
|
61
|
-
end
|
62
54
|
end
|
63
55
|
|
64
56
|
def authenticate!(password)
|
@@ -102,10 +94,6 @@ class User < ApplicationRecord
|
|
102
94
|
BCrypt::Password.create(password)
|
103
95
|
end
|
104
96
|
|
105
|
-
def ensure_username
|
106
|
-
self.username ||= email
|
107
|
-
end
|
108
|
-
|
109
97
|
def ensure_first_user_has_all_roles
|
110
98
|
return if User.any?
|
111
99
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<%= form_tag session_path do %>
|
20
20
|
<p>
|
21
21
|
<label>Email address</label>
|
22
|
-
<%= text_field_tag :
|
22
|
+
<%= text_field_tag :email, '' %>
|
23
23
|
</p>
|
24
24
|
<p>
|
25
25
|
<label>Password</label>
|
@@ -54,7 +54,7 @@
|
|
54
54
|
and we'll send you a link where you can reset your password.
|
55
55
|
</p>
|
56
56
|
<p>
|
57
|
-
<%= text_field_tag :
|
57
|
+
<%= text_field_tag :email, '' %>
|
58
58
|
</p>
|
59
59
|
<p>
|
60
60
|
<button type="submit">
|
@@ -9,5 +9,3 @@ If you want to reset your password, please click the following link:
|
|
9
9
|
This will take you to a web page where you can set a new password of your choosing. The link will expire in 24 hours.
|
10
10
|
|
11
11
|
If you do not want to change your password, please ignore this email.
|
12
|
-
|
13
|
-
If you have any further trouble, please don't hesitate in contacting us by sending us an email at support@anyone.no (or simply by replying to this message).
|
@@ -23,7 +23,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
xml.guid page_url(@locale, item, only_path: false)
|
26
|
-
xml.pubDate item.published_at.
|
26
|
+
xml.pubDate item.published_at.to_fs(:rfc822)
|
27
27
|
xml.tag!("dc:creator", item.author.name)
|
28
28
|
if item.image
|
29
29
|
xml.enclosure(
|
data/config/locales/en.yml
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
---
|
1
2
|
en:
|
2
3
|
date:
|
3
4
|
formats:
|
@@ -16,40 +17,65 @@ en:
|
|
16
17
|
user:
|
17
18
|
email: Email address
|
18
19
|
image: Profile picture
|
20
|
+
pages_core:
|
21
|
+
account_holder_exists: Account holder already exists
|
22
|
+
categories_controller:
|
23
|
+
created: New category created
|
24
|
+
deleted: Category was deleted
|
25
|
+
updated: Category was updated
|
26
|
+
changes_saved: Your changes were saved
|
27
|
+
invalid_login: >
|
28
|
+
The provided email address and password combination was not valid
|
29
|
+
invite_expired: This invite is no longer valid.
|
30
|
+
logged_out: You have been logged out
|
31
|
+
password_reset:
|
32
|
+
changed: Your password has been changed
|
33
|
+
expired: Your password reset link has expired
|
34
|
+
invalid_request: Invalid password reset request
|
35
|
+
not_found: Couldn't find a user with that email address
|
36
|
+
sent: An email with further instructions has been sent
|
19
37
|
templates:
|
20
38
|
default:
|
21
39
|
blocks:
|
22
40
|
name:
|
23
41
|
name: Name
|
24
|
-
description:
|
25
|
-
name of the
|
42
|
+
description: >
|
43
|
+
This is the name of the page, and it will also be the name
|
44
|
+
of the link to this page.
|
26
45
|
body:
|
27
46
|
name: Body
|
28
47
|
description: ""
|
29
48
|
headline:
|
30
49
|
name: Headline
|
31
|
-
description:
|
32
|
-
page
|
50
|
+
description: >
|
51
|
+
Optional, use if the headline should differ from the page
|
52
|
+
name.
|
33
53
|
excerpt:
|
34
54
|
name: Standfirst
|
35
55
|
description: An introductory paragraph before the start of the body.
|
36
56
|
boxout:
|
37
57
|
name: Boxout
|
38
|
-
description:
|
39
|
-
|
58
|
+
description: >
|
59
|
+
Part of the page, usually background info or facts related
|
60
|
+
to the article.
|
40
61
|
meta_title:
|
41
62
|
name: Title
|
42
|
-
description:
|
43
|
-
|
63
|
+
description: >
|
64
|
+
Document title. Will fall back to the page name if empty.
|
65
|
+
Recommended length: Up to 56 characters.
|
44
66
|
meta_description:
|
45
67
|
name: Description
|
46
|
-
description:
|
47
|
-
|
68
|
+
description: >
|
69
|
+
Description for search engines. Will fall back to
|
70
|
+
Standfirst if empty. Recommended length: Up to 156
|
71
|
+
characters.
|
48
72
|
open_graph_title:
|
49
73
|
name: Open Graph Title
|
50
|
-
description:
|
51
|
-
|
74
|
+
description: >
|
75
|
+
Page title for Facebook sharing. Will fall back to the
|
76
|
+
document title.
|
52
77
|
open_graph_description:
|
53
78
|
name: Open Graph Description
|
54
|
-
description:
|
55
|
-
Description
|
79
|
+
description: >
|
80
|
+
Description for Facebook sharing. Will fall back to
|
81
|
+
Description or Standfirst if empty.
|
@@ -14,13 +14,17 @@ module PagesCore
|
|
14
14
|
private
|
15
15
|
|
16
16
|
def default_handler
|
17
|
-
if ENV["VARNISH_URL"]
|
18
|
-
return PagesCore::StaticCache::VarnishHandler.new(ENV["VARNISH_URL"])
|
19
|
-
end
|
17
|
+
return varnish_handler if ENV["VARNISH_URL"]
|
20
18
|
|
21
19
|
# PagesCore::StaticCache::NullHandler.new
|
22
20
|
PagesCore::StaticCache::PageCacheHandler.new
|
23
21
|
end
|
22
|
+
|
23
|
+
def varnish_handler
|
24
|
+
PagesCore::StaticCache::VarnishHandler.new(
|
25
|
+
ENV.fetch("VARNISH_URL", nil)
|
26
|
+
)
|
27
|
+
end
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|
@@ -8,48 +8,48 @@ module PagesCore
|
|
8
8
|
|
9
9
|
def create_layout
|
10
10
|
copy_file(
|
11
|
-
"
|
11
|
+
"application.html.erb",
|
12
12
|
File.join("app/views/layouts/application.html.erb")
|
13
13
|
)
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
def create_css_framework
|
17
|
+
["application.sass.scss",
|
18
|
+
"config.scss",
|
19
|
+
"components/base.scss",
|
20
|
+
"framework/breakpoints.scss",
|
21
|
+
"framework/clearfix.scss",
|
22
|
+
"framework/grid.scss",
|
23
|
+
"framework/grid_overlay.scss",
|
24
|
+
"framework/fonts.scss",
|
25
|
+
"global/colors.scss",
|
26
|
+
"global/typography.scss",
|
27
|
+
"vendor/normalize.css"].each do |f|
|
28
|
+
template("stylesheets/#{f}", File.join("app/assets/stylesheets/#{f}"))
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
File.join("
|
31
|
-
|
32
|
+
def create_js_framework
|
33
|
+
["lib/ResponsiveEmbeds.js",
|
34
|
+
"lib/GridOverlay.js"].each do |f|
|
35
|
+
template("javascript/#{f}", File.join("app/javascript/#{f}"))
|
36
|
+
end
|
37
|
+
|
38
|
+
append_to_file "app/javascript/application.js" do
|
39
|
+
<<~JS
|
40
|
+
// Responsive embeds
|
41
|
+
import ResponsiveEmbeds from "./lib/ResponsiveEmbeds";
|
42
|
+
ResponsiveEmbeds.start();
|
43
|
+
|
44
|
+
// Grid overlay
|
45
|
+
import GridOverlay from "./lib/GridOverlay";
|
46
|
+
GridOverlay.start();
|
47
|
+
JS
|
48
|
+
end
|
32
49
|
end
|
33
50
|
|
34
|
-
def
|
35
|
-
|
36
|
-
"breakpoints.scss.erb",
|
37
|
-
File.join("app/assets/stylesheets/mixins/breakpoints.scss")
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
def create_clearfix_css
|
42
|
-
template(
|
43
|
-
"clearfix.scss.erb",
|
44
|
-
File.join("app/assets/stylesheets/mixins/clearfix.scss")
|
45
|
-
)
|
46
|
-
end
|
47
|
-
|
48
|
-
def create_base_css
|
49
|
-
template(
|
50
|
-
"base.scss.erb",
|
51
|
-
File.join("app/assets/stylesheets/components/base.scss")
|
52
|
-
)
|
51
|
+
def remove_application_css
|
52
|
+
remove_file("app/assets/stylesheets/application.css")
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|