alchemy_cms 4.5.0 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +23 -17
  3. data/.rubocop.yml +7 -15
  4. data/CHANGELOG.md +17 -0
  5. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +5 -5
  6. data/app/assets/javascripts/alchemy/templates/page.hbs +1 -1
  7. data/app/assets/stylesheets/alchemy/_mixins.scss +2 -3
  8. data/app/assets/stylesheets/alchemy/_variables.scss +2 -2
  9. data/app/assets/stylesheets/alchemy/lists.scss +0 -8
  10. data/app/assets/stylesheets/alchemy/nodes.scss +1 -1
  11. data/app/assets/stylesheets/alchemy/sitemap.scss +59 -21
  12. data/app/controllers/alchemy/admin/pages_controller.rb +0 -1
  13. data/app/controllers/alchemy/api/pages_controller.rb +2 -0
  14. data/app/decorators/alchemy/content_editor.rb +55 -0
  15. data/app/helpers/alchemy/admin/pages_helper.rb +16 -16
  16. data/app/models/alchemy/content.rb +8 -22
  17. data/app/models/alchemy/node.rb +8 -7
  18. data/app/models/alchemy/page.rb +11 -0
  19. data/app/models/alchemy/page/url_path.rb +66 -0
  20. data/app/serializers/alchemy/page_serializer.rb +2 -1
  21. data/app/serializers/alchemy/page_tree_serializer.rb +4 -3
  22. data/app/views/alchemy/admin/layoutpages/index.html.erb +5 -1
  23. data/app/views/alchemy/admin/nodes/_form.html.erb +2 -2
  24. data/app/views/alchemy/admin/pages/_form.html.erb +1 -1
  25. data/app/views/alchemy/admin/pages/_menu_fields.html.erb +33 -29
  26. data/app/views/alchemy/admin/pages/_page.html.erb +3 -6
  27. data/app/views/alchemy/admin/pages/_sitemap.html.erb +6 -0
  28. data/app/views/alchemy/admin/pages/info.html.erb +1 -1
  29. data/config/alchemy/config.yml +0 -6
  30. data/config/locales/alchemy.en.yml +6 -6
  31. data/lib/alchemy/config.rb +30 -2
  32. data/lib/alchemy/ssl_protection.rb +3 -1
  33. data/lib/alchemy/upgrader/four_point_six.rb +50 -0
  34. data/lib/alchemy/version.rb +1 -1
  35. data/lib/tasks/alchemy/convert.rake +2 -0
  36. data/lib/tasks/alchemy/upgrade.rake +67 -46
  37. metadata +6 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fd79c1d49d2d3ee4bb6f47b7ec4a9ec294bc890f9a217ee30cdac569eef0780
4
- data.tar.gz: baec6c36ea7c500185bade60f79fda54f3464055903375de4b43bc3a11c2457a
3
+ metadata.gz: f321858feead1aacab75385da9c01e7a8db1018adaf2e5f2ccb714be4c8edf44
4
+ data.tar.gz: 68ae5e042e449693217ab9390a04b5a6bab6d6810011e1c0aaaf8c3f80065f43
5
5
  SHA512:
6
- metadata.gz: 705b4473ea1d26a3c168b9a7e3592d9b14ad77b1e1802d227127f4a26ee6e4665a26ae6bc7357ffe0681d5f79ea5b1ebee75289db63e252fce61170be6325678
7
- data.tar.gz: ef27de44013eeb6f04f98ba2af578b07912f8386d8c1240300561e9bbdc803be69ff0f57c2ca12a5090cf380f461834570be23cddcb11361c54984dd451ad76f
6
+ metadata.gz: 78af2956df792c714818a8cdf91b3e3d87afa53c62617dd2d373eb168ce0bcc62c561f1a1343cb1ee9515f827a45e671330d1622abac789cdcff27b1658d1a8e
7
+ data.tar.gz: 54995595358bd0692c01892f4c1fc2691725f0e89846483c2d23bb519304e90177997ef61f4fb37e760100e10baf28dc4d8a3664ff1a9e4c431e64f2ce2bc5da
@@ -19,9 +19,9 @@ jobs:
19
19
  - postgresql
20
20
  env:
21
21
  DB: ${{ matrix.database }}
22
- MYSQL_PASSWORD: root
23
- POSTGRES_USER: postgres
24
- POSTGRES_PASSWORD: password
22
+ DB_USER: alchemy_user
23
+ DB_PASSWORD: password
24
+ DB_HOST: '127.0.0.1'
25
25
  RAILS_ENV: test
26
26
  RAILS_VERSION: ${{ matrix.rails }}
27
27
  CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22
@@ -29,11 +29,20 @@ jobs:
29
29
  postgres:
30
30
  image: postgres:11
31
31
  env:
32
- POSTGRES_USER: postgres
32
+ POSTGRES_USER: alchemy_user
33
33
  POSTGRES_PASSWORD: password
34
34
  POSTGRES_DB: alchemy_cms_dummy_test
35
35
  ports: ['5432:5432']
36
36
  options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
37
+ mysql:
38
+ image: mysql:latest
39
+ ports: ['3306:3306']
40
+ env:
41
+ MYSQL_USER: alchemy_user
42
+ MYSQL_PASSWORD: password
43
+ MYSQL_DATABASE: alchemy_cms_dummy_test
44
+ MYSQL_ROOT_PASSWORD: password
45
+ options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5
37
46
  steps:
38
47
  - uses: actions/checkout@v1
39
48
  - name: Set up Ruby
@@ -52,15 +61,15 @@ jobs:
52
61
  if: matrix.database == 'postgresql'
53
62
  run: |
54
63
  mkdir -p /home/runner/apt/cache
55
- sudo apt-get update -qq
56
- sudo apt-get install -qq --fix-missing libpq-dev -o dir::cache::archives="/home/runner/apt/cache"
64
+ sudo apt update -qq
65
+ sudo apt install -qq --fix-missing libpq-dev -o dir::cache::archives="/home/runner/apt/cache"
57
66
  sudo chown -R runner /home/runner/apt/cache
58
67
  - name: Install MySQL headers
59
68
  if: matrix.database == 'mysql'
60
69
  run: |
61
70
  mkdir -p /home/runner/apt/cache
62
- sudo apt-get update -qq
63
- sudo apt-get install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache"
71
+ sudo apt update -qq
72
+ sudo apt install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache"
64
73
  sudo chown -R runner /home/runner/apt/cache
65
74
  - name: Install bundler
66
75
  run: |
@@ -80,15 +89,12 @@ jobs:
80
89
  - name: Prepare database
81
90
  run: |
82
91
  bundle exec rake alchemy:spec:prepare
83
- - name: Install code climate test reporter
84
- run: |
85
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
86
- chmod +x ./cc-test-reporter
87
- ./cc-test-reporter before-build
88
- - name: Test with RSpec
89
- run: |
90
- bundle exec rspec
91
- ./cc-test-reporter after-build --exit-code $?
92
+ - name: Run tests & publish code coverage
93
+ uses: paambaati/codeclimate-action@v2.5.7
94
+ env:
95
+ CC_TEST_REPORTER_ID: bca4349e32f97919210ac8a450b04904b90683fcdd57d65a22c0f5065482bc22
96
+ with:
97
+ coverageCommand: bundle exec rspec
92
98
  - uses: actions/upload-artifact@master
93
99
  if: failure()
94
100
  with:
@@ -9,17 +9,12 @@ AllCops:
9
9
  - 'alchemy_cms.gemspec'
10
10
  - 'Rakefile'
11
11
 
12
- TargetRubyVersion: 2.3
12
+ TargetRubyVersion: 2.4
13
13
 
14
14
  # Really, rubocop?
15
15
  Bundler/OrderedGems:
16
16
  Enabled: false
17
17
 
18
- # Sometimes I believe this reads better
19
- # This also causes spacing issues on multi-line fixes
20
- Style/BracesAroundHashParameters:
21
- Enabled: false
22
-
23
18
  Style/EmptyLiteral:
24
19
  Enabled: false
25
20
 
@@ -55,13 +50,10 @@ Style/MixinUsage:
55
50
  Exclude:
56
51
  - spec/**/*
57
52
 
58
- Performance/Count:
59
- Enabled: false
60
-
61
- Layout/AlignHash:
53
+ Layout/HashAlignment:
62
54
  Enabled: false
63
55
 
64
- Layout/AlignParameters:
56
+ Layout/ParameterAlignment:
65
57
  Enabled: false
66
58
 
67
59
  Layout/ClosingParenthesisIndentation:
@@ -77,13 +69,13 @@ Layout/ElseAlignment:
77
69
  Layout/EmptyLineAfterMagicComment:
78
70
  Enabled: false
79
71
 
80
- Layout/IndentArray:
72
+ Layout/FirstArrayElementIndentation:
81
73
  Enabled: false
82
74
 
83
- Layout/IndentHash:
75
+ Layout/FirstHashElementIndentation:
84
76
  Enabled: false
85
77
 
86
- Layout/IndentHeredoc:
78
+ Layout/HeredocIndentation:
87
79
  EnforcedStyle: active_support
88
80
 
89
81
  Layout/IndentationWidth:
@@ -115,7 +107,7 @@ Layout/SpaceInsideParens:
115
107
  Layout/EndAlignment:
116
108
  Enabled: false
117
109
 
118
- Lint/HandleExceptions:
110
+ Lint/SuppressedException:
119
111
  Exclude:
120
112
  - 'config/initializers/mini_profiler.rb'
121
113
 
@@ -1,5 +1,22 @@
1
1
  ## 5.0.0 (unreleased)
2
2
 
3
+ ## 4.6.0 (2020-06-04)
4
+
5
+ - Use apt update instead of apt-get in GH action [#1865](https://github.com/AlchemyCMS/alchemy_cms/pull/1865) ([tvdeyen](https://github.com/tvdeyen))
6
+ - Use depth for page tree serializer root_or_leaf [#1864](https://github.com/AlchemyCMS/alchemy_cms/pull/1864) ([tvdeyen](https://github.com/tvdeyen))
7
+ - Fix sitemap wrapper height [#1861](https://github.com/AlchemyCMS/alchemy_cms/pull/1861) ([tvdeyen](https://github.com/tvdeyen))
8
+ - Do not return the root page with API responses. [#1860](https://github.com/AlchemyCMS/alchemy_cms/pull/1860) ([tvdeyen](https://github.com/tvdeyen))
9
+ - Introduce page.url_path and use it for alchemyPageSelect [#1859](https://github.com/AlchemyCMS/alchemy_cms/pull/1859) ([tvdeyen](https://github.com/tvdeyen))
10
+ - Update Urlname translation [#1857](https://github.com/AlchemyCMS/alchemy_cms/pull/1857) ([tvdeyen](https://github.com/tvdeyen))
11
+ - Show url name in Page tree [#1856](https://github.com/AlchemyCMS/alchemy_cms/pull/1856) ([tvdeyen](https://github.com/tvdeyen))
12
+ - Deprecate Page#visible attribute [#1855](https://github.com/AlchemyCMS/alchemy_cms/pull/1855) ([tvdeyen](https://github.com/tvdeyen))
13
+ - 4.6: Re-add `auto_logout_time` configuration option [#1852](https://github.com/AlchemyCMS/alchemy_cms/pull/1852) ([mamhoff](https://github.com/mamhoff))
14
+ - Backport ContentEditor to 4.6, deprecate removed methods on `Alchemy::Content` [#1847](https://github.com/AlchemyCMS/alchemy_cms/pull/1847) ([mamhoff](https://github.com/mamhoff))
15
+ - Deprecate auto_logout_time (4.6) [#1843](https://github.com/AlchemyCMS/alchemy_cms/pull/1843) ([tvdeyen](https://github.com/tvdeyen))
16
+ - Deprecate require_ssl (4.6) [#1842](https://github.com/AlchemyCMS/alchemy_cms/pull/1842) ([tvdeyen](https://github.com/tvdeyen))
17
+ - Deprecate url_nesting configuration (4.6) [#1841](https://github.com/AlchemyCMS/alchemy_cms/pull/1841) ([tvdeyen](https://github.com/tvdeyen))
18
+ - Allow page visible toggle (4.6) [#1838](https://github.com/AlchemyCMS/alchemy_cms/pull/1838) ([tvdeyen](https://github.com/tvdeyen))
19
+
3
20
  ## 4.5.0 (2020-03-30)
4
21
 
5
22
  - Sortable menus [#1758](https://github.com/AlchemyCMS/alchemy_cms/pull/1758) ([mamhoff](https://github.com/mamhoff))
@@ -76,16 +76,16 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog
76
76
  meta = data.meta
77
77
  results:
78
78
  data.pages.map (page) ->
79
- id: "/#{page.urlname}"
79
+ id: page.url_path
80
80
  name: page.name
81
- urlname: page.urlname
81
+ url_path: page.url_path
82
82
  page_id: page.id
83
83
  more: meta.page * meta.per_page < meta.total_count
84
84
  initSelection: ($element, callback) =>
85
85
  urlname = $element.val()
86
86
  $.get Alchemy.routes.api_pages_path,
87
87
  q:
88
- urlname_eq: urlname.replace(/^\//, '')
88
+ urlname_eq: urlname.replace(/^\/([a-z]{2}(-[A-Z]{2})?\/)?/, '')
89
89
  page: 1
90
90
  per_page: 1,
91
91
  (data) =>
@@ -93,9 +93,9 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog
93
93
  if page
94
94
  @initElementSelect(page.id)
95
95
  callback
96
- id: "/#{page.urlname}"
96
+ id: page.url_path
97
97
  name: page.name
98
- urlname: page.name
98
+ url_path: page.url_path
99
99
  page_id: page.id
100
100
  formatSelection: (page) ->
101
101
  page.name
@@ -4,6 +4,6 @@
4
4
  {{ page.name }}
5
5
  </span>
6
6
  <span class="page-select--page-urlname">
7
- /{{ page.urlname }}
7
+ {{ page.url_path }}
8
8
  </span>
9
9
  </div>
@@ -49,9 +49,8 @@
49
49
  border-color: $hover-border-color;
50
50
  }
51
51
 
52
- &:active, &:active:focus {
53
- border-color: $hover-border-color;
54
- box-shadow: none;
52
+ &:active, &.active {
53
+ box-shadow: inset $button-box-shadow;
55
54
  }
56
55
 
57
56
  &:focus {
@@ -76,7 +76,7 @@ $button-text-shadow: none !default;
76
76
  $button-box-shadow: 0px 1px 1px -1px #333 !default;
77
77
  $button-focus-box-shadow: 0px 1px 1px 0px $button-focus-border-color !default;
78
78
  $button-padding: 0.55em 2em !default;
79
- $small-button-padding: 0.4em 1.25em !default;
79
+ $small-button-padding: 0.4em 0.8em !default;
80
80
  $button-margin: $form-field-margin !default;
81
81
 
82
82
  $secondary-button-bg-color: transparent !default;
@@ -108,7 +108,7 @@ $form-right-width: 65% !default;
108
108
  $sitemap-line-height: 32px !default;
109
109
  $sitemap-page-background-color: rgba($white, 0.75) !default;
110
110
  $sitemap-page-hover-color: rgba($light_yellow, 0.5) !default;
111
- $sitemap-info-background-color: rgba($linked-color, 0.5) !default;
111
+ $sitemap-info-background-color: rgba($white, 0.5) !default;
112
112
  $sitemap-highlight-color: rgba(#fffba5, 0.5) !default;
113
113
 
114
114
  $main-menu-width: 150px !default;
@@ -13,14 +13,6 @@ ul.list {
13
13
  padding: 0;
14
14
  list-style-type: none;
15
15
 
16
- &#layoutpages {
17
- margin-top: 16px;
18
-
19
- li {
20
- margin-left: 8px;
21
- }
22
- }
23
-
24
16
  li {
25
17
  list-style-type: none;
26
18
  display: block;
@@ -18,7 +18,7 @@
18
18
 
19
19
  .node_page,
20
20
  .node_url {
21
- width: 200px;
21
+ width: 250px;
22
22
  max-width: 45%;
23
23
  white-space: nowrap;
24
24
  text-overflow: ellipsis;
@@ -1,3 +1,6 @@
1
+ $sitemap-url-large-width: 250px;
2
+ $sitemap-url-xlarge-width: 350px;
3
+
1
4
  #sort_panel {
2
5
  background: $light-gray;
3
6
  padding: 47px 0 8px 0;
@@ -20,7 +23,7 @@
20
23
 
21
24
  #sitemap-wrapper {
22
25
  position: relative;
23
- min-height: 100%;
26
+ min-height: calc(100vh - 96px);
24
27
  }
25
28
 
26
29
  .sitemap_pagename_link {
@@ -28,23 +31,35 @@
28
31
  padding: 0 10px;
29
32
  margin: 2px;
30
33
  text-decoration: none;
34
+ white-space: nowrap;
35
+ text-overflow: ellipsis;
36
+ overflow: hidden;
31
37
 
32
38
  &.inactive {
33
39
  color: #656565;
34
40
  }
35
41
  }
36
42
 
37
- .redirect_url {
43
+ .sitemap_url {
44
+ display: none;
38
45
  float: right;
39
- text-align: right;
40
46
  background-color: $sitemap-info-background-color;
41
- line-height: $sitemap-line-height;
47
+ line-height: $sitemap-line-height - 2px;
42
48
  font-size: $small-font-size;
43
- padding: 0 2*$default-padding;
44
- max-width: 45%;
49
+ padding: 0 2 * $default-padding;
45
50
  white-space: nowrap;
46
51
  overflow: hidden;
47
52
  text-overflow: ellipsis;
53
+ border: 1px solid $sitemap-page-background-color;
54
+
55
+ @media screen and (min-width: $large-screen-break-point) {
56
+ display: block;
57
+ width: $sitemap-url-large-width;
58
+ }
59
+
60
+ @media screen and (min-width: 1440px) {
61
+ width: $sitemap-url-xlarge-width;
62
+ }
48
63
  }
49
64
 
50
65
  .sitemap_line_spacer {
@@ -55,7 +70,7 @@
55
70
 
56
71
  .sitemap_page {
57
72
  height: $sitemap-line-height;
58
- margin: 3*$default-margin 0;
73
+ margin: 3 * $default-margin 0;
59
74
  position: relative;
60
75
  transition: background-color $transition-duration;
61
76
 
@@ -89,13 +104,13 @@
89
104
  width: 32px;
90
105
  line-height: $sitemap-line-height;
91
106
  float: left;
92
- padding: 0 2*$default-padding;
107
+ padding: 0 2 * $default-padding;
93
108
  text-align: center;
94
109
  }
95
110
 
96
111
  .sitemap_right_tools {
97
112
  height: $sitemap-line-height;
98
- padding: 0 2*$default-padding;
113
+ padding: 0 2 * $default-padding;
99
114
  float: right;
100
115
 
101
116
  .sitemap_tool {
@@ -130,7 +145,9 @@
130
145
  &.sorting {
131
146
  padding-top: 100px;
132
147
 
133
- .page_icon { cursor: move }
148
+ .page_icon {
149
+ cursor: move;
150
+ }
134
151
  }
135
152
 
136
153
  .page_folder {
@@ -183,25 +200,44 @@
183
200
  }
184
201
 
185
202
  #sitemap_heading {
203
+ display: flex;
186
204
  padding: 0;
187
-
188
- .page_infos {
189
- margin-right: 210px;
190
- text-align: left;
191
- float: right;
192
- line-height: 28px;
193
- background: transparent;
194
- }
205
+ line-height: 28px;
195
206
 
196
207
  .page_name {
197
- line-height: 28px;
198
208
  margin-left: 43px;
199
209
  }
210
+
211
+ .page_urlname {
212
+ display: none;
213
+ margin-left: auto;
214
+ padding-left: 2 * $default-padding;
215
+ padding-right: 2 * $default-padding;
216
+
217
+ @media screen and (min-width: $large-screen-break-point) {
218
+ display: block;
219
+ width: $sitemap-url-large-width;
220
+ }
221
+
222
+ @media screen and (min-width: 1440px) {
223
+ width: $sitemap-url-xlarge-width;
224
+ }
225
+ }
226
+
227
+ .page_status {
228
+ padding-left: 2 * $default-padding;
229
+ margin-right: 214px;
230
+ margin-left: auto;
231
+
232
+ @media screen and (min-width: $large-screen-break-point) {
233
+ margin-left: initial;
234
+ }
235
+ }
200
236
  }
201
237
 
202
238
  #page_filter_result {
203
239
  display: none;
204
- margin-left: 2*$default-margin;
240
+ margin-left: 2 * $default-margin;
205
241
  }
206
242
 
207
243
  .alchemy-dialog {
@@ -213,6 +249,8 @@
213
249
  margin: 0;
214
250
  padding: 0 24px 8px 8px;
215
251
 
216
- .page_icon { cursor: default }
252
+ .page_icon {
253
+ cursor: default;
254
+ }
217
255
  }
218
256
  }
@@ -142,7 +142,6 @@ module Alchemy
142
142
  @attachments = Attachment.all.collect { |f|
143
143
  [f.name, download_attachment_path(id: f.id, name: f.urlname)]
144
144
  }
145
- @url_prefix = prefix_locale? ? "#{Language.current.code}/" : ""
146
145
  end
147
146
 
148
147
  def fold
@@ -13,6 +13,7 @@ module Alchemy
13
13
  else
14
14
  @pages = Page.accessible_by(current_ability, :index)
15
15
  end
16
+ @pages = @pages.where.not(parent_id: nil)
16
17
  @pages = @pages.includes(*page_includes)
17
18
  if params[:page_layout].present?
18
19
  Alchemy::Deprecation.warn <<~WARN
@@ -104,6 +105,7 @@ module Alchemy
104
105
  [
105
106
  :tags,
106
107
  {
108
+ language: :site,
107
109
  elements: [
108
110
  {
109
111
  nested_elements: [