alchemy-custom-model 3.1.2 → 3.2
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.
- checksums.yaml +4 -4
 - data/app/assets/stylesheets/alchemy-custom-model/custom_style.css.scss +20 -0
 - data/app/helpers/alchemy/custom/model/admin/base_helper.rb +1 -1
 - data/app/helpers/alchemy/custom/model/admin/orders_helper.rb +2 -2
 - data/app/helpers/alchemy/pages_helper_decorator.rb +2 -2
 - data/app/views/alchemy/custom/model/admin/base/_gallery_item.html.erb +34 -1
 - data/lib/alchemy/custom/model/el_finder/paths/file.rb +1 -1
 - data/lib/alchemy/custom/model/model_decoration.rb +1 -0
 - data/lib/alchemy/custom/model/pictures_alt_methods.rb +28 -0
 - data/lib/alchemy/custom/model/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0fc385ac1ddd09464a96c5aa3c9f8b8cbe58c4987e7febd91efd2654b4b2506f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6d95f7b6a019fb7c378eb7dd700a42454dc6c0bea2326444c99db50171cfcae6
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6e3c0d0715ed7e6b488072e7324058d47bb57b391c0bd7367daa784efe39db4d08edb489f20b4576f09273fb913b160813c11bb7d9e223f0b73d4006c150046f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 604abd0732a5f9b910bf9b8327d9c7841d7c91c72eb21e688ac9cfdc7e603d499c6fc8aa5acd038041e9ad9327ec6409613ec09275d7b0df082c0c57a21c59bb
         
     | 
| 
         @@ -370,4 +370,24 @@ 
     | 
|
| 
       370 
370 
     | 
    
         
             
                }
         
     | 
| 
       371 
371 
     | 
    
         | 
| 
       372 
372 
     | 
    
         
             
              }
         
     | 
| 
      
 373 
     | 
    
         
            +
            }
         
     | 
| 
      
 374 
     | 
    
         
            +
             
     | 
| 
      
 375 
     | 
    
         
            +
             
     | 
| 
      
 376 
     | 
    
         
            +
            .gallery_item_blk {
         
     | 
| 
      
 377 
     | 
    
         
            +
              .overlay-hover {
         
     | 
| 
      
 378 
     | 
    
         
            +
                display: none;
         
     | 
| 
      
 379 
     | 
    
         
            +
                position: absolute;
         
     | 
| 
      
 380 
     | 
    
         
            +
                padding: 5px;
         
     | 
| 
      
 381 
     | 
    
         
            +
                top: 0;
         
     | 
| 
      
 382 
     | 
    
         
            +
                left: 0;
         
     | 
| 
      
 383 
     | 
    
         
            +
                color: white;
         
     | 
| 
      
 384 
     | 
    
         
            +
                background: rgba( #000, .4 );
         
     | 
| 
      
 385 
     | 
    
         
            +
                width: 100%;
         
     | 
| 
      
 386 
     | 
    
         
            +
                height: 100%;
         
     | 
| 
      
 387 
     | 
    
         
            +
              }
         
     | 
| 
      
 388 
     | 
    
         
            +
              &:hover {
         
     | 
| 
      
 389 
     | 
    
         
            +
                .overlay-hover {
         
     | 
| 
      
 390 
     | 
    
         
            +
                  display: block;
         
     | 
| 
      
 391 
     | 
    
         
            +
                }
         
     | 
| 
      
 392 
     | 
    
         
            +
              }
         
     | 
| 
       373 
393 
     | 
    
         
             
            }
         
     | 
| 
         @@ -221,7 +221,7 @@ module Alchemy::Custom::Model::Admin::BaseHelper 
     | 
|
| 
       221 
221 
     | 
    
         
             
                      component_id = SecureRandom.hex(10)
         
     | 
| 
       222 
222 
     | 
    
         | 
| 
       223 
223 
     | 
    
         
             
                      bf << form.fields_for(field) do |join_record_form|
         
     | 
| 
       224 
     | 
    
         
            -
                        render(layout: 'gallery_item', locals: {picture: join_record_form.object.picture,  
     | 
| 
      
 224 
     | 
    
         
            +
                        render(layout: 'gallery_item', locals: {picture: join_record_form.object.picture, jr: join_record_form.object}) do
         
     | 
| 
       225 
225 
     | 
    
         
             
                          sb = ActiveSupport::SafeBuffer.new
         
     | 
| 
       226 
226 
     | 
    
         | 
| 
       227 
227 
     | 
    
         
             
                          sb << join_record_form.hidden_field(:position, class: 'gallery_position_counter')
         
     | 
| 
         @@ -8,7 +8,7 @@ module Alchemy::Custom::Model::Admin::OrdersHelper 
     | 
|
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              def order_path(options = {})
         
     | 
| 
       11 
     | 
    
         
            -
                new_polymorphic_path([:admin, base_class.to_s.pluralize.underscore, :order], options)
         
     | 
| 
      
 11 
     | 
    
         
            +
                new_polymorphic_path([:admin, base_class.to_s.pluralize.underscore.to_sym, :order], options)
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              def index_ordered_path(obj = nil, options = {})
         
     | 
| 
         @@ -21,7 +21,7 @@ module Alchemy::Custom::Model::Admin::OrdersHelper 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
              def update_order_path(obj=nil,options = {})
         
     | 
| 
       23 
23 
     | 
    
         
             
                if obj.nil?
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
                  polymorphic_path([:admin, base_class.to_s.pluralize.underscore.to_sym, :order], options)
         
     | 
| 
       25 
25 
     | 
    
         
             
                else
         
     | 
| 
       26 
26 
     | 
    
         
             
                  polymorphic_path([:admin, obj, :order], options)
         
     | 
| 
       27 
27 
     | 
    
         | 
| 
         @@ -110,14 +110,14 @@ Alchemy::PagesHelper.module_eval do 
     | 
|
| 
       110 
110 
     | 
    
         
             
              end
         
     | 
| 
       111 
111 
     | 
    
         | 
| 
       112 
112 
     | 
    
         
             
              def render_menu_with_language(name, options = {})
         
     | 
| 
       113 
     | 
    
         
            -
                root_node = Alchemy::Node.where(language_id: Alchemy::Language.current.id).roots.find_by( 
     | 
| 
      
 113 
     | 
    
         
            +
                root_node = Alchemy::Node.where(language_id: Alchemy::Language.current.id).roots.find_by(menu_type: name)
         
     | 
| 
       114 
114 
     | 
    
         
             
                if root_node.nil?
         
     | 
| 
       115 
115 
     | 
    
         
             
                  warning("Menu with name #{name} not found!")
         
     | 
| 
       116 
116 
     | 
    
         
             
                  return
         
     | 
| 
       117 
117 
     | 
    
         
             
                end
         
     | 
| 
       118 
118 
     | 
    
         | 
| 
       119 
119 
     | 
    
         
             
                options = {
         
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
      
 120 
     | 
    
         
            +
                  node_partial_name: "#{root_node.to_partial_path}"
         
     | 
| 
       121 
121 
     | 
    
         
             
                }.merge(options)
         
     | 
| 
       122 
122 
     | 
    
         | 
| 
       123 
123 
     | 
    
         
             
                render(root_node, menu: root_node, node: root_node, options: options)
         
     | 
| 
         @@ -1,9 +1,42 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
             
     | 
| 
      
 2 
     | 
    
         
            +
            <% obj = jr.metadata_record(locale) %>
         
     | 
| 
      
 3 
     | 
    
         
            +
            <div class="gallery_item_blk" data-id="<%= jr.id %>">
         
     | 
| 
       2 
4 
     | 
    
         
             
              <%= image_tag(picture.image_file.thumb("140x140#").url) %>
         
     | 
| 
      
 5 
     | 
    
         
            +
              <% unless obj.nil? %>
         
     | 
| 
      
 6 
     | 
    
         
            +
                <div class="overlay-hover">
         
     | 
| 
      
 7 
     | 
    
         
            +
                  <% unless obj.title.blank? %>
         
     | 
| 
      
 8 
     | 
    
         
            +
                    <%= t('activerecord.attributes.selling_point_picture_metadatum.title') %>: <%= obj.title %>
         
     | 
| 
      
 9 
     | 
    
         
            +
                    <br/>
         
     | 
| 
      
 10 
     | 
    
         
            +
                  <% end %>
         
     | 
| 
      
 11 
     | 
    
         
            +
                  <% unless obj.alternative_text.blank? %>
         
     | 
| 
      
 12 
     | 
    
         
            +
                    <%= t('activerecord.attributes.selling_point_picture_metadatum.alternative_text') %>
         
     | 
| 
      
 13 
     | 
    
         
            +
                    : <%= obj.alternative_text %>
         
     | 
| 
      
 14 
     | 
    
         
            +
                    <br/>
         
     | 
| 
      
 15 
     | 
    
         
            +
                  <% end %>
         
     | 
| 
      
 16 
     | 
    
         
            +
                  <% unless obj.caption.blank? %>
         
     | 
| 
      
 17 
     | 
    
         
            +
                    <%= t('activerecord.attributes.selling_point_picture_metadatum.caption') %>: <%= obj.caption %>
         
     | 
| 
      
 18 
     | 
    
         
            +
                  <% end %>
         
     | 
| 
      
 19 
     | 
    
         
            +
                </div>
         
     | 
| 
      
 20 
     | 
    
         
            +
              <% end %>
         
     | 
| 
       3 
21 
     | 
    
         
             
              <%= yield if block_given? %>
         
     | 
| 
       4 
22 
     | 
    
         
             
              <div class="command_area">
         
     | 
| 
      
 23 
     | 
    
         
            +
                <% if not obj.nil? %>
         
     | 
| 
      
 24 
     | 
    
         
            +
                  <%
         
     | 
| 
      
 25 
     | 
    
         
            +
                    if obj.persisted?
         
     | 
| 
      
 26 
     | 
    
         
            +
                      url = edit_polymorphic_path([:admin, obj], :spp_id => jr.id)
         
     | 
| 
      
 27 
     | 
    
         
            +
                    else
         
     | 
| 
      
 28 
     | 
    
         
            +
                      url = new_polymorphic_path([:admin, obj], :spp_id => jr.id)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  %>
         
     | 
| 
      
 31 
     | 
    
         
            +
                  <%= link_to_dialog render_icon(:edit), url, {  }, title: Alchemy.t(:edit_image_properties) %>
         
     | 
| 
      
 32 
     | 
    
         
            +
                <% end %>
         
     | 
| 
       5 
33 
     | 
    
         
             
                <div class="destroy">
         
     | 
| 
       6 
34 
     | 
    
         
             
                  <i class="fas fa-times fa-lg fa-fw"></i>
         
     | 
| 
       7 
35 
     | 
    
         
             
                </div>
         
     | 
| 
       8 
36 
     | 
    
         
             
              </div>
         
     | 
| 
       9 
37 
     | 
    
         
             
            </div>
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
         @@ -3,7 +3,7 @@ module Alchemy::Custom::Model::ElFinder 
     | 
|
| 
       3 
3 
     | 
    
         
             
                class File < ActiveRecordReference
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
                  def full_fill_paylod(payload)
         
     | 
| 
       6 
     | 
    
         
            -
                    payload[:original_url] = ::Alchemy::Engine.routes.url_helpers.download_attachment_path(id: active_record_instance.id, name: active_record_instance. 
     | 
| 
      
 6 
     | 
    
         
            +
                    payload[:original_url] = ::Alchemy::Engine.routes.url_helpers.download_attachment_path(id: active_record_instance.id, name: active_record_instance.slug)
         
     | 
| 
       7 
7 
     | 
    
         
             
                    payload
         
     | 
| 
       8 
8 
     | 
    
         
             
                  end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Alchemy
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Custom
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Model
         
     | 
| 
      
 4 
     | 
    
         
            +
                  module PicturesAltMethods
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                    extend ActiveSupport::Concern
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                    included do
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                      def metadata_relation
         
     | 
| 
      
 11 
     | 
    
         
            +
                        # TO BE OVERRIDED WITH HAS_MANY RELATION OF METADATA MODEL SYMBOL
         
     | 
| 
      
 12 
     | 
    
         
            +
                        nil
         
     | 
| 
      
 13 
     | 
    
         
            +
                      end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                      def metadata_record(language_code)
         
     | 
| 
      
 16 
     | 
    
         
            +
                        if metadata_relation.nil?
         
     | 
| 
      
 17 
     | 
    
         
            +
                          nil
         
     | 
| 
      
 18 
     | 
    
         
            +
                        else
         
     | 
| 
      
 19 
     | 
    
         
            +
                          self.send(metadata_relation).joins(:language).
         
     | 
| 
      
 20 
     | 
    
         
            +
                            where(alchemy_languages: { language_code: language_code }).first_or_initialize
         
     | 
| 
      
 21 
     | 
    
         
            +
                        end
         
     | 
| 
      
 22 
     | 
    
         
            +
                      end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: alchemy-custom-model
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: '3.2'
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Alessandro Baccanelli
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2022-01-13 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: alchemy_cms
         
     | 
| 
         @@ -238,6 +238,7 @@ files: 
     | 
|
| 
       238 
238 
     | 
    
         
             
            - lib/alchemy/custom/model/order.rb
         
     | 
| 
       239 
239 
     | 
    
         
             
            - lib/alchemy/custom/model/pages_controller_dec.rb
         
     | 
| 
       240 
240 
     | 
    
         
             
            - lib/alchemy/custom/model/picture_used_by.rb
         
     | 
| 
      
 241 
     | 
    
         
            +
            - lib/alchemy/custom/model/pictures_alt_methods.rb
         
     | 
| 
       241 
242 
     | 
    
         
             
            - lib/alchemy/custom/model/sitemap_methods.rb
         
     | 
| 
       242 
243 
     | 
    
         
             
            - lib/alchemy/custom/model/slug_optimizer.rb
         
     | 
| 
       243 
244 
     | 
    
         
             
            - lib/alchemy/custom/model/translation_scope.rb
         
     |