alchemy_cms 5.1.9 → 5.2.0.b1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of alchemy_cms might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +2 -1
- data/CHANGELOG.md +21 -25
- data/Gemfile +2 -6
- data/alchemy_cms.gemspec +3 -3
- data/app/assets/stylesheets/alchemy/_variables.scss +2 -0
- data/app/assets/stylesheets/alchemy/elements.scss +38 -5
- data/app/assets/stylesheets/tinymce/skins/alchemy/content.min.css.scss +3 -3
- data/app/assets/stylesheets/tinymce/skins/alchemy/skin.min.css.scss +7 -7
- data/app/controllers/alchemy/admin/base_controller.rb +1 -0
- data/app/controllers/alchemy/admin/trash_controller.rb +2 -0
- data/app/decorators/alchemy/content_editor.rb +64 -0
- data/app/decorators/alchemy/element_editor.rb +1 -25
- data/app/helpers/alchemy/admin/contents_helper.rb +3 -8
- data/app/helpers/alchemy/elements_helper.rb +0 -18
- data/app/helpers/alchemy/pages_helper.rb +1 -1
- data/app/models/alchemy/attachment.rb +5 -1
- data/app/models/alchemy/content.rb +7 -0
- data/app/models/alchemy/element/definitions.rb +5 -22
- data/app/models/alchemy/element.rb +39 -1
- data/app/models/alchemy/node.rb +1 -1
- data/app/models/alchemy/page/page_elements.rb +9 -2
- data/app/models/alchemy/page.rb +1 -1
- data/app/models/alchemy/picture.rb +2 -2
- data/app/models/alchemy/picture_variant.rb +1 -1
- data/app/views/alchemy/admin/elements/_element.html.erb +1 -1
- data/app/views/alchemy/admin/elements/_element_header.html.erb +2 -0
- data/app/views/alchemy/essences/_essence_picture_view.html.erb +3 -3
- data/config/brakeman.ignore +305 -17
- data/config/locales/alchemy.en.yml +40 -24
- data/lib/alchemy/deprecation.rb +1 -1
- data/lib/alchemy/element_definition.rb +70 -0
- data/lib/alchemy/elements_finder.rb +6 -2
- data/lib/alchemy/engine.rb +1 -1
- data/lib/alchemy/essence.rb +4 -4
- data/lib/alchemy/filetypes.rb +13 -0
- data/lib/alchemy/forms/builder.rb +1 -1
- data/lib/alchemy/i18n.rb +4 -5
- data/lib/alchemy/page_layout.rb +1 -0
- data/lib/alchemy/resource.rb +3 -5
- data/lib/alchemy/test_support/integration_helpers.rb +5 -5
- data/lib/alchemy/upgrader/five_point_zero.rb +0 -32
- data/lib/alchemy/version.rb +1 -1
- data/lib/alchemy_cms.rb +1 -0
- data/lib/generators/alchemy/install/install_generator.rb +1 -2
- data/lib/tasks/alchemy/thumbnails.rake +2 -4
- data/lib/tasks/alchemy/upgrade.rake +0 -20
- data/package/admin.js +0 -2
- data/package/src/__tests__/i18n.spec.js +0 -23
- data/package/src/i18n.js +3 -1
- data/package.json +1 -1
- metadata +12 -18
| @@ -0,0 +1,70 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Alchemy
         | 
| 4 | 
            +
              class ElementDefinition
         | 
| 5 | 
            +
                class << self
         | 
| 6 | 
            +
                  # Returns the definitions from elements.yml file.
         | 
| 7 | 
            +
                  #
         | 
| 8 | 
            +
                  # Place a +elements.yml+ file inside your apps +config/alchemy+ folder to define
         | 
| 9 | 
            +
                  # your own set of elements
         | 
| 10 | 
            +
                  #
         | 
| 11 | 
            +
                  def all
         | 
| 12 | 
            +
                    @definitions ||= read_definitions_file.map(&:with_indifferent_access)
         | 
| 13 | 
            +
                  end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  # Add additional page definitions to collection.
         | 
| 16 | 
            +
                  #
         | 
| 17 | 
            +
                  # Useful for extending the elements from an Alchemy module.
         | 
| 18 | 
            +
                  #
         | 
| 19 | 
            +
                  # === Usage Example
         | 
| 20 | 
            +
                  #
         | 
| 21 | 
            +
                  #   Call +Alchemy::ElementDefinition.add(your_definition)+ in your engine.rb file.
         | 
| 22 | 
            +
                  #
         | 
| 23 | 
            +
                  # @param [Array || Hash]
         | 
| 24 | 
            +
                  #   You can pass a single element definition as Hash, or a collection of elements as Array.
         | 
| 25 | 
            +
                  #
         | 
| 26 | 
            +
                  def add(element)
         | 
| 27 | 
            +
                    all
         | 
| 28 | 
            +
                    if element.is_a?(Array)
         | 
| 29 | 
            +
                      @definitions += element
         | 
| 30 | 
            +
                    elsif element.is_a?(Hash)
         | 
| 31 | 
            +
                      @definitions << element
         | 
| 32 | 
            +
                    else
         | 
| 33 | 
            +
                      raise TypeError
         | 
| 34 | 
            +
                    end
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                  # Returns one element definition by given name.
         | 
| 38 | 
            +
                  #
         | 
| 39 | 
            +
                  def get(name)
         | 
| 40 | 
            +
                    return {} if name.blank?
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                    all.detect { |a| a["name"] == name }
         | 
| 43 | 
            +
                  end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  private
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                  # Reads the element definitions from +config/alchemy/elements.yml+.
         | 
| 48 | 
            +
                  #
         | 
| 49 | 
            +
                  def read_definitions_file
         | 
| 50 | 
            +
                    if File.exist?(definitions_file_path)
         | 
| 51 | 
            +
                      YAML.safe_load(
         | 
| 52 | 
            +
                        ERB.new(File.read(definitions_file_path)).result,
         | 
| 53 | 
            +
                        YAML_WHITELIST_CLASSES,
         | 
| 54 | 
            +
                        [],
         | 
| 55 | 
            +
                        true
         | 
| 56 | 
            +
                      ) || []
         | 
| 57 | 
            +
                    else
         | 
| 58 | 
            +
                      raise LoadError,
         | 
| 59 | 
            +
                            "Could not find elements.yml file! Please run `rails generate alchemy:install`"
         | 
| 60 | 
            +
                    end
         | 
| 61 | 
            +
                  end
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                  # Returns the elements.yml file path
         | 
| 64 | 
            +
                  #
         | 
| 65 | 
            +
                  def definitions_file_path
         | 
| 66 | 
            +
                    Rails.root.join "config/alchemy/elements.yml"
         | 
| 67 | 
            +
                  end
         | 
| 68 | 
            +
                end
         | 
| 69 | 
            +
              end
         | 
| 70 | 
            +
            end
         | 
| @@ -26,8 +26,6 @@ module Alchemy | |
| 26 26 | 
             
                #   Randomize the output of elements
         | 
| 27 27 | 
             
                # @option options [Boolean] :reverse (false)
         | 
| 28 28 | 
             
                #   Reverse the load order
         | 
| 29 | 
            -
                # @option options [Hash] :fallback
         | 
| 30 | 
            -
                #   Define elements that are loaded from another page if no element was found on given page.
         | 
| 31 29 | 
             
                def initialize(options = {})
         | 
| 32 30 | 
             
                  @options = options
         | 
| 33 31 | 
             
                end
         | 
| @@ -83,6 +81,9 @@ module Alchemy | |
| 83 81 | 
             
                  when Alchemy::Page
         | 
| 84 82 | 
             
                    page_or_layout
         | 
| 85 83 | 
             
                  when String
         | 
| 84 | 
            +
                    Alchemy::Deprecation.warn "Passing a String as `from_page` option to " \
         | 
| 85 | 
            +
                      "`render_elements` is deprecated and will be removed with Alchemy 6.0. " \
         | 
| 86 | 
            +
                      "Please load the page beforehand and pass it as an object instead."
         | 
| 86 87 | 
             
                    Alchemy::Page.find_by(
         | 
| 87 88 | 
             
                      language: Alchemy::Language.current,
         | 
| 88 89 | 
             
                      page_layout: page_or_layout,
         | 
| @@ -92,6 +93,9 @@ module Alchemy | |
| 92 93 | 
             
                end
         | 
| 93 94 |  | 
| 94 95 | 
             
                def fallback_required?(elements)
         | 
| 96 | 
            +
                  if options[:fallback]
         | 
| 97 | 
            +
                    Alchemy::Deprecation.warn "Passing `fallback` options to `render_elements` is deprecated an will be removed with Alchemy 6.0."
         | 
| 98 | 
            +
                  end
         | 
| 95 99 | 
             
                  options[:fallback] && elements
         | 
| 96 100 | 
             
                    .where(Alchemy::Element.table_name => {name: options[:fallback][:for]})
         | 
| 97 101 | 
             
                    .none?
         | 
    
        data/lib/alchemy/engine.rb
    CHANGED
    
    | @@ -40,7 +40,7 @@ module Alchemy | |
| 40 40 | 
             
                  if Alchemy.user_class
         | 
| 41 41 | 
             
                    ActiveSupport.on_load(:active_record) do
         | 
| 42 42 | 
             
                      Alchemy.user_class.model_stamper
         | 
| 43 | 
            -
                      Alchemy.user_class.stampable(stamper_class_name: Alchemy. | 
| 43 | 
            +
                      Alchemy.user_class.stampable(stamper_class_name: Alchemy.user_class_name)
         | 
| 44 44 | 
             
                    end
         | 
| 45 45 | 
             
                  end
         | 
| 46 46 | 
             
                end
         | 
    
        data/lib/alchemy/essence.rb
    CHANGED
    
    | @@ -83,7 +83,7 @@ module Alchemy #:nodoc: | |
| 83 83 |  | 
| 84 84 | 
             
                    if configuration[:belongs_to]
         | 
| 85 85 | 
             
                      class_eval <<-RUBY, __FILE__, __LINE__ + 1
         | 
| 86 | 
            -
                        belongs_to :ingredient_association,  | 
| 86 | 
            +
                        belongs_to :ingredient_association, **#{configuration[:belongs_to]}
         | 
| 87 87 |  | 
| 88 88 | 
             
                        alias_method :#{configuration[:ingredient_column]}, :ingredient_association
         | 
| 89 89 | 
             
                        alias_method :#{configuration[:ingredient_column]}=, :ingredient_association=
         | 
| @@ -108,9 +108,9 @@ module Alchemy #:nodoc: | |
| 108 108 | 
             
                  # Register the current class as has_many association on +Alchemy::Page+ and +Alchemy::Element+ models
         | 
| 109 109 | 
             
                  def register_as_essence_association!
         | 
| 110 110 | 
             
                    klass_name = model_name.to_s
         | 
| 111 | 
            -
                    arguments = [:has_many, klass_name.demodulize.tableize.to_sym | 
| 112 | 
            -
             | 
| 113 | 
            -
                    %w(Page Element).each { |k| "Alchemy::#{k}".constantize.send(*arguments) }
         | 
| 111 | 
            +
                    arguments = [:has_many, klass_name.demodulize.tableize.to_sym]
         | 
| 112 | 
            +
                    kwargs = { through: :contents, source: :essence, source_type: klass_name }
         | 
| 113 | 
            +
                    %w(Page Element).each { |k| "Alchemy::#{k}".constantize.send(*arguments, **kwargs) }
         | 
| 114 114 | 
             
                  end
         | 
| 115 115 | 
             
                end
         | 
| 116 116 |  | 
    
        data/lib/alchemy/filetypes.rb
    CHANGED
    
    | @@ -40,7 +40,20 @@ module Alchemy | |
| 40 40 | 
             
                EXCEL_FILE_TYPES = [
         | 
| 41 41 | 
             
                  "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
         | 
| 42 42 | 
             
                  "application/vnd.ms-excel",
         | 
| 43 | 
            +
                  "application/msexcel",
         | 
| 43 44 | 
             
                  "text/csv",
         | 
| 44 45 | 
             
                ]
         | 
| 46 | 
            +
             | 
| 47 | 
            +
                WORD_FILE_TYPES = [
         | 
| 48 | 
            +
                  "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
         | 
| 49 | 
            +
                  "application/vnd.ms-word",
         | 
| 50 | 
            +
                  "application/msword",
         | 
| 51 | 
            +
                ]
         | 
| 52 | 
            +
             | 
| 53 | 
            +
                POWERPOINT_FILE_TYPES = [
         | 
| 54 | 
            +
                  "application/vnd.openxmlformats-officedocument.presentationml.presentation",
         | 
| 55 | 
            +
                  "application/vnd.ms-powerpoint",
         | 
| 56 | 
            +
                  "application/mspowerpoint",
         | 
| 57 | 
            +
                ]
         | 
| 45 58 | 
             
              end
         | 
| 46 59 | 
             
            end
         | 
| @@ -11,7 +11,7 @@ module Alchemy | |
| 11 11 | 
             
                    if object.respond_to?(:attribute_fixed?) && object.attribute_fixed?(attribute_name)
         | 
| 12 12 | 
             
                      options[:disabled] = true
         | 
| 13 13 | 
             
                      options[:input_html] = options.fetch(:input_html, {}).merge(
         | 
| 14 | 
            -
                        "data-alchemy-tooltip" => Alchemy.t(:attribute_fixed, attribute_name),
         | 
| 14 | 
            +
                        "data-alchemy-tooltip" => Alchemy.t(:attribute_fixed, attribute: attribute_name),
         | 
| 15 15 | 
             
                      )
         | 
| 16 16 | 
             
                    end
         | 
| 17 17 |  | 
    
        data/lib/alchemy/i18n.rb
    CHANGED
    
    | @@ -12,8 +12,8 @@ module Alchemy | |
| 12 12 | 
             
                #
         | 
| 13 13 | 
             
                #     Alchemy.t(:hello)
         | 
| 14 14 | 
             
                #
         | 
| 15 | 
            -
                def t(msg,  | 
| 16 | 
            -
                  Alchemy::I18n.translate(msg,  | 
| 15 | 
            +
                def t(msg, **kwargs)
         | 
| 16 | 
            +
                  Alchemy::I18n.translate(msg, **kwargs)
         | 
| 17 17 | 
             
                end
         | 
| 18 18 | 
             
              end
         | 
| 19 19 |  | 
| @@ -47,11 +47,10 @@ module Alchemy | |
| 47 47 | 
             
                  #       world:
         | 
| 48 48 | 
             
                  #         hello: Hallo
         | 
| 49 49 | 
             
                  #
         | 
| 50 | 
            -
                  def translate(msg,  | 
| 51 | 
            -
                    options = args.extract_options!
         | 
| 50 | 
            +
                  def translate(msg, **options)
         | 
| 52 51 | 
             
                    humanize_default_string!(msg, options)
         | 
| 53 52 | 
             
                    scope = alchemy_scoped_scope(options)
         | 
| 54 | 
            -
                    ::I18n.t(msg, options.merge(scope: scope))
         | 
| 53 | 
            +
                    ::I18n.t(msg, **options.merge(scope: scope))
         | 
| 55 54 | 
             
                  end
         | 
| 56 55 |  | 
| 57 56 | 
             
                  def available_locales
         | 
    
        data/lib/alchemy/page_layout.rb
    CHANGED
    
    
    
        data/lib/alchemy/resource.rb
    CHANGED
    
    | @@ -132,9 +132,7 @@ module Alchemy | |
| 132 132 | 
             
                end
         | 
| 133 133 |  | 
| 134 134 | 
             
                def namespaced_resource_name
         | 
| 135 | 
            -
                  @_namespaced_resource_name ||=  | 
| 136 | 
            -
                    namespaced_resources_name.to_s.singularize
         | 
| 137 | 
            -
                  end.to_sym # Rails >= 6.0.3.7 needs symbols in polymorphic routes
         | 
| 135 | 
            +
                  @_namespaced_resource_name ||= namespaced_resources_name.singularize
         | 
| 138 136 | 
             
                end
         | 
| 139 137 |  | 
| 140 138 | 
             
                def namespaced_resources_name
         | 
| @@ -142,13 +140,13 @@ module Alchemy | |
| 142 140 | 
             
                    resource_name_array = resource_array.dup
         | 
| 143 141 | 
             
                    resource_name_array.delete(engine_name) if in_engine?
         | 
| 144 142 | 
             
                    resource_name_array.join("_")
         | 
| 145 | 
            -
                  end | 
| 143 | 
            +
                  end
         | 
| 146 144 | 
             
                end
         | 
| 147 145 |  | 
| 148 146 | 
             
                def namespace_for_scope
         | 
| 149 147 | 
             
                  namespace_array = namespace_diff
         | 
| 150 148 | 
             
                  namespace_array.delete(engine_name) if in_engine?
         | 
| 151 | 
            -
                  namespace_array | 
| 149 | 
            +
                  namespace_array
         | 
| 152 150 | 
             
                end
         | 
| 153 151 |  | 
| 154 152 | 
             
                # Returns an array of underscored association names
         | 
| @@ -6,16 +6,16 @@ module Alchemy | |
| 6 6 | 
             
                # This file is included in spec_helper.rb
         | 
| 7 7 | 
             
                #
         | 
| 8 8 | 
             
                module IntegrationHelpers
         | 
| 9 | 
            -
                  # Used to stub the  | 
| 9 | 
            +
                  # Used to stub the current_user in integration specs
         | 
| 10 10 | 
             
                  #
         | 
| 11 11 | 
             
                  # Pass either a user object or a symbol in the format of ':as_admin'.
         | 
| 12 | 
            -
                  # The browser language is set to english ('en')
         | 
| 13 12 | 
             
                  #
         | 
| 14 13 | 
             
                  def authorize_user(user_or_role = nil)
         | 
| 15 | 
            -
                     | 
| 16 | 
            -
             | 
| 17 | 
            -
                    else
         | 
| 14 | 
            +
                    case user_or_role
         | 
| 15 | 
            +
                    when Symbol, String
         | 
| 18 16 | 
             
                      user = build(:alchemy_dummy_user, user_or_role)
         | 
| 17 | 
            +
                    else
         | 
| 18 | 
            +
                      user = user_or_role
         | 
| 19 19 | 
             
                    end
         | 
| 20 20 | 
             
                    allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user)
         | 
| 21 21 | 
             
                  end
         | 
| @@ -1,19 +1,9 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            require_relative "tasks/harden_gutentag_migrations"
         | 
| 4 | 
            -
            require "rails/generators"
         | 
| 5 | 
            -
            require "thor"
         | 
| 6 | 
            -
            require "alchemy/install/tasks"
         | 
| 7 | 
            -
            require "alchemy/version"
         | 
| 8 4 |  | 
| 9 5 | 
             
            module Alchemy
         | 
| 10 6 | 
             
              class Upgrader::FivePointZero < Upgrader
         | 
| 11 | 
            -
                include Rails::Generators::Actions
         | 
| 12 | 
            -
                include Thor::Base
         | 
| 13 | 
            -
                include Thor::Actions
         | 
| 14 | 
            -
             | 
| 15 | 
            -
                source_root File.expand_path("../../generators/alchemy/install/files", __dir__)
         | 
| 16 | 
            -
             | 
| 17 7 | 
             
                class << self
         | 
| 18 8 | 
             
                  def install_gutentag_migrations
         | 
| 19 9 | 
             
                    desc "Install Gutentag migrations"
         | 
| @@ -46,28 +36,6 @@ module Alchemy | |
| 46 36 | 
             
                      log "Root page not found.", :skip
         | 
| 47 37 | 
             
                    end
         | 
| 48 38 | 
             
                  end
         | 
| 49 | 
            -
             | 
| 50 | 
            -
                  def run_webpacker_installer
         | 
| 51 | 
            -
                    # Webpacker does not create a package.json, but we need one
         | 
| 52 | 
            -
                    unless File.exist? app_root.join("package.json")
         | 
| 53 | 
            -
                      in_root { run "echo '{}' > package.json" }
         | 
| 54 | 
            -
                    end
         | 
| 55 | 
            -
                    new.rake("webpacker:install", abort_on_failure: true)
         | 
| 56 | 
            -
                  end
         | 
| 57 | 
            -
             | 
| 58 | 
            -
                  def add_npm_package
         | 
| 59 | 
            -
                    new.run "yarn add @alchemy_cms/admin@~#{Alchemy.version}"
         | 
| 60 | 
            -
                  end
         | 
| 61 | 
            -
             | 
| 62 | 
            -
                  def copy_alchemy_entry_point
         | 
| 63 | 
            -
                    webpack_config = YAML.load_file(app_root.join("config", "webpacker.yml"))[Rails.env]
         | 
| 64 | 
            -
                    new.copy_file "alchemy_admin.js",
         | 
| 65 | 
            -
                      app_root.join(webpack_config["source_path"], webpack_config["source_entry_path"], "alchemy/admin.js")
         | 
| 66 | 
            -
                  end
         | 
| 67 | 
            -
             | 
| 68 | 
            -
                  def app_root
         | 
| 69 | 
            -
                    @_app_root ||= Rails.root
         | 
| 70 | 
            -
                  end
         | 
| 71 39 | 
             
                end
         | 
| 72 40 | 
             
              end
         | 
| 73 41 | 
             
            end
         | 
    
        data/lib/alchemy/version.rb
    CHANGED
    
    
    
        data/lib/alchemy_cms.rb
    CHANGED
    
    | @@ -35,6 +35,7 @@ require_relative "alchemy/config" | |
| 35 35 | 
             
            require_relative "alchemy/configuration_methods"
         | 
| 36 36 | 
             
            require_relative "alchemy/controller_actions"
         | 
| 37 37 | 
             
            require_relative "alchemy/deprecation"
         | 
| 38 | 
            +
            require_relative "alchemy/element_definition"
         | 
| 38 39 | 
             
            require_relative "alchemy/elements_finder"
         | 
| 39 40 | 
             
            require_relative "alchemy/errors"
         | 
| 40 41 | 
             
            require_relative "alchemy/essence"
         | 
| @@ -1,7 +1,6 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 | 
             
            require "rails/generators"
         | 
| 3 3 | 
             
            require "alchemy/install/tasks"
         | 
| 4 | 
            -
            require "alchemy/version"
         | 
| 5 4 |  | 
| 6 5 | 
             
            module Alchemy
         | 
| 7 6 | 
             
              module Generators
         | 
| @@ -89,7 +88,7 @@ module Alchemy | |
| 89 88 | 
             
                  end
         | 
| 90 89 |  | 
| 91 90 | 
             
                  def add_npm_package
         | 
| 92 | 
            -
                    run "yarn add @alchemy_cms/admin | 
| 91 | 
            +
                    run "yarn add @alchemy_cms/admin"
         | 
| 93 92 | 
             
                  end
         | 
| 94 93 |  | 
| 95 94 | 
             
                  def copy_alchemy_entry_point
         | 
| @@ -4,8 +4,8 @@ namespace :alchemy do | |
| 4 4 | 
             
              namespace :generate do
         | 
| 5 5 | 
             
                desc "Generates all thumbnails for Alchemy Pictures and EssencePictures."
         | 
| 6 6 | 
             
                task thumbnails: [
         | 
| 7 | 
            -
                  " | 
| 8 | 
            -
                  " | 
| 7 | 
            +
                  "alchemy_dragonfly_s3:generate:picture_thumbnails",
         | 
| 8 | 
            +
                  "alchemy_dragonfly_s3:generate:essence_picture_thumbnails",
         | 
| 9 9 | 
             
                ]
         | 
| 10 10 |  | 
| 11 11 | 
             
                desc "Generates thumbnails for Alchemy Pictures."
         | 
| @@ -14,8 +14,6 @@ namespace :alchemy do | |
| 14 14 | 
             
                  puts "Please wait..."
         | 
| 15 15 |  | 
| 16 16 | 
             
                  Alchemy::Picture.find_each do |picture|
         | 
| 17 | 
            -
                    next unless picture.has_convertible_format?
         | 
| 18 | 
            -
             | 
| 19 17 | 
             
                    puts Alchemy::PictureThumb.generate_thumbs!(picture)
         | 
| 20 18 | 
             
                  end
         | 
| 21 19 |  | 
| @@ -42,9 +42,6 @@ namespace :alchemy do | |
| 42 42 | 
             
                    "alchemy:upgrade:5.0:install_gutentag_migrations",
         | 
| 43 43 | 
             
                    "alchemy:upgrade:5.0:remove_layout_roots",
         | 
| 44 44 | 
             
                    "alchemy:upgrade:5.0:remove_root_page",
         | 
| 45 | 
            -
                    "alchemy:upgrade:5.0:run_webpacker_installer",
         | 
| 46 | 
            -
                    "alchemy:upgrade:5.0:add_npm_package",
         | 
| 47 | 
            -
                    "alchemy:upgrade:5.0:copy_alchemy_entry_point",
         | 
| 48 45 | 
             
                  ]
         | 
| 49 46 |  | 
| 50 47 | 
             
                  desc "Install Gutentag migrations"
         | 
| @@ -61,23 +58,6 @@ namespace :alchemy do | |
| 61 58 | 
             
                  task remove_root_page: [:environment] do
         | 
| 62 59 | 
             
                    Alchemy::Upgrader::FivePointZero.remove_root_page
         | 
| 63 60 | 
             
                  end
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                  desc "Run webpacker installer"
         | 
| 66 | 
            -
                  task run_webpacker_installer: [:environment] do
         | 
| 67 | 
            -
                    Alchemy::Upgrader::FivePointZero.run_webpacker_installer
         | 
| 68 | 
            -
                  end
         | 
| 69 | 
            -
             | 
| 70 | 
            -
                  desc "Add NPM package"
         | 
| 71 | 
            -
                  task add_npm_package: [:environment] do
         | 
| 72 | 
            -
                    puts "adding npm_package..."
         | 
| 73 | 
            -
                    Alchemy::Upgrader::FivePointZero.add_npm_package
         | 
| 74 | 
            -
                  end
         | 
| 75 | 
            -
             | 
| 76 | 
            -
                  desc "Copy alchemy entry point"
         | 
| 77 | 
            -
                  task copy_alchemy_entry_point: [:environment] do
         | 
| 78 | 
            -
                    puts "copying alchemy entry point"
         | 
| 79 | 
            -
                    Alchemy::Upgrader::FivePointZero.copy_alchemy_entry_point
         | 
| 80 | 
            -
                  end
         | 
| 81 61 | 
             
                end
         | 
| 82 62 | 
             
              end
         | 
| 83 63 | 
             
            end
         | 
    
        data/package/admin.js
    CHANGED
    
    | @@ -1,5 +1,4 @@ | |
| 1 1 | 
             
            import translate from "./src/i18n"
         | 
| 2 | 
            -
            import translationData from "./src/translations"
         | 
| 3 2 | 
             
            import NodeTree from "./src/node_tree"
         | 
| 4 3 |  | 
| 5 4 | 
             
            // Global Alchemy object
         | 
| @@ -11,6 +10,5 @@ if (typeof window.Alchemy === "undefined") { | |
| 11 10 | 
             
            Object.assign(Alchemy, {
         | 
| 12 11 | 
             
              // Global utility method for translating a given string
         | 
| 13 12 | 
             
              t: translate,
         | 
| 14 | 
            -
              translations: Object.assign(Alchemy.translations || {}, translationData),
         | 
| 15 13 | 
             
              NodeTree
         | 
| 16 14 | 
             
            })
         | 
| @@ -15,20 +15,12 @@ describe("translate", () => { | |
| 15 15 | 
             
                })
         | 
| 16 16 |  | 
| 17 17 | 
             
                describe("if translation is present", () => {
         | 
| 18 | 
            -
                  beforeEach(() => {
         | 
| 19 | 
            -
                    Alchemy.translations = { en: { help: "Help" } }
         | 
| 20 | 
            -
                  })
         | 
| 21 | 
            -
             | 
| 22 18 | 
             
                  it("Returns translated string", () => {
         | 
| 23 19 | 
             
                    expect(translate("help")).toEqual("Help")
         | 
| 24 20 | 
             
                  })
         | 
| 25 21 |  | 
| 26 22 | 
             
                  describe("if key includes a period", () => {
         | 
| 27 23 | 
             
                    describe("that is translated", () => {
         | 
| 28 | 
            -
                      beforeEach(() => {
         | 
| 29 | 
            -
                        Alchemy.translations = { en: { formats: { date: "Y-m-d" } } }
         | 
| 30 | 
            -
                      })
         | 
| 31 | 
            -
             | 
| 32 24 | 
             
                      it("splits into group", () => {
         | 
| 33 25 | 
             
                        expect(translate("formats.date")).toEqual("Y-m-d")
         | 
| 34 26 | 
             
                      })
         | 
| @@ -48,10 +40,6 @@ describe("translate", () => { | |
| 48 40 | 
             
                  })
         | 
| 49 41 |  | 
| 50 42 | 
             
                  describe("if replacement is given", () => {
         | 
| 51 | 
            -
                    beforeEach(() => {
         | 
| 52 | 
            -
                      Alchemy.translations = { en: { allowed_chars: "of %{number} chars" } }
         | 
| 53 | 
            -
                    })
         | 
| 54 | 
            -
             | 
| 55 43 | 
             
                    it("replaces it", () => {
         | 
| 56 44 | 
             
                      expect(translate("allowed_chars", 5)).toEqual("of 5 chars")
         | 
| 57 45 | 
             
                    })
         | 
| @@ -79,15 +67,4 @@ describe("translate", () => { | |
| 79 67 | 
             
                  spy.mockRestore()
         | 
| 80 68 | 
             
                })
         | 
| 81 69 | 
             
              })
         | 
| 82 | 
            -
             | 
| 83 | 
            -
              describe("if Alchemy.translations is not set", () => {
         | 
| 84 | 
            -
                it("Returns passed string and logs a warning", () => {
         | 
| 85 | 
            -
                  const spy = jest.spyOn(console, "warn").mockImplementation(() => {})
         | 
| 86 | 
            -
                  expect(translate("help")).toEqual("help")
         | 
| 87 | 
            -
                  expect(spy.mock.calls).toEqual([
         | 
| 88 | 
            -
                    ["Translations for locale kl not found!"]
         | 
| 89 | 
            -
                  ])
         | 
| 90 | 
            -
                  spy.mockRestore()
         | 
| 91 | 
            -
                })
         | 
| 92 | 
            -
              })
         | 
| 93 70 | 
             
            })
         | 
    
        data/package/src/i18n.js
    CHANGED
    
    | @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            import translationData from "./translations"
         | 
| 2 | 
            +
             | 
| 1 3 | 
             
            const KEY_SEPARATOR = /\./
         | 
| 2 4 |  | 
| 3 5 | 
             
            function currentLocale() {
         | 
| @@ -9,7 +11,7 @@ function currentLocale() { | |
| 9 11 |  | 
| 10 12 | 
             
            function getTranslations() {
         | 
| 11 13 | 
             
              const locale = currentLocale()
         | 
| 12 | 
            -
              const translations =  | 
| 14 | 
            +
              const translations = translationData[locale]
         | 
| 13 15 |  | 
| 14 16 | 
             
              if (translations) {
         | 
| 15 17 | 
             
                return translations
         | 
    
        data/package.json
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: alchemy_cms
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 5. | 
| 4 | 
            +
              version: 5.2.0.b1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Thomas von Deyen
         | 
| @@ -10,10 +10,10 @@ authors: | |
| 10 10 | 
             
            - Hendrik Mans
         | 
| 11 11 | 
             
            - Carsten Fregin
         | 
| 12 12 | 
             
            - Martin Meyerhoff
         | 
| 13 | 
            -
            autorequire:
         | 
| 13 | 
            +
            autorequire: 
         | 
| 14 14 | 
             
            bindir: bin
         | 
| 15 15 | 
             
            cert_chain: []
         | 
| 16 | 
            -
            date: 2021-11 | 
| 16 | 
            +
            date: 2021-02-11 00:00:00.000000000 Z
         | 
| 17 17 | 
             
            dependencies:
         | 
| 18 18 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 19 19 | 
             
              name: active_model_serializers
         | 
| @@ -113,9 +113,6 @@ dependencies: | |
| 113 113 | 
             
                - - ">="
         | 
| 114 114 | 
             
                  - !ruby/object:Gem::Version
         | 
| 115 115 | 
             
                    version: 1.0.7
         | 
| 116 | 
            -
                - - "<"
         | 
| 117 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 118 | 
            -
                    version: 1.4.0
         | 
| 119 116 | 
             
              type: :runtime
         | 
| 120 117 | 
             
              prerelease: false
         | 
| 121 118 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -126,9 +123,6 @@ dependencies: | |
| 126 123 | 
             
                - - ">="
         | 
| 127 124 | 
             
                  - !ruby/object:Gem::Version
         | 
| 128 125 | 
             
                    version: 1.0.7
         | 
| 129 | 
            -
                - - "<"
         | 
| 130 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            -
                    version: 1.4.0
         | 
| 132 126 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 133 127 | 
             
              name: dragonfly_svg
         | 
| 134 128 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -282,7 +276,7 @@ dependencies: | |
| 282 276 | 
             
                    version: '1.8'
         | 
| 283 277 | 
             
                - - "<"
         | 
| 284 278 | 
             
                  - !ruby/object:Gem::Version
         | 
| 285 | 
            -
                    version:  | 
| 279 | 
            +
                    version: 2.4.2
         | 
| 286 280 | 
             
              type: :runtime
         | 
| 287 281 | 
             
              prerelease: false
         | 
| 288 282 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| @@ -292,7 +286,7 @@ dependencies: | |
| 292 286 | 
             
                    version: '1.8'
         | 
| 293 287 | 
             
                - - "<"
         | 
| 294 288 | 
             
                  - !ruby/object:Gem::Version
         | 
| 295 | 
            -
                    version:  | 
| 289 | 
            +
                    version: 2.4.2
         | 
| 296 290 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 297 291 | 
             
              name: request_store
         | 
| 298 292 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -519,14 +513,14 @@ dependencies: | |
| 519 513 | 
             
                requirements:
         | 
| 520 514 | 
             
                - - "~>"
         | 
| 521 515 | 
             
                  - !ruby/object:Gem::Version
         | 
| 522 | 
            -
                    version: 0. | 
| 516 | 
            +
                    version: '0.20'
         | 
| 523 517 | 
             
              type: :development
         | 
| 524 518 | 
             
              prerelease: false
         | 
| 525 519 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 526 520 | 
             
                requirements:
         | 
| 527 521 | 
             
                - - "~>"
         | 
| 528 522 | 
             
                  - !ruby/object:Gem::Version
         | 
| 529 | 
            -
                    version: 0. | 
| 523 | 
            +
                    version: '0.20'
         | 
| 530 524 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 531 525 | 
             
              name: webdrivers
         | 
| 532 526 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -1092,6 +1086,7 @@ files: | |
| 1092 1086 | 
             
            - lib/alchemy/configuration_methods.rb
         | 
| 1093 1087 | 
             
            - lib/alchemy/controller_actions.rb
         | 
| 1094 1088 | 
             
            - lib/alchemy/deprecation.rb
         | 
| 1089 | 
            +
            - lib/alchemy/element_definition.rb
         | 
| 1095 1090 | 
             
            - lib/alchemy/elements_finder.rb
         | 
| 1096 1091 | 
             
            - lib/alchemy/engine.rb
         | 
| 1097 1092 | 
             
            - lib/alchemy/errors.rb
         | 
| @@ -1279,14 +1274,13 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 1279 1274 | 
             
                  version: 2.3.0
         | 
| 1280 1275 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 1281 1276 | 
             
              requirements:
         | 
| 1282 | 
            -
              - - " | 
| 1277 | 
            +
              - - ">"
         | 
| 1283 1278 | 
             
                - !ruby/object:Gem::Version
         | 
| 1284 | 
            -
                  version:  | 
| 1279 | 
            +
                  version: 1.3.1
         | 
| 1285 1280 | 
             
            requirements:
         | 
| 1286 1281 | 
             
            - ImageMagick (libmagick), v6.6 or greater.
         | 
| 1287 | 
            -
            rubygems_version: 3.1. | 
| 1288 | 
            -
            signing_key:
         | 
| 1282 | 
            +
            rubygems_version: 3.1.4
         | 
| 1283 | 
            +
            signing_key: 
         | 
| 1289 1284 | 
             
            specification_version: 4
         | 
| 1290 1285 | 
             
            summary: A powerful, userfriendly and flexible CMS for Rails
         | 
| 1291 1286 | 
             
            test_files: []
         | 
| 1292 | 
            -
            ...
         |