alchemy_cms 5.0.1 → 5.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.github/PULL_REQUEST_TEMPLATE.md +1 -1
  3. data/.github/workflows/stale.yml +1 -1
  4. data/.gitignore +1 -0
  5. data/CHANGELOG.md +51 -2
  6. data/CONTRIBUTING.md +2 -2
  7. data/Gemfile +1 -1
  8. data/README.md +2 -2
  9. data/alchemy_cms.gemspec +2 -2
  10. data/app/assets/images/alchemy/missing-image.svg +1 -0
  11. data/app/assets/stylesheets/alchemy/_variables.scss +1 -0
  12. data/app/assets/stylesheets/alchemy/archive.scss +23 -17
  13. data/app/assets/stylesheets/alchemy/errors.scss +1 -1
  14. data/app/assets/stylesheets/alchemy/navigation.scss +7 -10
  15. data/app/assets/stylesheets/alchemy/pagination.scss +1 -1
  16. data/app/assets/stylesheets/alchemy/search.scss +12 -2
  17. data/app/assets/stylesheets/alchemy/tags.scss +19 -31
  18. data/app/controllers/alchemy/admin/pictures_controller.rb +13 -6
  19. data/app/controllers/alchemy/admin/resources_controller.rb +3 -3
  20. data/app/controllers/alchemy/pages_controller.rb +49 -14
  21. data/app/helpers/alchemy/admin/base_helper.rb +0 -44
  22. data/app/helpers/alchemy/admin/navigation_helper.rb +2 -1
  23. data/app/models/alchemy/attachment.rb +20 -3
  24. data/app/models/alchemy/attachment/url.rb +40 -0
  25. data/app/models/alchemy/essence_picture.rb +3 -3
  26. data/app/models/alchemy/essence_picture_view.rb +5 -3
  27. data/app/models/alchemy/page.rb +16 -1
  28. data/app/models/alchemy/page/page_natures.rb +2 -0
  29. data/app/models/alchemy/page/url_path.rb +8 -6
  30. data/app/models/alchemy/picture.rb +58 -2
  31. data/app/models/alchemy/picture/calculations.rb +55 -0
  32. data/app/models/alchemy/picture/transformations.rb +5 -49
  33. data/app/models/alchemy/picture/url.rb +28 -77
  34. data/app/models/alchemy/picture_thumb.rb +57 -0
  35. data/app/models/alchemy/picture_thumb/create.rb +39 -0
  36. data/app/models/alchemy/picture_thumb/signature.rb +23 -0
  37. data/app/models/alchemy/picture_thumb/uid.rb +22 -0
  38. data/app/models/alchemy/picture_variant.rb +114 -0
  39. data/app/views/alchemy/admin/attachments/show.html.erb +8 -8
  40. data/app/views/alchemy/admin/dashboard/index.html.erb +13 -16
  41. data/app/views/alchemy/admin/essence_pictures/crop.html.erb +1 -1
  42. data/app/views/alchemy/admin/essence_pictures/edit.html.erb +2 -2
  43. data/app/views/alchemy/admin/layoutpages/edit.html.erb +4 -6
  44. data/app/views/alchemy/admin/pages/_form.html.erb +4 -6
  45. data/app/views/alchemy/admin/pages/_new_page_form.html.erb +2 -1
  46. data/app/views/alchemy/admin/partials/_remote_search_form.html.erb +14 -13
  47. data/app/views/alchemy/admin/partials/_search_form.html.erb +8 -8
  48. data/app/views/alchemy/admin/pictures/_archive.html.erb +1 -1
  49. data/app/views/alchemy/admin/pictures/_form.html.erb +1 -1
  50. data/app/views/alchemy/admin/pictures/_picture.html.erb +3 -3
  51. data/app/views/alchemy/admin/pictures/_picture_to_assign.html.erb +1 -1
  52. data/app/views/alchemy/admin/pictures/edit_multiple.html.erb +1 -1
  53. data/app/views/alchemy/admin/pictures/index.html.erb +1 -1
  54. data/app/views/alchemy/admin/pictures/show.html.erb +3 -3
  55. data/app/views/alchemy/admin/resources/_per_page_select.html.erb +3 -3
  56. data/app/views/alchemy/admin/resources/index.html.erb +4 -1
  57. data/app/views/alchemy/admin/tags/index.html.erb +14 -15
  58. data/app/views/alchemy/base/500.html.erb +11 -13
  59. data/app/views/alchemy/essences/_essence_file_view.html.erb +3 -3
  60. data/config/alchemy/config.yml +15 -11
  61. data/config/alchemy/modules.yml +12 -12
  62. data/config/routes.rb +1 -1
  63. data/db/migrate/20200617110713_create_alchemy_picture_thumbs.rb +22 -0
  64. data/db/migrate/20200907111332_remove_tri_state_booleans.rb +33 -0
  65. data/lib/alchemy/auth_accessors.rb +12 -5
  66. data/lib/alchemy/config.rb +1 -3
  67. data/lib/alchemy/engine.rb +7 -2
  68. data/lib/alchemy/modules.rb +11 -1
  69. data/lib/alchemy/test_support/factories/picture_factory.rb +0 -1
  70. data/lib/alchemy/test_support/factories/picture_thumb_factory.rb +12 -0
  71. data/lib/alchemy/version.rb +1 -1
  72. data/lib/generators/alchemy/install/files/alchemy.en.yml +2 -2
  73. data/lib/generators/alchemy/install/templates/dragonfly.rb.tt +5 -5
  74. data/lib/tasks/alchemy/thumbnails.rake +37 -0
  75. metadata +22 -14
  76. data/.github/workflows/greetings.yml +0 -13
  77. data/app/controllers/concerns/alchemy/locale_redirects.rb +0 -40
  78. data/app/controllers/concerns/alchemy/page_redirects.rb +0 -68
  79. data/lib/alchemy/userstamp.rb +0 -12
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "5.0.1"
4
+ VERSION = "5.1.0.beta1"
5
5
 
6
6
  def self.version
7
7
  VERSION
@@ -18,7 +18,7 @@ en:
18
18
  # Default texts for new contents created
19
19
  default_content_texts:
20
20
  article_headline: "Welcome to your first Alchemy CMS page"
21
- article_text: '<p><strong>How to get started.</strong></p><p>First of all you should read about Alchemy and its architecture in the <a class="external" href="http://guides.alchemy-cms.com/stable/alchemy_approach.html" target="_blank" data-link-target="blank">guidelines</a>.</p><p>The most important things to know about Alchemy are elements and page layouts.</p><p><span style="text-decoration: underline;"><strong>Elements:</strong></span></p><p>With Alchemy you can split pages into content parts, elements. These elements can be defined out of several base content types: essences. The basic essences are:</p><ul><li>EssenceText - <em>A single line of text</em></li><li>EssenceRichtext - <em>A TinyMCE powered formatted text block</em></li><li>EssencePicture - <em>A reference to an image</em></li><li>EssenceHtml - <em>HTML embed code</em></li><li>EssenceSelect - <em>A selection of values</em></li><li>EssenceBoolean - <em>A checkbox</em></li></ul><p>Elements get defined in a YAML file <strong>config/alchemy/elements.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/stable/elements.html" target="_blank" data-link-target="blank">Read more about elements and how to define them in the guidelines.</a></p><p><span style="text-decoration: underline;"><strong>Page types:</strong></span></p><p>You can define several types of pages, called page layouts. You can assign elements to page layouts and control how elements and the page of a certain layout behave.</p><p>Page layouts get defined in a YAML file <strong>config/alchemy/page_layouts.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/stable/page_layouts.html" target="_blank" data-link-target="blank">Read more about defining page layouts in the guidelines.</a></p>'
21
+ article_text: '<p><strong>How to get started.</strong></p><p>First of all you should read about Alchemy and its architecture in the <a class="external" href="http://guides.alchemy-cms.com/alchemy_approach.html" target="_blank" data-link-target="blank">guidelines</a>.</p><p>The most important things to know about Alchemy are elements and page layouts.</p><p><span style="text-decoration: underline;"><strong>Elements:</strong></span></p><p>With Alchemy you can split pages into content parts, elements. These elements can be defined out of several base content types: essences. The basic essences are:</p><ul><li>EssenceText - <em>A single line of text</em></li><li>EssenceRichtext - <em>A TinyMCE powered formatted text block</em></li><li>EssencePicture - <em>A reference to an image</em></li><li>EssenceHtml - <em>HTML embed code</em></li><li>EssenceSelect - <em>A selection of values</em></li><li>EssenceBoolean - <em>A checkbox</em></li></ul><p>Elements get defined in a YAML file <strong>config/alchemy/elements.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/elements.html" target="_blank" data-link-target="blank">Read more about elements and how to define them in the guidelines.</a></p><p><span style="text-decoration: underline;"><strong>Page types:</strong></span></p><p>You can define several types of pages, called page layouts. You can assign elements to page layouts and control how elements and the page of a certain layout behave.</p><p>Page layouts get defined in a YAML file <strong>config/alchemy/page_layouts.yml</strong></p><p><a class="external" href="http://guides.alchemy-cms.com/page_layouts.html" target="_blank" data-link-target="blank">Read more about defining page layouts in the guidelines.</a></p>'
22
22
 
23
23
  # Hint texts for elements
24
24
  element_hints:
@@ -28,4 +28,4 @@ en:
28
28
  content_hints:
29
29
  headline: "This is a single line of unformatable Text"
30
30
  picture: "Pictures are stored in the library. You can assign a picture multiple times throughout your site. Alchemy has an image cropper build right in."
31
- text: "This is a rich text block powered by TinyMCE editor. You can change the configuration of the editor. See http://guides.alchemy-cms.com/stable/customize_tinymce.html"
31
+ text: "This is a rich text block powered by TinyMCE editor. You can change the configuration of the editor. See http://guides.alchemy-cms.com/customize_tinymce.html"
@@ -15,12 +15,12 @@ Dragonfly.app(:alchemy_pictures).configure do
15
15
  dragonfly_url nil
16
16
  plugin :imagemagick
17
17
  plugin :svg
18
- secret '<%= SecureRandom.hex(32) %>'
19
- url_format '/pictures/:job/:name.:ext'
18
+ secret "<%= SecureRandom.hex(32) %>"
19
+ url_format "/pictures/:job/:basename.:ext"
20
20
 
21
21
  datastore :file,
22
- root_path: Rails.root.join('uploads/pictures').to_s,
23
- server_root: Rails.root.join('public'),
22
+ root_path: Rails.root.join("uploads/pictures").to_s,
23
+ server_root: Rails.root.join("public"),
24
24
  store_meta: false
25
25
  end
26
26
 
@@ -30,6 +30,6 @@ Rails.application.middleware.use Dragonfly::Middleware, :alchemy_pictures
30
30
  # Attachments
31
31
  Dragonfly.app(:alchemy_attachments).configure do
32
32
  datastore :file,
33
- root_path: Rails.root.join('uploads/attachments').to_s,
33
+ root_path: Rails.root.join("uploads/attachments").to_s,
34
34
  store_meta: false
35
35
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ namespace :alchemy do
4
+ namespace :generate do
5
+ desc "Generates all thumbnails for Alchemy Pictures and EssencePictures."
6
+ task thumbnails: [
7
+ "alchemy_dragonfly_s3:generate:picture_thumbnails",
8
+ "alchemy_dragonfly_s3:generate:essence_picture_thumbnails",
9
+ ]
10
+
11
+ desc "Generates thumbnails for Alchemy Pictures."
12
+ task picture_thumbnails: :environment do
13
+ puts "Regenerate #{Alchemy::Picture.count} picture thumbnails."
14
+ puts "Please wait..."
15
+
16
+ Alchemy::Picture.find_each do |picture|
17
+ puts Alchemy::PictureThumb.generate_thumbs!(picture)
18
+ end
19
+
20
+ puts "Done!"
21
+ end
22
+
23
+ desc "Generates thumbnails for Alchemy EssencePictures."
24
+ task essence_picture_thumbnails: :environment do
25
+ essence_pictures = Alchemy::EssencePicture.joins(:content, :ingredient_association)
26
+ puts "Regenerate #{essence_pictures.count} essence picture thumbnails."
27
+ puts "Please wait..."
28
+
29
+ essence_pictures.find_each do |essence_picture|
30
+ puts essence_picture.picture_url
31
+ puts essence_picture.thumbnail_url
32
+ end
33
+
34
+ puts "Done!"
35
+ end
36
+ end
37
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.1.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2020-09-29 00:00:00.000000000 Z
16
+ date: 2020-10-30 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: active_model_serializers
@@ -87,22 +87,22 @@ dependencies:
87
87
  name: coffee-rails
88
88
  requirement: !ruby/object:Gem::Requirement
89
89
  requirements:
90
- - - "~>"
90
+ - - ">="
91
91
  - !ruby/object:Gem::Version
92
92
  version: '4.0'
93
93
  - - "<"
94
94
  - !ruby/object:Gem::Version
95
- version: '5.0'
95
+ version: '6.0'
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - "~>"
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: '4.0'
103
103
  - - "<"
104
104
  - !ruby/object:Gem::Version
105
- version: '5.0'
105
+ version: '6.0'
106
106
  - !ruby/object:Gem::Dependency
107
107
  name: dragonfly
108
108
  requirement: !ruby/object:Gem::Requirement
@@ -477,14 +477,14 @@ dependencies:
477
477
  requirements:
478
478
  - - "~>"
479
479
  - !ruby/object:Gem::Version
480
- version: '4.0'
480
+ version: '5.0'
481
481
  type: :development
482
482
  prerelease: false
483
483
  version_requirements: !ruby/object:Gem::Requirement
484
484
  requirements:
485
485
  - - "~>"
486
486
  - !ruby/object:Gem::Version
487
- version: '4.0'
487
+ version: '5.0'
488
488
  - !ruby/object:Gem::Dependency
489
489
  name: rails-controller-testing
490
490
  requirement: !ruby/object:Gem::Requirement
@@ -596,7 +596,6 @@ files:
596
596
  - ".github/ISSUE_TEMPLATE/Bug_report.md"
597
597
  - ".github/ISSUE_TEMPLATE/Feature_request.md"
598
598
  - ".github/PULL_REQUEST_TEMPLATE.md"
599
- - ".github/workflows/greetings.yml"
600
599
  - ".github/workflows/stale.yml"
601
600
  - ".gitignore"
602
601
  - ".hound.yml"
@@ -620,6 +619,7 @@ files:
620
619
  - app/assets/images/alchemy/icon-white.svg
621
620
  - app/assets/images/alchemy/icon.svg
622
621
  - app/assets/images/alchemy/lupe.cur
622
+ - app/assets/images/alchemy/missing-image.svg
623
623
  - app/assets/javascripts/alchemy/admin.js
624
624
  - app/assets/javascripts/alchemy/alchemy.autocomplete.js.coffee
625
625
  - app/assets/javascripts/alchemy/alchemy.base.js.coffee
@@ -757,8 +757,6 @@ files:
757
757
  - app/controllers/concerns/alchemy/admin/current_language.rb
758
758
  - app/controllers/concerns/alchemy/admin/uploader_responses.rb
759
759
  - app/controllers/concerns/alchemy/legacy_page_redirects.rb
760
- - app/controllers/concerns/alchemy/locale_redirects.rb
761
- - app/controllers/concerns/alchemy/page_redirects.rb
762
760
  - app/controllers/concerns/alchemy/site_redirects.rb
763
761
  - app/decorators/alchemy/content_editor.rb
764
762
  - app/decorators/alchemy/element_editor.rb
@@ -780,6 +778,7 @@ files:
780
778
  - app/mailers/alchemy/base_mailer.rb
781
779
  - app/mailers/alchemy/messages_mailer.rb
782
780
  - app/models/alchemy/attachment.rb
781
+ - app/models/alchemy/attachment/url.rb
783
782
  - app/models/alchemy/base_record.rb
784
783
  - app/models/alchemy/content.rb
785
784
  - app/models/alchemy/content/factory.rb
@@ -815,9 +814,15 @@ files:
815
814
  - app/models/alchemy/page/page_scopes.rb
816
815
  - app/models/alchemy/page/url_path.rb
817
816
  - app/models/alchemy/picture.rb
817
+ - app/models/alchemy/picture/calculations.rb
818
818
  - app/models/alchemy/picture/preprocessor.rb
819
819
  - app/models/alchemy/picture/transformations.rb
820
820
  - app/models/alchemy/picture/url.rb
821
+ - app/models/alchemy/picture_thumb.rb
822
+ - app/models/alchemy/picture_thumb/create.rb
823
+ - app/models/alchemy/picture_thumb/signature.rb
824
+ - app/models/alchemy/picture_thumb/uid.rb
825
+ - app/models/alchemy/picture_variant.rb
821
826
  - app/models/alchemy/site.rb
822
827
  - app/models/alchemy/site/layout.rb
823
828
  - app/models/alchemy/tag.rb
@@ -1070,6 +1075,8 @@ files:
1070
1075
  - db/migrate/20200511113603_add_menu_type_to_alchemy_nodes.rb
1071
1076
  - db/migrate/20200514091507_make_page_layoutpage_null_false.rb
1072
1077
  - db/migrate/20200519073500_remove_visible_from_alchemy_pages.rb
1078
+ - db/migrate/20200617110713_create_alchemy_picture_thumbs.rb
1079
+ - db/migrate/20200907111332_remove_tri_state_booleans.rb
1073
1080
  - lib/alchemy/ability_helper.rb
1074
1081
  - lib/alchemy/admin/locale.rb
1075
1082
  - lib/alchemy/admin/preview_url.rb
@@ -1118,6 +1125,7 @@ files:
1118
1125
  - lib/alchemy/test_support/factories/node_factory.rb
1119
1126
  - lib/alchemy/test_support/factories/page_factory.rb
1120
1127
  - lib/alchemy/test_support/factories/picture_factory.rb
1128
+ - lib/alchemy/test_support/factories/picture_thumb_factory.rb
1121
1129
  - lib/alchemy/test_support/factories/site_factory.rb
1122
1130
  - lib/alchemy/test_support/fixtures/image.png
1123
1131
  - lib/alchemy/test_support/integration_helpers.rb
@@ -1128,7 +1136,6 @@ files:
1128
1136
  - lib/alchemy/upgrader/five_point_zero.rb
1129
1137
  - lib/alchemy/upgrader/tasks/element_views_updater.rb
1130
1138
  - lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
1131
- - lib/alchemy/userstamp.rb
1132
1139
  - lib/alchemy/version.rb
1133
1140
  - lib/alchemy_cms.rb
1134
1141
  - lib/generators/alchemy/base.rb
@@ -1175,6 +1182,7 @@ files:
1175
1182
  - lib/kaminari/scoped_pagination_url_helper.rb
1176
1183
  - lib/tasks/alchemy/db.rake
1177
1184
  - lib/tasks/alchemy/install.rake
1185
+ - lib/tasks/alchemy/thumbnails.rake
1178
1186
  - lib/tasks/alchemy/tidy.rake
1179
1187
  - lib/tasks/alchemy/upgrade.rake
1180
1188
  - package.json
@@ -1263,9 +1271,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1263
1271
  version: 2.3.0
1264
1272
  required_rubygems_version: !ruby/object:Gem::Requirement
1265
1273
  requirements:
1266
- - - ">="
1274
+ - - ">"
1267
1275
  - !ruby/object:Gem::Version
1268
- version: '0'
1276
+ version: 1.3.1
1269
1277
  requirements:
1270
1278
  - ImageMagick (libmagick), v6.6 or greater.
1271
1279
  rubygems_version: 3.0.3
@@ -1,13 +0,0 @@
1
- name: Greetings
2
-
3
- on: [pull_request, issues]
4
-
5
- jobs:
6
- greeting:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - uses: actions/first-interaction@v1
10
- with:
11
- repo-token: ${{ secrets.GITHUB_TOKEN }}
12
- issue-message: 'Hey. Thanks for reporting this issue and welcome to AlchemyCMS. The maintainer have been notified. Please be patient while waiting for an answer. Open Source is done by volunteers, so give them some time to react. Meanwhile please think about sending a PR that fixes this issue. It is way more likely that it will be accepted than this bug fixed for you. Remember OpenSource is done by all of us. Again, thanks for reporting.'
13
- pr-message: 'Hey. Thanks for sending this PR. It is very much appreciated. Please be patient and give the maintainers some time to review your work. Meanwhile make sure that the PR meets our [contributing guidelines](https://github.com/AlchemyCMS/alchemy_cms/blob/master/CONTRIBUTING.md). This mostly means [great commit messages](https://chris.beams.io/posts/git-commit/) and adding tests. Thanks again for your contribution. Your help makes Alchemy better.'
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Alchemy
4
- # Handles locale redirects
5
- #
6
- # If the current URL has a locale prefix, but should not have one it redirects
7
- # to url without locale prefix.
8
- #
9
- # Situations we don't want a locale prefix:
10
- #
11
- # 1. If only one language is published
12
- # 2. If the requested locale is the current default locale
13
- #
14
- module LocaleRedirects
15
- extend ActiveSupport::Concern
16
-
17
- included do
18
- before_action :enforce_no_locale,
19
- if: :locale_prefix_not_allowed?,
20
- only: [:index, :show]
21
- end
22
-
23
- private
24
-
25
- # Redirects to requested action without locale prefixed
26
- def enforce_no_locale
27
- redirect_permanently_to additional_params.merge(locale: nil)
28
- end
29
-
30
- # Is the requested locale allowed?
31
- #
32
- # If Alchemy is not in multi language mode or the requested locale is the default locale,
33
- # then we want to redirect to a non prefixed url.
34
- #
35
- def locale_prefix_not_allowed?
36
- params[:locale].present? && !multi_language? ||
37
- params[:locale].presence == ::I18n.default_locale.to_s
38
- end
39
- end
40
- end
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Alchemy
4
- # Handles page redirect urls
5
- #
6
- # Lots of reasons exist to redirect to another URL than the requested one.
7
- # These module holds the logic behind these needs.
8
- #
9
- module PageRedirects
10
- extend ActiveSupport::Concern
11
-
12
- private
13
-
14
- # Returns an URL to redirect the request to.
15
- #
16
- # == Lookup:
17
- #
18
- # 1. If the page is not published and we have a published child,
19
- # we return the url top that page. (Configurable through +redirect_to_public_child+).
20
- # 2. If the page layout of the page found has a controller and action configured,
21
- # we return the url to that route. (Configure controller and action in `page_layouts.yml`).
22
- # 3. If the current page URL has no locale prefixed, but we should have one,
23
- # we return the prefixed URL.
24
- # 4. If no redirection is needed returns nil.
25
- #
26
- # @return String
27
- # @return NilClass
28
- #
29
- def redirect_url
30
- @_redirect_url ||= public_child_redirect_url || locale_prefixed_url || nil
31
- end
32
-
33
- def locale_prefixed_url
34
- return unless locale_prefix_missing?
35
-
36
- page_redirect_url(locale: Language.current.code)
37
- end
38
-
39
- def public_child_redirect_url
40
- return if @page.public?
41
-
42
- if configuration(:redirect_to_public_child)
43
- @page = @page.descendants.published.not_restricted.first
44
- @page ? page_redirect_url : page_not_found!
45
- else
46
- page_not_found!
47
- end
48
- end
49
-
50
- # Page url with or without locale while keeping all additional params
51
- def page_redirect_url(options = {})
52
- options = {
53
- locale: prefix_locale? ? @page.language_code : nil,
54
- urlname: @page.urlname,
55
- }.merge(options)
56
-
57
- alchemy.show_page_path additional_params.merge(options)
58
- end
59
-
60
- def default_locale?
61
- Language.current.code.to_sym == ::I18n.default_locale.to_sym
62
- end
63
-
64
- def locale_prefix_missing?
65
- multi_language? && params[:locale].blank? && !default_locale?
66
- end
67
- end
68
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Adds the model stamper ability to the provided user class
4
- #
5
- # It only adds it, if the user model is a active_record model.
6
- #
7
- if Alchemy.user_class < ActiveRecord::Base
8
- Alchemy.user_class.class_eval do
9
- model_stamper
10
- stampable stamper_class_name: Alchemy.user_class_name
11
- end
12
- end