alchemy_cms 6.0.12 → 6.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/brakeman-analysis.yml +26 -26
  3. data/.github/workflows/ci.yml +1 -1
  4. data/.github/workflows/stale.yml +2 -0
  5. data/CHANGELOG.md +45 -0
  6. data/Gemfile +2 -2
  7. data/alchemy_cms.gemspec +1 -1
  8. data/app/assets/javascripts/alchemy/alchemy.link_dialog.js.coffee +13 -11
  9. data/app/assets/stylesheets/alchemy/_variables.scss +9 -4
  10. data/app/assets/stylesheets/alchemy/elements.scss +96 -4
  11. data/app/assets/stylesheets/alchemy/forms.scss +59 -17
  12. data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +3 -3
  13. data/app/controllers/alchemy/admin/ingredients_controller.rb +1 -1
  14. data/app/controllers/alchemy/admin/pages_controller.rb +3 -3
  15. data/app/controllers/alchemy/api/ingredients_controller.rb +22 -0
  16. data/app/controllers/alchemy/messages_controller.rb +1 -1
  17. data/app/decorators/alchemy/ingredient_editor.rb +4 -0
  18. data/app/helpers/alchemy/url_helper.rb +0 -8
  19. data/app/models/alchemy/element/definitions.rb +16 -2
  20. data/app/models/alchemy/element/dom_id.rb +30 -0
  21. data/app/models/alchemy/element/element_contents.rb +39 -0
  22. data/app/models/alchemy/element/element_essences.rb +9 -1
  23. data/app/models/alchemy/element/element_ingredients.rb +7 -0
  24. data/app/models/alchemy/element/presenters.rb +1 -1
  25. data/app/models/alchemy/element.rb +14 -0
  26. data/app/models/alchemy/ingredients/headline.rb +4 -1
  27. data/app/models/alchemy/ingredients/text.rb +3 -0
  28. data/app/models/alchemy/page/page_layouts.rb +128 -0
  29. data/app/models/alchemy/page.rb +5 -2
  30. data/app/models/alchemy/picture_thumb/create.rb +15 -3
  31. data/app/models/concerns/alchemy/dom_ids.rb +32 -0
  32. data/app/serializers/alchemy/ingredient_serializer.rb +11 -0
  33. data/app/views/alchemy/admin/elements/update.js.erb +3 -0
  34. data/app/views/alchemy/admin/ingredients/_dom_id_fields.html.erb +4 -0
  35. data/app/views/alchemy/admin/ingredients/_headline_fields.html.erb +3 -0
  36. data/app/views/alchemy/admin/ingredients/_text_fields.html.erb +3 -0
  37. data/app/views/alchemy/admin/ingredients/update.js.erb +7 -0
  38. data/app/views/alchemy/admin/languages/_form.html.erb +1 -1
  39. data/app/views/alchemy/admin/languages/_language.html.erb +1 -1
  40. data/app/views/alchemy/admin/pages/_form.html.erb +9 -0
  41. data/app/views/alchemy/admin/pages/_page_layout_filter.html.erb +1 -1
  42. data/app/views/alchemy/admin/partials/_routes.html.erb +2 -1
  43. data/app/views/alchemy/ingredients/_headline_editor.html.erb +22 -20
  44. data/app/views/alchemy/ingredients/_headline_view.html.erb +1 -0
  45. data/app/views/alchemy/ingredients/_text_editor.html.erb +3 -0
  46. data/app/views/alchemy/ingredients/_text_view.html.erb +7 -3
  47. data/app/views/alchemy/ingredients/shared/_anchor.html.erb +9 -0
  48. data/app/views/alchemy/messages_mailer/contact_form_mail.de.text.erb +2 -0
  49. data/app/views/alchemy/messages_mailer/contact_form_mail.en.text.erb +2 -0
  50. data/app/views/alchemy/messages_mailer/contact_form_mail.es.text.erb +2 -0
  51. data/config/locales/alchemy.en.yml +7 -2
  52. data/config/routes.rb +1 -0
  53. data/db/migrate/20230123112425_add_searchable_to_alchemy_pages.rb +9 -0
  54. data/lib/alchemy/deprecation.rb +1 -1
  55. data/lib/alchemy/error_tracking/error_logger.rb +13 -0
  56. data/lib/alchemy/error_tracking.rb +3 -1
  57. data/lib/alchemy/page_layout.rb +0 -113
  58. data/lib/alchemy/test_support/shared_dom_ids_examples.rb +119 -0
  59. data/lib/alchemy/upgrader/tasks/ingredients_migrator.rb +7 -5
  60. data/lib/alchemy/version.rb +1 -1
  61. data/lib/alchemy.rb +17 -0
  62. data/package/admin.js +2 -0
  63. data/package/src/ingredient_anchor_link.js +17 -0
  64. data/package.json +2 -2
  65. data/vendor/assets/javascripts/tinymce/tinymce.min.js +2 -2
  66. metadata +19 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 706ea8d8bb121be924f467a6d367104dae78cf131a1a86bca33c08c75f377239
4
- data.tar.gz: 8e8d3603be2b6b507c39a010b6231b2b3b753babb6556453741258699635a400
3
+ metadata.gz: 143bb006641791929e37a72fd82d200d10084c85e9685934776e54dc61e08f58
4
+ data.tar.gz: 2a8a82d5f452822f394ee9af1d55eca46efa4772a269e09583de154addc8be5f
5
5
  SHA512:
6
- metadata.gz: 00b2766205aba938284f4fef79e6d7e00c1271c243ab4b50faa63dff68e11cb47c2029bc4afd20f57c917966429083328a0ab9a3629ab9ede810793b60aa036a
7
- data.tar.gz: ecfbc1794df353099fd1ec2454275c55d09c9521cb85591258f67707ed2cf6dc72f287ca99135373783710def1df11a3302066f51935772bcf84c56d94a8ba98
6
+ metadata.gz: fd987d8e08a1813c1f6b3ae50904910e1cb8c60c2a1a0ad5906ef9b0cdd3a233c71871e7c3b6b00f10b5caa8f56169c060cd61f03a1f0231b8ae85d7b1ff44b6
7
+ data.tar.gz: 9dae2d9dabe3c81da44d17ddfc4ddb8713a328927e07caef81d6c42aba2445a9854262fa12f55f74e3cd11960197ed183bbb898a363c7ff9b3dd5ef175b91743
@@ -5,42 +5,42 @@ name: Brakeman Scan
5
5
 
6
6
  on:
7
7
  push:
8
- branches: [ main ]
8
+ branches: [main]
9
9
  pull_request:
10
10
  # The branches below must be a subset of the branches above
11
- branches: [ main ]
11
+ branches: [main]
12
12
  schedule:
13
- - cron: '40 4 * * 2'
13
+ - cron: "40 4 * * 2"
14
14
 
15
15
  jobs:
16
16
  brakeman-scan:
17
17
  name: Brakeman Scan
18
18
  runs-on: ubuntu-latest
19
19
  steps:
20
- # Checkout the repository to the GitHub Actions runner
21
- - name: Checkout
22
- uses: actions/checkout@v2
20
+ # Checkout the repository to the GitHub Actions runner
21
+ - name: Checkout
22
+ uses: actions/checkout@v2
23
23
 
24
- # Customize the ruby version depending on your needs
25
- - name: Setup Ruby
26
- uses: actions/setup-ruby@v1
27
- with:
28
- ruby-version: '2.7'
24
+ # Customize the ruby version depending on your needs
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: "3.0"
29
29
 
30
- - name: Setup Brakeman
31
- env:
32
- BRAKEMAN_VERSION: '4.10' # SARIF support is provided in Brakeman version 4.10+
33
- run: |
34
- gem install brakeman --version $BRAKEMAN_VERSION
30
+ - name: Setup Brakeman
31
+ env:
32
+ BRAKEMAN_VERSION: "5.4" # SARIF support is provided in Brakeman version 4.10+
33
+ run: |
34
+ gem install brakeman --version $BRAKEMAN_VERSION
35
35
 
36
- # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
37
- - name: Scan
38
- continue-on-error: true
39
- run: |
40
- brakeman -f sarif -o output.sarif.json .
36
+ # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
37
+ - name: Scan
38
+ continue-on-error: true
39
+ run: |
40
+ brakeman -f sarif -o output.sarif.json .
41
41
 
42
- # Upload the SARIF file generated in the previous step
43
- - name: Upload SARIF
44
- uses: github/codeql-action/upload-sarif@v1
45
- with:
46
- sarif_file: output.sarif.json
42
+ # Upload the SARIF file generated in the previous step
43
+ - name: Upload SARIF
44
+ uses: github/codeql-action/upload-sarif@v1
45
+ with:
46
+ sarif_file: output.sarif.json
@@ -4,7 +4,7 @@ on: [push, pull_request]
4
4
 
5
5
  jobs:
6
6
  RSpec:
7
- runs-on: ubuntu-18.04
7
+ runs-on: ubuntu-latest
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
@@ -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,3 +1,48 @@
1
+ # Changelog
2
+
3
+ ## 6.1.1 (2023-01-23)
4
+
5
+ - Re-introduce deleted methods [#2422](https://github.com/AlchemyCMS/alchemy_cms/pull/2422) ([tvdeyen](https://github.com/tvdeyen))
6
+ - Add searchable field to page (Alchemy 6.1) [#2420](https://github.com/AlchemyCMS/alchemy_cms/pull/2420) ([kulturbande](https://github.com/kulturbande))
7
+
8
+ ## 6.1.0 (2023-01-19)
9
+
10
+ ### Features
11
+
12
+ - Add page layouts repository class option [#2410](https://github.com/AlchemyCMS/alchemy_cms/pull/2410) ([tvdeyen](https://github.com/tvdeyen))
13
+ - Add element definitions repository class option [#2409](https://github.com/AlchemyCMS/alchemy_cms/pull/2409) ([tvdeyen](https://github.com/tvdeyen))
14
+ - Allow to set preview_sources [#2407](https://github.com/AlchemyCMS/alchemy_cms/pull/2407) ([tvdeyen](https://github.com/tvdeyen))
15
+ - Allow to add anchors to ingredients [#2395](https://github.com/AlchemyCMS/alchemy_cms/pull/2395) ([tvdeyen](https://github.com/tvdeyen))
16
+ - Add a error logger exception handler [#2387](https://github.com/AlchemyCMS/alchemy_cms/pull/2387) ([tvdeyen](https://github.com/tvdeyen))
17
+ - Add a element DOM id class [#2373](https://github.com/AlchemyCMS/alchemy_cms/pull/2373) ([tvdeyen](https://github.com/tvdeyen))
18
+
19
+ ### Changes
20
+
21
+ - Remove old jasmine based javascript specs [#2400](https://github.com/AlchemyCMS/alchemy_cms/pull/2400) ([tvdeyen](https://github.com/tvdeyen))
22
+ - Update bundled Tinymce to 4.9.11 [#2399](https://github.com/AlchemyCMS/alchemy_cms/pull/2399) ([tvdeyen](https://github.com/tvdeyen))
23
+ - Add Headline size and level selects as input addons [#2398](https://github.com/AlchemyCMS/alchemy_cms/pull/2398) ([tvdeyen](https://github.com/tvdeyen))
24
+ - Remove Element.available scope [#2372](https://github.com/AlchemyCMS/alchemy_cms/pull/2372) ([tvdeyen](https://github.com/tvdeyen))
25
+ - Remove element_dom_id helper [#2369](https://github.com/AlchemyCMS/alchemy_cms/pull/2369) ([tvdeyen](https://github.com/tvdeyen))
26
+ - Use position for element dom_id [#2368](https://github.com/AlchemyCMS/alchemy_cms/pull/2368) ([tvdeyen](https://github.com/tvdeyen))
27
+ - Disallow deleting pages if still attached to menu node [#2338](https://github.com/AlchemyCMS/alchemy_cms/pull/2338) ([afdev82](https://github.com/afdev82))
28
+
29
+ ### Fixes
30
+
31
+ - Add `:contact_form_id` to `messages` params in `messages_controller` [#2403](https://github.com/AlchemyCMS/alchemy_cms/pull/2403) ([chiperific](https://github.com/chiperific))
32
+ - Do not create thumbs for invalid pictures [#2386](https://github.com/AlchemyCMS/alchemy_cms/pull/2386) ([tvdeyen](https://github.com/tvdeyen))
33
+
34
+ ### Misc
35
+
36
+ - [ruby - main] Upgrade sqlite3 to version 1.6.0 [#2408](https://github.com/AlchemyCMS/alchemy_cms/pull/2408) ([depfu](https://github.com/apps/depfu))
37
+ - [ruby - main] Upgrade puma to version 6.0.1 [#2404](https://github.com/AlchemyCMS/alchemy_cms/pull/2404) ([depfu](https://github.com/apps/depfu))
38
+ - CI: Update brakeman scan [#2390](https://github.com/AlchemyCMS/alchemy_cms/pull/2390) ([tvdeyen](https://github.com/tvdeyen))
39
+ - [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))
40
+ - CI: Try ubuntu-latest [#2378](https://github.com/AlchemyCMS/alchemy_cms/pull/2378) ([tvdeyen](https://github.com/tvdeyen))
41
+ - [ruby - main] Upgrade sqlite3 to version 1.5.0 [#2374](https://github.com/AlchemyCMS/alchemy_cms/pull/2374) ([depfu](https://github.com/apps/depfu))
42
+ - [js] Upgrade babel-jest to version 29.0.1 [#2362](https://github.com/AlchemyCMS/alchemy_cms/pull/2362) ([depfu](https://github.com/apps/depfu))
43
+ - Use released Rails gems again for local testing [#2355](https://github.com/AlchemyCMS/alchemy_cms/pull/2355) ([tvdeyen](https://github.com/tvdeyen))
44
+ - [js] Upgrade babel-jest to version 28.0.2 [#2324](https://github.com/AlchemyCMS/alchemy_cms/pull/2324) ([depfu](https://github.com/apps/depfu))
45
+
1
46
  ## 6.0.12 (2022-11-19)
2
47
 
3
48
  - More installer options [#2385](https://github.com/AlchemyCMS/alchemy_cms/pull/2385) ([tvdeyen](https://github.com/tvdeyen))
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
@@ -58,7 +58,7 @@ Gem::Specification.new do |gem|
58
58
  gem.add_development_dependency "capybara", ["~> 3.0"]
59
59
  gem.add_development_dependency "capybara-screenshot", ["~> 1.0"]
60
60
  gem.add_development_dependency "factory_bot_rails", ["~> 6.0"]
61
- gem.add_development_dependency "puma", ["~> 5.0"]
61
+ gem.add_development_dependency "puma", ["~> 6.0"]
62
62
  gem.add_development_dependency "rails-controller-testing", ["~> 1.0"]
63
63
  gem.add_development_dependency "rspec-activemodel-mocks", ["~> 1.0"]
64
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
@@ -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
 
@@ -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