alchemy_cms 6.0.14 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +0 -3
  3. data/.github/workflows/stale.yml +2 -0
  4. data/CHANGELOG.md +34 -5
  5. data/Gemfile +2 -2
  6. data/alchemy_cms.gemspec +2 -1
  7. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +13 -11
  8. data/app/assets/stylesheets/alchemy/_variables.scss +9 -4
  9. data/app/assets/stylesheets/alchemy/elements.scss +96 -4
  10. data/app/assets/stylesheets/alchemy/forms.scss +59 -17
  11. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +3 -3
  12. data/app/controllers/alchemy/admin/ingredients_controller.rb +1 -1
  13. data/app/controllers/alchemy/admin/pages_controller.rb +3 -3
  14. data/app/controllers/alchemy/api/ingredients_controller.rb +22 -0
  15. data/app/controllers/alchemy/messages_controller.rb +1 -1
  16. data/app/controllers/alchemy/pages_controller.rb +19 -5
  17. data/app/decorators/alchemy/ingredient_editor.rb +4 -0
  18. data/app/helpers/alchemy/elements_helper.rb +0 -8
  19. data/app/helpers/alchemy/url_helper.rb +0 -8
  20. data/app/models/alchemy/element/definitions.rb +16 -2
  21. data/app/models/alchemy/element/dom_id.rb +30 -0
  22. data/app/models/alchemy/element/presenters.rb +1 -1
  23. data/app/models/alchemy/element.rb +12 -3
  24. data/app/models/alchemy/ingredients/headline.rb +4 -1
  25. data/app/models/alchemy/ingredients/text.rb +3 -0
  26. data/app/models/alchemy/page/page_layouts.rb +128 -0
  27. data/app/models/alchemy/page.rb +4 -2
  28. data/app/models/alchemy/picture_thumb/create.rb +1 -1
  29. data/app/models/concerns/alchemy/dom_ids.rb +32 -0
  30. data/app/serializers/alchemy/ingredient_serializer.rb +11 -0
  31. data/app/views/alchemy/admin/elements/update.js.erb +3 -0
  32. data/app/views/alchemy/admin/ingredients/_dom_id_fields.html.erb +4 -0
  33. data/app/views/alchemy/admin/ingredients/_headline_fields.html.erb +3 -0
  34. data/app/views/alchemy/admin/ingredients/_text_fields.html.erb +3 -0
  35. data/app/views/alchemy/admin/ingredients/update.js.erb +7 -0
  36. data/app/views/alchemy/admin/languages/_form.html.erb +1 -1
  37. data/app/views/alchemy/admin/languages/_language.html.erb +1 -1
  38. data/app/views/alchemy/admin/pages/_page_layout_filter.html.erb +1 -1
  39. data/app/views/alchemy/admin/partials/_routes.html.erb +2 -1
  40. data/app/views/alchemy/ingredients/_headline_editor.html.erb +22 -20
  41. data/app/views/alchemy/ingredients/_headline_view.html.erb +1 -0
  42. data/app/views/alchemy/ingredients/_text_editor.html.erb +3 -0
  43. data/app/views/alchemy/ingredients/_text_view.html.erb +7 -3
  44. data/app/views/alchemy/ingredients/shared/_anchor.html.erb +9 -0
  45. data/app/views/alchemy/messages_mailer/contact_form_mail.de.text.erb +2 -0
  46. data/app/views/alchemy/messages_mailer/contact_form_mail.en.text.erb +2 -0
  47. data/app/views/alchemy/messages_mailer/contact_form_mail.es.text.erb +2 -0
  48. data/config/locales/alchemy.en.yml +5 -2
  49. data/config/routes.rb +1 -0
  50. data/lib/alchemy/error_tracking/error_logger.rb +13 -0
  51. data/lib/alchemy/error_tracking.rb +3 -1
  52. data/lib/alchemy/install/tasks.rb +1 -7
  53. data/lib/alchemy/page_layout.rb +0 -113
  54. data/lib/alchemy/test_support/shared_dom_ids_examples.rb +119 -0
  55. data/lib/alchemy/upgrader/tasks/add_page_versions.rb +2 -2
  56. data/lib/alchemy/upgrader/tasks/ingredients_migrator.rb +7 -5
  57. data/lib/alchemy/version.rb +1 -1
  58. data/lib/alchemy.rb +4 -0
  59. data/lib/alchemy_cms.rb +1 -1
  60. data/lib/generators/alchemy/elements/templates/view.html.erb +1 -1
  61. data/lib/generators/alchemy/elements/templates/view.html.haml +1 -1
  62. data/lib/generators/alchemy/elements/templates/view.html.slim +1 -1
  63. data/lib/tasks/alchemy/thumbnails.rake +1 -1
  64. data/package/admin.js +2 -0
  65. data/package/src/ingredient_anchor_link.js +17 -0
  66. data/package.json +2 -2
  67. data/vendor/assets/javascripts/tinymce/tinymce.min.js +2 -2
  68. metadata +32 -6
  69. data/lib/non_stupid_digest_assets.rb +0 -55
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7660ee7a4387ae1ae5293069a13ea8f23be271fe0238366fc11415ede97123b6
4
- data.tar.gz: '0691e8d6635818e96526819efd18325419e1fade8e44b488de68e0553c69097d'
3
+ metadata.gz: d85d573a2ae43f5152d2ae9082b0548f6cd4611b51f73aee187d796a037fb55e
4
+ data.tar.gz: 4d30a22cd1c6945e1fe51fdb68c94d716b623d297c6750643518bb291041fb1a
5
5
  SHA512:
6
- metadata.gz: ed74ebd703752b44d09b583ce5e46eb939936841982683ff613d177ab3bc295246d1cc55cc976c634c3c22d1e8063175709ab0f3ce20046738957daceee9129d
7
- data.tar.gz: 219dd97a18c9a2d784099006277b60b3607f6d635c59559464aa66ba354e368ca642aee211036e4abde42745f73faee9d20ff4ad502123a82c433964443146ec
6
+ metadata.gz: a2381b9af6f92c97955d9415f6d79160cd6940edfa01be10c28ddf7e1166416216e009d903ebf680fc6d788edb6b60f1019f6cbfdc252c1cc8b7829c49369607
7
+ data.tar.gz: 19a66a2d66bf5d34020a3e59a440baeb7d305dde3bc9681eb609cfef7862b58b7628b258683185f0b3fdb49d3abc89d3a0a4b1b40e4a7480129ca93f09980845
@@ -82,9 +82,6 @@ jobs:
82
82
  sudo apt update -qq
83
83
  sudo apt install -qq --fix-missing libmysqlclient-dev -o dir::cache::archives="/home/runner/apt/cache"
84
84
  sudo chown -R runner /home/runner/apt/cache
85
- - uses: actions/setup-node@v3
86
- with:
87
- node-version: 16
88
85
  - name: Restore node modules cache
89
86
  id: yarn-cache
90
87
  uses: actions/cache@v2.1.3
@@ -12,6 +12,8 @@ jobs:
12
12
  - uses: actions/stale@v5
13
13
  with:
14
14
  repo-token: ${{ secrets.GITHUB_TOKEN }}
15
+ days-before-issue-stale: 180
16
+ days-before-close: 30
15
17
  stale-issue-message: |
16
18
  This issue has not seen any activity in a long time.
17
19
  Please create a pull request with a fix or ask someone of the community if they can help.
data/CHANGELOG.md CHANGED
@@ -1,13 +1,42 @@
1
1
  # Changelog
2
2
 
3
- ## 6.0.14 (2023-05-18)
3
+ ## 6.1.0 (2023-01-19)
4
4
 
5
- - [6.0] Do not eager load elements in pages controller [#2474](https://github.com/AlchemyCMS/alchemy_cms/pull/2474) ([tvdeyen](https://github.com/tvdeyen))
5
+ ### Features
6
+
7
+ - Add page layouts repository class option [#2410](https://github.com/AlchemyCMS/alchemy_cms/pull/2410) ([tvdeyen](https://github.com/tvdeyen))
8
+ - Add element definitions repository class option [#2409](https://github.com/AlchemyCMS/alchemy_cms/pull/2409) ([tvdeyen](https://github.com/tvdeyen))
9
+ - Allow to set preview_sources [#2407](https://github.com/AlchemyCMS/alchemy_cms/pull/2407) ([tvdeyen](https://github.com/tvdeyen))
10
+ - Allow to add anchors to ingredients [#2395](https://github.com/AlchemyCMS/alchemy_cms/pull/2395) ([tvdeyen](https://github.com/tvdeyen))
11
+ - Add a error logger exception handler [#2387](https://github.com/AlchemyCMS/alchemy_cms/pull/2387) ([tvdeyen](https://github.com/tvdeyen))
12
+ - Add a element DOM id class [#2373](https://github.com/AlchemyCMS/alchemy_cms/pull/2373) ([tvdeyen](https://github.com/tvdeyen))
13
+
14
+ ### Changes
15
+
16
+ - Remove old jasmine based javascript specs [#2400](https://github.com/AlchemyCMS/alchemy_cms/pull/2400) ([tvdeyen](https://github.com/tvdeyen))
17
+ - Update bundled Tinymce to 4.9.11 [#2399](https://github.com/AlchemyCMS/alchemy_cms/pull/2399) ([tvdeyen](https://github.com/tvdeyen))
18
+ - Add Headline size and level selects as input addons [#2398](https://github.com/AlchemyCMS/alchemy_cms/pull/2398) ([tvdeyen](https://github.com/tvdeyen))
19
+ - Remove Element.available scope [#2372](https://github.com/AlchemyCMS/alchemy_cms/pull/2372) ([tvdeyen](https://github.com/tvdeyen))
20
+ - Remove element_dom_id helper [#2369](https://github.com/AlchemyCMS/alchemy_cms/pull/2369) ([tvdeyen](https://github.com/tvdeyen))
21
+ - Use position for element dom_id [#2368](https://github.com/AlchemyCMS/alchemy_cms/pull/2368) ([tvdeyen](https://github.com/tvdeyen))
22
+ - Disallow deleting pages if still attached to menu node [#2338](https://github.com/AlchemyCMS/alchemy_cms/pull/2338) ([afdev82](https://github.com/afdev82))
6
23
 
7
- ## 6.0.13 (2023-03-29)
24
+ ### Fixes
25
+
26
+ - Add `:contact_form_id` to `messages` params in `messages_controller` [#2403](https://github.com/AlchemyCMS/alchemy_cms/pull/2403) ([chiperific](https://github.com/chiperific))
27
+ - Do not create thumbs for invalid pictures [#2386](https://github.com/AlchemyCMS/alchemy_cms/pull/2386) ([tvdeyen](https://github.com/tvdeyen))
28
+
29
+ ### Misc
8
30
 
9
- - Fix installer: Add seeds file if not exists [#2446](https://github.com/AlchemyCMS/alchemy_cms/pull/2446) ([tvdeyen](https://github.com/tvdeyen))
10
- - Integrate non_stupid_digest_assets gem [#2430](https://github.com/AlchemyCMS/alchemy_cms/pull/2430) ([afdev82](https://github.com/afdev82))
31
+ - [ruby - main] Upgrade sqlite3 to version 1.6.0 [#2408](https://github.com/AlchemyCMS/alchemy_cms/pull/2408) ([depfu](https://github.com/apps/depfu))
32
+ - [ruby - main] Upgrade puma to version 6.0.1 [#2404](https://github.com/AlchemyCMS/alchemy_cms/pull/2404) ([depfu](https://github.com/apps/depfu))
33
+ - CI: Update brakeman scan [#2390](https://github.com/AlchemyCMS/alchemy_cms/pull/2390) ([tvdeyen](https://github.com/tvdeyen))
34
+ - [ruby - main] Upgrade net-imap to version 0.3.1 [#2379](https://github.com/AlchemyCMS/alchemy_cms/pull/2379) ([depfu](https://github.com/apps/depfu))
35
+ - CI: Try ubuntu-latest [#2378](https://github.com/AlchemyCMS/alchemy_cms/pull/2378) ([tvdeyen](https://github.com/tvdeyen))
36
+ - [ruby - main] Upgrade sqlite3 to version 1.5.0 [#2374](https://github.com/AlchemyCMS/alchemy_cms/pull/2374) ([depfu](https://github.com/apps/depfu))
37
+ - [js] Upgrade babel-jest to version 29.0.1 [#2362](https://github.com/AlchemyCMS/alchemy_cms/pull/2362) ([depfu](https://github.com/apps/depfu))
38
+ - Use released Rails gems again for local testing [#2355](https://github.com/AlchemyCMS/alchemy_cms/pull/2355) ([tvdeyen](https://github.com/tvdeyen))
39
+ - [js] Upgrade babel-jest to version 28.0.2 [#2324](https://github.com/AlchemyCMS/alchemy_cms/pull/2324) ([depfu](https://github.com/apps/depfu))
11
40
 
12
41
  ## 6.0.12 (2022-11-19)
13
42
 
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ rails_version = ENV.fetch("RAILS_VERSION", 7.0).to_f
7
7
  gem "rails", "~> #{rails_version}.0"
8
8
 
9
9
  if ENV["DB"].nil? || ENV["DB"] == "sqlite"
10
- gem "sqlite3", "~> 1.4.1"
10
+ gem "sqlite3", "~> 1.6.0"
11
11
  end
12
12
  if ENV["DB"] == "mysql" || ENV["DB"] == "mariadb"
13
13
  gem "mysql2", "~> 0.5.1"
@@ -50,7 +50,7 @@ if Gem.ruby_version >= Gem::Version.new("3.1.0")
50
50
  if rails_version.to_s.match?(/6.1/)
51
51
  # Rails 6.1 needs this as well
52
52
  gem "net-pop", "~> 0.1.0", require: false
53
- gem "net-imap", "~> 0.2.0", require: false
53
+ gem "net-imap", "~> 0.3.1", require: false
54
54
  end
55
55
  gem "net-smtp", "~> 0.3.0", require: false
56
56
  end
data/alchemy_cms.gemspec CHANGED
@@ -45,6 +45,7 @@ Gem::Specification.new do |gem|
45
45
  gem.add_runtime_dependency "jquery-ui-rails", ["~> 6.0"]
46
46
  gem.add_runtime_dependency "kaminari", ["~> 1.1"]
47
47
  gem.add_runtime_dependency "originator", ["~> 3.1"]
48
+ gem.add_runtime_dependency "non-stupid-digest-assets", ["~> 1.0.8"]
48
49
  gem.add_runtime_dependency "ransack", [">= 1.8", "< 4.0"]
49
50
  gem.add_runtime_dependency "request_store", ["~> 1.2"]
50
51
  gem.add_runtime_dependency "responders", [">= 2.0", "< 4.0"]
@@ -57,7 +58,7 @@ Gem::Specification.new do |gem|
57
58
  gem.add_development_dependency "capybara", ["~> 3.0"]
58
59
  gem.add_development_dependency "capybara-screenshot", ["~> 1.0"]
59
60
  gem.add_development_dependency "factory_bot_rails", ["~> 6.0"]
60
- gem.add_development_dependency "puma", ["~> 5.0"]
61
+ gem.add_development_dependency "puma", ["~> 6.0"]
61
62
  gem.add_development_dependency "rails-controller-testing", ["~> 1.0"]
62
63
  gem.add_development_dependency "rspec-activemodel-mocks", ["~> 1.0"]
63
64
  gem.add_development_dependency "rspec-rails", [">= 4.0.0.beta2"]
@@ -100,7 +100,7 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog
100
100
  (data) =>
101
101
  page = data.pages[0]
102
102
  if page
103
- @initElementSelect(page.id)
103
+ @initDomIdSelect(page.id)
104
104
  callback
105
105
  id: page.url_path
106
106
  name: page.name
@@ -116,16 +116,19 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog
116
116
  @$element_anchor.select2('destroy').prop('disabled', true)
117
117
  else
118
118
  @$element_anchor.val('')
119
- @initElementSelect(event.added.page_id)
119
+ @initDomIdSelect(event.added.page_id)
120
120
 
121
- # Initializes the select2 based elements select
121
+ # Initializes the select2 based dom id select
122
122
  # reveals after a page has been selected
123
- initElementSelect: (page_id) ->
124
- $.get Alchemy.routes.api_elements_path, page_id: page_id, (data) =>
123
+ initDomIdSelect: (page_id) ->
124
+ $.get Alchemy.routes.api_ingredients_path, page_id: page_id, (data) =>
125
+ dom_ids = data.ingredients.filter (ingredient) ->
126
+ ingredient.data?.dom_id
127
+ .map (ingredient) ->
128
+ id: ingredient.data.dom_id
129
+ text: "##{ingredient.data.dom_id}"
125
130
  @$element_anchor.prop('disabled', false).removeAttr('placeholder').select2
126
- data: [ id: '', text: Alchemy.t('None') ].concat data.elements.map (element) ->
127
- id: element.dom_id
128
- text: element.display_name
131
+ data: [ id: '', text: Alchemy.t('None') ].concat(dom_ids)
129
132
 
130
133
  # Creates a link if no validation errors are present.
131
134
  # Otherwise shows an error notice.
@@ -238,11 +241,10 @@ class window.Alchemy.LinkDialog extends Alchemy.Dialog
238
241
  # Populates the internal anchors select
239
242
  initAnchorLinks: ->
240
243
  frame = document.getElementById('alchemy_preview_window')
241
- elements = frame.contentDocument?.getElementsByTagName('*') || []
244
+ elements = frame.contentDocument?.querySelectorAll('[id]') || []
242
245
  if elements.length > 0
243
246
  for element in elements
244
- if element.id
245
- @$anchor_link.append("<option value='##{element.id}'>##{element.id}</option>")
247
+ @$anchor_link.append("<option value='##{element.id}'>##{element.id}</option>")
246
248
  else
247
249
  @$anchor_link.html("<option>#{Alchemy.t('No anchors found')}</option>")
248
250
  return
@@ -21,8 +21,10 @@ $anchor-color: $very-dark-orange !default;
21
21
 
22
22
  $body-background-color: $light-gray !default;
23
23
 
24
- $default-font-family: "Open Sans", "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, Tahoma, sans-serif !default;
25
- $mono-font-family: Menlo, Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace !default;
24
+ $default-font-family: "Open Sans", "Lucida Grande", "Lucida Sans Unicode",
25
+ "Lucida Sans", Verdana, Tahoma, sans-serif !default;
26
+ $mono-font-family: Menlo, Monaco, "Bitstream Vera Sans Mono", "Lucida Console",
27
+ Terminal, monospace !default;
26
28
  $base-font-size: 12px !default;
27
29
  $default-font-size: 1em !default;
28
30
  $small-font-size: 0.9em !default;
@@ -44,15 +46,18 @@ $default-border-color: rgba(#afafaf, 0.5) !default;
44
46
  $border-inset-color: lighten($default-border-color, 10%) !default;
45
47
  $default-border-width: 1px !default;
46
48
  $default-border-style: solid !default;
47
- $default-border: $default-border-width $default-border-style $default-border-color !default;
49
+ $default-border: $default-border-width $default-border-style
50
+ $default-border-color !default;
48
51
  $default-border-radius: 3px !default;
49
52
 
50
53
  $form-field-margin: $default-margin 0 !default;
51
54
  $form-field-height: 31px !default;
55
+ $form-field-addon-width: 30px !default;
52
56
  $form-field-background-color: $white !default;
53
57
  $form-field-border-width: $default-border-width !default;
54
58
  $form-field-border-style: $default-border-style !default;
55
- $form-field-border-color: $default-border-color $default-border-color $border-inset-color $border-inset-color !default;
59
+ $form-field-border-color: $default-border-color $default-border-color
60
+ $border-inset-color $border-inset-color !default;
56
61
  $form-field-box-shadow: inset 0px 0 1px $medium-gray !default;
57
62
  $form-field-padding: 0.6em 0.75em !default;
58
63
  $form-field-font-size: $default-font-size !default;
@@ -487,7 +487,7 @@
487
487
  $focus-border-color: $focus-color,
488
488
  $focus-box-shadow: 0 0 0 2px $focus-color
489
489
  );
490
- width: 29px;
490
+ width: $form-field-addon-width;
491
491
  height: $form-field-height;
492
492
 
493
493
  &.disabled,
@@ -601,6 +601,44 @@
601
601
  }
602
602
  }
603
603
 
604
+ .ingredient-editor.headline {
605
+ &.with-level-select {
606
+ input[type="text"] {
607
+ padding-right: $form-field-addon-width + 2 * $default-padding;
608
+ }
609
+
610
+ &.with-anchor {
611
+ input[type="text"] {
612
+ padding-right: 22px + $form-field-addon-width + $default-padding;
613
+ }
614
+ }
615
+ }
616
+
617
+ &.with-size-select {
618
+ input[type="text"] {
619
+ padding-right: $form-field-addon-width + 2 * $default-padding;
620
+ }
621
+
622
+ &.with-anchor {
623
+ input[type="text"] {
624
+ padding-right: 22px + $form-field-addon-width + $default-padding;
625
+ }
626
+ }
627
+
628
+ &.with-level-select {
629
+ input[type="text"] {
630
+ padding-right: 2 * ($form-field-addon-width + $default-padding);
631
+ }
632
+
633
+ &.with-anchor {
634
+ input[type="text"] {
635
+ padding-right: 16px + 2 * ($form-field-addon-width + $default-padding);
636
+ }
637
+ }
638
+ }
639
+ }
640
+ }
641
+
604
642
  .content_editor.essence_audio,
605
643
  .content_editor.essence_file,
606
644
  .content_editor.essence_video,
@@ -690,6 +728,24 @@ select.long {
690
728
  width: 100%;
691
729
  }
692
730
 
731
+ &.linkable {
732
+ input[type="text"] {
733
+ padding-right: 2 * ($form-field-addon-width + $default-padding);
734
+ }
735
+
736
+ &.with-anchor {
737
+ input[type="text"] {
738
+ padding-right: 26px + 2 * ($form-field-addon-width + $default-padding);
739
+ }
740
+ }
741
+ }
742
+
743
+ &.with-anchor {
744
+ input[type="text"] {
745
+ padding-right: 26px;
746
+ }
747
+ }
748
+
693
749
  &.missing {
694
750
  .message {
695
751
  margin: 0;
@@ -936,8 +992,44 @@ textarea.has_tinymce {
936
992
  }
937
993
 
938
994
  .ingredient-date--label,
939
- .essence_date--label {
995
+ .essence_date--label,
996
+ .edit-ingredient-anchor-link {
940
997
  position: absolute;
941
- right: 7px;
942
- top: 37px;
998
+ right: 2 * $default-padding;
999
+ bottom: 15px;
1000
+ margin: 0 !important;
1001
+ }
1002
+
1003
+ .edit-ingredient-anchor-link {
1004
+ right: $default-padding;
1005
+
1006
+ > a {
1007
+ padding: $default-padding;
1008
+ }
1009
+
1010
+ .linkable & {
1011
+ right: 2 * $form-field-addon-width + $default-padding;
1012
+ }
1013
+
1014
+ .with-size-select & {
1015
+ right: $form-field-addon-width + $default-padding;
1016
+ }
1017
+
1018
+ .with-level-select & {
1019
+ right: $form-field-addon-width + $default-padding;
1020
+ }
1021
+
1022
+ .with-level-select.with-size-select & {
1023
+ right: 2 * $form-field-addon-width + $default-padding;
1024
+ }
1025
+ }
1026
+
1027
+ .ingredient-properties-link {
1028
+ position: absolute;
1029
+ right: 2px;
1030
+ bottom: 15px;
1031
+
1032
+ > a {
1033
+ padding: $default-padding;
1034
+ }
943
1035
  }
@@ -1,8 +1,7 @@
1
1
  form {
2
-
3
2
  #main_content > &.alchemy {
4
3
  max-width: 600px;
5
- padding: 2*$default-padding;
4
+ padding: 2 * $default-padding;
6
5
  margin: 2em auto;
7
6
  }
8
7
 
@@ -43,8 +42,8 @@ form {
43
42
  }
44
43
 
45
44
  > .autocomplete_tag_list {
46
-
47
- .select2-container, .select2-choices {
45
+ .select2-container,
46
+ .select2-choices {
48
47
  width: 100%;
49
48
  }
50
49
  }
@@ -81,16 +80,16 @@ form {
81
80
  }
82
81
 
83
82
  &.field_with_errors {
84
-
85
83
  input[type="text"],
86
84
  input[type="email"],
87
85
  input[type="password"],
88
86
  textarea,
89
87
  .select2-choices {
90
- @extend %field-with-error
88
+ @extend %field-with-error;
91
89
  }
92
90
 
93
- .select2-choice, .select2-choices {
91
+ .select2-choice,
92
+ .select2-choices {
94
93
  border-color: $error_border_color;
95
94
  color: $error_text_color;
96
95
  margin-bottom: 4px;
@@ -100,7 +99,9 @@ form {
100
99
  }
101
100
  }
102
101
 
103
- label { color: $error_text_color }
102
+ label {
103
+ color: $error_text_color;
104
+ }
104
105
  }
105
106
 
106
107
  small.error {
@@ -115,27 +116,71 @@ form {
115
116
 
116
117
  &.language_locale small.error {
117
118
  @include form-hint(
118
- $background-color: $error_background_color,
119
- $border-color: $error_border_color
119
+ $background-color: $error_background_color,
120
+ $border-color: $error_border_color
120
121
  );
121
122
  text-align: left;
122
123
  }
123
124
  }
124
125
 
126
+ .input-addon {
127
+ width: $form-field-addon-width;
128
+ position: absolute;
129
+ bottom: 2 * $default-padding;
130
+
131
+ select {
132
+ width: 100%;
133
+ padding: 0 2px;
134
+ text-align: center;
135
+ }
136
+
137
+ &.left {
138
+ left: 0;
139
+
140
+ select {
141
+ border-top-right-radius: 0;
142
+ border-bottom-right-radius: 0;
143
+ }
144
+ }
145
+
146
+ &.right {
147
+ left: unset;
148
+ right: 0;
149
+
150
+ select {
151
+ border-top-left-radius: 0;
152
+ border-bottom-left-radius: 0;
153
+ }
154
+
155
+ &.second {
156
+ left: unset;
157
+ right: $form-field-addon-width;
158
+
159
+ select {
160
+ border-right-width: 0;
161
+ border-top-right-radius: 0;
162
+ border-bottom-right-radius: 0;
163
+ }
164
+ }
165
+ }
166
+ }
167
+
125
168
  .input > .with-hint,
126
169
  .checkbox > .with-hint {
127
170
  cursor: default;
128
171
 
129
- input, textarea {
172
+ input,
173
+ textarea {
130
174
  cursor: not-allowed;
131
175
  }
132
176
  }
133
177
 
134
178
  .inline-input {
135
179
  @include clearfix;
136
- margin: 0 -1*$default-margin;
180
+ margin: 0 -1 * $default-margin;
137
181
 
138
- .left-column, .right-column {
182
+ .left-column,
183
+ .right-column {
139
184
  padding: 0 $default-padding;
140
185
  }
141
186
 
@@ -192,9 +237,7 @@ form {
192
237
  }
193
238
 
194
239
  .input-row {
195
-
196
240
  .input-column {
197
-
198
241
  &:first-of-type {
199
242
  padding-left: 0;
200
243
  }
@@ -212,7 +255,6 @@ textarea#essence_picture_caption {
212
255
 
213
256
  // styles for link overlay selects
214
257
  .window_form {
215
-
216
258
  td.checkbox {
217
259
  text-align: left;
218
260
  }
@@ -224,5 +266,5 @@ textarea#essence_picture_caption {
224
266
 
225
267
  .input-column > label {
226
268
  display: block;
227
- margin-top: $default-margin +1;
269
+ margin-top: $default-margin + 1;
228
270
  }
@@ -30,7 +30,7 @@ td,th {
30
30
 
31
31
  .mce-object {
32
32
  border: 1px dotted #3a3a3a;
33
- background: #d5d5d5 url('tinymce/skins/alchemy/fonts/img/object.gif') no-repeat center;
33
+ background: #d5d5d5 url('tinymce/skins/alchemy/img/object.gif') no-repeat center;
34
34
  }
35
35
 
36
36
  .mce-pagebreak {
@@ -55,7 +55,7 @@ td,th {
55
55
  width: 9px!important;
56
56
  height: 9px!important;
57
57
  border: 1px dotted #3a3a3a;
58
- background: #d5d5d5 url('tinymce/skins/alchemy/fonts/img/anchor.gif') no-repeat center;
58
+ background: #d5d5d5 url('tinymce/skins/alchemy/img/anchor.gif') no-repeat center;
59
59
  }
60
60
 
61
61
  .mce-nbsp {
@@ -77,7 +77,7 @@ hr {
77
77
  }
78
78
 
79
79
  .mce-spellchecker-word {
80
- background: url('tinymce/skins/alchemy/fonts/img/wline.gif') repeat-x bottom left;
80
+ background: url('tinymce/skins/alchemy/img/wline.gif') repeat-x bottom left;
81
81
  cursor: default;
82
82
  }
83
83
 
@@ -19,7 +19,7 @@ module Alchemy
19
19
  private
20
20
 
21
21
  def ingredient_params
22
- params.require(:ingredient).permit(@ingredient.class.stored_attributes[:data])
22
+ params[:ingredient]&.permit(@ingredient.class.stored_attributes[:data]) || {}
23
23
  end
24
24
 
25
25
  def load_croppable_resource
@@ -78,9 +78,9 @@ module Alchemy
78
78
 
79
79
  def new
80
80
  @page ||= Page.new(layoutpage: params[:layoutpage] == "true", parent_id: params[:parent_id])
81
- @page_layouts = PageLayout.layouts_for_select(@current_language.id, @page.layoutpage?)
81
+ @page_layouts = Page.layouts_for_select(@current_language.id, layoutpages: @page.layoutpage?)
82
82
  @clipboard = get_clipboard("pages")
83
- @clipboard_items = Page.all_from_clipboard_for_select(@clipboard, @current_language.id, @page.layoutpage?)
83
+ @clipboard_items = Page.all_from_clipboard_for_select(@clipboard, @current_language.id, layoutpages: @page.layoutpage?)
84
84
  end
85
85
 
86
86
  def create
@@ -398,7 +398,7 @@ module Alchemy
398
398
  def load_languages_and_layouts
399
399
  @language = @current_language
400
400
  @languages_with_page_tree = Language.on_current_site.with_root_page
401
- @page_layouts = PageLayout.layouts_for_select(@language.id)
401
+ @page_layouts = Page.layouts_for_select(@language.id)
402
402
  end
403
403
 
404
404
  def set_preview_mode
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alchemy
4
+ class Api::IngredientsController < Api::BaseController
5
+ # Returns all ingredients as json object
6
+ #
7
+ # You can either load all or only these for :element_id or :page_id param
8
+ #
9
+ def index
10
+ @ingredients = Alchemy::Ingredient.accessible_by(current_ability, :index)
11
+
12
+ if params[:page_id].present?
13
+ @ingredients = @ingredients
14
+ .where(alchemy_page_versions: { page_id: params[:page_id] })
15
+ .merge(Alchemy::PageVersion.drafts)
16
+ .joins(element: :page_version)
17
+ end
18
+
19
+ render json: @ingredients, adapter: :json, root: "ingredients"
20
+ end
21
+ end
22
+ end
@@ -124,7 +124,7 @@ module Alchemy
124
124
  end
125
125
 
126
126
  def message_params
127
- params.require(:message).permit(*mailer_config["fields"])
127
+ params.require(:message).permit(*mailer_config["fields"], :contact_form_id)
128
128
  end
129
129
  end
130
130
  end
@@ -104,7 +104,14 @@ module Alchemy
104
104
  # If no index page and no admin users are present we show the "Welcome to Alchemy" page.
105
105
  #
106
106
  def load_index_page
107
- @page ||= Language.current_root_page
107
+ @page ||= begin
108
+ Alchemy::Page.
109
+ contentpages.
110
+ language_roots.
111
+ where(language: Language.current).
112
+ includes(page_includes).
113
+ first
114
+ end
108
115
  render template: "alchemy/welcome", layout: false if signup_required?
109
116
  end
110
117
 
@@ -120,10 +127,13 @@ module Alchemy
120
127
  def load_page
121
128
  page_not_found! unless Language.current
122
129
 
123
- @page ||= Language.current.pages.contentpages.find_by(
124
- urlname: params[:urlname],
125
- language_code: params[:locale] || Language.current.code,
126
- )
130
+ @page ||= begin
131
+ Alchemy::Page.
132
+ contentpages.
133
+ where(language: Language.current).
134
+ includes(page_includes).
135
+ find_by(urlname: params[:urlname])
136
+ end
127
137
  end
128
138
 
129
139
  def enforce_locale
@@ -234,5 +244,9 @@ module Alchemy
234
244
  def page_not_found!
235
245
  not_found_error!("Alchemy::Page not found \"#{request.fullpath}\"")
236
246
  end
247
+
248
+ def page_includes
249
+ Alchemy::EagerLoading.page_includes(version: :public_version)
250
+ end
237
251
  end
238
252
  end
@@ -36,6 +36,10 @@ module Alchemy
36
36
  "ingredient-editor",
37
37
  partial_name,
38
38
  deprecated? ? "deprecated" : nil,
39
+ respond_to?(:level_options) && level_options.many? ? "with-level-select" : nil,
40
+ respond_to?(:size_options) && size_options.many? ? "with-size-select" : nil,
41
+ settings[:linkable] ? "linkable" : nil,
42
+ settings[:anchor] ? "with-anchor" : nil,
39
43
  ].compact
40
44
  end
41
45
 
@@ -166,14 +166,6 @@ module Alchemy
166
166
  render "alchemy/elements/view_not_found", name: element.name
167
167
  end
168
168
 
169
- # Returns a string for the id attribute of a html element for the given element
170
- # @deprecated
171
- def element_dom_id(element)
172
- element&.dom_id
173
- end
174
-
175
- deprecate element_dom_id: "element.dom_id", deprecator: Alchemy::Deprecation
176
-
177
169
  # Renders the HTML tag attributes required for preview mode.
178
170
  def element_preview_code(element)
179
171
  tag_builder.tag_options(element_preview_code_attributes(element))
@@ -33,13 +33,5 @@ module Alchemy
33
33
  def download_alchemy_attachment_url(attachment)
34
34
  alchemy.download_attachment_url(attachment, attachment.slug)
35
35
  end
36
-
37
- # Returns the full url containing host, page and anchor for the given element
38
- # @deprecated
39
- def full_url_for_element(element)
40
- "#{current_server}/#{element.page.urlname}##{element.dom_id}"
41
- end
42
-
43
- deprecate :full_url_for_element, deprecator: Alchemy::Deprecation
44
36
  end
45
37
  end