alchemy_cms 6.0.11 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) 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 +46 -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/elements_helper.rb +0 -8
  19. data/app/helpers/alchemy/url_helper.rb +0 -8
  20. data/app/models/alchemy/attachment/url.rb +1 -0
  21. data/app/models/alchemy/element/definitions.rb +16 -2
  22. data/app/models/alchemy/element/dom_id.rb +30 -0
  23. data/app/models/alchemy/element/presenters.rb +1 -1
  24. data/app/models/alchemy/element.rb +12 -3
  25. data/app/models/alchemy/ingredients/headline.rb +4 -1
  26. data/app/models/alchemy/ingredients/text.rb +3 -0
  27. data/app/models/alchemy/page/page_layouts.rb +128 -0
  28. data/app/models/alchemy/page.rb +4 -2
  29. data/app/models/alchemy/picture_thumb/create.rb +15 -3
  30. data/app/models/concerns/alchemy/dom_ids.rb +32 -0
  31. data/app/serializers/alchemy/ingredient_serializer.rb +11 -0
  32. data/app/views/alchemy/admin/elements/update.js.erb +3 -0
  33. data/app/views/alchemy/admin/ingredients/_dom_id_fields.html.erb +4 -0
  34. data/app/views/alchemy/admin/ingredients/_headline_fields.html.erb +3 -0
  35. data/app/views/alchemy/admin/ingredients/_text_fields.html.erb +3 -0
  36. data/app/views/alchemy/admin/ingredients/update.js.erb +7 -0
  37. data/app/views/alchemy/admin/languages/_form.html.erb +1 -1
  38. data/app/views/alchemy/admin/languages/_language.html.erb +1 -1
  39. data/app/views/alchemy/admin/pages/_page_layout_filter.html.erb +1 -1
  40. data/app/views/alchemy/admin/partials/_routes.html.erb +2 -1
  41. data/app/views/alchemy/ingredients/_headline_editor.html.erb +22 -20
  42. data/app/views/alchemy/ingredients/_headline_view.html.erb +1 -0
  43. data/app/views/alchemy/ingredients/_text_editor.html.erb +3 -0
  44. data/app/views/alchemy/ingredients/_text_view.html.erb +7 -3
  45. data/app/views/alchemy/ingredients/shared/_anchor.html.erb +9 -0
  46. data/app/views/alchemy/messages_mailer/contact_form_mail.de.text.erb +2 -0
  47. data/app/views/alchemy/messages_mailer/contact_form_mail.en.text.erb +2 -0
  48. data/app/views/alchemy/messages_mailer/contact_form_mail.es.text.erb +2 -0
  49. data/config/locales/alchemy.en.yml +5 -2
  50. data/config/routes.rb +1 -0
  51. data/lib/alchemy/error_tracking/error_logger.rb +13 -0
  52. data/lib/alchemy/error_tracking.rb +3 -1
  53. data/lib/alchemy/install/tasks.rb +1 -3
  54. data/lib/alchemy/modules.rb +2 -2
  55. data/lib/alchemy/page_layout.rb +0 -113
  56. data/lib/alchemy/test_support/shared_dom_ids_examples.rb +119 -0
  57. data/lib/alchemy/upgrader/tasks/add_page_versions.rb +2 -2
  58. data/lib/alchemy/upgrader/tasks/ingredients_migrator.rb +7 -5
  59. data/lib/alchemy/version.rb +1 -1
  60. data/lib/alchemy.rb +4 -0
  61. data/lib/generators/alchemy/elements/templates/view.html.erb +1 -1
  62. data/lib/generators/alchemy/elements/templates/view.html.haml +1 -1
  63. data/lib/generators/alchemy/elements/templates/view.html.slim +1 -1
  64. data/lib/generators/alchemy/install/install_generator.rb +27 -3
  65. data/lib/generators/alchemy/module/templates/ability.rb.tt +2 -3
  66. data/lib/generators/alchemy/module/templates/module_config.rb.tt +16 -14
  67. data/lib/tasks/alchemy/thumbnails.rake +1 -1
  68. data/package/admin.js +2 -0
  69. data/package/src/ingredient_anchor_link.js +17 -0
  70. data/package.json +2 -2
  71. data/vendor/assets/javascripts/tinymce/tinymce.min.js +2 -2
  72. metadata +18 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc9b537e2e01fab999228f1a8813bbd0c905d521639eeeb1413021c70e5add7e
4
- data.tar.gz: 6d93f0bb79d91d05a6cda0d9a1f6697fada5cd2de30bc11b7e5c879f98ebd1a4
3
+ metadata.gz: d85d573a2ae43f5152d2ae9082b0548f6cd4611b51f73aee187d796a037fb55e
4
+ data.tar.gz: 4d30a22cd1c6945e1fe51fdb68c94d716b623d297c6750643518bb291041fb1a
5
5
  SHA512:
6
- metadata.gz: 9640f98ba68fb3b85dcdf7edb966911eb148448838259981576f0f5da1e8a6511b2adf6c72753c5396b13ae7d3d42776ac160db9e5793b6b34f4cb5296e28910
7
- data.tar.gz: 59ab7f7c6097b79df1971212cae17cc587aadb93338b8e7a8131dfdea73756bb3e0ec0b5fd68726769b829e326b346bd0ce9832764bd613af131a4b21dfb8a76
6
+ metadata.gz: a2381b9af6f92c97955d9415f6d79160cd6940edfa01be10c28ddf7e1166416216e009d903ebf680fc6d788edb6b60f1019f6cbfdc252c1cc8b7829c49369607
7
+ data.tar.gz: 19a66a2d66bf5d34020a3e59a440baeb7d305dde3bc9681eb609cfef7862b58b7628b258683185f0b3fdb49d3abc89d3a0a4b1b40e4a7480129ca93f09980845
@@ -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,49 @@
1
+ # Changelog
2
+
3
+ ## 6.1.0 (2023-01-19)
4
+
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))
23
+
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
30
+
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))
40
+
41
+ ## 6.0.12 (2022-11-19)
42
+
43
+ - More installer options [#2385](https://github.com/AlchemyCMS/alchemy_cms/pull/2385) ([tvdeyen](https://github.com/tvdeyen))
44
+ - Fix custom module installer [#2384](https://github.com/AlchemyCMS/alchemy_cms/pull/2384) ([tvdeyen](https://github.com/tvdeyen))
45
+ - Always provide format with attachment URLs [#2383](https://github.com/AlchemyCMS/alchemy_cms/pull/2383) ([mamhoff](https://github.com/mamhoff))
46
+
1
47
  ## 6.0.11 (2022-09-22)
2
48
 
3
49
  - Do not touch pages when toggling element [#2377](https://github.com/AlchemyCMS/alchemy_cms/pull/2377) ([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
 
@@ -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))