pages_core 3.11.3 → 3.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/assets/builds/pages_core/admin-dist.js +3 -3
- data/app/assets/stylesheets/pages/admin/components/header.scss +4 -4
- data/app/assets/stylesheets/pages/admin/components/modal.scss +0 -20
- data/app/assets/stylesheets/pages/admin.scss +0 -20
- data/app/assets/stylesheets/pages/errors.css +1 -1
- data/app/controllers/admin/calendars_controller.rb +36 -0
- data/app/controllers/admin/categories_controller.rb +2 -2
- data/app/controllers/admin/news_controller.rb +58 -0
- data/app/controllers/admin/pages_controller.rb +2 -3
- data/app/controllers/admin/password_resets_controller.rb +4 -4
- data/app/controllers/admin/users_controller.rb +4 -4
- data/app/controllers/errors_controller.rb +1 -1
- data/app/controllers/sessions_controller.rb +1 -1
- data/app/helpers/admin/calendars_helper.rb +29 -0
- data/app/helpers/pages_core/admin/content_tabs_helper.rb +1 -0
- data/app/helpers/pages_core/admin/labelled_field_helper.rb +1 -1
- data/app/helpers/pages_core/application_helper.rb +1 -1
- data/app/javascript/components/PageTreeNode.jsx +0 -8
- data/app/javascript/components/Toast.jsx +1 -1
- data/app/models/category.rb +1 -1
- data/app/models/concerns/pages_core/page_model/dated_page.rb +38 -0
- data/app/models/page.rb +1 -1
- data/app/policies/page_policy.rb +2 -6
- data/app/views/admin/calendars/show.html.erb +83 -0
- data/app/views/admin/invites/show.html.erb +6 -4
- data/app/views/admin/{pages/news.html.erb → news/index.html.erb} +12 -7
- data/app/views/admin/pages/_list_item.html.erb +2 -1
- data/app/views/admin/password_resets/show.html.erb +4 -2
- data/app/views/admin/users/login.html.erb +3 -3
- data/app/views/admin/users/new.html.erb +6 -4
- data/app/views/admin/users/new_password.html.erb +1 -1
- data/app/views/layouts/admin/_header.html.erb +4 -16
- data/app/views/layouts/admin/_page_header.html.erb +5 -3
- data/app/views/layouts/errors.html.erb +2 -2
- data/config/routes.rb +7 -2
- data/lib/pages_core/pages_plugin.rb +6 -1
- data/lib/rails/generators/pages_core/install/install_generator.rb +2 -2
- data/lib/rails/generators/pages_core/install/templates/delayed_job +2 -3
- data/lib/rails/generators/pages_core/rspec/templates/rails_helper.rb +2 -2
- metadata +9 -6
- data/app/controllers/concerns/pages_core/admin/news_page_controller.rb +0 -67
@@ -19,11 +19,11 @@
|
|
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, "", autocomplete: "email") %>
|
23
23
|
</p>
|
24
24
|
<p>
|
25
25
|
<label>Password</label>
|
26
|
-
<%= password_field_tag
|
26
|
+
<%= password_field_tag(:password, "", autocomplete: "current-password") %>
|
27
27
|
</p>
|
28
28
|
<p>
|
29
29
|
<button type="submit">Sign in</button>
|
@@ -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, "", autocomplete: "email") %>
|
58
58
|
</p>
|
59
59
|
<p>
|
60
60
|
<button type="submit">
|
@@ -9,10 +9,12 @@
|
|
9
9
|
|
10
10
|
<%= form_for [:admin, @user], builder: PagesCore::FormBuilder do |f| %>
|
11
11
|
|
12
|
-
<%= f.labelled_text_field :name %>
|
13
|
-
<%= f.labelled_text_field :email %>
|
14
|
-
<%= f.labelled_password_field
|
15
|
-
|
12
|
+
<%= f.labelled_text_field(:name, autocomplete: "name") %>
|
13
|
+
<%= f.labelled_text_field(:email, autocomplete: "email") %>
|
14
|
+
<%= f.labelled_password_field(:password,
|
15
|
+
autocomplete: "new-password") %>
|
16
|
+
<%= f.labelled_password_field(:confirm_password,
|
17
|
+
autocomplete: "new-password") %>
|
16
18
|
|
17
19
|
<p>
|
18
20
|
<button type="submit">
|
@@ -1,8 +1,8 @@
|
|
1
1
|
<header>
|
2
|
-
<div
|
2
|
+
<div class="logo">
|
3
3
|
<%= link_to image_tag("pages/admin/icon.png"), '/admin' %>
|
4
4
|
</div>
|
5
|
-
<div
|
5
|
+
<div class="site-name">
|
6
6
|
<h1>
|
7
7
|
<%= link_to "Pages", "/admin" %> <%= PagesCore.config :site_name %>
|
8
8
|
</h1>
|
@@ -14,24 +14,12 @@
|
|
14
14
|
<%= link_to("Log out", session_path, method: "delete") %>
|
15
15
|
</div>
|
16
16
|
<% end %>
|
17
|
-
<
|
17
|
+
<nav class="tabs">
|
18
18
|
<% if logged_in? %>
|
19
19
|
<%= header_tabs(:pages) %>
|
20
20
|
<%= header_tabs(:pages_plugins) %>
|
21
21
|
<%= header_tabs(:custom) %>
|
22
22
|
<%= header_tabs(:account) %>
|
23
23
|
<% end -%>
|
24
|
-
</
|
24
|
+
</nav>
|
25
25
|
</header>
|
26
|
-
|
27
|
-
<% if flash[:error] && false %>
|
28
|
-
<div id="flash-error">
|
29
|
-
<%= flash[:error] %>
|
30
|
-
</div>
|
31
|
-
<% end %>
|
32
|
-
|
33
|
-
<% if flash[:notice] && false %>
|
34
|
-
<div id="flash-notice">
|
35
|
-
<%= flash[:notice] %>
|
36
|
-
</div>
|
37
|
-
<% end %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% if @page_description || @content_tabs %>
|
2
|
-
<div
|
2
|
+
<div class="page-description"<% if @content_tabs %> class="with_content_tabs"<% end %>>
|
3
3
|
<% if @page_description_links -%>
|
4
4
|
<div class="links">
|
5
5
|
<%= @page_description_links.html_safe %>
|
@@ -9,7 +9,8 @@
|
|
9
9
|
<%= (@page_description || @page_title).html_safe %>
|
10
10
|
</h3>
|
11
11
|
<% if @content_tabs %>
|
12
|
-
<ul
|
12
|
+
<ul class="content-tabs"
|
13
|
+
role="tablist">
|
13
14
|
<% @content_tabs.map do |t| %>
|
14
15
|
<li id="content-tab-link-<%= t[:key] %>"
|
15
16
|
data-tab="<%= t[:key] %>"
|
@@ -23,7 +24,8 @@
|
|
23
24
|
data: {
|
24
25
|
action: "click->main#changeTab",
|
25
26
|
tab: t[:key]
|
26
|
-
|
27
|
+
},
|
28
|
+
role: "tab") %>
|
27
29
|
<% end %>
|
28
30
|
</li>
|
29
31
|
<% end %>
|
data/config/routes.rb
CHANGED
@@ -78,11 +78,16 @@ Rails.application.routes.draw do
|
|
78
78
|
|
79
79
|
# Pages
|
80
80
|
scope ":locale" do
|
81
|
+
resources :news,
|
82
|
+
only: %i[index],
|
83
|
+
path: "pages/news(/:year(/:month)(/page/:page))"
|
84
|
+
|
85
|
+
resource :calendar,
|
86
|
+
path: "pages/calendar(/:year(/:month)(/page/:page))"
|
87
|
+
|
81
88
|
resources :pages do
|
82
89
|
collection do
|
83
|
-
get "news(/:year(/:month)(/page/:page))", action: :news, as: :news
|
84
90
|
get "deleted"
|
85
|
-
get "new_news" # TODO: Should be refactored
|
86
91
|
end
|
87
92
|
|
88
93
|
member do
|
@@ -15,11 +15,16 @@ module PagesCore
|
|
15
15
|
|
16
16
|
paths["db/migrate"] = "db/migrate"
|
17
17
|
|
18
|
-
admin_menu_item "News", proc {
|
18
|
+
admin_menu_item "News", proc { admin_news_index_path(@locale) }, :pages,
|
19
19
|
if: proc { Page.news_pages.any? },
|
20
20
|
current: proc { @page && @page.parent.try(&:news_page?) }
|
21
21
|
|
22
|
+
admin_menu_item "Calendar", proc { admin_calendar_path(@locale) }, :pages,
|
23
|
+
if: proc { Page.with_dates.any? },
|
24
|
+
current: proc { @page && @page.starts_at? }
|
25
|
+
|
22
26
|
admin_menu_item "Pages", proc { admin_pages_path(@locale) }, :pages
|
27
|
+
|
23
28
|
admin_menu_item "Users", proc { admin_users_path }, :account
|
24
29
|
end
|
25
30
|
end
|
@@ -58,8 +58,8 @@ module PagesCore
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def create_delayed_job_script
|
61
|
-
template "delayed_job", File.join("
|
62
|
-
File.chmod(0o755, Rails.root.join("
|
61
|
+
template "delayed_job", File.join("bin/delayed_job")
|
62
|
+
File.chmod(0o755, Rails.root.join("bin/delayed_job"))
|
63
63
|
end
|
64
64
|
|
65
65
|
def create_delayed_job_initializer
|
@@ -1,8 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require File.expand_path(
|
5
|
-
|
6
|
-
)
|
4
|
+
require File.expand_path(File.join(File.dirname(__FILE__), "..", "config",
|
5
|
+
"environment"))
|
7
6
|
require "delayed/command"
|
8
7
|
Delayed::Command.new(ARGV).daemonize
|
@@ -31,7 +31,7 @@ require "shoulda-matchers"
|
|
31
31
|
# directory. Alternatively, in the individual `*_spec.rb` files, manually
|
32
32
|
# require only the support files necessary.
|
33
33
|
#
|
34
|
-
Dir[Rails.root.join("spec/support/**/*.rb")].
|
34
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each do |f|
|
35
35
|
require f
|
36
36
|
end
|
37
37
|
|
@@ -41,7 +41,7 @@ ActiveRecord::Migration.maintain_test_schema!
|
|
41
41
|
|
42
42
|
RSpec.configure do |config|
|
43
43
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
44
|
-
config.fixture_path =
|
44
|
+
config.fixture_path = Rails.root.join("spec/fixtures")
|
45
45
|
|
46
46
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
47
47
|
# examples within a transaction, remove the following line or assign false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pages_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Inge Jørgensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -561,13 +561,14 @@ files:
|
|
561
561
|
- app/controller_dummies/pages_controller.rb
|
562
562
|
- app/controller_dummies/sitemaps_controller.rb
|
563
563
|
- app/controllers/admin/attachments_controller.rb
|
564
|
+
- app/controllers/admin/calendars_controller.rb
|
564
565
|
- app/controllers/admin/categories_controller.rb
|
565
566
|
- app/controllers/admin/images_controller.rb
|
566
567
|
- app/controllers/admin/invites_controller.rb
|
568
|
+
- app/controllers/admin/news_controller.rb
|
567
569
|
- app/controllers/admin/pages_controller.rb
|
568
570
|
- app/controllers/admin/password_resets_controller.rb
|
569
571
|
- app/controllers/admin/users_controller.rb
|
570
|
-
- app/controllers/concerns/pages_core/admin/news_page_controller.rb
|
571
572
|
- app/controllers/concerns/pages_core/admin/persistent_params.rb
|
572
573
|
- app/controllers/concerns/pages_core/authentication.rb
|
573
574
|
- app/controllers/concerns/pages_core/error_renderer.rb
|
@@ -592,6 +593,7 @@ files:
|
|
592
593
|
- app/formatters/pages_core/image_embedder.rb
|
593
594
|
- app/formatters/pages_core/link_renderer.rb
|
594
595
|
- app/helpers/admin/admin_helper.rb
|
596
|
+
- app/helpers/admin/calendars_helper.rb
|
595
597
|
- app/helpers/admin/menu_helper.rb
|
596
598
|
- app/helpers/admin/pages_helper.rb
|
597
599
|
- app/helpers/application_helper.rb
|
@@ -728,9 +730,11 @@ files:
|
|
728
730
|
- app/services/pages_core/create_user_service.rb
|
729
731
|
- app/services/pages_core/destroy_invite_service.rb
|
730
732
|
- app/services/pages_core/invite_service.rb
|
733
|
+
- app/views/admin/calendars/show.html.erb
|
731
734
|
- app/views/admin/images/show.json.jbuilder
|
732
735
|
- app/views/admin/invites/new.html.erb
|
733
736
|
- app/views/admin/invites/show.html.erb
|
737
|
+
- app/views/admin/news/index.html.erb
|
734
738
|
- app/views/admin/pages/_edit_content.html.erb
|
735
739
|
- app/views/admin/pages/_edit_files.html.erb
|
736
740
|
- app/views/admin/pages/_edit_images.html.erb
|
@@ -742,7 +746,6 @@ files:
|
|
742
746
|
- app/views/admin/pages/edit.html.erb
|
743
747
|
- app/views/admin/pages/index.html.erb
|
744
748
|
- app/views/admin/pages/new.html.erb
|
745
|
-
- app/views/admin/pages/news.html.erb
|
746
749
|
- app/views/admin/password_resets/show.html.erb
|
747
750
|
- app/views/admin/users/_access_control.html.erb
|
748
751
|
- app/views/admin/users/_list.html.erb
|
@@ -856,14 +859,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
856
859
|
requirements:
|
857
860
|
- - ">="
|
858
861
|
- !ruby/object:Gem::Version
|
859
|
-
version:
|
862
|
+
version: 3.0.0
|
860
863
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
861
864
|
requirements:
|
862
865
|
- - ">="
|
863
866
|
- !ruby/object:Gem::Version
|
864
867
|
version: '0'
|
865
868
|
requirements: []
|
866
|
-
rubygems_version: 3.
|
869
|
+
rubygems_version: 3.4.1
|
867
870
|
signing_key:
|
868
871
|
specification_version: 4
|
869
872
|
summary: Pages Core
|
@@ -1,67 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module PagesCore
|
4
|
-
module Admin
|
5
|
-
module NewsPageController
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
included do
|
9
|
-
before_action :require_news_pages, only: [:news]
|
10
|
-
before_action :find_news_pages, only: %i[news new_news]
|
11
|
-
before_action :find_year_and_month, only: %i[news]
|
12
|
-
end
|
13
|
-
|
14
|
-
def news
|
15
|
-
@archive_finder = archive_finder(@news_pages, @locale)
|
16
|
-
unless @year
|
17
|
-
redirect_to(news_admin_pages_path(@locale,
|
18
|
-
(@archive_finder.latest_year ||
|
19
|
-
Time.zone.now.year)))
|
20
|
-
return
|
21
|
-
end
|
22
|
-
@pages = @archive_finder.by_year_and_maybe_month(@year, @month)
|
23
|
-
.paginate(per_page: 50, page: params[:page])
|
24
|
-
end
|
25
|
-
|
26
|
-
def new_news
|
27
|
-
new
|
28
|
-
render action: :new
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def archive_finder(parents, locale)
|
34
|
-
Page.where(parent_page_id: parents)
|
35
|
-
.visible
|
36
|
-
.order("published_at DESC")
|
37
|
-
.in_locale(locale)
|
38
|
-
.archive_finder
|
39
|
-
end
|
40
|
-
|
41
|
-
def find_news_pages
|
42
|
-
@news_pages = Page.news_pages
|
43
|
-
.in_locale(@locale)
|
44
|
-
.reorder("parent_page_id ASC, position ASC")
|
45
|
-
return if @news_pages.any?
|
46
|
-
|
47
|
-
redirect_to(admin_pages_url(@locale))
|
48
|
-
end
|
49
|
-
|
50
|
-
def find_year_and_month
|
51
|
-
@year = params[:year]&.to_i
|
52
|
-
@month = params[:month]&.to_i
|
53
|
-
end
|
54
|
-
|
55
|
-
# Redirect away if no news pages has been configured
|
56
|
-
def require_news_pages
|
57
|
-
return if Page.news_pages.any?
|
58
|
-
|
59
|
-
redirect_to(admin_pages_url(@locale))
|
60
|
-
end
|
61
|
-
|
62
|
-
def latest_year
|
63
|
-
archive_finder.latest_year_and_month.first || Time.zone.now.year
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|