alchemy_cms 6.0.0.b1 → 6.0.0.pre.b5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -0
  3. data/README.md +14 -2
  4. data/Rakefile +37 -23
  5. data/alchemy_cms.gemspec +1 -1
  6. data/app/assets/stylesheets/alchemy/_extends.scss +15 -2
  7. data/app/assets/stylesheets/alchemy/archive.scss +16 -1
  8. data/app/assets/stylesheets/alchemy/fonts.scss +0 -0
  9. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.svg +0 -0
  10. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.ttf +0 -0
  11. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce-small.woff +0 -0
  12. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.svg +0 -0
  13. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.ttf +0 -0
  14. data/app/assets/stylesheets/tinymce/skins/alchemy/fonts/tinymce.woff +0 -0
  15. data/app/assets/stylesheets/tinymce/skins/alchemy/img/anchor.gif +0 -0
  16. data/app/assets/stylesheets/tinymce/skins/alchemy/img/loader.gif +0 -0
  17. data/app/assets/stylesheets/tinymce/skins/alchemy/img/object.gif +0 -0
  18. data/app/assets/stylesheets/tinymce/skins/alchemy/img/trans.gif +0 -0
  19. data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +0 -0
  20. data/app/controllers/alchemy/admin/attachments_controller.rb +3 -3
  21. data/app/controllers/alchemy/admin/elements_controller.rb +1 -0
  22. data/app/controllers/alchemy/admin/pages_controller.rb +1 -9
  23. data/app/controllers/alchemy/admin/pictures_controller.rb +21 -8
  24. data/app/controllers/alchemy/admin/resources_controller.rb +84 -10
  25. data/app/controllers/alchemy/api/elements_controller.rb +12 -8
  26. data/app/controllers/alchemy/api/pages_controller.rb +4 -2
  27. data/app/decorators/alchemy/element_editor.rb +7 -4
  28. data/app/decorators/alchemy/ingredient_editor.rb +5 -1
  29. data/app/helpers/alchemy/elements_block_helper.rb +14 -6
  30. data/app/models/alchemy/attachment.rb +24 -7
  31. data/app/models/alchemy/element/element_essences.rb +14 -3
  32. data/app/models/alchemy/element/element_ingredients.rb +11 -3
  33. data/app/models/alchemy/element/presenters.rb +18 -1
  34. data/app/models/alchemy/element.rb +0 -14
  35. data/app/models/alchemy/ingredient.rb +21 -62
  36. data/app/models/alchemy/page/page_natures.rb +1 -10
  37. data/app/models/alchemy/page/page_scopes.rb +4 -0
  38. data/app/models/alchemy/page.rb +13 -4
  39. data/app/models/alchemy/page_version.rb +1 -1
  40. data/app/models/alchemy/picture.rb +14 -38
  41. data/app/views/alchemy/admin/attachments/_archive_overlay.html.erb +1 -1
  42. data/app/views/alchemy/admin/attachments/index.html.erb +2 -3
  43. data/app/views/alchemy/admin/elements/create.js.erb +1 -1
  44. data/app/views/alchemy/admin/elements/destroy.js.erb +1 -3
  45. data/app/views/alchemy/admin/elements/fold.js.erb +2 -2
  46. data/app/views/alchemy/admin/elements/update.js.erb +1 -1
  47. data/app/views/alchemy/admin/pages/_toolbar.html.erb +1 -1
  48. data/app/views/alchemy/admin/pages/edit.html.erb +1 -1
  49. data/app/views/alchemy/admin/pages/index.html.erb +2 -9
  50. data/app/views/alchemy/admin/partials/_search_form.html.erb +9 -0
  51. data/app/views/alchemy/admin/pictures/_archive.html.erb +1 -1
  52. data/app/views/alchemy/admin/pictures/_archive_overlay.html.erb +1 -1
  53. data/app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb +4 -2
  54. data/app/views/alchemy/admin/pictures/index.html.erb +8 -3
  55. data/app/views/alchemy/admin/resources/_filter.html.erb +12 -0
  56. data/app/views/alchemy/admin/resources/_filter_bar.html.erb +14 -17
  57. data/app/views/alchemy/admin/resources/_form.html.erb +2 -0
  58. data/app/views/alchemy/admin/resources/_table_header.html.erb +15 -0
  59. data/app/views/alchemy/admin/resources/index.html.erb +3 -11
  60. data/app/views/alchemy/ingredients/_boolean_editor.html.erb +1 -1
  61. data/app/views/alchemy/ingredients/_file_editor.html.erb +3 -1
  62. data/app/views/alchemy/ingredients/_headline_editor.html.erb +1 -1
  63. data/app/views/alchemy/ingredients/_html_editor.html.erb +1 -1
  64. data/app/views/alchemy/ingredients/_link_editor.html.erb +8 -8
  65. data/app/views/alchemy/ingredients/_node_editor.html.erb +1 -0
  66. data/app/views/alchemy/ingredients/_page_editor.html.erb +1 -0
  67. data/app/views/alchemy/ingredients/_picture_editor.html.erb +7 -6
  68. data/app/views/alchemy/ingredients/_select_editor.html.erb +1 -0
  69. data/app/views/alchemy/ingredients/_text_editor.html.erb +5 -4
  70. data/config/locales/alchemy.en.yml +85 -49
  71. data/lib/alchemy/forms/builder.rb +21 -1
  72. data/lib/alchemy/resource_filter.rb +40 -0
  73. data/lib/alchemy/resources_helper.rb +1 -16
  74. data/lib/alchemy/test_support/shared_ingredient_examples.rb +21 -4
  75. data/lib/alchemy/tinymce.rb +4 -0
  76. data/lib/alchemy/upgrader/tasks/ingredients_migrator.rb +18 -7
  77. data/lib/alchemy/version.rb +1 -1
  78. data/lib/alchemy_cms.rb +1 -0
  79. data/lib/generators/alchemy/menus/templates/node.html.erb +1 -1
  80. data/lib/generators/alchemy/menus/templates/node.html.haml +1 -1
  81. data/lib/generators/alchemy/menus/templates/node.html.slim +1 -1
  82. data/lib/generators/alchemy/menus/templates/wrapper.html.erb +1 -1
  83. data/lib/generators/alchemy/menus/templates/wrapper.html.haml +1 -1
  84. data/lib/generators/alchemy/menus/templates/wrapper.html.slim +1 -1
  85. data/package.json +1 -1
  86. metadata +7 -7
  87. data/app/views/alchemy/admin/attachments/_filter_bar.html.erb +0 -29
  88. data/app/views/alchemy/admin/pictures/_filter_bar.html.erb +0 -30
@@ -34,6 +34,10 @@ module Alchemy
34
34
  @@init
35
35
  end
36
36
 
37
+ def custom_configs_present?(page)
38
+ custom_config_contents(page).any? || custom_config_ingredients(page).any?
39
+ end
40
+
37
41
  def custom_config_contents(page)
38
42
  content_definitions_from_elements(page.descendent_element_definitions)
39
43
  end
@@ -10,6 +10,9 @@ module Alchemy::Upgrader::Tasks
10
10
  def create_ingredients
11
11
  Alchemy::Deprecation.silence do
12
12
  elements_with_ingredients = Alchemy::ElementDefinition.all.select { |d| d.key?(:ingredients) }
13
+ if ENV["ONLY"]
14
+ elements_with_ingredients = elements_with_ingredients.select { |d| d[:name].in? ENV["ONLY"].split(",") }
15
+ end
13
16
  # eager load all elements that have ingredients defined but no ingredient records yet.
14
17
  all_elements = Alchemy::Element
15
18
  .named(elements_with_ingredients.map { |d| d[:name] })
@@ -22,21 +25,29 @@ module Alchemy::Upgrader::Tasks
22
25
  puts "-- Creating ingredients for #{elements.count} #{element_definition[:name]}(s)"
23
26
  elements.each do |element|
24
27
  Alchemy::Element.transaction do
25
- element.ingredients = element_definition[:ingredients].map do |ingredient_definition|
28
+ element_definition[:ingredients].each do |ingredient_definition|
26
29
  content = element.content_by_name(ingredient_definition[:role])
27
30
  next unless content
28
31
 
29
- ingredient = Alchemy::Ingredient.build(role: ingredient_definition[:role], element: element)
30
- belongs_to_associations = content.essence.class.reflect_on_all_associations(:belongs_to)
32
+ essence = content.essence
33
+ ingredient = element.ingredients.build(
34
+ role: ingredient_definition[:role],
35
+ type: Alchemy::Ingredient.normalize_type(ingredient_definition[:type]),
36
+ )
37
+ belongs_to_associations = essence.class.reflect_on_all_associations(:belongs_to)
31
38
  if belongs_to_associations.any?
32
- ingredient.related_object = content.essence.public_send(belongs_to_associations.first.name)
39
+ ingredient.related_object = essence.public_send(belongs_to_associations.first.name)
33
40
  else
34
41
  ingredient.value = content.ingredient
35
42
  end
36
- content.destroy!
43
+ data = ingredient.class.stored_attributes.fetch(:data, []).each_with_object({}) do |attr, d|
44
+ d[attr] = essence.public_send(attr)
45
+ end
46
+ ingredient.data = data
37
47
  print "."
38
- ingredient
39
- end.compact
48
+ ingredient.save!
49
+ content.destroy!
50
+ end
40
51
  end
41
52
  end
42
53
  puts "\n"
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "6.0.0.b1"
4
+ VERSION = "6.0.0-b5"
5
5
 
6
6
  def self.version
7
7
  VERSION
data/lib/alchemy_cms.rb CHANGED
@@ -54,6 +54,7 @@ require_relative "alchemy/permissions"
54
54
  require_relative "alchemy/resource"
55
55
  require_relative "alchemy/tinymce"
56
56
  require_relative "alchemy/taggable"
57
+ require_relative "alchemy/version"
57
58
 
58
59
  # Require hacks
59
60
  require_relative "kaminari/scoped_pagination_url_helper"
@@ -1,4 +1,4 @@
1
- <%% cache node do %>
1
+ <%% cache [node, @page, @preview_mode] do %>
2
2
  <%%= content_tag :li, class: ['nav-item', node.children.any? ? 'dropdown' : nil].compact do %>
3
3
  <%%= link_to_if node.url,
4
4
  node.name,
@@ -1,4 +1,4 @@
1
- - cache node do
1
+ - cache [node, @page, @preview_mode] do
2
2
  = content_tag :li,
3
3
  class: ['nav-item', node.children.any? ? 'dropdown' : nil].compact do
4
4
  = link_to_if node.url,
@@ -1,4 +1,4 @@
1
- - cache node do
1
+ - cache [node, @page, @preview_mode] do
2
2
  = content_tag :li,
3
3
  class: ['nav-item', node.children.any? ? 'dropdown' : nil].compact do
4
4
  = link_to_if node.url,
@@ -1,4 +1,4 @@
1
- <%% cache menu do %>
1
+ <%% cache [menu, @page, @preview_mode] do %>
2
2
  <ul class="nav">
3
3
  <%%= render partial: menu.to_partial_path,
4
4
  collection: menu.children.includes(:page, :children),
@@ -1,4 +1,4 @@
1
- - cache menu do
1
+ - cache [menu, @page, @preview_mode] do
2
2
  %ul.nav
3
3
  = render partial: menu.to_partial_path,
4
4
  collection: menu.children.includes(:page, :children),
@@ -1,4 +1,4 @@
1
- - cache menu do
1
+ - cache [menu, @page, @preview_mode] do
2
2
  ul.nav
3
3
  = render partial: menu.to_partial_path,
4
4
  collection: menu.children.includes(:page, :children),
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "0.2.0",
3
+ "version": "6.0.0-b5",
4
4
  "description": "AlchemyCMS",
5
5
  "browser": "package/admin.js",
6
6
  "files": [
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: 6.0.0.b1
4
+ version: 6.0.0.pre.b5
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: 2021-07-05 00:00:00.000000000 Z
16
+ date: 2021-08-27 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionmailer
@@ -689,14 +689,14 @@ dependencies:
689
689
  requirements:
690
690
  - - "~>"
691
691
  - !ruby/object:Gem::Version
692
- version: '4.0'
692
+ version: '5.0'
693
693
  type: :development
694
694
  prerelease: false
695
695
  version_requirements: !ruby/object:Gem::Requirement
696
696
  requirements:
697
697
  - - "~>"
698
698
  - !ruby/object:Gem::Version
699
- version: '4.0'
699
+ version: '5.0'
700
700
  - !ruby/object:Gem::Dependency
701
701
  name: timecop
702
702
  requirement: !ruby/object:Gem::Requirement
@@ -1013,7 +1013,6 @@ files:
1013
1013
  - app/views/alchemy/admin/attachments/_attachment.html.erb
1014
1014
  - app/views/alchemy/admin/attachments/_file_to_assign.html.erb
1015
1015
  - app/views/alchemy/admin/attachments/_files_list.html.erb
1016
- - app/views/alchemy/admin/attachments/_filter_bar.html.erb
1017
1016
  - app/views/alchemy/admin/attachments/_overlay_file_list.html.erb
1018
1017
  - app/views/alchemy/admin/attachments/_replace_button.html.erb
1019
1018
  - app/views/alchemy/admin/attachments/_tag_list.html.erb
@@ -1131,7 +1130,6 @@ files:
1131
1130
  - app/views/alchemy/admin/pictures/_archive.html.erb
1132
1131
  - app/views/alchemy/admin/pictures/_archive_overlay.html.erb
1133
1132
  - app/views/alchemy/admin/pictures/_filter_and_size_bar.html.erb
1134
- - app/views/alchemy/admin/pictures/_filter_bar.html.erb
1135
1133
  - app/views/alchemy/admin/pictures/_form.html.erb
1136
1134
  - app/views/alchemy/admin/pictures/_infos.html.erb
1137
1135
  - app/views/alchemy/admin/pictures/_overlay_picture_list.html.erb
@@ -1145,6 +1143,7 @@ files:
1145
1143
  - app/views/alchemy/admin/pictures/index.js.erb
1146
1144
  - app/views/alchemy/admin/pictures/show.html.erb
1147
1145
  - app/views/alchemy/admin/pictures/update.js.erb
1146
+ - app/views/alchemy/admin/resources/_filter.html.erb
1148
1147
  - app/views/alchemy/admin/resources/_filter_bar.html.erb
1149
1148
  - app/views/alchemy/admin/resources/_form.html.erb
1150
1149
  - app/views/alchemy/admin/resources/_per_page_select.html.erb
@@ -1323,6 +1322,7 @@ files:
1323
1322
  - lib/alchemy/paths.rb
1324
1323
  - lib/alchemy/permissions.rb
1325
1324
  - lib/alchemy/resource.rb
1325
+ - lib/alchemy/resource_filter.rb
1326
1326
  - lib/alchemy/resources_helper.rb
1327
1327
  - lib/alchemy/routing_constraints.rb
1328
1328
  - lib/alchemy/seeder.rb
@@ -1516,7 +1516,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1516
1516
  version: 1.3.1
1517
1517
  requirements:
1518
1518
  - ImageMagick (libmagick), v6.6 or greater.
1519
- rubygems_version: 3.1.4
1519
+ rubygems_version: 3.1.6
1520
1520
  signing_key:
1521
1521
  specification_version: 4
1522
1522
  summary: A powerful, userfriendly and flexible CMS for Rails
@@ -1,29 +0,0 @@
1
- <div id="filter_bar">
2
- <h3><%= Alchemy.t('Filter') %></h3>
3
- <%= select_tag(
4
- 'file_type_filter',
5
- options_for_select(
6
- Alchemy::Attachment.file_types_for_select,
7
- search_filter_params[:file_type]
8
- ),
9
- include_blank: Alchemy.t('Show all files'),
10
- data: { remote: !!request.xhr? },
11
- class: 'alchemy_selectbox'
12
- ) %>
13
- </div>
14
-
15
- <script type="text/javascript">
16
- $(function() {
17
- $('#file_type_filter').on('change', function(e) {
18
- var $this = $(this);
19
- var url = '<%= alchemy.admin_attachments_path(search_filter_params.except(:file_type).to_h) %>';
20
- if ($this.data('remote') === true) {
21
- $.get(url, {file_type: $this.val()}, null, 'script');
22
- } else {
23
- delimiter = url.match(/\?/) ? '&' : '?';
24
- Turbolinks.visit(url + delimiter + 'file_type=' + encodeURIComponent($this.val()));
25
- }
26
- return false;
27
- });
28
- });
29
- </script>
@@ -1,30 +0,0 @@
1
- <div id="filter_bar">
2
- <h3><%= Alchemy.t('Filter') %></h3>
3
- <%= select_tag(
4
- 'picture_filter',
5
- options_for_select([
6
- [Alchemy.t(:all_pictures), ''],
7
- [Alchemy.t(:last_upload_only), 'last_upload'],
8
- [Alchemy.t(:recently_uploaded_only), 'recent'],
9
- [Alchemy.t(:without_tag), 'without_tag']
10
- ], search_filter_params[:filter]),
11
- :data => { :remote => !!request.xhr? },
12
- :class => 'alchemy_selectbox'
13
- ) %>
14
- </div>
15
-
16
- <script type="text/javascript">
17
- $(function() {
18
- $('#picture_filter').on('change', function(e) {
19
- var $this = $(this);
20
- var url = '<%= alchemy.admin_pictures_path(search_filter_params.except(:filter).to_h) %>';
21
- if ($this.data('remote') === true) {
22
- $.get(url, {filter: $this.val()}, null, 'script');
23
- } else {
24
- delimiter = url.match(/\?/) ? '&' : '?';
25
- Turbolinks.visit(url + delimiter + 'filter=' + $this.val());
26
- }
27
- return false;
28
- });
29
- });
30
- </script>