pages_core 3.11.3 → 3.12.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/app/assets/builds/fonts/661557ef.ttf +0 -0
  4. data/app/assets/builds/fonts/a18fc2d2.woff2 +0 -0
  5. data/app/assets/builds/fonts/b2c7b78f.woff2 +0 -0
  6. data/app/assets/builds/fonts/ceddc204.ttf +0 -0
  7. data/app/assets/builds/pages_core/admin-dist.js +4 -3
  8. data/app/assets/builds/pages_core/admin.css +9233 -0
  9. data/app/assets/images/pages/admin/angle-down-solid.svg +1 -0
  10. data/app/assets/images/pages/admin/icon.svg +1 -0
  11. data/app/assets/stylesheets/pages_core/admin/components/archive.css +6 -0
  12. data/app/assets/stylesheets/{pages/admin/components/attachments.scss → pages_core/admin/components/attachments.css} +35 -28
  13. data/app/assets/stylesheets/{pages/admin.scss → pages_core/admin/components/base.css} +125 -143
  14. data/app/assets/stylesheets/pages_core/admin/components/forms.css +223 -0
  15. data/app/assets/stylesheets/{pages/admin/components/header.scss → pages_core/admin/components/header.css} +78 -48
  16. data/app/assets/stylesheets/{pages/admin/components/image_editor.scss → pages_core/admin/components/image_editor.css} +42 -31
  17. data/app/assets/stylesheets/{pages/admin/components/image_grid.scss → pages_core/admin/components/image_grid.css} +76 -64
  18. data/app/assets/stylesheets/{pages/admin/components/image_uploader.scss → pages_core/admin/components/image_uploader.css} +12 -12
  19. data/app/assets/stylesheets/{pages/admin/components/layout.scss → pages_core/admin/components/layout.css} +13 -9
  20. data/app/assets/stylesheets/pages_core/admin/components/links.css +40 -0
  21. data/app/assets/stylesheets/pages_core/admin/components/list_table.css +66 -0
  22. data/app/assets/stylesheets/{pages/admin/components/login.scss → pages_core/admin/components/login.css} +6 -5
  23. data/app/assets/stylesheets/{pages/admin/components/modal.scss → pages_core/admin/components/modal.css} +10 -32
  24. data/app/assets/stylesheets/{pages/admin/components/page_tree.scss → pages_core/admin/components/page_tree.css} +54 -55
  25. data/app/assets/stylesheets/{pages/admin/components/pagination.scss → pages_core/admin/components/pagination.css} +17 -17
  26. data/app/assets/stylesheets/{pages/admin/components/sidebar.scss → pages_core/admin/components/sidebar.css} +8 -7
  27. data/app/assets/stylesheets/{pages/admin/components/tag_editor.scss → pages_core/admin/components/tag_editor.css} +10 -15
  28. data/app/assets/stylesheets/{pages/admin/components/textarea.scss → pages_core/admin/components/textarea.css} +1 -1
  29. data/app/assets/stylesheets/{pages/admin/components/toast.scss → pages_core/admin/components/toast.css} +5 -3
  30. data/app/assets/stylesheets/{pages/admin/components/toolbar.scss → pages_core/admin/components/toolbar.css} +56 -29
  31. data/app/assets/stylesheets/{pages/admin/controllers/pages.scss → pages_core/admin/controllers/pages.css} +63 -52
  32. data/app/assets/stylesheets/pages_core/admin/controllers/users.css +3 -0
  33. data/app/assets/stylesheets/pages_core/admin/vars.css +34 -0
  34. data/app/assets/stylesheets/pages_core/admin.postcss.css +9 -0
  35. data/app/controllers/admin/calendars_controller.rb +36 -0
  36. data/app/controllers/admin/categories_controller.rb +2 -2
  37. data/app/controllers/admin/news_controller.rb +58 -0
  38. data/app/controllers/admin/pages_controller.rb +2 -3
  39. data/app/controllers/admin/password_resets_controller.rb +4 -4
  40. data/app/controllers/admin/users_controller.rb +4 -4
  41. data/app/controllers/errors_controller.rb +1 -1
  42. data/app/controllers/sessions_controller.rb +1 -1
  43. data/app/formatters/pages_core/image_embedder.rb +5 -27
  44. data/app/helpers/admin/calendars_helper.rb +37 -0
  45. data/app/helpers/admin/news_helper.rb +13 -0
  46. data/app/helpers/pages_core/admin/admin_helper.rb +11 -54
  47. data/app/helpers/pages_core/admin/content_tabs_helper.rb +1 -0
  48. data/app/helpers/pages_core/admin/deprecated_admin_helper.rb +40 -0
  49. data/app/helpers/pages_core/admin/labelled_field_helper.rb +1 -1
  50. data/app/helpers/pages_core/application_helper.rb +1 -1
  51. data/app/helpers/pages_core/images_helper.rb +37 -0
  52. data/app/javascript/components/Attachments/Attachment.jsx +2 -2
  53. data/app/javascript/components/EditableImage.jsx +1 -1
  54. data/app/javascript/components/ImageCropper/Toolbar.jsx +3 -3
  55. data/app/javascript/components/PageTreeNode.jsx +9 -17
  56. data/app/javascript/components/RichTextToolbarButton.jsx +1 -1
  57. data/app/javascript/components/Toast.jsx +1 -1
  58. data/app/mailers/admin_mailer.rb +1 -0
  59. data/app/models/category.rb +1 -1
  60. data/app/models/concerns/pages_core/page_model/dated_page.rb +38 -0
  61. data/app/models/invite.rb +8 -0
  62. data/app/models/page.rb +1 -1
  63. data/app/policies/page_policy.rb +2 -6
  64. data/app/views/admin/calendars/_sidebar.html.erb +47 -0
  65. data/app/views/admin/calendars/show.html.erb +45 -0
  66. data/app/views/admin/invites/new.html.erb +2 -8
  67. data/app/views/admin/invites/show.html.erb +8 -8
  68. data/app/views/admin/news/_sidebar.html.erb +48 -0
  69. data/app/views/admin/news/index.html.erb +53 -0
  70. data/app/views/admin/pages/_list_item.html.erb +2 -1
  71. data/app/views/admin/pages/deleted.html.erb +10 -8
  72. data/app/views/admin/pages/edit.html.erb +20 -11
  73. data/app/views/admin/pages/index.html.erb +7 -8
  74. data/app/views/admin/pages/new.html.erb +10 -14
  75. data/app/views/admin/password_resets/show.html.erb +7 -7
  76. data/app/views/admin/users/deactivated.html.erb +6 -7
  77. data/app/views/admin/users/edit.html.erb +7 -9
  78. data/app/views/admin/users/index.html.erb +3 -6
  79. data/app/views/admin/users/login.html.erb +7 -8
  80. data/app/views/admin/users/new.html.erb +8 -8
  81. data/app/views/admin/users/new_password.html.erb +5 -6
  82. data/app/views/admin/users/show.html.erb +11 -9
  83. data/app/views/errors/401.html.erb +2 -1
  84. data/app/views/errors/403.html.erb +2 -1
  85. data/app/views/errors/404.html.erb +1 -3
  86. data/app/views/errors/405.html.erb +2 -1
  87. data/app/views/errors/422.html.erb +2 -1
  88. data/app/views/errors/500.html.erb +2 -3
  89. data/app/views/layouts/admin/_header.html.erb +5 -18
  90. data/app/views/layouts/admin/_page_header.html.erb +9 -7
  91. data/app/views/layouts/admin.html.erb +3 -3
  92. data/app/views/layouts/errors.html.erb +129 -6
  93. data/config/routes.rb +7 -2
  94. data/lib/pages_core/engine.rb +4 -3
  95. data/lib/pages_core/pages_plugin.rb +6 -1
  96. data/lib/pages_core.rb +0 -1
  97. data/lib/rails/generators/pages_core/install/install_generator.rb +2 -2
  98. data/lib/rails/generators/pages_core/install/templates/delayed_job +2 -3
  99. data/lib/rails/generators/pages_core/rspec/templates/rails_helper.rb +2 -2
  100. metadata +45 -199
  101. data/app/assets/images/pages/admin/icon.png +0 -0
  102. data/app/assets/images/pages/admin/image-editor-bg.png +0 -0
  103. data/app/assets/images/pages/admin/list-table-pin-blue.gif +0 -0
  104. data/app/assets/images/pages/admin/list-table-pin-disabled.gif +0 -0
  105. data/app/assets/images/pages/admin/list-table-pin-green.gif +0 -0
  106. data/app/assets/images/pages/admin/list-table-pin-red.gif +0 -0
  107. data/app/assets/images/pages/admin/list-table-pin-yellow.gif +0 -0
  108. data/app/assets/images/pages/admin/loading-modal.gif +0 -0
  109. data/app/assets/images/pages/feed-icon-14x14.png +0 -0
  110. data/app/assets/stylesheets/pages/admin/components/archive.scss +0 -6
  111. data/app/assets/stylesheets/pages/admin/components/buttons.scss +0 -23
  112. data/app/assets/stylesheets/pages/admin/components/forms.scss +0 -169
  113. data/app/assets/stylesheets/pages/admin/components/links.scss +0 -43
  114. data/app/assets/stylesheets/pages/admin/components/list_table.scss +0 -61
  115. data/app/assets/stylesheets/pages/admin/controllers/users.scss +0 -3
  116. data/app/assets/stylesheets/pages/admin/mixins/breakpoints.scss +0 -21
  117. data/app/assets/stylesheets/pages/admin/mixins/clearfix.scss +0 -7
  118. data/app/assets/stylesheets/pages/admin/mixins/gradients.scss +0 -7
  119. data/app/assets/stylesheets/pages/admin/vars.scss +0 -30
  120. data/app/assets/stylesheets/pages/errors.css +0 -128
  121. data/app/controllers/concerns/pages_core/admin/news_page_controller.rb +0 -67
  122. data/app/views/admin/pages/news.html.erb +0 -83
  123. data/vendor/assets/stylesheets/ReactCrop.css +0 -167
  124. /data/app/assets/stylesheets/{pages/admin/components/tabs.scss → pages_core/admin/components/tabs.css} +0 -0
@@ -5,8 +5,8 @@ class PagePolicy < Policy
5
5
  true
6
6
  end
7
7
 
8
- def news?
9
- true
8
+ def calendar?
9
+ index?
10
10
  end
11
11
 
12
12
  def deleted?
@@ -17,10 +17,6 @@ class PagePolicy < Policy
17
17
  user.role?(:pages)
18
18
  end
19
19
 
20
- def new_news?
21
- create?
22
- end
23
-
24
20
  def show?
25
21
  true
26
22
  end
@@ -0,0 +1,47 @@
1
+ <% if policy(Page).new? %>
2
+ <h2>
3
+ New entry
4
+ </h2>
5
+ <p>
6
+ <%= form_tag new_admin_page_path, method: :get do %>
7
+ In
8
+ <%= select_tag("parent", calendar_page_options(locale)) %>
9
+ <button type="submit">
10
+ Go
11
+ </button>
12
+ <% end %>
13
+ </p>
14
+ <% end %>
15
+
16
+ <div class="archive-index">
17
+ <% calendar_years_with_count.each do |year, year_count| %>
18
+ <h2>
19
+ <%= link_to_unless_current(
20
+ year,
21
+ admin_calendar_path(locale, year: year)
22
+ ) %>
23
+ <span class="count">
24
+ (<%= year_count %>)
25
+ </span>
26
+ </h2>
27
+ <ul>
28
+ <% calendar_months_count(year).each do |month, month_count| %>
29
+ <li>
30
+ <% if year == @year && month == @month %>
31
+ <strong>
32
+ <%= month_name(month) %>
33
+ </strong>
34
+ <% else %>
35
+ <%= link_to_unless_current(
36
+ month_name(month),
37
+ admin_calendar_path(locale, month: month, year: year)
38
+ ) %>
39
+ <% end %>
40
+ <span class="count">
41
+ (<%= month_count %>)
42
+ </span>
43
+ </li>
44
+ <% end %>
45
+ </ul>
46
+ <% end %>
47
+ </div>
@@ -0,0 +1,45 @@
1
+ <% content_for :page_title, "Calendar" %>
2
+ <% content_for(:page_description) do %>
3
+ Calendar:
4
+ <em>
5
+ <% if @month %>
6
+ <%= month_name(@month) %>
7
+ <% end %>
8
+ <%= @year %>
9
+ </em>
10
+ <% end %>
11
+
12
+ <% content_for :page_description_links do %>
13
+ <%= locale_links { |l| admin_calendar_path(l, @year) } %>
14
+ <% end %>
15
+
16
+ <% content_for :sidebar do %>
17
+ <%= render(partial: "sidebar", locals: { locale: @locale }) %>
18
+ <% end %>
19
+
20
+ <% if @pages.any? %>
21
+ <table class="list calendar-item-list">
22
+ <tr>
23
+ <th>Name</th>
24
+ <th>Date</th>
25
+ <th>Published</th>
26
+ <th>Section</th>
27
+ </tr>
28
+ <% @pages.each do |page| %>
29
+ <%= render(partial: "admin/pages/list_item",
30
+ locals: {
31
+ page: page,
32
+ date: true,
33
+ section: true,
34
+ sections: @parents
35
+ }) %>
36
+ <% end %>
37
+ </table>
38
+ <%= will_paginate @pages, renderer: PagesCore::LinkRenderer %>
39
+ <% else %>
40
+ <div class="content">
41
+ <p>
42
+ No calendar items have been posted yet.
43
+ </p>
44
+ </div>
45
+ <% end %>
@@ -1,11 +1,5 @@
1
- <%
2
- self.page_title = "New invite"
3
- self.page_description = "New invite"
4
- %>
5
-
6
- <% content_for(:sidebar) do %>
7
- &nbsp;
8
- <% end %>
1
+ <% content_for :page_title, "New invite" %>
2
+ <% content_for :page_description, "New invite" %>
9
3
 
10
4
  <%= form_for [:admin, @invite], builder: PagesCore::FormBuilder do |f| %>
11
5
  <%= f.labelled_text_field :email %>
@@ -1,7 +1,5 @@
1
- <%
2
- self.page_title = "Welcome"
3
- self.page_description = "Welcome to Pages"
4
- %>
1
+ <% content_for :page_title, "Welcome" %>
2
+ <% content_for :page_description, "Welcome to Pages" %>
5
3
 
6
4
  <div class="content">
7
5
  <p>
@@ -12,10 +10,12 @@
12
10
  <%= form_for(@user,
13
11
  url: accept_admin_invite_path(@invite, token: @invite.token),
14
12
  builder: PagesCore::FormBuilder) do |f| %>
15
- <%= f.labelled_text_field :name %>
16
- <%= f.labelled_text_field :email %>
17
- <%= f.labelled_password_field :password %>
18
- <%= f.labelled_password_field :confirm_password %>
13
+ <%= f.labelled_text_field :name, autocomplete: "name" %>
14
+ <%= f.labelled_text_field :email, autocomplete: "email" %>
15
+ <%= f.labelled_password_field(:password,
16
+ autocomplete: "new-password") %>
17
+ <%= f.labelled_password_field(:confirm_password,
18
+ autocomplete: "new-password") %>
19
19
  <p>
20
20
  <button type="submit">
21
21
  Sign up
@@ -0,0 +1,48 @@
1
+ <% if policy(Page).new? %>
2
+ <h2>New article</h2>
3
+ <p>
4
+ <%= form_tag new_admin_page_path, method: :get do %>
5
+ In
6
+ <%= select_tag("parent", news_page_options(news_pages)) %>
7
+ <button type="submit">
8
+ Go
9
+ </button>
10
+ <% end %>
11
+ </p>
12
+ <% end %>
13
+
14
+ <div class="archive-index">
15
+ <% archive_finder.years_with_count.reverse.each do |year, year_count| %>
16
+ <h2>
17
+ <%= link_to_unless_current(
18
+ year,
19
+ admin_news_index_path(locale, year: year, category: category&.slug)
20
+ ) %>
21
+ <%= ": #{@category.name}" if @category %>
22
+ <span class="count">
23
+ (<%= year_count %>)
24
+ </span>
25
+ </h2>
26
+ <ul>
27
+ <% archive_finder.months_in_year_with_count(year).reverse.each do |month, page_count| %>
28
+ <li>
29
+ <% if year == @year && month == @month %>
30
+ <strong>
31
+ <%= month_name(month) %>
32
+ </strong>
33
+ (<%= page_count %>)
34
+ <% else %>
35
+ <%= link_to(
36
+ month_name(month),
37
+ admin_news_index_path(locale, year: year, month: month,
38
+ category: category&.slug)
39
+ ) %>
40
+ <span class="count">
41
+ (<%= page_count %>)
42
+ </span>
43
+ <% end %>
44
+ </li>
45
+ <% end %>
46
+ </ul>
47
+ <% end %>
48
+ </div>
@@ -0,0 +1,53 @@
1
+ <% content_for(:page_title, "News") %>
2
+
3
+ <% content_for(:page_description) do %>
4
+ News:
5
+ <em>
6
+ <% if @month %>
7
+ <%= month_name(@month) %>
8
+ <% end %>
9
+ <%= @year %>
10
+ </em>
11
+ <% end %>
12
+
13
+ <% content_for :page_description_links do %>
14
+ <%= locale_links { |l| admin_news_index_path(l, @year) } %>
15
+ <% end %>
16
+
17
+ <% content_for :sidebar do %>
18
+ <%= render(partial: "sidebar",
19
+ locals: {
20
+ locale: @locale,
21
+ category: @category,
22
+ news_pages: @news_pages,
23
+ archive_finder: @archive_finder
24
+ }) %>
25
+ <% end %>
26
+
27
+ <% if @pages.length > 0 %>
28
+ <table class="list news-item-list">
29
+ <tr>
30
+ <th>Name</th>
31
+ <th>Published</th>
32
+ <th>Author</th>
33
+ <th>Section</th>
34
+ </tr>
35
+ <% @pages.each do |page| %>
36
+ <%= render(partial: "admin/pages/list_item",
37
+ locals: {
38
+ page: page,
39
+ author: true,
40
+ section: true,
41
+ sections: @news_pages
42
+ }) %>
43
+ <% end %>
44
+ </table>
45
+
46
+ <%= will_paginate @pages, renderer: PagesCore::LinkRenderer %>
47
+ <% else %>
48
+ <div class="content">
49
+ <p>
50
+ No news items have been posted yet.
51
+ </p>
52
+ </div>
53
+ <% end %>
@@ -2,6 +2,7 @@
2
2
  author ||= false
3
3
  date ||= false
4
4
  section ||= false
5
+ sections ||= []
5
6
  %>
6
7
  <tr class="<%= [page.status_label.downcase,((page.autopublish?) ? 'autopublish' : nil), ((page.pinned?) ? 'pinned' : nil)].join(' ') %>">
7
8
  <td class="name">
@@ -44,7 +45,7 @@
44
45
  <% end %>
45
46
  <% if section %>
46
47
  <td>
47
- <%= news_section_name(page.parent, @news_pages) %>
48
+ <%= news_section_name(page.parent, sections) %>
48
49
  </td>
49
50
  <% end %>
50
51
  </tr>
@@ -1,11 +1,13 @@
1
- <%
2
- self.page_title = "Pages"
3
- self.page_description = link_to("All pages", admin_pages_path(@locale)) +
4
- " / Deleted pages"
5
- if PagesCore.config.localizations?
6
- self.page_description_links = 'In ' + PagesCore.config.locales.map{ |l, n| link_to_unless_current n, deleted_admin_pages_path(l) }.join(link_separator)
7
- end
8
- %>
1
+ <% content_for :page_title, "Deleted pages" %>
2
+
3
+ <% content_for :page_description do %>
4
+ <%= link_to("All pages", admin_pages_path(@locale)) %> /
5
+ Deleted pages
6
+ <% end %>
7
+
8
+ <% content_for :page_description_links do %>
9
+ <%= locale_links { |l| deleted_admin_pages_path(l) } %>
10
+ <% end %>
9
11
 
10
12
  <% if @pages.any? %>
11
13
  <table class="deleted-pages list">
@@ -1,15 +1,24 @@
1
- <%
2
- self.page_title = "Editing “" + @page.name.to_s + "”"
3
- self.page_description = "Editing " + [@page.ancestors.reverse,@page].flatten.map{|page| link_to((page.name rescue "(Untitled)"), edit_admin_page_path(@locale, page))}.join(" &raquo; ")
1
+ <% content_for :page_title do %>
2
+ <% if @page.name? %>
3
+ Edit “<%= @page.name %>”
4
+ <% else %>
5
+ Edit page
6
+ <% end %>
7
+ <% end %>
8
+ <% content_for :page_description do %>
9
+ Editing
10
+ <% @page.ancestors.reverse.each do |page| %>
11
+ <%= link_to(page.name? ? page.name : tag.i("Untitled"),
12
+ edit_admin_page_path(@locale, page)) %>
13
+ &raquo;
14
+ <% end %>
15
+ <%= link_to(@page.name? ? @page.name : tag.i("Untitled"),
16
+ edit_admin_page_path(@locale, @page)) %>
17
+ <% end %>
4
18
 
5
- if PagesCore.config.localizations?
6
- self.page_description_links = "In " + safe_join(
7
- PagesCore.config.locales.map do |l, name|
8
- link_to_unless((l == @locale.to_sym), name, edit_admin_page_path(l, @page.localize(l)))
9
- end,
10
- link_separator)
11
- end
12
- %>
19
+ <% content_for :page_description_links do %>
20
+ <%= locale_links { |l| edit_admin_page_path(l, @page.localize(l)) } %>
21
+ <% end %>
13
22
 
14
23
  <% content_for :main_wrapper do %>
15
24
  <%= form_for(@page,
@@ -1,13 +1,12 @@
1
- <%
2
- self.page_title = "Pages"
3
- self.page_description = "All pages / " + link_to("Deleted pages", deleted_admin_pages_path(@locale))
1
+ <% content_for :page_title, "Pages" %>
4
2
 
5
- if PagesCore.config.localizations?
6
- self.page_description_links = 'In ' + PagesCore.config.locales.map{ |l, n| link_to_unless_current n, admin_pages_path(l) }.join(link_separator)
7
- end
8
- %>
3
+ <% content_for :page_description do %>
4
+ All pages /
5
+ <%= link_to("Deleted pages", deleted_admin_pages_path(@locale)) %>
6
+ <% end %>
9
7
 
10
- <% content_for :sidebar do %>
8
+ <% content_for :page_description_links do %>
9
+ <%= locale_links { |l| admin_pages_path(l) } %>
11
10
  <% end %>
12
11
 
13
12
  <div class="content">
@@ -1,15 +1,11 @@
1
- <%
2
- if @page.parent
3
- self.page_title = "New page"
4
- self.page_description = "<em>#{@page.parent.name}</em> &raquo; New Page"
5
- else
6
- self.page_title = "Create new page"
7
- self.page_description = "You are creating a new root page"
8
- end
9
-
10
- @url_options = { action: :new }
11
- @url_options[:parent] = @page.parent if @page.parent
12
- %>
1
+ <% content_for :page_title, "New page" %>
2
+ <% content_for :page_description do %>
3
+ <% if @page.parent %>
4
+ <em><%= @page.parent.name %></em> &raquo; New Page
5
+ <% else %>
6
+ You are creating a new root page
7
+ <% end %>
8
+ <% end %>
13
9
 
14
10
  <% content_for :main_wrapper do %>
15
11
  <%= form_for(@page,
@@ -25,7 +21,7 @@
25
21
 
26
22
  <% content_for :main do %>
27
23
  <div class="content">
28
- <%= f.hidden_field 'parent_page_id' if @page.parent %>
24
+ <%= f.hidden_field "parent_page_id" if @page.parent %>
29
25
 
30
26
  <%= render(partial: "form", locals: { f: f }) %>
31
27
 
@@ -43,7 +39,7 @@
43
39
  </main>
44
40
 
45
41
  <aside class="sidebar" id="page-form-sidebar">
46
- <%= render partial: 'edit_options', locals: { f: f } %>
42
+ <%= render partial: "edit_options", locals: { f: f } %>
47
43
  </aside>
48
44
  <% end %>
49
45
  <% end %>
@@ -1,16 +1,16 @@
1
- <%
2
- self.page_title = "Reset password"
3
- self.page_description = "Please choose a new password to proceed"
4
- add_body_class "login"
5
- -%>
1
+ <% content_for :page_title, "Reset password" %>
2
+ <% content_for :page_description, "Please choose a new password to proceed" %>
3
+ <% content_for :body_class, "login" %>
6
4
 
7
5
  <div class="login-form">
8
6
  <%= form_for(@user,
9
7
  url: admin_password_reset_path(@password_reset_token, token: @password_reset_token.token),
10
8
  builder: PagesCore::Admin::FormBuilder,
11
9
  class: 'form') do |f| %>
12
- <%= f.labelled_password_field :password %>
13
- <%= f.labelled_password_field :confirm_password %>
10
+ <%= f.labelled_password_field(:password,
11
+ autocomplete: "new-password") %>
12
+ <%= f.labelled_password_field(:confirm_password,
13
+ autocomplete: "new-password") %>
14
14
  <p>
15
15
  <button type="submit">
16
16
  Change Password
@@ -1,12 +1,11 @@
1
- <%
2
- self.page_title = "Deactivated users"
3
- self.page_description = "Viewing deactivated users"
4
- self.page_description_links = link_to("View active users", admin_users_path)
5
- %>
1
+ <% content_for :page_title, "Deactivated users" %>
2
+ <% content_for :page_description, "Viewing deactivated users" %>
6
3
 
4
+ <% content_for(:page_description_links) do %>
5
+ <%= link_to("View active users", admin_users_path) %>
6
+ <% end %>
7
7
 
8
8
  <% content_for :sidebar do %>
9
9
  <% end %>
10
10
 
11
-
12
- <%= render partial: 'list', locals: {users: @users} %>
11
+ <%= render partial: "list", locals: { users: @users } %>
@@ -1,12 +1,10 @@
1
- <%
2
- self.page_title = "Editing user: #{@user.name}"
3
- if @user == current_user
4
- self.page_description = "You are editing " + link_to("your own", [:admin, @user]) + " profile."
5
- else
6
- self.page_description = "You are editing " + link_to("#{@user.name}", [:admin, @user]) + "'s profile."
7
- end
8
- self.page_description_links = link_to("View all users", admin_users_path)
9
- %>
1
+ <% content_for :page_title, "Editing user: #{@user.name}" %>
2
+
3
+ <% content_for :page_description do %>
4
+ You are editing
5
+ <%= link_to((@user == current_user ? "your own profile" : "#{@user.name}"),
6
+ [:admin, @user]) %>
7
+ <% end %>
10
8
 
11
9
  <% content_for :sidebar do %>
12
10
  <% if @user != current_user %>
@@ -1,8 +1,5 @@
1
- <%
2
- self.page_title = "Users"
3
- self.page_description = "Viewing active users"
4
- %>
5
-
1
+ <% content_for :page_title, "Users" %>
2
+ <% content_for :page_description, "Viewing active users" %>
6
3
 
7
4
  <% content_for :sidebar do %>
8
5
  <% if policy(User).new? %>
@@ -24,4 +21,4 @@
24
21
  <% end %>
25
22
 
26
23
 
27
- <%= render partial: 'list', locals: {users: @users} %>
24
+ <%= render partial: "list", locals: { users: @users } %>
@@ -1,8 +1,7 @@
1
- <%
2
- self.page_title = "Sign in"
3
- self.page_description = "Please enter your email address and password to sign in"
4
- add_body_class "login"
5
- -%>
1
+ <% content_for :page_title, "Sign in" %>
2
+ <% content_for(:page_description,
3
+ "Please enter your email address and password to sign in") %>
4
+ <% content_for :body_class, "login" %>
6
5
 
7
6
  <% content_for :sidebar do %>
8
7
  <h2>Please note</h2>
@@ -19,11 +18,11 @@
19
18
  <%= form_tag session_path do %>
20
19
  <p>
21
20
  <label>Email address</label>
22
- <%= text_field_tag :email, '' %>
21
+ <%= text_field_tag(:email, "", autocomplete: "email") %>
23
22
  </p>
24
23
  <p>
25
24
  <label>Password</label>
26
- <%= password_field_tag :password, '' %>
25
+ <%= password_field_tag(:password, "", autocomplete: "current-password") %>
27
26
  </p>
28
27
  <p>
29
28
  <button type="submit">Sign in</button>
@@ -54,7 +53,7 @@
54
53
  and we'll send you a link where you can reset your password.
55
54
  </p>
56
55
  <p>
57
- <%= text_field_tag :email, '' %>
56
+ <%= text_field_tag(:email, "", autocomplete: "email") %>
58
57
  </p>
59
58
  <p>
60
59
  <button type="submit">
@@ -1,7 +1,5 @@
1
- <%
2
- self.page_title = "Welcome"
3
- self.page_description = "Welcome to Pages"
4
- %>
1
+ <% content_for :page_title, "Welcome" %>
2
+ <% content_for :page_description, "Welcome to Pages" %>
5
3
 
6
4
  <div class="content">
7
5
  <p>Welcome to Pages! Before you can log on, we need to create the first user account.</p>
@@ -9,10 +7,12 @@
9
7
 
10
8
  <%= form_for [:admin, @user], builder: PagesCore::FormBuilder do |f| %>
11
9
 
12
- <%= f.labelled_text_field :name %>
13
- <%= f.labelled_text_field :email %>
14
- <%= f.labelled_password_field :password %>
15
- <%= f.labelled_password_field :confirm_password %>
10
+ <%= f.labelled_text_field(:name, autocomplete: "name") %>
11
+ <%= f.labelled_text_field(:email, autocomplete: "email") %>
12
+ <%= f.labelled_password_field(:password,
13
+ autocomplete: "new-password") %>
14
+ <%= f.labelled_password_field(:confirm_password,
15
+ autocomplete: "new-password") %>
16
16
 
17
17
  <p>
18
18
  <button type="submit">
@@ -1,8 +1,7 @@
1
- <%
2
- self.page_title = "Log in &raquo; Forgotten password"
3
- self.page_description = "Creating a new password"
4
- add_body_class = "login"
5
- %>
1
+ <% content_for :page_title, "Log in &raquo; Forgotten password" %>
2
+ <% content_for :page_description, "Creating a new password" %>
3
+ <% content_for :body_class, "login" -%>
4
+
6
5
  <div class="content">
7
6
  <p>
8
7
  Did you lose your password? Don't worry, it happens.
@@ -13,7 +12,7 @@
13
12
  </div>
14
13
  <%= form_tag(reset_password_admin_users_path, method: :post) do %>
15
14
  <p>
16
- <%= text_field_tag :email, '', size: 32 %>
15
+ <%= text_field_tag(:email, "", size: 32, autocomplete: "email") %>
17
16
  <%= submit_tag "Find" %>
18
17
  </p>
19
18
  </form>
@@ -1,12 +1,14 @@
1
- <%
2
- self.page_title = "#{@user.name}"
3
- if @user == current_user
4
- self.page_description = "You are viewing " + link_to( "your own", admin_user_path( @user ) ) + " profile."
5
- else
6
- self.page_description = "You are viewing " + link_to( "#{@user.name}", admin_user_path( @user ) ) + "'s profile."
7
- end
8
- self.page_description_links = [ ( link_to( "Edit", edit_admin_user_path( @user ) ) if policy(@user).edit? ), link_to( "View all users", admin_users_path ) ].compact.join( link_separator )
9
- %>
1
+ <% content_for :page_title, @user.name %>
2
+
3
+ <% content_for :page_description do %>
4
+ You are viewing
5
+ <%= link_to((@user == current_user ? "your own profile" : "#{@user.name}"),
6
+ [:admin, @user]) %>
7
+ <% end %>
8
+
9
+ <% content_for(:page_description_links) do %>
10
+ <%= link_to("Edit", edit_admin_user_path(@user)) if policy(@user).edit? %>
11
+ <% end %>
10
12
 
11
13
  <% content_for :sidebar do %>
12
14
  <h2>People</h2>
@@ -1,4 +1,5 @@
1
- <% @page_title = "Unauthorized" %>
1
+ <% content_for :page_title, "Unauthorized" %>
2
+
2
3
  <p>
3
4
  You are not authorized to access this resource.
4
5
  </p>
@@ -1,4 +1,5 @@
1
- <% @page_title = "Forbidden" %>
1
+ <% content_for :page_title, "Forbidden" %>
2
+
2
3
  <p>
3
4
  You are not authorized to access this resource.
4
5
  </p>
@@ -1,6 +1,4 @@
1
- <%
2
- @page_title = "Page not found"
3
- %>
1
+ <% content_for :page_title, "Page not found" %>
4
2
 
5
3
  <p>
6
4
  The page you were looking for could not be found. It might have been removed,
@@ -1,4 +1,5 @@
1
- <% @page_title = "405: Method Not Allowed" %>
1
+ <% content_for :page_title, "405: Method Not Allowed" %>
2
+
2
3
  <p>This method has not been implemented.</p>
3
4
 
4
5
  <%= render partial: 'errors/generic_help' %>
@@ -1,4 +1,5 @@
1
- <% @page_title = "422: Unacceptable" %>
1
+ <% content_for :page_title, "422: Unacceptable" %>
2
+
2
3
  <p>
3
4
  The change you wanted was rejected.
4
5
  Maybe you tried to change something you didn't have access to.
@@ -1,6 +1,5 @@
1
- <%
2
- @page_title = "500 Internal Server Error"
3
- %>
1
+ <% content_for :page_title, "500 Internal Server Error" %>
2
+
4
3
  <p>
5
4
  We're experiencing an internal server problem. Please try again later.
6
5
  </p>